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

Fix potentiall issues on the ravb driver.

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 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

-- 
2.25.1


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

* [PATCH net 1/2] net: ravb: Fix lack of register setting after system resumed for Gen3
  2023-01-19  4:39 [PATCH net 0/2] net: ravb: Fix potential issues Yoshihiro Shimoda
@ 2023-01-19  4:39 ` Yoshihiro Shimoda
  2023-01-20 19:47   ` Sergey Shtylyov
  2023-01-19  4:39 ` [PATCH net 2/2] net: ravb: Fix possible hang if RIS2_QFF1 happen Yoshihiro Shimoda
  2023-01-19 21:39 ` [PATCH net 0/2] net: ravb: Fix potential issues Tony Nguyen
  2 siblings, 1 reply; 7+ messages in thread
From: Yoshihiro Shimoda @ 2023-01-19  4:39 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 resetted 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>
---
 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] 7+ messages in thread

* [PATCH net 2/2] net: ravb: Fix possible hang if RIS2_QFF1 happen
  2023-01-19  4:39 [PATCH net 0/2] net: ravb: Fix potential issues Yoshihiro Shimoda
  2023-01-19  4:39 ` [PATCH net 1/2] net: ravb: Fix lack of register setting after system resumed for Gen3 Yoshihiro Shimoda
@ 2023-01-19  4:39 ` Yoshihiro Shimoda
  2023-01-20 20:12   ` Sergey Shtylyov
  2023-01-19 21:39 ` [PATCH net 0/2] net: ravb: Fix potential issues Tony Nguyen
  2 siblings, 1 reply; 7+ messages in thread
From: Yoshihiro Shimoda @ 2023-01-19  4:39 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: a0d2f20650e8 ("Renesas Ethernet AVB PTP clock driver")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 3f61100c02f4..bcbb62f90fb7 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1101,7 +1101,7 @@ 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 */
-- 
2.25.1


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

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

On 1/18/2023 8:39 PM, Yoshihiro Shimoda wrote:
> Fix potentiall issues on the ravb driver.

Typo here, but probably not worth a fixup unless you need a v2.

> 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 | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)

Looks ok to me.

Reviewed-by: Tony Nguyen <anthony.l.nguyen@intel.com>

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

* Re: [PATCH net 1/2] net: ravb: Fix lack of register setting after system resumed for Gen3
  2023-01-19  4:39 ` [PATCH net 1/2] net: ravb: Fix lack of register setting after system resumed for Gen3 Yoshihiro Shimoda
@ 2023-01-20 19:47   ` Sergey Shtylyov
  0 siblings, 0 replies; 7+ messages in thread
From: Sergey Shtylyov @ 2023-01-20 19:47 UTC (permalink / raw)
  To: Yoshihiro Shimoda, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-renesas-soc

On 1/19/23 7:39 AM, Yoshihiro Shimoda wrote:

> After system entered Suspend to RAM, registers setting of this
> hardware is resetted because the SoC will be turned off. On R-Car Gen3

   s/resetted/reset/.

> (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>

[...]

MBR, Sergey

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

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

On 1/19/23 7:39 AM, 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: a0d2f20650e8 ("Renesas Ethernet AVB PTP clock driver")

   No, it's actually c156633f1353 ("Renesas Ethernet AVB driver proper|)!

> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
[...]

> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 3f61100c02f4..bcbb62f90fb7 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -1101,7 +1101,7 @@ 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),

   Might as well fix the QFF1 comment indentation below...

[...]

MBR, Sergey

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

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

Hi Sergey-san,

> From: Sergey Shtylyov, Sent: Saturday, January 21, 2023 5:12 AM
> 
> On 1/19/23 7:39 AM, 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: a0d2f20650e8 ("Renesas Ethernet AVB PTP clock driver")
> 
>    No, it's actually c156633f1353 ("Renesas Ethernet AVB driver proper|)!

I'll fix it on v2.

> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> [...]
> 
> > diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> > index 3f61100c02f4..bcbb62f90fb7 100644
> > --- a/drivers/net/ethernet/renesas/ravb_main.c
> > +++ b/drivers/net/ethernet/renesas/ravb_main.c
> > @@ -1101,7 +1101,7 @@ 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),
> 
>    Might as well fix the QFF1 comment indentation below...

OK, I will also fix it.

Best regards,
Yoshihiro Shimoda


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

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

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

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