]> 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)
committerMichal Simek <monstr@monstr.eu>
Tue, 3 Oct 2017 15:26:11 +0000 (17:26 +0200)
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 a9577a561e3cf871ba36c3cc0f0cc7280221c05f..10b6f1549904a1e09d914dc7457219d458463d55 100644 (file)
@@ -426,7 +426,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 */
@@ -450,7 +450,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);