linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: dwmac-rk: Fix ethernet on rk3399 based devices
@ 2021-09-29 13:50 Punit Agrawal
  2021-09-29 21:02 ` Heiko Stübner
  0 siblings, 1 reply; 9+ messages in thread
From: Punit Agrawal @ 2021-09-29 13:50 UTC (permalink / raw)
  To: netdev
  Cc: linux-rockchip, linux-arm-kernel, davem, peppe.cavallaro,
	alexandre.torgue, kuba, Punit Agrawal, Heiko Stuebner,
	Michael Riesch

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")
Suggested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Punit Agrawal <punitagrawal@gmail.com>
Cc: Michael Riesch <michael.riesch@wolfvision.net>
---
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(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index ed817011a94a..6924a6aacbd5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -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);
 }
-- 
2.32.0


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-rk: Fix ethernet on rk3399 based devices
  2021-09-29 13:50 [PATCH] net: stmmac: dwmac-rk: Fix ethernet on rk3399 based devices Punit Agrawal
@ 2021-09-29 21:02 ` Heiko Stübner
  2021-10-01 23:02   ` Jakub Kicinski
  0 siblings, 1 reply; 9+ messages in thread
From: Heiko Stübner @ 2021-09-29 21:02 UTC (permalink / raw)
  To: netdev, Punit Agrawal
  Cc: linux-rockchip, linux-arm-kernel, davem, peppe.cavallaro,
	alexandre.torgue, kuba, Punit Agrawal, Michael Riesch

Am Mittwoch, 29. September 2021, 15:50:49 CEST schrieb Punit Agrawal:
> 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")
> Suggested-by: Heiko Stuebner <heiko@sntech.de>
> Signed-off-by: Punit Agrawal <punitagrawal@gmail.com>
> Cc: Michael Riesch <michael.riesch@wolfvision.net>

On a rk3399-puma which has the described issue,
Tested-by: Heiko Stuebner <heiko@sntech.de>


> ---
> 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(+)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> index ed817011a94a..6924a6aacbd5 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> @@ -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);
>  }
> 





_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-rk: Fix ethernet on rk3399 based devices
  2021-09-29 21:02 ` Heiko Stübner
@ 2021-10-01 23:02   ` Jakub Kicinski
  2021-10-02 21:33     ` Andreas Rammhold
  0 siblings, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2021-10-01 23:02 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: netdev, Punit Agrawal, linux-rockchip, linux-arm-kernel, davem,
	peppe.cavallaro, alexandre.torgue, Michael Riesch

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:
> > 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")
> > Suggested-by: Heiko Stuebner <heiko@sntech.de>
> > Signed-off-by: Punit Agrawal <punitagrawal@gmail.com>
> > Cc: Michael Riesch <michael.riesch@wolfvision.net>  
> 
> On a rk3399-puma which has the described issue,
> Tested-by: Heiko Stuebner <heiko@sntech.de>

Applied, thanks!

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-rk: Fix ethernet on rk3399 based devices
  2021-10-01 23:02   ` Jakub Kicinski
@ 2021-10-02 21:33     ` Andreas Rammhold
  2021-10-03  0:20       ` Jakub Kicinski
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Rammhold @ 2021-10-02 21:33 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Heiko Stübner, netdev, Punit Agrawal, linux-rockchip,
	linux-arm-kernel, davem, peppe.cavallaro, alexandre.torgue,
	Michael Riesch

On 16:02 01.10.21, Jakub Kicinski wrote:
> 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:
> > > 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")
> > > Suggested-by: Heiko Stuebner <heiko@sntech.de>
> > > Signed-off-by: Punit Agrawal <punitagrawal@gmail.com>
> > > Cc: Michael Riesch <michael.riesch@wolfvision.net>  
> > 
> > On a rk3399-puma which has the described issue,
> > Tested-by: Heiko Stuebner <heiko@sntech.de>
> 
> 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?

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-rk: Fix ethernet on rk3399 based devices
  2021-10-02 21:33     ` Andreas Rammhold
@ 2021-10-03  0:20       ` Jakub Kicinski
  2021-10-03  0:41         ` Andreas Rammhold
  0 siblings, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2021-10-03  0:20 UTC (permalink / raw)
  To: Andreas Rammhold
  Cc: Heiko Stübner, netdev, Punit Agrawal, linux-rockchip,
	linux-arm-kernel, davem, peppe.cavallaro, alexandre.torgue,
	Michael Riesch

On Sat, 2 Oct 2021 23:33:03 +0200 Andreas Rammhold wrote:
> On 16:02 01.10.21, Jakub Kicinski wrote:
> > On Wed, 29 Sep 2021 23:02:35 +0200 Heiko Stübner wrote:  
> > > On a rk3399-puma which has the described issue,
> > > Tested-by: Heiko Stuebner <heiko@sntech.de>  
> > 
> > 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.

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-rk: Fix ethernet on rk3399 based devices
  2021-10-03  0:20       ` Jakub Kicinski
@ 2021-10-03  0:41         ` Andreas Rammhold
  2021-10-03  9:15           ` Heiko Stübner
  2021-10-04 12:06           ` Punit Agrawal
  0 siblings, 2 replies; 9+ messages in thread
From: Andreas Rammhold @ 2021-10-03  0:41 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Heiko Stübner, netdev, Punit Agrawal, linux-rockchip,
	linux-arm-kernel, davem, peppe.cavallaro, alexandre.torgue,
	Michael Riesch

On 17:20 02.10.21, Jakub Kicinski wrote:
> On Sat, 2 Oct 2021 23:33:03 +0200 Andreas Rammhold wrote:
> > On 16:02 01.10.21, Jakub Kicinski wrote:
> > > On Wed, 29 Sep 2021 23:02:35 +0200 Heiko Stübner wrote:  
> > > > On a rk3399-puma which has the described issue,
> > > > Tested-by: Heiko Stuebner <heiko@sntech.de>  
> > > 
> > > 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.

I am sorry. I meant 5.13.

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-rk: Fix ethernet on rk3399 based devices
  2021-10-03  0:41         ` Andreas Rammhold
@ 2021-10-03  9:15           ` Heiko Stübner
  2021-10-04 12:06           ` Punit Agrawal
  1 sibling, 0 replies; 9+ messages in thread
From: Heiko Stübner @ 2021-10-03  9:15 UTC (permalink / raw)
  To: Jakub Kicinski, Andreas Rammhold
  Cc: netdev, Punit Agrawal, linux-rockchip, linux-arm-kernel, davem,
	peppe.cavallaro, alexandre.torgue, Michael Riesch

Am Sonntag, 3. Oktober 2021, 02:41:03 CEST schrieb Andreas Rammhold:
> On 17:20 02.10.21, Jakub Kicinski wrote:
> > On Sat, 2 Oct 2021 23:33:03 +0200 Andreas Rammhold wrote:
> > > On 16:02 01.10.21, Jakub Kicinski wrote:
> > > > On Wed, 29 Sep 2021 23:02:35 +0200 Heiko Stübner wrote:  
> > > > > On a rk3399-puma which has the described issue,
> > > > > Tested-by: Heiko Stuebner <heiko@sntech.de>  
> > > > 
> > > > 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.
> 
> 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




_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-rk: Fix ethernet on rk3399 based devices
  2021-10-03  0:41         ` Andreas Rammhold
  2021-10-03  9:15           ` Heiko Stübner
@ 2021-10-04 12:06           ` Punit Agrawal
  2021-10-05  9:08             ` andreas
  1 sibling, 1 reply; 9+ messages in thread
From: Punit Agrawal @ 2021-10-04 12:06 UTC (permalink / raw)
  To: Andreas Rammhold
  Cc: Jakub Kicinski, Heiko Stübner, netdev, linux-rockchip,
	linux-arm-kernel, davem, peppe.cavallaro, alexandre.torgue,
	Michael Riesch

Andreas Rammhold <andreas@rammhold.de> writes:

> On 17:20 02.10.21, Jakub Kicinski wrote:
>> On Sat, 2 Oct 2021 23:33:03 +0200 Andreas Rammhold wrote:
>> > On 16:02 01.10.21, Jakub Kicinski wrote:
>> > > On Wed, 29 Sep 2021 23:02:35 +0200 Heiko Stübner wrote:  
>> > > > On a rk3399-puma which has the described issue,
>> > > > Tested-by: Heiko Stuebner <heiko@sntech.de>  
>> > > 
>> > > 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.
>
> 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.

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-rk: Fix ethernet on rk3399 based devices
  2021-10-04 12:06           ` Punit Agrawal
@ 2021-10-05  9:08             ` andreas
  0 siblings, 0 replies; 9+ messages in thread
From: andreas @ 2021-10-05  9:08 UTC (permalink / raw)
  To: Punit Agrawal
  Cc: Andreas Rammhold, Jakub Kicinski, Heiko Stübner, netdev,
	linux-rockchip, linux-arm-kernel, davem, peppe.cavallaro,
	alexandre.torgue, Michael Riesch

On 21:06 04.10.21, Punit Agrawal wrote:
> Andreas Rammhold <andreas@rammhold.de> writes:
> 
> > On 17:20 02.10.21, Jakub Kicinski wrote:
> >> On Sat, 2 Oct 2021 23:33:03 +0200 Andreas Rammhold wrote:
> >> > On 16:02 01.10.21, Jakub Kicinski wrote:
> >> > > On Wed, 29 Sep 2021 23:02:35 +0200 Heiko Stübner wrote:  
> >> > > > On a rk3399-puma which has the described issue,
> >> > > > Tested-by: Heiko Stuebner <heiko@sntech.de>  
> >> > > 
> >> > > 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.
> >
> > 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.

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-10-05  9:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 13:50 [PATCH] net: stmmac: dwmac-rk: Fix ethernet on rk3399 based devices Punit Agrawal
2021-09-29 21:02 ` Heiko Stübner
2021-10-01 23:02   ` Jakub Kicinski
2021-10-02 21:33     ` Andreas Rammhold
2021-10-03  0:20       ` Jakub Kicinski
2021-10-03  0:41         ` Andreas Rammhold
2021-10-03  9:15           ` Heiko Stübner
2021-10-04 12:06           ` Punit Agrawal
2021-10-05  9:08             ` andreas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).