linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 0/2] net: ravb: Fix potential issues
@ 2023-01-23 13:13 Yoshihiro Shimoda
  2023-01-23 13:13 ` [PATCH net v2 1/2] net: ravb: Fix lack of register setting after system resumed for Gen3 Yoshihiro Shimoda
  2023-01-23 13:13 ` [PATCH net v2 2/2] net: ravb: Fix possible hang if RIS2_QFF1 happen Yoshihiro Shimoda
  0 siblings, 2 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2023-01-23 13:13 UTC (permalink / raw)
  To: s.shtylyov, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda

Fix potentiall issues on the ravb driver.

Changes from v1:
https://lore.kernel.org/all/20230119043920.875280-1-yoshihiro.shimoda.uh@renesas.com/
 - Fix typo in the patch [1/2].
 - Add Reviewed-by in the patch [1/2].
 - Fix "Fixed" tag in the patch [2/2].
 - Fix a comment indentation of the code in the patch [2/2].

Yoshihiro Shimoda (2):
  net: ravb: Fix lack of register setting after system resumed for Gen3
  net: ravb: Fix possible hang if RIS2_QFF1 happen

 drivers/net/ethernet/renesas/ravb_main.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

-- 
2.25.1


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

* [PATCH net v2 1/2] net: ravb: Fix lack of register setting after system resumed for Gen3
  2023-01-23 13:13 [PATCH net v2 0/2] net: ravb: Fix potential issues Yoshihiro Shimoda
@ 2023-01-23 13:13 ` Yoshihiro Shimoda
  2023-01-23 13:13 ` [PATCH net v2 2/2] net: ravb: Fix possible hang if RIS2_QFF1 happen Yoshihiro Shimoda
  1 sibling, 0 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2023-01-23 13:13 UTC (permalink / raw)
  To: s.shtylyov, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda

After system entered Suspend to RAM, registers setting of this
hardware is reset because the SoC will be turned off. On R-Car Gen3
(info->ccc_gac), ravb_ptp_init() is called in ravb_probe() only. So,
after system resumed, it lacks of the initial settings for ptp. So,
add ravb_ptp_{init,stop}() into ravb_{resume,suspend}().

Fixes: f5d7837f96e5 ("ravb: ptp: Add CONFIG mode support")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 drivers/net/ethernet/renesas/ravb_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index b4e0fc7f65bd..3f61100c02f4 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2973,6 +2973,9 @@ static int __maybe_unused ravb_suspend(struct device *dev)
 	else
 		ret = ravb_close(ndev);
 
+	if (priv->info->ccc_gac)
+		ravb_ptp_stop(ndev);
+
 	return ret;
 }
 
@@ -3011,6 +3014,9 @@ static int __maybe_unused ravb_resume(struct device *dev)
 	/* Restore descriptor base address table */
 	ravb_write(ndev, priv->desc_bat_dma, DBAT);
 
+	if (priv->info->ccc_gac)
+		ravb_ptp_init(ndev, priv->pdev);
+
 	if (netif_running(ndev)) {
 		if (priv->wol_enabled) {
 			ret = ravb_wol_restore(ndev);
-- 
2.25.1


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

* [PATCH net v2 2/2] net: ravb: Fix possible hang if RIS2_QFF1 happen
  2023-01-23 13:13 [PATCH net v2 0/2] net: ravb: Fix potential issues Yoshihiro Shimoda
  2023-01-23 13:13 ` [PATCH net v2 1/2] net: ravb: Fix lack of register setting after system resumed for Gen3 Yoshihiro Shimoda
@ 2023-01-23 13:13 ` Yoshihiro Shimoda
  2023-01-23 19:41   ` Sergey Shtylyov
  1 sibling, 1 reply; 5+ messages in thread
From: Yoshihiro Shimoda @ 2023-01-23 13:13 UTC (permalink / raw)
  To: s.shtylyov, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda

Since this driver enables the interrupt by RIC2_QFE1, this driver
should clear the interrupt flag if it happens. Otherwise, the interrupt
causes to hang the system.

Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 3f61100c02f4..0f54849a3823 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1101,14 +1101,14 @@ static void ravb_error_interrupt(struct net_device *ndev)
 	ravb_write(ndev, ~(EIS_QFS | EIS_RESERVED), EIS);
 	if (eis & EIS_QFS) {
 		ris2 = ravb_read(ndev, RIS2);
-		ravb_write(ndev, ~(RIS2_QFF0 | RIS2_RFFF | RIS2_RESERVED),
+		ravb_write(ndev, ~(RIS2_QFF0 | RIS2_QFF1 | RIS2_RFFF | RIS2_RESERVED),
 			   RIS2);
 
 		/* Receive Descriptor Empty int */
 		if (ris2 & RIS2_QFF0)
 			priv->stats[RAVB_BE].rx_over_errors++;
 
-		    /* Receive Descriptor Empty int */
+		/* Receive Descriptor Empty int */
 		if (ris2 & RIS2_QFF1)
 			priv->stats[RAVB_NC].rx_over_errors++;
 
-- 
2.25.1


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

* Re: [PATCH net v2 2/2] net: ravb: Fix possible hang if RIS2_QFF1 happen
  2023-01-23 13:13 ` [PATCH net v2 2/2] net: ravb: Fix possible hang if RIS2_QFF1 happen Yoshihiro Shimoda
@ 2023-01-23 19:41   ` Sergey Shtylyov
  2023-01-23 23:47     ` Yoshihiro Shimoda
  0 siblings, 1 reply; 5+ messages in thread
From: Sergey Shtylyov @ 2023-01-23 19:41 UTC (permalink / raw)
  To: Yoshihiro Shimoda, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-renesas-soc

Hello!

On 1/23/23 4:13 PM, Yoshihiro Shimoda wrote:

> Since this driver enables the interrupt by RIC2_QFE1, this driver
> should clear the interrupt flag if it happens. Otherwise, the interrupt
> causes to hang the system.
> 
> Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>

[...]
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 3f61100c02f4..0f54849a3823 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -1101,14 +1101,14 @@ static void ravb_error_interrupt(struct net_device *ndev)
>  	ravb_write(ndev, ~(EIS_QFS | EIS_RESERVED), EIS);
>  	if (eis & EIS_QFS) {
>  		ris2 = ravb_read(ndev, RIS2);
> -		ravb_write(ndev, ~(RIS2_QFF0 | RIS2_RFFF | RIS2_RESERVED),
> +		ravb_write(ndev, ~(RIS2_QFF0 | RIS2_QFF1 | RIS2_RFFF | RIS2_RESERVED),
>  			   RIS2);
>  
>  		/* Receive Descriptor Empty int */
>  		if (ris2 & RIS2_QFF0)
>  			priv->stats[RAVB_BE].rx_over_errors++;
>  
> -		    /* Receive Descriptor Empty int */
> +		/* Receive Descriptor Empty int */

   Well, that should've been noted in the commit log...

[...]

MBR, Sergey

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

* RE: [PATCH net v2 2/2] net: ravb: Fix possible hang if RIS2_QFF1 happen
  2023-01-23 19:41   ` Sergey Shtylyov
@ 2023-01-23 23:47     ` Yoshihiro Shimoda
  0 siblings, 0 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2023-01-23 23:47 UTC (permalink / raw)
  To: Sergey Shtylyov, davem, edumazet, kuba, pabeni; +Cc: netdev, linux-renesas-soc

Hello!

> From: Sergey Shtylyov, Sent: Tuesday, January 24, 2023 4:41 AM
> 
> On 1/23/23 4:13 PM, Yoshihiro Shimoda wrote:
> 
> > Since this driver enables the interrupt by RIC2_QFE1, this driver
> > should clear the interrupt flag if it happens. Otherwise, the interrupt
> > causes to hang the system.
> >
> > Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> 
> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>

Thank you for your review!

> [...]
> > diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> > index 3f61100c02f4..0f54849a3823 100644
> > --- a/drivers/net/ethernet/renesas/ravb_main.c
> > +++ b/drivers/net/ethernet/renesas/ravb_main.c
> > @@ -1101,14 +1101,14 @@ static void ravb_error_interrupt(struct net_device *ndev)
> >  	ravb_write(ndev, ~(EIS_QFS | EIS_RESERVED), EIS);
> >  	if (eis & EIS_QFS) {
> >  		ris2 = ravb_read(ndev, RIS2);
> > -		ravb_write(ndev, ~(RIS2_QFF0 | RIS2_RFFF | RIS2_RESERVED),
> > +		ravb_write(ndev, ~(RIS2_QFF0 | RIS2_QFF1 | RIS2_RFFF | RIS2_RESERVED),
> >  			   RIS2);
> >
> >  		/* Receive Descriptor Empty int */
> >  		if (ris2 & RIS2_QFF0)
> >  			priv->stats[RAVB_BE].rx_over_errors++;
> >
> > -		    /* Receive Descriptor Empty int */
> > +		/* Receive Descriptor Empty int */
> 
>    Well, that should've been noted in the commit log...

Oops. I think so. So, I'll send v3 patch.

Best regards,
Yoshihiro Shimoda


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

end of thread, other threads:[~2023-01-23 23:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23 13:13 [PATCH net v2 0/2] net: ravb: Fix potential issues Yoshihiro Shimoda
2023-01-23 13:13 ` [PATCH net v2 1/2] net: ravb: Fix lack of register setting after system resumed for Gen3 Yoshihiro Shimoda
2023-01-23 13:13 ` [PATCH net v2 2/2] net: ravb: Fix possible hang if RIS2_QFF1 happen Yoshihiro Shimoda
2023-01-23 19:41   ` Sergey Shtylyov
2023-01-23 23:47     ` Yoshihiro Shimoda

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).