Skip to contentSkip to conversation

net: stmmac: dwmac-rk: Fix ethernet on rk3399 based devices

PATCH Applied Punit Agrawal 4 participants 9 messages Sep 29, 2021 – Oct 5, 2021

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: stmmac: dwmac-rk: Fix ethernet on rk3399 based devices

Commit 2d26f6e39afb ("net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings") while getting rid of a runtime PM warning ended up breaking ethernet
on rk3399 based devices. By dropping an extra reference to the device,
the commit ends up enabling suspend / resume of the ethernet device - which appears to be broken.

While the issue with runtime pm is being investigated, partially revert commit 2d26f6e39afb to restore the network on rk3399.

Fixes 2d26f6e39afb ("net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings")
Cc Michael Riesch <[email protected]>

---
Hi,

There's been a few reports of broken ethernet on rk3399 based boards. The issue got introduced due to a late commit in the 5.14 cycle.

It would be great if this commit can be taken as a fix for the next rc as well as applied to the 5.14 stable releases.

Thanks,
Punit

 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +5 -0
index ed817011a94a..6924a6aacbd5 100644
@@ -21,6 +21,7 @@
 #include <linux/delay.h>
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
+#include <linux/pm_runtime.h>
 
 #include "stmmac_platform.h"
 
@@ -1528,6 +1529,8 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
 		return ret;
 	}
 
+	pm_runtime_get_sync(dev);
+
 	if (bsp_priv->integrated_phy)
 		rk_gmac_integrated_phy_powerup(bsp_priv);
 
@@ -1539,6 +1542,8 @@ static void rk_gmac_powerdown(struct rk_priv_data *gmac)
 	if (gmac->integrated_phy)
 		rk_gmac_integrated_phy_powerdown(gmac);
 
+	pm_runtime_put_sync(&gmac->pdev->dev);
+
 	phy_power_on(gmac, false);
 	gmac_clk_enable(gmac, false);
 }
Signature · 7 lines
2.32.0


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
maintainer Tested-by on v1 1/1
#1 lore raw

Am Mittwoch, 29. September 2021, 15:50:49 CEST schrieb Punit Agrawal:

Quoted 6 lines

Commit 2d26f6e39afb ("net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings") while getting rid of a runtime PM warning ended up breaking ethernet
on rk3399 based devices. By dropping an extra reference to the device,
the commit ends up enabling suspend / resume of the ethernet device - which appears to be broken.

Quoted 7 lines

While the issue with runtime pm is being investigated, partially revert commit 2d26f6e39afb to restore the network on rk3399.

Fixes 2d26f6e39afb ("net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings")
Cc Michael Riesch <[email protected]>

On a rk3399-puma which has the described issue,

Quoted 39 lines

---
Hi,

There's been a few reports of broken ethernet on rk3399 based boards. The issue got introduced due to a late commit in the 5.14 cycle.

It would be great if this commit can be taken as a fix for the next rc as well as applied to the 5.14 stable releases.

Thanks,
Punit

 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +3 -0
index ed817011a94a..6924a6aacbd5 100644
@@ -21,6 +21,7 @@
 #include <linux/delay.h>
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
+#include <linux/pm_runtime.h>
 
 #include "stmmac_platform.h"
 
@@ -1528,6 +1529,8 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
 		return ret;
 	}
 
+	pm_runtime_get_sync(dev);
+
 	if (bsp_priv->integrated_phy)
 		rk_gmac_integrated_phy_powerup(bsp_priv);
 

drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c static void rk_gmac_powerdown(struct rk_priv_data *gmac) · line 1549

Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +2 -0
@@ -1539,6 +1542,8 @@ static void rk_gmac_powerdown(struct rk_priv_data *gmac)
 	if (gmac->integrated_phy)
 		rk_gmac_integrated_phy_powerdown(gmac);
 
+	pm_runtime_put_sync(&gmac->pdev->dev);
+
 	phy_power_on(gmac, false);
 	gmac_clk_enable(gmac, false);
 }

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

maintainer Applied
#2 lore raw
Quoted 10 lines · On Wed, 29 Sep 2021 23:02:35 +0200 Heiko Stübner wrote:

Am Mittwoch, 29. September 2021, 15:50:49 CEST schrieb Punit Agrawal:

Quoted 9 lines

Commit 2d26f6e39afb ("net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings") while getting rid of a runtime PM warning ended up breaking ethernet
on rk3399 based devices. By dropping an extra reference to the device,
the commit ends up enabling suspend / resume of the ethernet device - which appears to be broken.

While the issue with runtime pm is being investigated, partially revert commit 2d26f6e39afb to restore the network on rk3399.

Quoted 7 lines
Quoted 4 lines
Fixes 2d26f6e39afb ("net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings")
Cc Michael Riesch <[email protected]>

On a rk3399-puma which has the described issue,

Applied, thanks!

#3 lore raw
Quoted 16 lines · Jakub Kicinski
Quoted 15 lines · On Wed, 29 Sep 2021 23:02:35 +0200 Heiko Stübner wrote:

Am Mittwoch, 29. September 2021, 15:50:49 CEST schrieb Punit Agrawal:

Quoted 13 lines

Commit 2d26f6e39afb ("net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings") while getting rid of a runtime PM warning ended up breaking ethernet
on rk3399 based devices. By dropping an extra reference to the device,
the commit ends up enabling suspend / resume of the ethernet device - which appears to be broken.

While the issue with runtime pm is being investigated, partially revert commit 2d26f6e39afb to restore the network on rk3399.

Fixes 2d26f6e39afb ("net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings")
Cc Michael Riesch <[email protected]>
Quoted 4 lines
Quoted 2 lines

On a rk3399-puma which has the described issue,

Applied, thanks!

This also fixed the issue on a RockPi4.

Will any of you submit this to the stable kernels (as this broke within 3.13 for me) or shall I do that?

maintainer
#4 lore raw
Quoted 11 lines · On Sat, 2 Oct 2021 23:33:03 +0200 Andreas Rammhold wrote:
Quoted 5 lines · Jakub Kicinski
Quoted 2 lines · On Wed, 29 Sep 2021 23:02:35 +0200 Heiko Stübner wrote:

On a rk3399-puma which has the described issue,

Applied, thanks!

This also fixed the issue on a RockPi4.

Will any of you submit this to the stable kernels (as this broke within 3.13 for me) or shall I do that?

I won't. The patch should be in Linus's tree in around 1 week - at which point anyone can request the backport.

That said, as you probably know, 4.4 is the oldest active stable branch, the ship has sailed for anything 3.x.

#5 lore raw
Quoted 10 lines · Jakub Kicinski
Quoted 9 lines · On Sat, 2 Oct 2021 23:33:03 +0200 Andreas Rammhold wrote:
Quoted 5 lines · Jakub Kicinski
Quoted 2 lines · On Wed, 29 Sep 2021 23:02:35 +0200 Heiko Stübner wrote:

On a rk3399-puma which has the described issue,

Applied, thanks!

This also fixed the issue on a RockPi4.

Quoted 8 lines
Quoted 2 lines

Will any of you submit this to the stable kernels (as this broke within 3.13 for me) or shall I do that?

I won't. The patch should be in Linus's tree in around 1 week - at which point anyone can request the backport.

That said, as you probably know, 4.4 is the oldest active stable branch, the ship has sailed for anything 3.x.

I am sorry. I meant 5.13.

maintainer
#6 lore raw

Am Sonntag, 3. Oktober 2021, 02:41:03 CEST schrieb Andreas Rammhold:

Quoted 14 lines · Jakub Kicinski
Quoted 13 lines · On Sat, 2 Oct 2021 23:33:03 +0200 Andreas Rammhold wrote:
Quoted 11 lines · Jakub Kicinski
Quoted 5 lines · On Wed, 29 Sep 2021 23:02:35 +0200 Heiko Stübner wrote:
Quoted 2 lines

On a rk3399-puma which has the described issue,

Applied, thanks!

This also fixed the issue on a RockPi4.

Will any of you submit this to the stable kernels (as this broke within 3.13 for me) or shall I do that?

Quoted 8 lines
Quoted 5 lines

I won't. The patch should be in Linus's tree in around 1 week - at which point anyone can request the backport.

That said, as you probably know, 4.4 is the oldest active stable branch, the ship has sailed for anything 3.x.

I am sorry. I meant 5.13.

As the commit has "fixes" tag, it should be picked up automatically for stable kernels that include the original commit.

Heiko

#7 lore raw
In reply to Andreas Rammhold
Quoted 14 lines · Andreas Rammhold
Quoted 13 lines · Jakub Kicinski
Quoted 11 lines · On Sat, 2 Oct 2021 23:33:03 +0200 Andreas Rammhold wrote:
Quoted 5 lines · Jakub Kicinski
Quoted 2 lines · On Wed, 29 Sep 2021 23:02:35 +0200 Heiko Stübner wrote:

On a rk3399-puma which has the described issue,

Applied, thanks!

This also fixed the issue on a RockPi4.

Will any of you submit this to the stable kernels (as this broke within 3.13 for me) or shall I do that?

Quoted 7 lines
Quoted 5 lines

I won't. The patch should be in Linus's tree in around 1 week - at which point anyone can request the backport.

That said, as you probably know, 4.4 is the oldest active stable branch, the ship has sailed for anything 3.x.

I am sorry. I meant 5.13.

AFAICT, 2d26f6e39afb ("net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings") is not in 5.13 stable.

Either you're not using the stable kernel or there's another issue breaking things on the RockPi4.

#8 lore raw
Quoted 22 lines · Punit Agrawal
Quoted 20 lines · Andreas Rammhold
Quoted 18 lines · Jakub Kicinski
Quoted 11 lines · On Sat, 2 Oct 2021 23:33:03 +0200 Andreas Rammhold wrote:
Quoted 5 lines · Jakub Kicinski
Quoted 2 lines · On Wed, 29 Sep 2021 23:02:35 +0200 Heiko Stübner wrote:

On a rk3399-puma which has the described issue,

Applied, thanks!

This also fixed the issue on a RockPi4.

Will any of you submit this to the stable kernels (as this broke within 3.13 for me) or shall I do that?

I won't. The patch should be in Linus's tree in around 1 week - at which point anyone can request the backport.

That said, as you probably know, 4.4 is the oldest active stable branch, the ship has sailed for anything 3.x.

Quoted 7 lines
Quoted 1 line

I am sorry. I meant 5.13.

AFAICT, 2d26f6e39afb ("net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings") is not in 5.13 stable.

Either you're not using the stable kernel or there's another issue breaking things on the RockPi4.

I was using the 5.13 branch, somewhere after 5.13.12 the network started to fail on bootup. Due to the nature of the system I don't have persistent logs on it. When I next looked at the system (and updated to 5.14.x) the issue still occured until I applied this patch on to 5.14.8. Might have been the same use-facing issue but different bugs?

I can try to narrow the issue down further. It'll probably take a few evenings to test this out.