net: ethernet: sun4i-emac: Support phy-handle property for finding PHYs
authorChen-Yu Tsai <wens@csie.org>
Tue, 6 Aug 2019 07:35:39 +0000 (15:35 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 6 Aug 2019 18:29:16 +0000 (11:29 -0700)
The sun4i-emac uses the "phy" property to find the PHY it's supposed to
use. This property was deprecated in favor of "phy-handle" in commit
8c5b09447625 ("dt-bindings: net: sun4i-emac: Convert the binding to a
schemas").

Add support for this new property name, and fall back to the old one in
case the device tree hasn't been updated.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/allwinner/sun4i-emac.c

index 3434730a76990b6ed78f4207428c1eabc8d49155..0537df06a9b58ae47f3f139266d12dd906ce9be6 100644 (file)
@@ -860,7 +860,9 @@ static int emac_probe(struct platform_device *pdev)
                goto out_clk_disable_unprepare;
        }
 
-       db->phy_node = of_parse_phandle(np, "phy", 0);
+       db->phy_node = of_parse_phandle(np, "phy-handle", 0);
+       if (!db->phy_node)
+               db->phy_node = of_parse_phandle(np, "phy", 0);
        if (!db->phy_node) {
                dev_err(&pdev->dev, "no associated PHY\n");
                ret = -ENODEV;