Skip to contentSkip to conversation

net: designware: fix PHY reset with DM_MDIO

PATCH New Neil Armstrong 2 participants 3 messages Apr 21, 2021 – Apr 23, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: designware: fix PHY reset with DM_MDIO

The dw_eth_pdata is not accessible from the mdio device, it gets the mdio bus plat leading to random sleeps (-10174464 on Odroid-HC4).

This moves the dw_mdio_reset function to a common one taking the ethernet device as parameter and use it from the dw_mdio_reset and dm_mdio variant functions.

Fixes 5160b4567c net: designware: add DM_MDIO support
---
 drivers/net/designware.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/net/designware.c +11 -4
index b8ba00b7c0..5d92257e74 100644
@@ -91,9 +91,8 @@ static int dw_mdio_write(struct mii_dev *bus, int addr, int devad, int reg,
 }
 
 #if defined(CONFIG_DM_ETH) && CONFIG_IS_ENABLED(DM_GPIO)
-static int dw_mdio_reset(struct mii_dev *bus)
+static int __dw_mdio_reset(struct udevice *dev)
 {
-	struct udevice *dev = bus->priv;
 	struct dw_eth_dev *priv = dev_get_priv(dev);
 	struct dw_eth_pdata *pdata = dev_get_plat(dev);
 	int ret;
@@ -122,6 +121,13 @@ static int dw_mdio_reset(struct mii_dev *bus)
 
 	return 0;
 }
+
+static int dw_mdio_reset(struct mii_dev *bus)
+{
+	struct udevice *dev = bus->priv;
+
+	return __dw_mdio_reset(dev);
+}
 #endif
 
 #if IS_ENABLED(CONFIG_DM_MDIO)
@@ -142,9 +148,10 @@ int designware_eth_mdio_write(struct udevice *mdio_dev, int addr, int devad, int
 #if CONFIG_IS_ENABLED(DM_GPIO)
 int designware_eth_mdio_reset(struct udevice *mdio_dev)
 {
-	struct mdio_perdev_priv *pdata = dev_get_uclass_priv(mdio_dev);
+	struct mdio_perdev_priv *mdio_pdata = dev_get_uclass_priv(mdio_dev);
+	struct udevice *dev = mdio_pdata->mii_bus->priv;
 
-	return dw_mdio_reset(pdata->mii_bus);
+	return __dw_mdio_reset(dev->parent);
 }
 #endif
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 net: designware: fix PHY reset with DM_MDIO

Quoted 57 lines · Neil Armstrong

The dw_eth_pdata is not accessible from the mdio device, it gets the mdio bus plat leading to random sleeps (-10174464 on Odroid-HC4).

This moves the dw_mdio_reset function to a common one taking the ethernet device as parameter and use it from the dw_mdio_reset and dm_mdio variant functions.

Fixes 5160b4567c net: designware: add DM_MDIO support
---
 drivers/net/designware.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/net/designware.c +11 -5
index b8ba00b7c0..5d92257e74 100644
@@ -91,9 +91,8 @@ static int dw_mdio_write(struct mii_dev *bus, int addr, int devad, int reg,
 }
 
 #if defined(CONFIG_DM_ETH) && CONFIG_IS_ENABLED(DM_GPIO)
-static int dw_mdio_reset(struct mii_dev *bus)
+static int __dw_mdio_reset(struct udevice *dev)
 {
-       struct udevice *dev = bus->priv;
        struct dw_eth_dev *priv = dev_get_priv(dev);
        struct dw_eth_pdata *pdata = dev_get_plat(dev);
        int ret;
@@ -122,6 +121,13 @@ static int dw_mdio_reset(struct mii_dev *bus)
 
        return 0;
 }
+
+static int dw_mdio_reset(struct mii_dev *bus)
+{
+       struct udevice *dev = bus->priv;
+
+       return __dw_mdio_reset(dev);
+}
 #endif
 
 #if IS_ENABLED(CONFIG_DM_MDIO)
@@ -142,9 +148,10 @@ int designware_eth_mdio_write(struct udevice *mdio_dev, int addr, int devad, int
 #if CONFIG_IS_ENABLED(DM_GPIO)
 int designware_eth_mdio_reset(struct udevice *mdio_dev)
 {
-       struct mdio_perdev_priv *pdata = dev_get_uclass_priv(mdio_dev);
+       struct mdio_perdev_priv *mdio_pdata = dev_get_uclass_priv(mdio_dev);
+       struct udevice *dev = mdio_pdata->mii_bus->priv;
 
-       return dw_mdio_reset(pdata->mii_bus);
+       return __dw_mdio_reset(dev->parent);
 }
 #endif
 
--
Quoted 2 lines

2.25.1

#2 lore raw

PATCH 1/1 net: designware: fix PHY reset with DM_MDIO

Quoted 57 lines · Ramon Fried
Quoted 56 lines · Neil Armstrong

The dw_eth_pdata is not accessible from the mdio device, it gets the mdio bus plat leading to random sleeps (-10174464 on Odroid-HC4).

This moves the dw_mdio_reset function to a common one taking the ethernet device as parameter and use it from the dw_mdio_reset and dm_mdio variant functions.

Fixes 5160b4567c net: designware: add DM_MDIO support
---
 drivers/net/designware.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/net/designware.c +11 -4
index b8ba00b7c0..5d92257e74 100644
@@ -91,9 +91,8 @@ static int dw_mdio_write(struct mii_dev *bus, int addr, int devad, int reg,
 }
 
 #if defined(CONFIG_DM_ETH) && CONFIG_IS_ENABLED(DM_GPIO)
-static int dw_mdio_reset(struct mii_dev *bus)
+static int __dw_mdio_reset(struct udevice *dev)
 {
-       struct udevice *dev = bus->priv;
        struct dw_eth_dev *priv = dev_get_priv(dev);
        struct dw_eth_pdata *pdata = dev_get_plat(dev);
        int ret;
@@ -122,6 +121,13 @@ static int dw_mdio_reset(struct mii_dev *bus)
 
        return 0;
 }
+
+static int dw_mdio_reset(struct mii_dev *bus)
+{
+       struct udevice *dev = bus->priv;
+
+       return __dw_mdio_reset(dev);
+}
 #endif
 
 #if IS_ENABLED(CONFIG_DM_MDIO)
@@ -142,9 +148,10 @@ int designware_eth_mdio_write(struct udevice *mdio_dev, int addr, int devad, int
 #if CONFIG_IS_ENABLED(DM_GPIO)
 int designware_eth_mdio_reset(struct udevice *mdio_dev)
 {
-       struct mdio_perdev_priv *pdata = dev_get_uclass_priv(mdio_dev);
+       struct mdio_perdev_priv *mdio_pdata = dev_get_uclass_priv(mdio_dev);
+       struct udevice *dev = mdio_pdata->mii_bus->priv;
 
-       return dw_mdio_reset(pdata->mii_bus);
+       return __dw_mdio_reset(dev->parent);
 }
 #endif
 
Quoted 5 lines
Quoted 3 lines

--
2.25.1

Thanks,
Applied to u-boot-amlogic