Skip to content

Commit

Permalink
hw/arm/xlnx-versal-virt: modify gem/phy DT nodes
Browse files Browse the repository at this point in the history
Modify the gem/phy device tree nodes so that VxWorks
properly binds the genericPhy driver to the ethernet-phy
DT node. Previously, the phy was represented using a
fixed-link node that VxWorks does not parse properly.

The compatible string for the gem node has been modified
from "cdns,zynqmp-gem" to "cdns,versal-gem". The VxWorks
gem driver does not match "cdns,zynqmp-gem".

Note: VxWorks needs additional property "phy-mode" to
properly bind the driver against "cdns,versal-gem".

Signed-off-by: Nelson Ho <Nelson.Ho@windriver.com>
  • Loading branch information
ho28 committed Sep 17, 2024
1 parent 4c9e68e commit 58a89e3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
19 changes: 13 additions & 6 deletions hw/arm/xlnx-versal-virt.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,22 @@ static void fdt_add_canfd_nodes(VersalVirt *s)
}
}

static void fdt_add_fixed_link_nodes(VersalVirt *s, char *gemname,
static void fdt_add_generic_phy_node(VersalVirt *s, char *gemname,
uint32_t phandle)
{
char *name = g_strdup_printf("%s/fixed-link", gemname);
uint64_t addr = MM_GEM_PHY_OFF;
char *name = g_strdup_printf("%s/ethernet-phy@%" PRIx64, gemname, addr);
const char compat_phy[] = "genericPhy";

qemu_fdt_add_subnode(s->fdt, name);
qemu_fdt_setprop_cell(s->fdt, name, "phandle", phandle);
qemu_fdt_setprop(s->fdt, name, "full-duplex", NULL, 0);
qemu_fdt_setprop_cell(s->fdt, name, "speed", 1000);
qemu_fdt_setprop_cell(s->fdt, name, "fifo-depth", 0x01);
qemu_fdt_setprop_cell(s->fdt, name, "tx-internal-delay", 0x0a);
qemu_fdt_setprop_cell(s->fdt, name, "rx-internal-delay", 0x08);
qemu_fdt_setprop_cell(s->fdt, name, "rgmii-delay", 0x03);
qemu_fdt_setprop_cell(s->fdt, name, "reg", MM_GEM_PHY_OFF);
qemu_fdt_setprop(s->fdt, name, "compatible",
compat_phy, sizeof(compat_phy));
g_free(name);
}

Expand All @@ -293,14 +300,14 @@ static void fdt_add_gem_nodes(VersalVirt *s)
uint64_t addrs[] = { MM_GEM1, MM_GEM0 };
unsigned int irqs[] = { VERSAL_GEM1_IRQ_0, VERSAL_GEM0_IRQ_0 };
const char clocknames[] = "pclk\0hclk\0tx_clk\0rx_clk";
const char compat_gem[] = "cdns,zynqmp-gem\0cdns,gem";
const char compat_gem[] = "cdns,versal-gem\0cdns,gem";
int i;

for (i = 0; i < ARRAY_SIZE(addrs); i++) {
char *name = g_strdup_printf("/ethernet@%" PRIx64, addrs[i]);
qemu_fdt_add_subnode(s->fdt, name);

fdt_add_fixed_link_nodes(s, name, s->phandle.ethernet_phy[i]);
fdt_add_generic_phy_node(s, name, s->phandle.ethernet_phy[i]);
qemu_fdt_setprop_string(s->fdt, name, "phy-mode", "rgmii-id");
qemu_fdt_setprop_cell(s->fdt, name, "phy-handle",
s->phandle.ethernet_phy[i]);
Expand Down
1 change: 1 addition & 0 deletions include/hw/arm/xlnx-versal.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ struct Versal {
#define MM_GEM0_SIZE 0x10000
#define MM_GEM1 0xff0d0000U
#define MM_GEM1_SIZE 0x10000
#define MM_GEM_PHY_OFF 0xc

#define MM_ADMA_CH0 0xffa80000U
#define MM_ADMA_CH0_SIZE 0x10000
Expand Down

0 comments on commit 58a89e3

Please sign in to comment.