]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: gem: Add support for more PHYs on MDIO bus
authorMichal Simek <michal.simek@xilinx.com>
Mon, 30 May 2016 08:43:11 +0000 (10:43 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 23 Sep 2020 08:31:40 +0000 (10:31 +0200)
Find out MDIO bus and enable MDIO access to it if this is done via
different GEM controller. Only works across GEM instances.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/net/zynq_gem.c

index da4b6fba9ff67a066e88a8325d2dee394ca0a02b..8afec8bbfcff59ff81904bbf3352b3a86f36b061 100644 (file)
@@ -758,6 +758,9 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
 
        if (!dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
                                        &phandle_args)) {
+               fdt_addr_t addr;
+               ofnode parent;
+
                debug("phy-handle does exist %s\n", dev->name);
                priv->phyaddr = ofnode_read_u32_default(phandle_args.node,
                                                        "reg", -1);
@@ -765,6 +768,13 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
                priv->max_speed = ofnode_read_u32_default(phandle_args.node,
                                                          "max-speed",
                                                          SPEED_1000);
+
+               parent = ofnode_get_parent(phandle_args.node);
+               addr = ofnode_get_addr(parent);
+               if (addr != FDT_ADDR_T_NONE) {
+                       debug("MDIO bus not found %s\n", dev->name);
+                       priv->mdiobase = (struct zynq_gem_regs *)addr;
+               }
        }
 
        phy_mode = dev_read_prop(dev, "phy-mode", NULL);