diff options
author | Michal Simek <michal.simek@xilinx.com> | 2015-11-30 13:17:50 (GMT) |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2015-12-07 09:14:28 (GMT) |
commit | 3cdb1450deb236184f0c673f6ea0ad993c285ad2 (patch) | |
tree | e1d3d4c321a2bad2ec4985962dcd563830d78f72 | |
parent | 6889ca7198f68691ddd7923268040eb7f4e6d3ff (diff) | |
download | u-boot-fsl-qoriq-3cdb1450deb236184f0c673f6ea0ad993c285ad2.tar.xz |
net: gem: Read information about interface from DT
Do not set interface via configs. Read information from DT.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
-rw-r--r-- | drivers/net/zynq_gem.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index 9e8616e..0ee909c 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -621,12 +621,6 @@ static int zynq_gem_probe(struct udevice *dev) priv->bus->priv = priv; strcpy(priv->bus->name, "gem"); -#ifndef CONFIG_ZYNQ_GEM_INTERFACE - priv->interface = PHY_INTERFACE_MODE_MII; -#else - priv->interface = CONFIG_ZYNQ_GEM_INTERFACE; -#endif - ret = mdio_register(priv->bus); if (ret) return ret; @@ -660,6 +654,7 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev) struct eth_pdata *pdata = dev_get_platdata(dev); struct zynq_gem_priv *priv = dev_get_priv(dev); int offset = 0; + const char *phy_mode; pdata->iobase = (phys_addr_t)dev_get_addr(dev); priv->iobase = (struct zynq_gem_regs *)pdata->iobase; @@ -671,8 +666,17 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev) if (offset > 0) priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", 0); - printf("ZYNQ GEM: %lx, phyaddr %d\n", (ulong)priv->iobase, - priv->phyaddr); + phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL); + if (phy_mode) + pdata->phy_interface = phy_get_interface_by_name(phy_mode); + if (pdata->phy_interface == -1) { + debug("%s: Invalid PHY interface '%s'\n", __func__, phy_mode); + return -EINVAL; + } + priv->interface = pdata->phy_interface; + + printf("ZYNQ GEM: %lx, phyaddr %d, interface %s\n", (ulong)priv->iobase, + priv->phyaddr, phy_string_for_interface(priv->interface)); return 0; } |