]> git.ipfire.org Git - thirdparty/u-boot.git/blobdiff - drivers/net/phy/phy.c
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-net
[thirdparty/u-boot.git] / drivers / net / phy / phy.c
index e0b37a9542edb2c3d663f1eddba6fd9a0d2e98c6..1121b99abff54a46b8286381cfde5d7a24a6d4a6 100644 (file)
@@ -533,6 +533,9 @@ int phy_init(void)
        phy_natsemi_init();
 #endif
 #ifdef CONFIG_NXP_C45_TJA11XX_PHY
+       phy_nxp_c45_tja11xx_init();
+#endif
+#ifdef CONFIG_PHY_NXP_TJA11XX
        phy_nxp_tja11xx_init();
 #endif
 #ifdef CONFIG_PHY_REALTEK
@@ -1029,7 +1032,7 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
 
 #ifdef CONFIG_PHY_ETHERNET_ID
        if (!phydev)
-               phydev = phy_connect_phy_id(bus, dev);
+               phydev = phy_connect_phy_id(bus, dev, addr);
 #endif
 
 #ifdef CONFIG_PHY_XILINX_GMII2RGMII
@@ -1078,3 +1081,23 @@ int phy_shutdown(struct phy_device *phydev)
 
        return 0;
 }
+
+/**
+ * phy_modify - Convenience function for modifying a given PHY register
+ * @phydev: the phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: register number to write
+ * @mask: bit mask of bits to clear
+ * @set: new value of bits set in mask to write to @regnum
+ */
+int phy_modify(struct phy_device *phydev, int devad, int regnum, u16 mask,
+              u16 set)
+{
+       int ret;
+
+       ret = phy_read(phydev, devad, regnum);
+       if (ret < 0)
+               return ret;
+
+       return phy_write(phydev, devad, regnum, (ret & ~mask) | set);
+}