]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: phy: gmii2rgmii: Support external rgmii-id phy
authorStefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Wed, 22 Mar 2023 08:42:47 +0000 (09:42 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 5 May 2023 21:48:44 +0000 (17:48 -0400)
Read the phy mode of the external phy from the device tree if available
and check that it is a RGMII variant.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
drivers/net/phy/xilinx_gmii2rgmii.c

index 0b7436a7e1e9a81d81902f50ba497c18d753c2b1..e2969bc48424fbf0fa3e90ae42514429f34db6e4 100644 (file)
@@ -48,7 +48,14 @@ static int xilinxgmiitorgmii_config(struct phy_device *phydev)
                return -EINVAL;
        }
 
-       ext_phydev->interface = PHY_INTERFACE_MODE_RGMII;
+       ext_phydev->interface = ofnode_read_phy_mode(node);
+       if (ext_phydev->interface == PHY_INTERFACE_MODE_NA) {
+               ext_phydev->interface = PHY_INTERFACE_MODE_RGMII;
+       } else if (!phy_interface_is_rgmii(ext_phydev)) {
+               printf("Incorrect external interface type\n");
+               return -EINVAL;
+       }
+
        ext_phydev->node = phandle.node;
        phydev->priv = ext_phydev;