* [PATCH v2 1/8] clk: r9a08g045-cpg: Add clocks and resets for CAN-FD
2026-07-09 18:23 [PATCH v2 0/8] can: rcar_canfd: Add support for Renesas RZ/G3S Claudiu Beznea
@ 2026-07-09 18:23 ` Claudiu Beznea
2026-07-10 10:18 ` Geert Uytterhoeven
2026-07-09 18:23 ` [PATCH v2 2/8] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3S SoC Claudiu Beznea
` (6 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Claudiu Beznea @ 2026-07-09 18:23 UTC (permalink / raw)
To: mkl, mailhol, robh, krzk+dt, conor+dt, geert+renesas, magnus.damm,
mturquette, sboyd, bmasney, biju.das.jz, claudiu.beznea.uj,
fabrizio.castro.jz
Cc: claudiu.beznea, linux-can, devicetree, linux-renesas-soc,
linux-clk
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Renesas RZ/G3S SoC has a CAN-FD IP. Add clocks and resets for it.
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v2:
- used R9A08G045_CLK_P4 ID for P4 clock
- still collected the tags; Biju, Geert, please let me know if you consider
otherwise
drivers/clk/renesas/r9a08g045-cpg.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/clk/renesas/r9a08g045-cpg.c b/drivers/clk/renesas/r9a08g045-cpg.c
index 624fc5e6fb24..ea2a6a71aebd 100644
--- a/drivers/clk/renesas/r9a08g045-cpg.c
+++ b/drivers/clk/renesas/r9a08g045-cpg.c
@@ -77,6 +77,7 @@ enum clk_ids {
CLK_SEL_PLL4,
CLK_P1_DIV2,
CLK_P3_DIV2,
+ CLK_P4_DIV2,
CLK_SD0_DIV4,
CLK_SD1_DIV4,
CLK_SD2_DIV4,
@@ -172,6 +173,8 @@ static const struct cpg_core_clk r9a08g045_core_clks[] __initconst = {
DEF_G3S_DIV("P3", R9A08G045_CLK_P3, CLK_PLL3_DIV2_4, DIVPL3C, G3S_DIVPL3C_STS,
dtable_1_32, 0, 0, 0, NULL),
DEF_FIXED("P3_DIV2", CLK_P3_DIV2, R9A08G045_CLK_P3, 1, 2),
+ DEF_FIXED("P4", R9A08G045_CLK_P4, CLK_PLL2_DIV2, 1, 5),
+ DEF_FIXED("P4_DIV2", CLK_P4_DIV2, R9A08G045_CLK_P4, 1, 2),
DEF_FIXED("P5", R9A08G045_CLK_P5, CLK_PLL2_DIV2, 1, 4),
DEF_FIXED("ZT", R9A08G045_CLK_ZT, CLK_PLL3_DIV2_8, 1, 1),
DEF_FIXED("S0", R9A08G045_CLK_S0, CLK_SEL_PLL4, 1, 2),
@@ -274,6 +277,10 @@ static const struct rzg2l_mod_clk r9a08g045_mod_clks[] = {
MSTOP(BUS_MCPU2, BIT(5))),
DEF_MOD("scif5_clk_pck", R9A08G045_SCIF5_CLK_PCK, R9A08G045_CLK_P0, 0x584, 5,
MSTOP(BUS_MCPU3, BIT(4))),
+ DEF_MOD("canfd_pclk", R9A08G045_CANFD_PCLK, CLK_P4_DIV2, 0x594, 0,
+ MSTOP(BUS_MCPU2, BIT(9))),
+ DEF_MOD("canfd_clk_ram", R9A08G045_CANFD_CLK_RAM, R9A08G045_CLK_P4, 0x594, 1,
+ MSTOP(BUS_MCPU2, BIT(9))),
DEF_MOD("gpio_hclk", R9A08G045_GPIO_HCLK, R9A08G045_OSCCLK, 0x598, 0,
MSTOP(BUS_PERI_CPU, BIT(6))),
DEF_MOD("adc_adclk", R9A08G045_ADC_ADCLK, R9A08G045_CLK_TSU, 0x5a8, 0,
@@ -324,6 +331,8 @@ static const struct rzg2l_reset r9a08g045_resets[] = {
DEF_RST(R9A08G045_SCIF3_RST_SYSTEM_N, 0x884, 3),
DEF_RST(R9A08G045_SCIF4_RST_SYSTEM_N, 0x884, 4),
DEF_RST(R9A08G045_SCIF5_RST_SYSTEM_N, 0x884, 5),
+ DEF_RST(R9A08G045_CANFD_RSTP_N, 0x894, 0),
+ DEF_RST(R9A08G045_CANFD_RSTC_N, 0x894, 1),
DEF_RST(R9A08G045_GPIO_RSTN, 0x898, 0),
DEF_RST(R9A08G045_GPIO_PORT_RESETN, 0x898, 1),
DEF_RST(R9A08G045_GPIO_SPARE_RESETN, 0x898, 2),
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH v2 1/8] clk: r9a08g045-cpg: Add clocks and resets for CAN-FD
2026-07-09 18:23 ` [PATCH v2 1/8] clk: r9a08g045-cpg: Add clocks and resets for CAN-FD Claudiu Beznea
@ 2026-07-10 10:18 ` Geert Uytterhoeven
0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2026-07-10 10:18 UTC (permalink / raw)
To: Claudiu Beznea
Cc: mkl, mailhol, robh, krzk+dt, conor+dt, magnus.damm, mturquette,
sboyd, bmasney, biju.das.jz, claudiu.beznea.uj,
fabrizio.castro.jz, claudiu.beznea, linux-can, devicetree,
linux-renesas-soc, linux-clk
Hi Claudiu,
On Thu, 9 Jul 2026 at 20:23, Claudiu Beznea
<claudiu.beznea+renesas@tuxon.dev> wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> Renesas RZ/G3S SoC has a CAN-FD IP. Add clocks and resets for it.
>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> ---
>
> Changes in v2:
> - used R9A08G045_CLK_P4 ID for P4 clock
> - still collected the tags; Biju, Geert, please let me know if you consider
> otherwise
Thanks, will queue this one instead of v1 in renesas-clk for v7.3.
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] 14+ messages in thread
* [PATCH v2 2/8] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3S SoC
2026-07-09 18:23 [PATCH v2 0/8] can: rcar_canfd: Add support for Renesas RZ/G3S Claudiu Beznea
2026-07-09 18:23 ` [PATCH v2 1/8] clk: r9a08g045-cpg: Add clocks and resets for CAN-FD Claudiu Beznea
@ 2026-07-09 18:23 ` Claudiu Beznea
2026-07-10 10:14 ` Geert Uytterhoeven
2026-07-09 18:23 ` [PATCH v2 3/8] can: rcar_canfd: Fix typos in macro names Claudiu Beznea
` (5 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Claudiu Beznea @ 2026-07-09 18:23 UTC (permalink / raw)
To: mkl, mailhol, robh, krzk+dt, conor+dt, geert+renesas, magnus.damm,
mturquette, sboyd, bmasney, biju.das.jz, claudiu.beznea.uj,
fabrizio.castro.jz
Cc: claudiu.beznea, linux-can, devicetree, linux-renesas-soc,
linux-clk
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
The CAN FD controller found on the Renesas RZ/G3S SoC is largely compatible
with the variant present on the RZ/G3E SoC. The main differences are:
- the RZ/G3S provides only two CAN FD channels
- the RZ/G3S supports only CAN FD operation; the Channel n CAN FD
Configuration Register does not implement the bits used to select
classical CAN-only mode (bit 30) or CAN FD-only mode (bit 28);
consequently, bit 31 (CAN FD Frame Distinction Enable) of the same
register is also not implemented
- some bits in several registers (mainly reserved or status bits) are
read-write on the RZ/G3S but read-only on the RZ/G3E; their behavior is
otherwise identical: the bits read back as 0 on both SoCs and software
is allowed to write only 0 to them on the RZ/G3S
- the RZ/G3S provides 128 acceptance filters, compared to 64 on the
RZ/G3E
- the RZ/G3S can use PCLK clock as the CAN FD clock source through an
internal clock divider, while also supporting an external CAN FD clock
source
Since:
- the SoC clock generator provides to the CAN IP only the peripheral and
the RAM clocks
- when sourced from the peripheral clock, the CAN-FD clock is obtained
inside the IP itself by dividing the peripheral clock
- the assigned-clocks and assigned-clock-rates properties are specific to
the CAN-FD clock
the assigned-clocks and assigned-clock-rates properties were dropped from
the required properties list of the Renesas RZ/G3S SoC.
Add documentation for the Renesas RZ/G3S SoC.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v2:
- forbid renesas,no-can-fd and renesas,fd-only since the IP supports
only CAN-FD; for this didn't collect Biju's tag
.../bindings/net/can/renesas,rcar-canfd.yaml | 20 +++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
index b9d9dd7a7967..43ebfd73f5bf 100644
--- a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
+++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
@@ -13,6 +13,7 @@ properties:
compatible:
oneOf:
- enum:
+ - renesas,r9a08g045-canfd # RZ/G3S
- renesas,r9a09g047-canfd # RZ/G3E
- renesas,r9a09g077-canfd # RZ/T2H
@@ -185,8 +186,6 @@ required:
- clocks
- clock-names
- power-domains
- - assigned-clocks
- - assigned-clock-rates
- channel0
- channel1
@@ -198,6 +197,7 @@ allOf:
compatible:
contains:
enum:
+ - renesas,r9a08g045-canfd
- renesas,rzg2l-canfd
then:
properties:
@@ -267,6 +267,7 @@ allOf:
contains:
enum:
- renesas,r9a09g077-canfd
+ - renesas,r9a08g045-canfd
- renesas,rcar-gen3-canfd
- renesas,rzg2l-canfd
then:
@@ -330,6 +331,7 @@ allOf:
compatible:
contains:
enum:
+ - renesas,r9a08g045-canfd
- renesas,r9a09g047-canfd
- renesas,rzg2l-canfd
then:
@@ -350,6 +352,20 @@ allOf:
properties:
reset-names: false
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: renesas,r9a08g045-canfd
+ then:
+ properties:
+ renesas,no-can-fd: false
+ renesas,fd-only: false
+ else:
+ required:
+ - assigned-clocks
+ - assigned-clock-rates
+
unevaluatedProperties: false
examples:
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH v2 2/8] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3S SoC
2026-07-09 18:23 ` [PATCH v2 2/8] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3S SoC Claudiu Beznea
@ 2026-07-10 10:14 ` Geert Uytterhoeven
0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2026-07-10 10:14 UTC (permalink / raw)
To: Claudiu Beznea
Cc: mkl, mailhol, robh, krzk+dt, conor+dt, magnus.damm, mturquette,
sboyd, bmasney, biju.das.jz, claudiu.beznea.uj,
fabrizio.castro.jz, claudiu.beznea, linux-can, devicetree,
linux-renesas-soc, linux-clk
Hi Claudiu,
On Thu, 9 Jul 2026 at 20:23, Claudiu Beznea
<claudiu.beznea+renesas@tuxon.dev> wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> The CAN FD controller found on the Renesas RZ/G3S SoC is largely compatible
> with the variant present on the RZ/G3E SoC. The main differences are:
> - the RZ/G3S provides only two CAN FD channels
> - the RZ/G3S supports only CAN FD operation; the Channel n CAN FD
> Configuration Register does not implement the bits used to select
> classical CAN-only mode (bit 30) or CAN FD-only mode (bit 28);
> consequently, bit 31 (CAN FD Frame Distinction Enable) of the same
> register is also not implemented
> - some bits in several registers (mainly reserved or status bits) are
> read-write on the RZ/G3S but read-only on the RZ/G3E; their behavior is
> otherwise identical: the bits read back as 0 on both SoCs and software
> is allowed to write only 0 to them on the RZ/G3S
> - the RZ/G3S provides 128 acceptance filters, compared to 64 on the
> RZ/G3E
> - the RZ/G3S can use PCLK clock as the CAN FD clock source through an
> internal clock divider, while also supporting an external CAN FD clock
> source
>
> Since:
> - the SoC clock generator provides to the CAN IP only the peripheral and
> the RAM clocks
> - when sourced from the peripheral clock, the CAN-FD clock is obtained
> inside the IP itself by dividing the peripheral clock
> - the assigned-clocks and assigned-clock-rates properties are specific to
> the CAN-FD clock
> the assigned-clocks and assigned-clock-rates properties were dropped from
> the required properties list of the Renesas RZ/G3S SoC.
>
> Add documentation for the Renesas RZ/G3S SoC.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> ---
>
> Changes in v2:
> - forbid renesas,no-can-fd and renesas,fd-only since the IP supports
> only CAN-FD; for this didn't collect Biju's tag
Thanks for the update!
> --- a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
> +++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
> @@ -267,6 +267,7 @@ allOf:
> contains:
> enum:
> - renesas,r9a09g077-canfd
> + - renesas,r9a08g045-canfd
Please preserve sort order (alphabetical).
> - renesas,rcar-gen3-canfd
> - renesas,rzg2l-canfd
> then:
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] 14+ messages in thread
* [PATCH v2 3/8] can: rcar_canfd: Fix typos in macro names
2026-07-09 18:23 [PATCH v2 0/8] can: rcar_canfd: Add support for Renesas RZ/G3S Claudiu Beznea
2026-07-09 18:23 ` [PATCH v2 1/8] clk: r9a08g045-cpg: Add clocks and resets for CAN-FD Claudiu Beznea
2026-07-09 18:23 ` [PATCH v2 2/8] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3S SoC Claudiu Beznea
@ 2026-07-09 18:23 ` Claudiu Beznea
2026-07-09 18:23 ` [PATCH v2 4/8] can: rcar_canfd: Allow the CAN FD clock to be sourced from fck Claudiu Beznea
` (4 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Claudiu Beznea @ 2026-07-09 18:23 UTC (permalink / raw)
To: mkl, mailhol, robh, krzk+dt, conor+dt, geert+renesas, magnus.damm,
mturquette, sboyd, bmasney, biju.das.jz, claudiu.beznea.uj,
fabrizio.castro.jz
Cc: claudiu.beznea, linux-can, devicetree, linux-renesas-soc,
linux-clk
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
The bits 1..0 of the Channel n Control Register are named CHMDC (Channel
Mode select). Fix typos in macro names by replacing DMC with MDC.
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v2:
- collected tags
drivers/net/can/rcar/rcar_canfd.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 4ee108abffb8..879f31c97276 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -132,9 +132,9 @@
#define RCANFD_CCTR_BEIE BIT(8)
#define RCANFD_CCTR_CSLPR BIT(2)
#define RCANFD_CCTR_CHMDC_MASK (0x3)
-#define RCANFD_CCTR_CHDMC_COPM (0x0)
-#define RCANFD_CCTR_CHDMC_CRESET (0x1)
-#define RCANFD_CCTR_CHDMC_CHLT (0x2)
+#define RCANFD_CCTR_CHMDC_COPM (0x0)
+#define RCANFD_CCTR_CHMDC_CRESET (0x1)
+#define RCANFD_CCTR_CHMDC_CHLT (0x2)
/* RSCFDnCFDCmSTS / RSCFDnCmSTS */
#define RCANFD_CSTS_COMSTS BIT(7)
@@ -828,7 +828,7 @@ static int rcar_canfd_reset_controller(struct rcar_canfd_global *gpriv)
rcar_canfd_update_bit(gpriv->base, RCANFD_CCTR(ch),
RCANFD_CCTR_CHMDC_MASK,
- RCANFD_CCTR_CHDMC_CRESET);
+ RCANFD_CCTR_CHMDC_CRESET);
/* Ensure Channel reset mode */
err = readl_poll_timeout((gpriv->base + RCANFD_CSTS(ch)), sts,
@@ -1504,7 +1504,7 @@ static int rcar_canfd_start(struct net_device *ndev)
/* Set channel to Operational mode */
rcar_canfd_update_bit(priv->base, RCANFD_CCTR(ch),
- RCANFD_CCTR_CHMDC_MASK, RCANFD_CCTR_CHDMC_COPM);
+ RCANFD_CCTR_CHMDC_MASK, RCANFD_CCTR_CHMDC_COPM);
/* Verify channel mode change */
err = readl_poll_timeout((priv->base + RCANFD_CSTS(ch)), sts,
@@ -1578,7 +1578,7 @@ static void rcar_canfd_stop(struct net_device *ndev)
/* Transition to channel reset mode */
rcar_canfd_update_bit(priv->base, RCANFD_CCTR(ch),
- RCANFD_CCTR_CHMDC_MASK, RCANFD_CCTR_CHDMC_CRESET);
+ RCANFD_CCTR_CHMDC_MASK, RCANFD_CCTR_CHMDC_CRESET);
/* Check Channel reset mode */
err = readl_poll_timeout((priv->base + RCANFD_CSTS(ch)), sts,
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v2 4/8] can: rcar_canfd: Allow the CAN FD clock to be sourced from fck
2026-07-09 18:23 [PATCH v2 0/8] can: rcar_canfd: Add support for Renesas RZ/G3S Claudiu Beznea
` (2 preceding siblings ...)
2026-07-09 18:23 ` [PATCH v2 3/8] can: rcar_canfd: Fix typos in macro names Claudiu Beznea
@ 2026-07-09 18:23 ` Claudiu Beznea
2026-07-09 18:35 ` sashiko-bot
2026-07-09 18:23 ` [PATCH v2 5/8] can: rcar_canfd: Do not set registers selecting the CAN mode Claudiu Beznea
` (3 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Claudiu Beznea @ 2026-07-09 18:23 UTC (permalink / raw)
To: mkl, mailhol, robh, krzk+dt, conor+dt, geert+renesas, magnus.damm,
mturquette, sboyd, bmasney, biju.das.jz, claudiu.beznea.uj,
fabrizio.castro.jz
Cc: claudiu.beznea, linux-can, devicetree, linux-renesas-soc,
linux-clk
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
On the Renesas RZ/G3S, the CAN FD clock can be sourced either from fck
(the peripheral clock) or from an external clock (can_clk). When fck is
used, it is divided internally by the CAN FD controller.
Adjust the existing canfd clock handling code to support the RZ/G3S CAN.
The existing struct rcar_canfd_hw_info instances were updated to address
the request in the Link discussion.
Link: https://lore.kernel.org/all/1d9719e3-10ff-4cd8-b729-55fea93c37ce@wanadoo.fr
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v2:
- changed the logic to request canfd only if info->fcan_pclk and contrary
get the fcan clock from pclk; for this didn't collect the Rb tag
drivers/net/can/rcar/rcar_canfd.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 879f31c97276..b66f72de46c9 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -444,6 +444,7 @@ struct rcar_canfd_hw_info {
unsigned ch_interface_mode:1; /* Has channel interface mode */
unsigned shared_can_regs:1; /* Has shared classical can registers */
unsigned external_clk:1; /* Has external clock */
+ unsigned fcan_pclk:1; /* Has fcan sourced from pclk. */
};
/* Channel priv data */
@@ -617,6 +618,7 @@ static const struct rcar_canfd_hw_info rcar_gen3_hw_info = {
.ch_interface_mode = 0,
.shared_can_regs = 0,
.external_clk = 1,
+ .fcan_pclk = 0,
};
static const struct rcar_canfd_hw_info rcar_gen4_hw_info = {
@@ -634,6 +636,7 @@ static const struct rcar_canfd_hw_info rcar_gen4_hw_info = {
.ch_interface_mode = 1,
.shared_can_regs = 1,
.external_clk = 1,
+ .fcan_pclk = 0,
};
static const struct rcar_canfd_hw_info rzg2l_hw_info = {
@@ -651,6 +654,7 @@ static const struct rcar_canfd_hw_info rzg2l_hw_info = {
.ch_interface_mode = 0,
.shared_can_regs = 0,
.external_clk = 1,
+ .fcan_pclk = 0,
};
static const struct rcar_canfd_hw_info r9a09g047_hw_info = {
@@ -668,6 +672,7 @@ static const struct rcar_canfd_hw_info r9a09g047_hw_info = {
.ch_interface_mode = 1,
.shared_can_regs = 1,
.external_clk = 0,
+ .fcan_pclk = 0,
};
static const struct rcar_canfd_hw_info r9a09g077_hw_info = {
@@ -685,6 +690,7 @@ static const struct rcar_canfd_hw_info r9a09g077_hw_info = {
.ch_interface_mode = 1,
.shared_can_regs = 1,
.external_clk = 1,
+ .fcan_pclk = 0,
};
/* Helper functions */
@@ -2191,13 +2197,19 @@ static int rcar_canfd_probe(struct platform_device *pdev)
*/
gpriv->can_clk = devm_clk_get(dev, "can_clk");
if (IS_ERR(gpriv->can_clk) || (clk_get_rate(gpriv->can_clk) == 0)) {
- gpriv->can_clk = devm_clk_get(dev, "canfd");
- if (IS_ERR(gpriv->can_clk))
- return dev_err_probe(dev, PTR_ERR(gpriv->can_clk),
- "cannot get canfd clock\n");
+ if (info->fcan_pclk) {
+ fcan_freq = clk_get_rate(gpriv->clkp);
+ } else {
+ gpriv->can_clk = devm_clk_get(dev, "canfd");
+ if (IS_ERR(gpriv->can_clk))
+ return dev_err_probe(dev, PTR_ERR(gpriv->can_clk),
+ "cannot get canfd clock\n");
+
+ fcan_freq = clk_get_rate(gpriv->can_clk);
+ }
/* CANFD clock may be further divided within the IP */
- fcan_freq = clk_get_rate(gpriv->can_clk) / info->postdiv;
+ fcan_freq /= info->postdiv;
} else {
fcan_freq = clk_get_rate(gpriv->can_clk);
gpriv->extclk = gpriv->info->external_clk;
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH v2 4/8] can: rcar_canfd: Allow the CAN FD clock to be sourced from fck
2026-07-09 18:23 ` [PATCH v2 4/8] can: rcar_canfd: Allow the CAN FD clock to be sourced from fck Claudiu Beznea
@ 2026-07-09 18:35 ` sashiko-bot
0 siblings, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-07-09 18:35 UTC (permalink / raw)
To: Claudiu Beznea
Cc: linux-can, Oliver Hartkopp, wsa+renesas, Oleksij Rempel,
Marc Kleine-Budde, conor+dt, devicetree, robh, Vincent Mailhol
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [High] Unhandled ERR_PTR dereference leading to kernel panic in clock API.
Pre-existing issues:
- [High] Use-After-Free and Double Free on probe error path.
--
--- Patch [4]: [PATCH v2 4/8] can: rcar_canfd: Allow the CAN FD clock to be sourced from fck ---
commit 4210af3a91e163ec149ddcdedbbe130decc7d427
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
can: rcar_canfd: Allow the CAN FD clock to be sourced from fck
Adjust the existing canfd clock handling code to support the RZ/G3S CAN.
When fck is used, it is divided internally by the CAN FD controller.
Link: https://lore.kernel.org/all/1d9719e3-10ff-4cd8-b729-55fea93c37ce@wanadoo.fr
> diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
> index b40ae5998c1da..0283620ebcf8d 100644
> --- a/drivers/net/can/rcar/rcar_canfd.c
> +++ b/drivers/net/can/rcar/rcar_canfd.c
[ ... ]
> @@ -2190,13 +2196,19 @@ static int rcar_canfd_probe(struct platform_device *pdev)
> */
> gpriv->can_clk = devm_clk_get(dev, "can_clk");
> if (IS_ERR(gpriv->can_clk) || (clk_get_rate(gpriv->can_clk) == 0)) {
> - gpriv->can_clk = devm_clk_get(dev, "canfd");
> - if (IS_ERR(gpriv->can_clk))
> - return dev_err_probe(dev, PTR_ERR(gpriv->can_clk),
> - "cannot get canfd clock\n");
> + if (info->fcan_pclk) {
> + fcan_freq = clk_get_rate(gpriv->clkp);
> + } else {
[Severity: High]
If info->fcan_pclk is true and can_clk is not present, gpriv->can_clk
retains an ERR_PTR value here.
When the interface is brought up later, rcar_canfd_open() calls
clk_prepare_enable(gpriv->can_clk):
drivers/net/can/rcar/rcar_canfd.c:rcar_canfd_open() {
...
/* Peripheral clock is already enabled in probe */
err = clk_prepare_enable(gpriv->can_clk);
if (err) {
...
}
Because clk_prepare_enable() checks for NULL but not for IS_ERR(), will
this dereference the error pointer and cause a kernel panic? Should
gpriv->can_clk be explicitly set to NULL when using the fcan_pclk fallback?
> + gpriv->can_clk = devm_clk_get(dev, "canfd");
> + if (IS_ERR(gpriv->can_clk))
> + return dev_err_probe(dev, PTR_ERR(gpriv->can_clk),
> + "cannot get canfd clock\n");
> +
> + fcan_freq = clk_get_rate(gpriv->can_clk);
> + }
>
> /* CANFD clock may be further divided within the IP */
> - fcan_freq = clk_get_rate(gpriv->can_clk) / info->postdiv;
> + fcan_freq /= info->postdiv;
> } else {
> fcan_freq = clk_get_rate(gpriv->can_clk);
> gpriv->extclk = gpriv->info->external_clk;
[Severity: High]
This is a pre-existing issue, but there is a use-after-free and double
free on the probe error path.
In rcar_canfd_channel_probe():
drivers/net/can/rcar/rcar_canfd.c:rcar_canfd_channel_probe() {
...
gpriv->ch[priv->channel] = priv;
err = register_candev(ndev);
if (err) {
dev_err(dev, "register_candev() failed: %pe\n", ERR_PTR(err));
goto fail_candev;
}
...
fail_candev:
netif_napi_del(&priv->napi);
fail:
free_candev(ndev);
return err;
}
If register_candev() fails, ndev (which contains priv) is freed via
free_candev(), but the global pointer gpriv->ch[priv->channel] is not
cleared.
Then in the parent rcar_canfd_probe(), the error handler cleans up:
drivers/net/can/rcar/rcar_canfd.c:rcar_canfd_probe() {
...
fail_channel:
for_each_set_bit(ch, &gpriv->channels_mask, info->max_channels)
rcar_canfd_channel_remove(gpriv, ch);
...
}
And rcar_canfd_channel_remove() bypasses the NULL check:
drivers/net/can/rcar/rcar_canfd.c:rcar_canfd_channel_remove() {
struct rcar_canfd_channel *priv = gpriv->ch[ch];
if (priv) {
unregister_candev(priv->ndev);
netif_napi_del(&priv->napi);
free_candev(priv->ndev);
}
}
Will this cause unregister_candev() to be called on an already freed device,
followed by a second free_candev()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709182332.876408-1-claudiu.beznea+renesas@tuxon.dev?part=4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 5/8] can: rcar_canfd: Do not set registers selecting the CAN mode
2026-07-09 18:23 [PATCH v2 0/8] can: rcar_canfd: Add support for Renesas RZ/G3S Claudiu Beznea
` (3 preceding siblings ...)
2026-07-09 18:23 ` [PATCH v2 4/8] can: rcar_canfd: Allow the CAN FD clock to be sourced from fck Claudiu Beznea
@ 2026-07-09 18:23 ` Claudiu Beznea
2026-07-09 18:23 ` [PATCH v2 6/8] can: rcar_canfd: Add support for Renesas RZ/G3S Claudiu Beznea
` (2 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Claudiu Beznea @ 2026-07-09 18:23 UTC (permalink / raw)
To: mkl, mailhol, robh, krzk+dt, conor+dt, geert+renesas, magnus.damm,
mturquette, sboyd, bmasney, biju.das.jz, claudiu.beznea.uj,
fabrizio.castro.jz
Cc: claudiu.beznea, linux-can, devicetree, linux-renesas-soc,
linux-clk
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
The bits 30 (classical CAN-only mode) and 28 (FD-only enable) of the
Channel n CAN-FD Configuration Register of the Renesas RZ/G3S SoC are not
available. The IP supports only CAN-FD mode. RZ/G3S HW manual (revision
1.30) specify the bits are read as zero and the write value should always
be zero.
Add the mode_select_na flag in struct rcar_canfd_hw_info to cover RZ/G3S
and avoid writing to unavailable bits.
The existing struct rcar_canfd_hw_info instances were updated to address
the request in the Link discussion.
Commit prepares for the addition of the Renesas RZ/G3S SoC.
Link: https://lore.kernel.org/all/1d9719e3-10ff-4cd8-b729-55fea93c37ce@wanadoo.fr
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v2:
- collected the tags
- updated patch description to reflect this is a preparatory commit
drivers/net/can/rcar/rcar_canfd.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index b66f72de46c9..112aa9024487 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -445,6 +445,7 @@ struct rcar_canfd_hw_info {
unsigned shared_can_regs:1; /* Has shared classical can registers */
unsigned external_clk:1; /* Has external clock */
unsigned fcan_pclk:1; /* Has fcan sourced from pclk. */
+ unsigned mode_select_na:1; /* Has no bits for selecting the mode. */
};
/* Channel priv data */
@@ -619,6 +620,7 @@ static const struct rcar_canfd_hw_info rcar_gen3_hw_info = {
.shared_can_regs = 0,
.external_clk = 1,
.fcan_pclk = 0,
+ .mode_select_na = 0,
};
static const struct rcar_canfd_hw_info rcar_gen4_hw_info = {
@@ -637,6 +639,7 @@ static const struct rcar_canfd_hw_info rcar_gen4_hw_info = {
.shared_can_regs = 1,
.external_clk = 1,
.fcan_pclk = 0,
+ .mode_select_na = 0,
};
static const struct rcar_canfd_hw_info rzg2l_hw_info = {
@@ -655,6 +658,7 @@ static const struct rcar_canfd_hw_info rzg2l_hw_info = {
.shared_can_regs = 0,
.external_clk = 1,
.fcan_pclk = 0,
+ .mode_select_na = 0,
};
static const struct rcar_canfd_hw_info r9a09g047_hw_info = {
@@ -673,6 +677,7 @@ static const struct rcar_canfd_hw_info r9a09g047_hw_info = {
.shared_can_regs = 1,
.external_clk = 0,
.fcan_pclk = 0,
+ .mode_select_na = 0,
};
static const struct rcar_canfd_hw_info r9a09g077_hw_info = {
@@ -691,6 +696,7 @@ static const struct rcar_canfd_hw_info r9a09g077_hw_info = {
.shared_can_regs = 1,
.external_clk = 1,
.fcan_pclk = 0,
+ .mode_select_na = 0,
};
/* Helper functions */
@@ -846,6 +852,9 @@ static int rcar_canfd_reset_controller(struct rcar_canfd_global *gpriv)
}
/* Set the controller into appropriate mode */
+ if (gpriv->info->mode_select_na)
+ continue;
+
if (gpriv->info->ch_interface_mode) {
/* Do not set CLOE and FDOE simultaneously */
if (!gpriv->fdmode) {
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v2 6/8] can: rcar_canfd: Add support for Renesas RZ/G3S
2026-07-09 18:23 [PATCH v2 0/8] can: rcar_canfd: Add support for Renesas RZ/G3S Claudiu Beznea
` (4 preceding siblings ...)
2026-07-09 18:23 ` [PATCH v2 5/8] can: rcar_canfd: Do not set registers selecting the CAN mode Claudiu Beznea
@ 2026-07-09 18:23 ` Claudiu Beznea
2026-07-09 18:39 ` sashiko-bot
2026-07-09 18:23 ` [PATCH v2 7/8] arm64: dts: renesas: r9a08g045: Add CAN-FD node Claudiu Beznea
2026-07-09 18:23 ` [PATCH v2 8/8] arm64: dts: renesas: rzg3s-smarc: Enable CAN-FD Claudiu Beznea
7 siblings, 1 reply; 14+ messages in thread
From: Claudiu Beznea @ 2026-07-09 18:23 UTC (permalink / raw)
To: mkl, mailhol, robh, krzk+dt, conor+dt, geert+renesas, magnus.damm,
mturquette, sboyd, bmasney, biju.das.jz, claudiu.beznea.uj,
fabrizio.castro.jz
Cc: claudiu.beznea, linux-can, devicetree, linux-renesas-soc,
linux-clk
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Add support for Renesas RZ/G3S
The Renesas RZ/G3S CAN-FD controller is largely compatible with the
variant found on the Renesas RZ/G3E. The main differences are:
- the RZ/G3S provides 128 acceptance filters
- the RZ/G3S supports only two channels
- the RZ/G3S supports only CAN-FD operation and does not implement the
bits used to select between classical CAN-only and CAN FD-only modes.
- the RZ/G3S includes an internal divider that allows the peripheral
clock to be used as the CAN FD clock source.
Add support for the Renesas RZ/G3S.
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v2:
- initialized shared_global_irqs = 0 for RZ/G3S, to follow the request
from https://lore.kernel.org/all/1d9719e3-10ff-4cd8-b729-55fea93c37ce@wanadoo.fr
- collected tags
drivers/net/can/rcar/rcar_canfd.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 112aa9024487..a3a1ac10fe7a 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -661,6 +661,26 @@ static const struct rcar_canfd_hw_info rzg2l_hw_info = {
.mode_select_na = 0,
};
+static const struct rcar_canfd_hw_info r9a08g045_hw_info = {
+ .nom_bittiming = &rcar_canfd_gen4_nom_bittiming_const,
+ .data_bittiming = &rcar_canfd_gen4_data_bittiming_const,
+ .tdc_const = &rcar_canfd_gen4_tdc_const,
+ .regs = &rcar_gen4_regs,
+ .sh = &rcar_gen4_shift_data,
+ .rnc_field_width = 16,
+ .max_aflpn = 127,
+ .max_cftml = 31,
+ .max_channels = 2,
+ .postdiv = 2,
+ .shared_global_irqs = 0,
+ .multi_channel_irqs = 1,
+ .ch_interface_mode = 1,
+ .shared_can_regs = 1,
+ .external_clk = 1,
+ .fcan_pclk = 1,
+ .mode_select_na = 1,
+};
+
static const struct rcar_canfd_hw_info r9a09g047_hw_info = {
.nom_bittiming = &rcar_canfd_gen4_nom_bittiming_const,
.data_bittiming = &rcar_canfd_gen4_data_bittiming_const,
@@ -2383,6 +2403,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(rcar_canfd_pm_ops, rcar_canfd_suspend,
static const __maybe_unused struct of_device_id rcar_canfd_of_table[] = {
{ .compatible = "renesas,r8a779a0-canfd", .data = &rcar_gen4_hw_info },
+ { .compatible = "renesas,r9a08g045-canfd", .data = &r9a08g045_hw_info },
{ .compatible = "renesas,r9a09g047-canfd", .data = &r9a09g047_hw_info },
{ .compatible = "renesas,r9a09g077-canfd", .data = &r9a09g077_hw_info },
{ .compatible = "renesas,rcar-gen3-canfd", .data = &rcar_gen3_hw_info },
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH v2 6/8] can: rcar_canfd: Add support for Renesas RZ/G3S
2026-07-09 18:23 ` [PATCH v2 6/8] can: rcar_canfd: Add support for Renesas RZ/G3S Claudiu Beznea
@ 2026-07-09 18:39 ` sashiko-bot
0 siblings, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-07-09 18:39 UTC (permalink / raw)
To: Claudiu Beznea
Cc: conor+dt, robh, Marc Kleine-Budde, devicetree, wsa+renesas,
Oleksij Rempel, Oliver Hartkopp, Vincent Mailhol, linux-can
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Low] The `max_aflpn` field is incorrectly configured to 127, modeling 2048 acceptance filter rules instead of the hardware's 128 rules.
Pre-existing issues:
- [High] Silent data truncation of received CAN FD frames when the interface is configured in Classical CAN mode.
--
--- Patch [6]: [PATCH v2 6/8] can: rcar_canfd: Add support for Renesas RZ/G3S ---
commit dd7ffbc8ce8271e811932ba34aecef0183db4270
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
can: rcar_canfd: Add support for Renesas RZ/G3S
The Renesas RZ/G3S CAN-FD controller is largely compatible with the
variant found on the Renesas RZ/G3E. The main differences are:
- the RZ/G3S provides 128 acceptance filters
- the RZ/G3S supports only two channels
- the RZ/G3S supports only CAN-FD operation and does not implement the
bits used to select between classical CAN-only and CAN FD-only modes.
- the RZ/G3S includes an internal divider that allows the peripheral
clock to be used as the CAN FD clock source.
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
> index 22f87491cd913..e74b72e60272e 100644
> --- a/drivers/net/can/rcar/rcar_canfd.c
> +++ b/drivers/net/can/rcar/rcar_canfd.c
> @@ -661,6 +661,26 @@ static const struct rcar_canfd_hw_info rzg2l_hw_info = {
> .mode_select_na = 0,
> };
>
> +static const struct rcar_canfd_hw_info r9a08g045_hw_info = {
> + .nom_bittiming = &rcar_canfd_gen4_nom_bittiming_const,
> + .data_bittiming = &rcar_canfd_gen4_data_bittiming_const,
> + .tdc_const = &rcar_canfd_gen4_tdc_const,
> + .regs = &rcar_gen4_regs,
> + .sh = &rcar_gen4_shift_data,
> + .rnc_field_width = 16,
> + .max_aflpn = 127,
[Severity: Low]
Is this max_aflpn value correct for the RZ/G3S hardware?
The commit message mentions the RZ/G3S provides 128 acceptance filters.
Setting max_aflpn to 127 configures a mask for up to 128 pages (2048 rules).
Should this mask be 7 (for 8 pages / 128 filters) to match the hardware
specification?
> + .max_cftml = 31,
> + .max_channels = 2,
> + .postdiv = 2,
> + .shared_global_irqs = 0,
> + .multi_channel_irqs = 1,
> + .ch_interface_mode = 1,
> + .shared_can_regs = 1,
> + .external_clk = 1,
> + .fcan_pclk = 1,
> + .mode_select_na = 1,
[Severity: High]
This is a pre-existing issue, but does adding a controller with
mode_select_na = 1 expose a silent data truncation issue?
If a user requests Classical CAN mode via the DT property renesas,no-can-fd,
the controller will still receive FD frames because mode_select_na prevents
hardware-level Classical CAN mode on this SoC.
When a CAN FD frame is received, rcar_canfd_rx_pkt() checks the ctrlmode:
drivers/net/can/rcar/rcar_canfd.c:rcar_canfd_rx_pkt() {
if ((priv->can.ctrlmode & CAN_CTRLMODE_FD) &&
sts & RCANFD_RFFDSTS_RFFDF)
skb = alloc_canfd_skb(ndev, &cf);
else
skb = alloc_can_skb(ndev, (struct can_frame **)&cf);
...
}
Since CAN_CTRLMODE_FD is disabled, it allocates a Classical CAN skb instead
of dropping the unsupported FD frame. It then truncates the DLC and copies
up to 8 bytes:
drivers/net/can/rcar/rcar_canfd.c:rcar_canfd_rx_pkt() {
...
} else {
cf->len = can_cc_dlc2len(RCANFD_RFPTR_RFDLC(dlc));
if (id & RCANFD_RFID_RFRTR)
cf->can_id |= CAN_RTR_FLAG;
else if (gpriv->info->shared_can_regs)
rcar_canfd_get_data(priv, cf, RCANFD_F_RFDF(gpriv, ridx, 0));
...
}
Can this cause an FD frame to be silently truncated and passed to userspace
as a valid Classical CAN frame?
> +};
> +
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709182332.876408-1-claudiu.beznea+renesas@tuxon.dev?part=6
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 7/8] arm64: dts: renesas: r9a08g045: Add CAN-FD node
2026-07-09 18:23 [PATCH v2 0/8] can: rcar_canfd: Add support for Renesas RZ/G3S Claudiu Beznea
` (5 preceding siblings ...)
2026-07-09 18:23 ` [PATCH v2 6/8] can: rcar_canfd: Add support for Renesas RZ/G3S Claudiu Beznea
@ 2026-07-09 18:23 ` Claudiu Beznea
2026-07-09 18:23 ` [PATCH v2 8/8] arm64: dts: renesas: rzg3s-smarc: Enable CAN-FD Claudiu Beznea
7 siblings, 0 replies; 14+ messages in thread
From: Claudiu Beznea @ 2026-07-09 18:23 UTC (permalink / raw)
To: mkl, mailhol, robh, krzk+dt, conor+dt, geert+renesas, magnus.damm,
mturquette, sboyd, bmasney, biju.das.jz, claudiu.beznea.uj,
fabrizio.castro.jz
Cc: claudiu.beznea, linux-can, devicetree, linux-renesas-soc,
linux-clk
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
The Renesas RZ/G3S SoC includes a CAN-FD controller with two channels.
Add the corresponding device tree node.
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v2:
- collected tags
arch/arm64/boot/dts/renesas/r9a08g045.dtsi | 39 ++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/r9a08g045.dtsi b/arch/arm64/boot/dts/renesas/r9a08g045.dtsi
index 3a69bb246bab..fe46f3d9c7cc 100644
--- a/arch/arm64/boot/dts/renesas/r9a08g045.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a08g045.dtsi
@@ -29,6 +29,13 @@ audio_clk2: audio2-clk {
clock-frequency = <0>;
};
+ can_clk: can-clk {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ /* This value must be overridden by boards that provide it. */
+ clock-frequency = <0>;
+ };
+
cluster0_opp: opp-table-0 {
compatible = "operating-points-v2";
opp-shared;
@@ -498,6 +505,38 @@ ssi3: ssi@100a8c00 {
status = "disabled";
};
+ canfd: can@100c0000 {
+ compatible = "renesas,r9a08g045-canfd";
+ reg = <0 0x100c0000 0 0x20000>;
+ interrupts = <GIC_SPI 373 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 374 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 377 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 375 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 379 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 378 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 376 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 380 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "g_err", "g_recc",
+ "ch0_err", "ch0_rec", "ch0_trx",
+ "ch1_err", "ch1_rec", "ch1_trx";
+ clocks = <&cpg CPG_MOD R9A08G045_CANFD_PCLK>,
+ <&cpg CPG_MOD R9A08G045_CANFD_CLK_RAM>,
+ <&can_clk>;
+ clock-names = "fck", "ram_clk", "can_clk";
+ resets = <&cpg R9A08G045_CANFD_RSTP_N>,
+ <&cpg R9A08G045_CANFD_RSTC_N>;
+ reset-names = "rstp_n", "rstc_n";
+ power-domains = <&cpg>;
+ status = "disabled";
+
+ channel0 {
+ status = "disabled";
+ };
+ channel1 {
+ status = "disabled";
+ };
+ };
+
cpg: clock-controller@11010000 {
compatible = "renesas,r9a08g045-cpg";
reg = <0 0x11010000 0 0x10000>;
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v2 8/8] arm64: dts: renesas: rzg3s-smarc: Enable CAN-FD
2026-07-09 18:23 [PATCH v2 0/8] can: rcar_canfd: Add support for Renesas RZ/G3S Claudiu Beznea
` (6 preceding siblings ...)
2026-07-09 18:23 ` [PATCH v2 7/8] arm64: dts: renesas: r9a08g045: Add CAN-FD node Claudiu Beznea
@ 2026-07-09 18:23 ` Claudiu Beznea
2026-07-09 18:40 ` sashiko-bot
7 siblings, 1 reply; 14+ messages in thread
From: Claudiu Beznea @ 2026-07-09 18:23 UTC (permalink / raw)
To: mkl, mailhol, robh, krzk+dt, conor+dt, geert+renesas, magnus.damm,
mturquette, sboyd, bmasney, biju.das.jz, claudiu.beznea.uj,
fabrizio.castro.jz
Cc: claudiu.beznea, linux-can, devicetree, linux-renesas-soc,
linux-clk
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
The two CAN FD channels available on the Renesas RZ/G3S SoC are routed
through the Renesas SMARC Carrier II board when used with the Renesas
RZ/G3S SMARC Module.
The CAN transceiver on the Carrier II board has its standby pins connected
to GPIOs that are selected through the SW_GPIO_CAN_PMOD switches. By
default, these switches route the GPIOs to the PMOD interfaces.
Enable the CAN FD controller and its two available channels.
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v2:
- collected tags
.../boot/dts/renesas/rzg3s-smarc-switches.h | 12 +++++
arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi | 46 +++++++++++++++++++
2 files changed, 58 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/rzg3s-smarc-switches.h b/arch/arm64/boot/dts/renesas/rzg3s-smarc-switches.h
index bbf908a5322c..198874ad9a65 100644
--- a/arch/arm64/boot/dts/renesas/rzg3s-smarc-switches.h
+++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc-switches.h
@@ -37,4 +37,16 @@
*/
#define SW_OPT_MUX4 SW_ON
+/*
+ * SW_GPIO_CAN_PMOD[x] switches' states:
+ * @SW_GPIO_CAN_PMOD1:
+ * SW_OFF - GPIO8 connected to CAN0_STB (position 1-2)
+ * SW_ON - GPIO8 connected to PMOD1 (position 2-3)
+ * @SW_GPIO_CAN_PMOD2:
+ * SW_OFF - GPIO9 connected to CAN1_STB (position 4-5)
+ * SW_ON - GPIO9 connected to PMOD1 (position 5-6)
+ */
+#define SW_GPIO_CAN_PMOD1 SW_ON
+#define SW_GPIO_CAN_PMOD2 SW_ON
+
#endif /* __RZG3S_SMARC_SWITCHES_H__ */
diff --git a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi b/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
index 70af605168b0..2be684f55914 100644
--- a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
@@ -68,6 +68,24 @@ codec_dai: simple-audio-card,codec {
};
};
+ can_transceiver0: can-phy0 {
+ compatible = "ti,tcan1042";
+ #phy-cells = <0>;
+ max-bitrate = <8000000>;
+#if SW_GPIO_CAN_PMOD1 == SW_OFF
+ standby-gpios = <&pinctrl RZG2L_GPIO(13, 0) GPIO_ACTIVE_HIGH>;
+#endif
+ };
+
+ can_transceiver1: can-phy1 {
+ compatible = "ti,tcan1042";
+ #phy-cells = <0>;
+ max-bitrate = <8000000>;
+#if SW_GPIO_CAN_PMOD2 == SW_OFF
+ standby-gpios = <&pinctrl RZG2L_GPIO(13, 1) GPIO_ACTIVE_HIGH>;
+#endif
+ };
+
vcc_sdhi1: regulator-vcc-sdhi1 {
compatible = "regulator-fixed";
regulator-name = "SDHI1 Vcc";
@@ -92,6 +110,22 @@ &audio_clk2 {
clock-frequency = <12288000>;
};
+&canfd {
+ pinctrl-0 = <&canfd_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+
+ channel0 {
+ phys = <&can_transceiver0>;
+ status = "okay";
+ };
+
+ channel1 {
+ phys = <&can_transceiver1>;
+ status = "okay";
+ };
+};
+
&ehci0 {
dr_mode = "otg";
status = "okay";
@@ -171,6 +205,18 @@ audio_clock_pins: audio-clock {
input-enable;
};
+ canfd_pins: canfd {
+ can0_pins: can0 {
+ pinmux = <RZG2L_PORT_PINMUX(6, 1, 3)>, /* CAN0_TX */
+ <RZG2L_PORT_PINMUX(6, 2, 3)>; /* CAN0_RX */
+ };
+
+ can1_pins: can1 {
+ pinmux = <RZG2L_PORT_PINMUX(17, 0, 3)>, /* CAN1_TX */
+ <RZG2L_PORT_PINMUX(17, 1, 3)>; /* CAN1_RX */
+ };
+ };
+
key-1-gpio-hog {
gpio-hog;
gpios = <RZG2L_GPIO(18, 0) GPIO_ACTIVE_LOW>;
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH v2 8/8] arm64: dts: renesas: rzg3s-smarc: Enable CAN-FD
2026-07-09 18:23 ` [PATCH v2 8/8] arm64: dts: renesas: rzg3s-smarc: Enable CAN-FD Claudiu Beznea
@ 2026-07-09 18:40 ` sashiko-bot
0 siblings, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-07-09 18:40 UTC (permalink / raw)
To: Claudiu Beznea
Cc: wsa+renesas, devicetree, Oleksij Rempel, robh, Oliver Hartkopp,
conor+dt, Vincent Mailhol, Marc Kleine-Budde, linux-can
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] CAN channels are enabled unconditionally even when their transceiver standby pins are disconnected by hardware switches, rendering the CAN bus physically inoperable.
--
--- Patch [8]: [PATCH v2 8/8] arm64: dts: renesas: rzg3s-smarc: Enable CAN-FD ---
commit f8b012ec526a1699faa0dea73b3d5f10dc6c3d9d
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
arm64: dts: renesas: rzg3s-smarc: Enable CAN-FD
This commit enables the CAN FD controller and its two channels on the
Renesas RZ/G3S SMARC Module. It conditionally sets up the standby GPIOs
for the CAN transceivers based on the states of the SW_GPIO_CAN_PMOD
switches.
> diff --git a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi b/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
> index 70af605168b07..2be684f559144 100644
> --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
> +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
[ ... ]
> @@ -92,6 +110,22 @@ &audio_clk2 {
> clock-frequency = <12288000>;
> };
>
> +&canfd {
> + pinctrl-0 = <&canfd_pins>;
> + pinctrl-names = "default";
> + status = "okay";
> +
> + channel0 {
> + phys = <&can_transceiver0>;
> + status = "okay";
> + };
> +
> + channel1 {
> + phys = <&can_transceiver1>;
> + status = "okay";
> + };
> +};
[Severity: Medium]
Since SW_GPIO_CAN_PMOD1 and SW_GPIO_CAN_PMOD2 are SW_ON by default, the
transceiver standby pins are disconnected from the SoC GPIOs. Because the
TCAN1042 PHY has an internal pull-up on the STB pin, leaving it floating
forces the transceiver into standby mode.
Does setting status = "okay" here unconditionally expose inoperable CAN bus
interfaces to userspace? Should the channel status be guarded by the same
switch macros used for the standby-gpios properties?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709182332.876408-1-claudiu.beznea+renesas@tuxon.dev?part=8
^ permalink raw reply [flat|nested] 14+ messages in thread