linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: rcar_canfd: Add missing ECC error checks for channels 2-7
@ 2022-10-28 10:06 Geert Uytterhoeven
  2022-10-28 10:21 ` Biju Das
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2022-10-28 10:06 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, Biju Das
  Cc: Ulrich Hecht, linux-can, netdev, linux-renesas-soc, Geert Uytterhoeven

When introducing support for R-Car V3U, which has 8 instead of 2
channels, the ECC error bitmask was extended to take into account the
extra channels, but rcar_canfd_global_error() was not updated to act
upon the extra bits.

Replace the RCANFD_GERFL_EEF[01] macros by a new macro that takes the
channel number, fixing R-Car V3U while simplifying the code.

Fixes: 45721c406dcf50d4 ("can: rcar_canfd: Add support for r8a779a0 SoC")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Compile-tested only.

This patch conflicts with "[PATCH v3 6/6] can: rcar_canfd: Add
has_gerfl_eef to struct rcar_canfd_hw_info"[1].  Sorry for that.

[1] https://lore.kernel.org/all/20221027082158.95895-7-biju.das.jz@bp.renesas.com/
---
 drivers/net/can/rcar/rcar_canfd.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 710bd0e9c3c08c02..7cca9b7507cc6805 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -81,8 +81,7 @@ enum rcanfd_chip_id {
 
 /* RSCFDnCFDGERFL / RSCFDnGERFL */
 #define RCANFD_GERFL_EEF0_7		GENMASK(23, 16)
-#define RCANFD_GERFL_EEF1		BIT(17)
-#define RCANFD_GERFL_EEF0		BIT(16)
+#define RCANFD_GERFL_EEF(ch)		BIT(16 + (ch))
 #define RCANFD_GERFL_CMPOF		BIT(3)	/* CAN FD only */
 #define RCANFD_GERFL_THLES		BIT(2)
 #define RCANFD_GERFL_MES		BIT(1)
@@ -90,7 +89,7 @@ enum rcanfd_chip_id {
 
 #define RCANFD_GERFL_ERR(gpriv, x) \
 	((x) & (reg_v3u(gpriv, RCANFD_GERFL_EEF0_7, \
-			RCANFD_GERFL_EEF0 | RCANFD_GERFL_EEF1) | \
+			RCANFD_GERFL_EEF(0) | RCANFD_GERFL_EEF(1)) | \
 		RCANFD_GERFL_MES | \
 		((gpriv)->fdmode ? RCANFD_GERFL_CMPOF : 0)))
 
@@ -936,12 +935,8 @@ static void rcar_canfd_global_error(struct net_device *ndev)
 	u32 ridx = ch + RCANFD_RFFIFO_IDX;
 
 	gerfl = rcar_canfd_read(priv->base, RCANFD_GERFL);
-	if ((gerfl & RCANFD_GERFL_EEF0) && (ch == 0)) {
-		netdev_dbg(ndev, "Ch0: ECC Error flag\n");
-		stats->tx_dropped++;
-	}
-	if ((gerfl & RCANFD_GERFL_EEF1) && (ch == 1)) {
-		netdev_dbg(ndev, "Ch1: ECC Error flag\n");
+	if (gerfl & RCANFD_GERFL_EEF(ch)) {
+		netdev_dbg(ndev, "Ch%u: ECC Error flag\n", ch);
 		stats->tx_dropped++;
 	}
 	if (gerfl & RCANFD_GERFL_MES) {
-- 
2.25.1


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

* RE: [PATCH] can: rcar_canfd: Add missing ECC error checks for channels 2-7
  2022-10-28 10:06 [PATCH] can: rcar_canfd: Add missing ECC error checks for channels 2-7 Geert Uytterhoeven
@ 2022-10-28 10:21 ` Biju Das
  2022-10-28 10:29 ` Marc Kleine-Budde
  2022-10-28 12:11 ` Marc Kleine-Budde
  2 siblings, 0 replies; 6+ messages in thread
From: Biju Das @ 2022-10-28 10:21 UTC (permalink / raw)
  To: Geert Uytterhoeven, Wolfgang Grandegger, Marc Kleine-Budde
  Cc: Ulrich Hecht, linux-can, netdev, linux-renesas-soc

Hi Geert,

> Subject: [PATCH] can: rcar_canfd: Add missing ECC error checks for
> channels 2-7
> 
> When introducing support for R-Car V3U, which has 8 instead of 2
> channels, the ECC error bitmask was extended to take into account the
> extra channels, but rcar_canfd_global_error() was not updated to act
> upon the extra bits.
> 
> Replace the RCANFD_GERFL_EEF[01] macros by a new macro that takes the
> channel number, fixing R-Car V3U while simplifying the code.
> 
> Fixes: 45721c406dcf50d4 ("can: rcar_canfd: Add support for r8a779a0
> SoC")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> Compile-tested only.
> 
> This patch conflicts with "[PATCH v3 6/6] can: rcar_canfd: Add
> has_gerfl_eef to struct rcar_canfd_hw_info"[1].  Sorry for that.

Ok. I will add dependency on 6/6 with this patch.

Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

Cheers,
Biju

> 
> [1]
> ---
>  drivers/net/can/rcar/rcar_canfd.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/can/rcar/rcar_canfd.c
> b/drivers/net/can/rcar/rcar_canfd.c
> index 710bd0e9c3c08c02..7cca9b7507cc6805 100644
> --- a/drivers/net/can/rcar/rcar_canfd.c
> +++ b/drivers/net/can/rcar/rcar_canfd.c
> @@ -81,8 +81,7 @@ enum rcanfd_chip_id {
> 
>  /* RSCFDnCFDGERFL / RSCFDnGERFL */
>  #define RCANFD_GERFL_EEF0_7		GENMASK(23, 16)
> -#define RCANFD_GERFL_EEF1		BIT(17)
> -#define RCANFD_GERFL_EEF0		BIT(16)
> +#define RCANFD_GERFL_EEF(ch)		BIT(16 + (ch))
>  #define RCANFD_GERFL_CMPOF		BIT(3)	/* CAN FD only */
>  #define RCANFD_GERFL_THLES		BIT(2)
>  #define RCANFD_GERFL_MES		BIT(1)
> @@ -90,7 +89,7 @@ enum rcanfd_chip_id {
> 
>  #define RCANFD_GERFL_ERR(gpriv, x) \
>  	((x) & (reg_v3u(gpriv, RCANFD_GERFL_EEF0_7, \
> -			RCANFD_GERFL_EEF0 | RCANFD_GERFL_EEF1) | \
> +			RCANFD_GERFL_EEF(0) | RCANFD_GERFL_EEF(1)) | \
>  		RCANFD_GERFL_MES | \
>  		((gpriv)->fdmode ? RCANFD_GERFL_CMPOF : 0)))
> 
> @@ -936,12 +935,8 @@ static void rcar_canfd_global_error(struct
> net_device *ndev)
>  	u32 ridx = ch + RCANFD_RFFIFO_IDX;
> 
>  	gerfl = rcar_canfd_read(priv->base, RCANFD_GERFL);
> -	if ((gerfl & RCANFD_GERFL_EEF0) && (ch == 0)) {
> -		netdev_dbg(ndev, "Ch0: ECC Error flag\n");
> -		stats->tx_dropped++;
> -	}
> -	if ((gerfl & RCANFD_GERFL_EEF1) && (ch == 1)) {
> -		netdev_dbg(ndev, "Ch1: ECC Error flag\n");
> +	if (gerfl & RCANFD_GERFL_EEF(ch)) {
> +		netdev_dbg(ndev, "Ch%u: ECC Error flag\n", ch);
>  		stats->tx_dropped++;
>  	}
>  	if (gerfl & RCANFD_GERFL_MES) {



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

* Re: [PATCH] can: rcar_canfd: Add missing ECC error checks for channels 2-7
  2022-10-28 10:06 [PATCH] can: rcar_canfd: Add missing ECC error checks for channels 2-7 Geert Uytterhoeven
  2022-10-28 10:21 ` Biju Das
@ 2022-10-28 10:29 ` Marc Kleine-Budde
  2022-10-28 11:06   ` Geert Uytterhoeven
  2022-10-28 12:11 ` Marc Kleine-Budde
  2 siblings, 1 reply; 6+ messages in thread
From: Marc Kleine-Budde @ 2022-10-28 10:29 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfgang Grandegger, Biju Das, Ulrich Hecht, linux-can, netdev,
	linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 880 bytes --]

On 28.10.2022 12:06:45, Geert Uytterhoeven wrote:
> When introducing support for R-Car V3U, which has 8 instead of 2
> channels, the ECC error bitmask was extended to take into account the
> extra channels, but rcar_canfd_global_error() was not updated to act
> upon the extra bits.
> 
> Replace the RCANFD_GERFL_EEF[01] macros by a new macro that takes the
> channel number, fixing R-Car V3U while simplifying the code.
> 
> Fixes: 45721c406dcf50d4 ("can: rcar_canfd: Add support for r8a779a0 SoC")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Is this stable material?

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] can: rcar_canfd: Add missing ECC error checks for channels 2-7
  2022-10-28 10:29 ` Marc Kleine-Budde
@ 2022-10-28 11:06   ` Geert Uytterhoeven
  2022-10-28 11:27     ` Biju Das
  0 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2022-10-28 11:06 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Wolfgang Grandegger, Biju Das, Ulrich Hecht, linux-can, netdev,
	linux-renesas-soc

Hi Marc,

On Fri, Oct 28, 2022 at 12:29 PM Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> On 28.10.2022 12:06:45, Geert Uytterhoeven wrote:
> > When introducing support for R-Car V3U, which has 8 instead of 2
> > channels, the ECC error bitmask was extended to take into account the
> > extra channels, but rcar_canfd_global_error() was not updated to act
> > upon the extra bits.
> >
> > Replace the RCANFD_GERFL_EEF[01] macros by a new macro that takes the
> > channel number, fixing R-Car V3U while simplifying the code.
> >
> > Fixes: 45721c406dcf50d4 ("can: rcar_canfd: Add support for r8a779a0 SoC")
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> Is this stable material?

Upstream DTS[1] has only the first two channels enabled, so it's not
critical. But it never hurts to end up in stable, helping e.g. CiP.

[1] arch/arm64/boot/dts/renesas/r8a779a0-falcon.dts

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* RE: [PATCH] can: rcar_canfd: Add missing ECC error checks for channels 2-7
  2022-10-28 11:06   ` Geert Uytterhoeven
@ 2022-10-28 11:27     ` Biju Das
  0 siblings, 0 replies; 6+ messages in thread
From: Biju Das @ 2022-10-28 11:27 UTC (permalink / raw)
  To: Geert Uytterhoeven, Marc Kleine-Budde
  Cc: Wolfgang Grandegger, Ulrich Hecht, linux-can, netdev, linux-renesas-soc

Hi Geert,

> Subject: Re: [PATCH] can: rcar_canfd: Add missing ECC error checks for
> channels 2-7
> 
> Hi Marc,
> 
> On Fri, Oct 28, 2022 at 12:29 PM Marc Kleine-Budde
> <mkl@pengutronix.de> wrote:
> > On 28.10.2022 12:06:45, Geert Uytterhoeven wrote:
> > > When introducing support for R-Car V3U, which has 8 instead of 2
> > > channels, the ECC error bitmask was extended to take into account
> > > the extra channels, but rcar_canfd_global_error() was not updated
> to
> > > act upon the extra bits.
> > >
> > > Replace the RCANFD_GERFL_EEF[01] macros by a new macro that takes
> > > the channel number, fixing R-Car V3U while simplifying the code.
> > >
> > > Fixes: 45721c406dcf50d4 ("can: rcar_canfd: Add support for
> r8a779a0
> > > SoC")
> > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >
> > Is this stable material?
> 
> Upstream DTS[1] has only the first two channels enabled, so it's not
> critical. But it never hurts to end up in stable, helping e.g. CiP.

Yes, That will avoid backporting effort if it goes via stable.

FYI,  We have a plan to backport the whole CAN FD fixes/enhancement series to
5.10 cip [2] once it hits Linux mainline-rc.

[2] https://git.kernel.org/pub/scm/linux/kernel/git/cip/linux-cip.git/log/?h=linux-5.10.y-cip

Cheers,
Biju


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

* Re: [PATCH] can: rcar_canfd: Add missing ECC error checks for channels 2-7
  2022-10-28 10:06 [PATCH] can: rcar_canfd: Add missing ECC error checks for channels 2-7 Geert Uytterhoeven
  2022-10-28 10:21 ` Biju Das
  2022-10-28 10:29 ` Marc Kleine-Budde
@ 2022-10-28 12:11 ` Marc Kleine-Budde
  2 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2022-10-28 12:11 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfgang Grandegger, Biju Das, Ulrich Hecht, linux-can, netdev,
	linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 898 bytes --]

On 28.10.2022 12:06:45, Geert Uytterhoeven wrote:
> When introducing support for R-Car V3U, which has 8 instead of 2
> channels, the ECC error bitmask was extended to take into account the
> extra channels, but rcar_canfd_global_error() was not updated to act
> upon the extra bits.
> 
> Replace the RCANFD_GERFL_EEF[01] macros by a new macro that takes the
> channel number, fixing R-Car V3U while simplifying the code.
> 
> Fixes: 45721c406dcf50d4 ("can: rcar_canfd: Add support for r8a779a0 SoC")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Added stable on Cc and added to linux-can.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2022-10-28 12:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28 10:06 [PATCH] can: rcar_canfd: Add missing ECC error checks for channels 2-7 Geert Uytterhoeven
2022-10-28 10:21 ` Biju Das
2022-10-28 10:29 ` Marc Kleine-Budde
2022-10-28 11:06   ` Geert Uytterhoeven
2022-10-28 11:27     ` Biju Das
2022-10-28 12:11 ` Marc Kleine-Budde

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