]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: phy: Fix rgmii-id phy reset timeout issue
authorT Karthik Reddy <t.karthik.reddy@xilinx.com>
Tue, 29 Mar 2022 14:05:57 +0000 (16:05 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 5 Apr 2022 13:10:54 +0000 (15:10 +0200)
While creating a phy device using phy_device_create(), we need to
provide a valid phyaddr instead of 0 causing phy address being
registered as 0 with mdio bus and shows mdio phy list as below

ZynqMP>  mdio list
eth0:
0 - TI DP83867 <--> ethernet@ff0b0000
eth1:
0 - TI DP83867 <--> ethernet@ff0c0000

Also PHY soft reset is being requested on 0 instead of valid
address causing "PHY reset timed out" error.

So add phyaddr argument to phy_connect_phy_id() and to its prototype
to create phy device with valid phyaddress.

Fixes: a744a284e354 ("net: phy: Add support for ethernet-phy-id with gpio reset")
Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Link: https://lore.kernel.org/r/fe35fddb9faa5af577ffdfabaec6879c935a30f8.1648562755.git.michal.simek@xilinx.com
drivers/net/phy/ethernet_id.c
drivers/net/phy/phy.c
include/phy.h

index 5617ac3ad62f681081b8acd82b17e72493b1d126..44abc5bfb30155263e2ca7d8d51da01e91d79933 100644 (file)
@@ -12,7 +12,7 @@
 #include <asm/gpio.h>
 
 struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev,
-                                     phy_interface_t interface)
+                                     int phyaddr, phy_interface_t interface)
 {
        struct phy_device *phydev;
        struct ofnode_phandle_args phandle_args;
@@ -61,7 +61,7 @@ struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev,
        }
 
        id =  vendor << 16 | device;
-       phydev = phy_device_create(bus, 0, id, false, interface);
+       phydev = phy_device_create(bus, phyaddr, id, false, interface);
        if (phydev)
                phydev->node = node;
 
index 92fff5b72c0c50fbc5977d55b60be60179eeeba7..d4731860f73e3c6ee236f992a8aa97b7f6f032b7 100644 (file)
@@ -1049,7 +1049,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, interface);
+               phydev = phy_connect_phy_id(bus, dev, addr, interface);
 #endif
 
 #ifdef CONFIG_PHY_XILINX_GMII2RGMII
index 9ea4bd42db4de6a71ee6efcbb21ffb629b0368fc..5e3da4b01b6c18329033004f09266bfb5a0136c7 100644 (file)
@@ -479,7 +479,7 @@ struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
  *                     or NULL otherwise
  */
 struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev,
-                                     phy_interface_t interface);
+                                     int phyaddr, phy_interface_t interface);
 
 static inline ofnode phy_get_ofnode(struct phy_device *phydev)
 {