]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
net: macb: add support for mdio phy nodes
authorKedareswara rao Appana <appanad@xilinx.com>
Fri, 19 Aug 2016 13:01:13 +0000 (18:31 +0530)
committerSoren Brinkmann <soren.brinkmann@xilinx.com>
Tue, 13 Sep 2016 18:22:13 +0000 (11:22 -0700)
This patch adds support for mdio phy nodes.

With this patch the macb driver first tries to find
the mdio node.
If it is available will create the phy/mdio devices for the
phy/mdio nodes available in the mdio.

If the mdio node is not available it will try to probe the phy nodes
available in the mac nodes as the driver does earlier.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
drivers/net/ethernet/cadence/macb.c

index 97e14d74e281d60f86f0d1aa70eba74f29acbcd8..c8a1cc51f93ed412ea6335864ef1c9b98708ec88 100644 (file)
@@ -428,7 +428,7 @@ static int macb_mii_probe(struct net_device *dev)
 static int macb_mii_init(struct macb *bp)
 {
        struct macb_platform_data *pdata;
-       struct device_node *np;
+       struct device_node *np, *mdio_np;
        int err = -ENXIO, i;
 
        /* Enable management port */
@@ -452,7 +452,13 @@ static int macb_mii_init(struct macb *bp)
        dev_set_drvdata(&bp->dev->dev, bp->mii_bus);
 
        np = bp->pdev->dev.of_node;
-       if (np) {
+       mdio_np = of_get_child_by_name(np, "mdio");
+       if (mdio_np) {
+               of_node_put(mdio_np);
+               err = of_mdiobus_register(bp->mii_bus, mdio_np);
+               if (err)
+                       goto err_out_unregister_bus;
+       } else if (np) {
                /* try dt phy registration */
                err = of_mdiobus_register(bp->mii_bus, np);