Skip to contentSkip to conversation

arm64: renesas: r8a78000: Add PWM support

PATCH In review Geert Uytterhoeven 4 participants 17 messages Oct 29 – Nov 6

Subsystems (6)
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

cover arm64: renesas: r8a78000: Add PWM support

Hi all,

This patch series adds CAN-FD support for the Renesas R-Car X5H SoC, as found on the Renesas Ironhide development board. On this board, clocks, power-domains, and resets must be accessed only through SCMI firmware.

Just like its GPIO[1] and PWM[2] counterparts, this series is a bit special, in that several patches are not meant to be applied upstream yet:
1. The first RFC patch documents support for CAN-FD on R-Car X5H,
2. Patches 2-4, targeting the can tree, add driver support for CAN-FD on R-Car X5H,
3. Patch 5, targeting a shared DT bindings branch, adds a CAN-FD clock definition,
4. RFC patch 6 adds CAN-FD device nodes to the R-Car X5H .dtsi file,
5. The remaining patches are marked DNI, and depend on code or DTS that is not yet upstream. More detail can be found in the individual patches.

CAN-FD channels 1 to 6 and 12 to 15 have been tested on Ironhide using canfdtest and an oscilloscope.

Thanks for your comments!

[1] "[PATCH 0/7] arm64: renesas: r8a78000: Enable GPIO support"

    https://lore.kernel.org/[email protected]
[2] "[PATCH 00/11] arm64: renesas: r8a78000: Add PWM support"
    https://lore.kernel.org/[email protected]

Geert Uytterhoeven (9):
[RFC] dt-bindings: can: renesas,rcar-canfd: Document R-Car X5H support
can: rcar_canfd: Add Runtime PM support
can: rcar_canfd: Make clkp local
can: rcar_canfd: Add support for R-Car Gen5
dt-bindings: clock: renesas,r8a78000-cpg: Add CAN-FD clock [RFC] arm64: dts: renesas: r8a78000: Add CAN-FD nodes [DNI] clk: renesas: r8a78000: Add CAN-FD clocks
[DNI] pmdomain: renesas: r8a78000: Add CAN-FD support [DNI] arm64: dts: renesas: ironhide: Enable CAN-FD

 .../bindings/net/can/renesas,rcar-canfd.yaml  |  84 +++++++
 .../boot/dts/renesas/r8a78000-ironhide.dts    | 117 ++++++++-
 arch/arm64/boot/dts/renesas/r8a78000.dtsi     | 235 ++++++++++++++++++
 drivers/clk/renesas/r8a78000-cpg.c            |   5 +
 drivers/net/can/rcar/rcar_canfd.c             |  43 +++-
 drivers/pmdomain/renesas/r8a78000-mdlc.c      |   2 +
 .../dt-bindings/clock/renesas,r8a78000-cpg.h  |   1 +
 7 files changed, 476 insertions(+), 11 deletions(-)
Signature · 12 lines
2.43.0

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
author maintainer
#1 lore raw

PATCH 1/9 dt-bindings: can: renesas,rcar-canfd: Document R-Car X5H support

Document support for the Controller Area Network Flexible Data Rate (CAN-FD) modules as found on R-Car X5H, which is the first member of the R-Car Gen5 family. It is a further evolution of the CAN-FD block found on R-Car Gen4 SoCs, adding Freedom From Interference and Virtual Machine support.

Binding-wise, the major difference is the split of global and per-channel interrupts (like on RZ/G2L), and the addition of Virtual Machine interrupts.

---
Do we need the VM interrupts, or are they meant for the hypervisor? If yes, should we add a third option for interrupts and interrupt-names:
- 2 global interrupts,
- 8 VM interrupts,
- 8 (= number of channels) x 3 channel interrupts,
so we can easily restrict the number of interrupts when a variant with less than 8 channels appears?

---
 .../bindings/net/can/renesas,rcar-canfd.yaml  | 84 +++++++++++++++++++
 1 file changed, 84 insertions(+)
Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml +84 -0
index 470d178e5faccf6a..2d36d63b281e30b2 100644
@@ -40,6 +40,11 @@ properties:
               - renesas,r8a779h0-canfd     # R-Car V4M
           - const: renesas,rcar-gen4-canfd # R-Car Gen4
 
+      - items:
+          - enum:
+              - renesas,r8a78000-canfd     # R-Car X5H
+          - const: renesas,rcar-gen5-canfd # R-Car Gen5
+
       - items:
           - enum:
               - renesas,r9a07g043-canfd    # RZ/G2UL and RZ/Five
@@ -86,6 +91,36 @@ properties:
           - description: CAN5 error interrupt
           - description: CAN5 transmit interrupt
           - description: CAN5 transmit/receive FIFO receive completion interrupt
+          - description: CAN6 error interrupt
+          - description: CAN6 transmit interrupt
+          - description: CAN6 transmit/receive FIFO receive completion interrupt
+          - description: CAN7 error interrupt
+          - description: CAN7 transmit interrupt
+          - description: CAN7 transmit/receive FIFO receive completion interrupt
+          - description: Virtual Machine 0 transmit interrupt
+          - description: Virtual Machine 0 receive interrupt
+          - description: Virtual Machine 0 error interrupt
+          - description: Virtual Machine 1 transmit interrupt
+          - description: Virtual Machine 1 receive interrupt
+          - description: Virtual Machine 1 error interrupt
+          - description: Virtual Machine 2 transmit interrupt
+          - description: Virtual Machine 2 receive interrupt
+          - description: Virtual Machine 2 error interrupt
+          - description: Virtual Machine 3 transmit interrupt
+          - description: Virtual Machine 3 receive interrupt
+          - description: Virtual Machine 3 error interrupt
+          - description: Virtual Machine 4 transmit interrupt
+          - description: Virtual Machine 4 receive interrupt
+          - description: Virtual Machine 4 error interrupt
+          - description: Virtual Machine 5 transmit interrupt
+          - description: Virtual Machine 5 receive interrupt
+          - description: Virtual Machine 5 error interrupt
+          - description: Virtual Machine 6 transmit interrupt
+          - description: Virtual Machine 6 receive interrupt
+          - description: Virtual Machine 6 error interrupt
+          - description: Virtual Machine 7 transmit interrupt
+          - description: Virtual Machine 7 receive interrupt
+          - description: Virtual Machine 7 error interrupt
         minItems: 8
 
   interrupt-names:
@@ -114,6 +149,36 @@ properties:
           - const: ch5_err
           - const: ch5_rec
           - const: ch5_trx
+          - const: ch6_err
+          - const: ch6_rec
+          - const: ch6_trx
+          - const: ch7_err
+          - const: ch7_rec
+          - const: ch7_trx
+          - const: vm0_tx
+          - const: vm0_rx
+          - const: vm0_err
+          - const: vm1_tx
+          - const: vm1_rx
+          - const: vm1_err
+          - const: vm2_tx
+          - const: vm2_rx
+          - const: vm2_err
+          - const: vm3_tx
+          - const: vm3_rx
+          - const: vm3_err
+          - const: vm4_tx
+          - const: vm4_rx
+          - const: vm4_err
+          - const: vm5_tx
+          - const: vm5_rx
+          - const: vm5_err
+          - const: vm6_tx
+          - const: vm6_rx
+          - const: vm6_err
+          - const: vm7_tx
+          - const: vm7_rx
+          - const: vm7_err
         minItems: 8
 
   clocks:
@@ -232,6 +297,22 @@ allOf:
         resets:
           maxItems: 1
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: renesas,rcar-gen5-canfd
+    then:
+      properties:
+        interrupts:
+          minItems: 50
+
+        interrupt-names:
+          minItems: 50
+
+        resets:
+          maxItems: 1
+
   - if:
       properties:
         compatible:
@@ -241,9 +322,11 @@ allOf:
       properties:
         interrupts:
           minItems: 20
+          maxItems: 20
 
         interrupt-names:
           minItems: 20
+          maxItems: 20
 
         resets:
           minItems: 2
@@ -354,6 +437,7 @@ allOf:
             enum:
               - renesas,rcar-gen3-canfd
               - renesas,rcar-gen4-canfd
+              - renesas,rcar-gen5-canfd
     then:
       required:
         - resets
Signature · 1 line
2.43.0
author maintainer
#2 lore raw

PATCH 2/9 can: rcar_canfd: Add Runtime PM support

In reply to Geert Uytterhoeven

On R-Car X5H, the CAN-FD module is part of a power domain. This means Runtime PM must be used to make sure the domain is powered when needed. The CAN-FD module is part of a Clock Domain on all supported SoCs. Hence remove explicit management of the functional clock, as this is handled automatically by Runtime PM.

---
 drivers/net/can/rcar/rcar_canfd.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/can/rcar/rcar_canfd.c +11 -6
index 4d805df5ff9e8933..74d9ffd2790587b9 100644
@@ -37,6 +37,7 @@
 #include <linux/of.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/types.h>
 
@@ -2004,9 +2005,9 @@ static int rcar_canfd_global_init(struct rcar_canfd_global *gpriv)
 	int err;
 
 	/* Enable peripheral clock for register access */
-	err = clk_prepare_enable(gpriv->clkp);
+	err = pm_runtime_resume_and_get(dev);
 	if (err) {
-		dev_err(dev, "failed to enable peripheral clock: %pe\n",
+		dev_err(dev, "pm_runtime_resume_and_get() failed: %pe\n",
 			ERR_PTR(err));
 		return err;
 	}
@@ -2016,7 +2017,7 @@ static int rcar_canfd_global_init(struct rcar_canfd_global *gpriv)
 	if (err) {
 		dev_err(dev,
 			"failed to enable RAM clock, error %d\n", err);
-		goto fail_clk;
+		goto fail_rpm;
 	}
 
 	err = reset_control_reset(gpriv->rstc1);
@@ -2074,8 +2075,8 @@ static int rcar_canfd_global_init(struct rcar_canfd_global *gpriv)
 	reset_control_assert(gpriv->rstc1);
 fail_ram_clk:
 	clk_disable_unprepare(gpriv->clk_ram);
-fail_clk:
-	clk_disable_unprepare(gpriv->clkp);
+fail_rpm:
+	pm_runtime_put(dev);
 	return err;
 }
 
@@ -2093,7 +2094,7 @@ static void rcar_canfd_global_deinit(struct rcar_canfd_global *gpriv, bool full)
 	reset_control_assert(gpriv->rstc2);
 	reset_control_assert(gpriv->rstc1);
 	clk_disable_unprepare(gpriv->clk_ram);
-	clk_disable_unprepare(gpriv->clkp);
+	pm_runtime_put(&gpriv->pdev->dev);
 }
 
 static int rcar_canfd_probe(struct platform_device *pdev)
@@ -2254,6 +2255,10 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 		}
 	}
 
+	err = devm_pm_runtime_enable(dev);
+	if (err)
+		goto fail_dev;
+
 	err = rcar_canfd_global_init(gpriv);
 	if (err)
 		goto fail_mode;
Signature · 1 line
2.43.0
Reviewed-by on v1 2/9
#3 lore raw

RE: [PATCH 2/9] can: rcar_canfd: Add Runtime PM support

Hi Geert,

Quoted 5 lines

-----Original Message-----
From: linux-arm-kernel <[email protected]> On Behalf Of Geert Uytterhoeven
Sent: 29 October 2026 13:11
Subject: [PATCH 2/9] can: rcar_canfd: Add Runtime PM support

Quoted 7 lines

On R-Car X5H, the CAN-FD module is part of a power domain. This means Runtime PM must be used to make sure the domain is powered when needed.
The CAN-FD module is part of a Clock Domain on all supported SoCs.
Hence remove explicit management of the functional clock, as this is handled automatically by Runtime PM.

Cheers,
Biju

Quoted 71 lines
---
 drivers/net/can/rcar/rcar_canfd.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/can/rcar/rcar_canfd.c +7 -6
index 4d805df5ff9e8933..74d9ffd2790587b9 100644
@@ -37,6 +37,7 @@
 #include <linux/of.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/types.h>
 
@@ -2004,9 +2005,9 @@ static int rcar_canfd_global_init(struct rcar_canfd_global *gpriv)
 	int err;
 
 	/* Enable peripheral clock for register access */
-	err = clk_prepare_enable(gpriv->clkp);
+	err = pm_runtime_resume_and_get(dev);
 	if (err) {
-		dev_err(dev, "failed to enable peripheral clock: %pe\n",
+		dev_err(dev, "pm_runtime_resume_and_get() failed: %pe\n",
 			ERR_PTR(err));
 		return err;
 	}
@@ -2016,7 +2017,7 @@ static int rcar_canfd_global_init(struct rcar_canfd_global *gpriv)
 	if (err) {
 		dev_err(dev,
 			"failed to enable RAM clock, error %d\n", err);
-		goto fail_clk;
+		goto fail_rpm;
 	}
 
 	err = reset_control_reset(gpriv->rstc1);
@@ -2074,8 +2075,8 @@ static int rcar_canfd_global_init(struct rcar_canfd_global *gpriv)
 	reset_control_assert(gpriv->rstc1);
 fail_ram_clk:
 	clk_disable_unprepare(gpriv->clk_ram);
-fail_clk:
-	clk_disable_unprepare(gpriv->clkp);
+fail_rpm:
+	pm_runtime_put(dev);
 	return err;
 }
 
@@ -2093,7 +2094,7 @@ static void rcar_canfd_global_deinit(struct rcar_canfd_global *gpriv, bool full)
 	reset_control_assert(gpriv->rstc2);
 	reset_control_assert(gpriv->rstc1);
 	clk_disable_unprepare(gpriv->clk_ram);
-	clk_disable_unprepare(gpriv->clkp);
+	pm_runtime_put(&gpriv->pdev->dev);
 }
 
 static int rcar_canfd_probe(struct platform_device *pdev) @@ -2254,6 +2255,10 @@ static int

rcar_canfd_probe(struct platform_device *pdev)

drivers/net/can/rcar/rcar_canfd.c +4 -1
 		}
 	}
 
+	err = devm_pm_runtime_enable(dev);
+	if (err)
+		goto fail_dev;
+
 	err = rcar_canfd_global_init(gpriv);
 	if (err)
 		goto fail_mode;
--

2.43.0

author maintainer
#4 lore raw

PATCH 3/9 can: rcar_canfd: Make clkp local

In reply to Geert Uytterhoeven

The peripheral clock is only used in rcar_canfd_probe(), so convert clkp to a local variable.

---
 drivers/net/can/rcar/rcar_canfd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/can/rcar/rcar_canfd.c +4 -4
index 74d9ffd2790587b9..9dbe44710dcced80 100644
@@ -467,7 +467,6 @@ struct rcar_canfd_global {
 	void __iomem *base;		/* Register base address */
 	struct rcar_canfd_f_c __iomem *fcbase;
 	struct platform_device *pdev;	/* Respective platform device */
-	struct clk *clkp;		/* Peripheral clock */
 	struct clk *can_clk;		/* fCAN clock */
 	struct clk *clk_ram;		/* Clock RAM */
 	unsigned long channels_mask;	/* Enabled channels mask */
@@ -2111,6 +2110,7 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 	bool fdmode = true;			/* CAN FD only mode - default */
 	char name[9] = "channelX";
 	u32 ch, fcan_freq;
+	struct clk *clkp;
 	int i;
 
 	info = of_device_get_match_data(dev);
@@ -2181,9 +2181,9 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 				     "failed to get rstc_n\n");
 
 	/* Peripheral clock */
-	gpriv->clkp = devm_clk_get(dev, "fck");
-	if (IS_ERR(gpriv->clkp))
-		return dev_err_probe(dev, PTR_ERR(gpriv->clkp),
+	clkp = devm_clk_get(dev, "fck");
+	if (IS_ERR(clkp))
+		return dev_err_probe(dev, PTR_ERR(clkp),
 				     "cannot get peripheral clock\n");
 
 	/* fCAN clock: Pick External clock. If not available fallback to
Signature · 1 line
2.43.0
#5 lore raw

RE: [PATCH 3/9] can: rcar_canfd: Make clkp local

Hi Geert,

Thanks for the patch.

Quoted 17 lines

-----Original Message-----
From: Geert Uytterhoeven <[email protected]>
Sent: 29 October 2026 13:11
Subject: [PATCH 3/9] can: rcar_canfd: Make clkp local

The peripheral clock is only used in rcar_canfd_probe(), so convert clkp to a local variable.

---
 drivers/net/can/rcar/rcar_canfd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/can/rcar/rcar_canfd.c +0 -0
index 74d9ffd2790587b9..9dbe44710dcced80 100644

drivers/net/can/rcar/rcar_canfd.c struct rcar_canfd_global { · line 470

Quoted 4 lines
drivers/net/can/rcar/rcar_canfd.c +0 -1
@@ -467,7 +467,6 @@ struct rcar_canfd_global {
 	void __iomem *base;		/* Register base address */
 	struct rcar_canfd_f_c __iomem *fcbase;
 	struct platform_device *pdev;	/* Respective platform device */
-	struct clk *clkp;		/* Peripheral clock */

Unless I am missing something, I get build error

drivers/net/can/rcar/rcar_canfd.c: In function 'rcar_canfd_probe':
drivers/net/can/rcar/rcar_canfd.c:2250:55: error: 'struct rcar_canfd_global' has no member named 'clkp'
2250 | fcan_freq = clk_get_rate(gpriv->clkp);

Cheers,
Biju

#6 lore raw

Re: [PATCH 3/9] can: rcar_canfd: Make clkp local

Hi Biju,

Quoted 18 lines · Biju Das
Quoted 11 lines

From: Geert Uytterhoeven <[email protected]>
Sent: 29 October 2026 13:11
Subject: [PATCH 3/9] can: rcar_canfd: Make clkp local

The peripheral clock is only used in rcar_canfd_probe(), so convert clkp to a local variable.

drivers/net/can/rcar/rcar_canfd.c struct rcar_canfd_global { · line 470

Quoted 4 lines
drivers/net/can/rcar/rcar_canfd.c +0 -1
@@ -467,7 +467,6 @@ struct rcar_canfd_global {
      void __iomem *base;             /* Register base address */
      struct rcar_canfd_f_c __iomem *fcbase;
      struct platform_device *pdev;   /* Respective platform device */
-     struct clk *clkp;               /* Peripheral clock */

Unless I am missing something, I get build error

Quoted 3 lines

drivers/net/can/rcar/rcar_canfd.c: In function 'rcar_canfd_probe':
drivers/net/can/rcar/rcar_canfd.c:2250:55: error: 'struct rcar_canfd_global' has no member named 'clkp'
2250 | fcan_freq = clk_get_rate(gpriv->clkp);

If your tree has Claudiu's "[PATCH v4 3/7] can: rcar_canfd: Allow the CAN FD clock to be sourced from fck", you have to update the new user of gpriv->clkp.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
#7 lore raw

RE: [PATCH 3/9] can: rcar_canfd: Make clkp local

Hi Geert,

Quoted 26 lines

-----Original Message-----
From: Geert Uytterhoeven <[email protected]>
Sent: 06 November 2026 08:21
Subject: Re: [PATCH 3/9] can: rcar_canfd: Make clkp local

Hi Biju,

Quoted 18 lines · Biju Das
Quoted 11 lines

From: Geert Uytterhoeven <[email protected]>
Sent: 29 October 2026 13:11
Subject: [PATCH 3/9] can: rcar_canfd: Make clkp local

The peripheral clock is only used in rcar_canfd_probe(), so convert clkp to a local variable.

drivers/net/can/rcar/rcar_canfd.c struct rcar_canfd_global { · line 470

Quoted 4 lines
drivers/net/can/rcar/rcar_canfd.c +0 -1
@@ -467,7 +467,6 @@ struct rcar_canfd_global {
      void __iomem *base;             /* Register base address */
      struct rcar_canfd_f_c __iomem *fcbase;
      struct platform_device *pdev;   /* Respective platform device */
-     struct clk *clkp;               /* Peripheral clock */

Unless I am missing something, I get build error

Quoted 7 lines
Quoted 2 lines

drivers/net/can/rcar/rcar_canfd.c: In function 'rcar_canfd_probe':
drivers/net/can/rcar/rcar_canfd.c:2250:55: error: 'struct rcar_canfd_global' has no member named

'clkp'

Quoted 1 line

2250 | fcan_freq = clk_get_rate(gpriv->clkp);

If your tree has Claudiu's "[PATCH v4 3/7] can: rcar_canfd: Allow the CAN FD clock to be sourced from fck", you have to update the new user of gpriv->clkp.

That explains it.

Claudiu's patch added that change and it is not present in
https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git/log/

Cheers,
Biju

Reviewed-by on v1 3/9
#8 lore raw

RE: [PATCH 3/9] can: rcar_canfd: Make clkp local

In reply to Geert Uytterhoeven

Hi Geert,

Quoted 8 lines

-----Original Message-----
From: Geert Uytterhoeven <[email protected]>
Sent: 29 October 2026 13:11
Subject: [PATCH 3/9] can: rcar_canfd: Make clkp local

The peripheral clock is only used in rcar_canfd_probe(), so convert clkp to a local variable.

Cheers,
Biju

Quoted 40 lines
---
 drivers/net/can/rcar/rcar_canfd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/can/rcar/rcar_canfd.c +4 -5
index 74d9ffd2790587b9..9dbe44710dcced80 100644
@@ -467,7 +467,6 @@ struct rcar_canfd_global {
 	void __iomem *base;		/* Register base address */
 	struct rcar_canfd_f_c __iomem *fcbase;
 	struct platform_device *pdev;	/* Respective platform device */
-	struct clk *clkp;		/* Peripheral clock */
 	struct clk *can_clk;		/* fCAN clock */
 	struct clk *clk_ram;		/* Clock RAM */
 	unsigned long channels_mask;	/* Enabled channels mask */
@@ -2111,6 +2110,7 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 	bool fdmode = true;			/* CAN FD only mode - default */
 	char name[9] = "channelX";
 	u32 ch, fcan_freq;
+	struct clk *clkp;
 	int i;
 
 	info = of_device_get_match_data(dev);
@@ -2181,9 +2181,9 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 				     "failed to get rstc_n\n");
 
 	/* Peripheral clock */
-	gpriv->clkp = devm_clk_get(dev, "fck");
-	if (IS_ERR(gpriv->clkp))
-		return dev_err_probe(dev, PTR_ERR(gpriv->clkp),
+	clkp = devm_clk_get(dev, "fck");
+	if (IS_ERR(clkp))
+		return dev_err_probe(dev, PTR_ERR(clkp),
 				     "cannot get peripheral clock\n");
 
 	/* fCAN clock: Pick External clock. If not available fallback to
--

2.43.0

author maintainer
#9 lore raw

PATCH 4/9 can: rcar_canfd: Add support for R-Car Gen5

In reply to Geert Uytterhoeven

The CAN-FD block on R-Car Gen5 is similar to the variant on R-Car Gen4, but uses split global and per-channel interrupts, like on RZ/G2L.

---
 drivers/net/can/rcar/rcar_canfd.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/net/can/rcar/rcar_canfd.c +18 -0
index 9dbe44710dcced80..702a3aa1949ab9da 100644
@@ -636,6 +636,23 @@ static const struct rcar_canfd_hw_info rcar_gen4_hw_info = {
 	.external_clk = 1,
 };
 
+static const struct rcar_canfd_hw_info rcar_gen5_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 = 8,
+	.postdiv = 2,
+	.multi_channel_irqs = 1,
+	.ch_interface_mode = 1,
+	.shared_can_regs = 1,
+	.external_clk = 1,
+};
+
 static const struct rcar_canfd_hw_info rzg2l_hw_info = {
 	.nom_bittiming = &rcar_canfd_gen3_nom_bittiming_const,
 	.data_bittiming = &rcar_canfd_gen3_data_bittiming_const,
@@ -2370,6 +2387,7 @@ static const __maybe_unused struct of_device_id rcar_canfd_of_table[] = {
 	{ .compatible = "renesas,r9a09g077-canfd", .data = &r9a09g077_hw_info },
 	{ .compatible = "renesas,rcar-gen3-canfd", .data = &rcar_gen3_hw_info },
 	{ .compatible = "renesas,rcar-gen4-canfd", .data = &rcar_gen4_hw_info },
+	{ .compatible = "renesas,rcar-gen5-canfd", .data = &rcar_gen5_hw_info },
 	{ .compatible = "renesas,rzg2l-canfd", .data = &rzg2l_hw_info },
 	{ }
 };
Signature · 1 line
2.43.0
#10 lore raw

Re: [PATCH 4/9] can: rcar_canfd: Add support for R-Car Gen5

Quoted 12 lines · Geert Uytterhoeven

The CAN-FD block on R-Car Gen5 is similar to the variant on R-Car Gen4, but uses split global and per-channel interrupts, like on RZ/G2L.

drivers/net/can/rcar/rcar_canfd.c +1 -0
@@ -636,6 +636,23 @@ static const struct rcar_canfd_hw_info rcar_gen4_hw_info = {
        .external_clk = 1,
 };
 
+static const struct rcar_canfd_hw_info rcar_gen5_hw_info = {

drivers/net/can/rcar/rcar_canfd.c static const struct rcar_canfd_hw_info rcar_gen4_hw_info = { · line 649

Quoted 10 lines
drivers/net/can/rcar/rcar_canfd.c +10 -0
+       .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 = 8,
+       .postdiv = 2,

R-Car X5H does not have the /2 postdivider, so this should be one. Else the bitrate is twice as fast as intended when the external can_clk is not available.

drivers/net/can/rcar/rcar_canfd.c static const struct rcar_canfd_hw_info rcar_gen4_hw_info = { · line 658

Quoted 9 lines
drivers/net/can/rcar/rcar_canfd.c +6 -0
+       .multi_channel_irqs = 1,
+       .ch_interface_mode = 1,
+       .shared_can_regs = 1,
+       .external_clk = 1,
+};
+
 static const struct rcar_canfd_hw_info rzg2l_hw_info = {
        .nom_bittiming = &rcar_canfd_gen3_nom_bittiming_const,
        .data_bittiming = &rcar_canfd_gen3_data_bittiming_const,

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
author maintainer
#11 lore raw

PATCH 5/9 dt-bindings: clock: renesas,r8a78000-cpg: Add CAN-FD clock

In reply to Geert Uytterhoeven

Add a definition for the CANFD_SCP_MAIN clock, as used by the Controller Area Network Flexible Data Rate (CAN-FD) modules on R-Car X5H.

---
This depends on "[PATCH 07/11] dt-bindings: clock: renesas,r8a78000-cpg:
Add PWM clocks"
https://lore.kernel.org/e723696e02cfb34fb808e2ae3ccb6faf68528c00.1793026273.git.geert+renesas@glider.be

---
 include/dt-bindings/clock/renesas,r8a78000-cpg.h | 1 +
 1 file changed, 1 insertion(+)
include/dt-bindings/clock/renesas,r8a78000-cpg.h +1 -0
index 8c30476d41448cf5..9d7f3afcb2c52ec4 100644
@@ -31,5 +31,6 @@
 #define R8A78000_CPG_SGASYNCD8_PERW_MAIN	21
 #define R8A78000_CPG_SGASYNCD16_PERW_MAIN	22
 #define R8A78000_CPG_S0ASYNCD8_PERW_MAIN	23
+#define R8A78000_CPG_CANFD_SCP_MAIN		24
 
 #endif /* __DT_BINDINGS_CLOCK_RENESAS_R8A78000_CPG_H__ */
Signature · 1 line
2.43.0
Acked-by on v1 5/9
#12 lore raw

Re: [PATCH 5/9] dt-bindings: clock: renesas,r8a78000-cpg: Add CAN-FD clock

Quoted 8 lines · Geert Uytterhoeven

Add a definition for the CANFD_SCP_MAIN clock, as used by the Controller Area Network Flexible Data Rate (CAN-FD) modules on R-Car X5H.

---
This depends on "[PATCH 07/11] dt-bindings: clock: renesas,r8a78000-cpg:
Add PWM clocks"
https://lore.kernel.org/e723696e02cfb34fb808e2ae3ccb6faf68528c00.1793026273.git.geert+renesas@glider.be

Maybe just squash it there?

Best regards,
Krzysztof

author maintainer
#13 lore raw

PATCH 6/9 arm64: dts: renesas: r8a78000: Add CAN-FD nodes

In reply to Geert Uytterhoeven

Add device nodes for the two Controller Area Network Flexible Data Rate (CAN-FD) interfaces and the related external CAN clock on the Renesas R-Car X5H (R8A78000) SoC.

---
RFC, as the DT bindings update is marked RFC.

---
 arch/arm64/boot/dts/renesas/r8a78000.dtsi | 235 ++++++++++++++++++++++
 1 file changed, 235 insertions(+)
arch/arm64/boot/dts/renesas/r8a78000.dtsi +235 -0
index c5e48eac4c3712d8..437e49c58ff299a0 100644
@@ -15,6 +15,13 @@ / {
 	#size-cells = <2>;
 	interrupt-parent = <&gic>;
 
+	/* External CAN clock - to be overridden by boards that provide it */
+	can_clk: can-clk {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <0>;
+	};
+
 	cpus {
 		#address-cells = <2>;
 		#size-cells = <0>;
@@ -1783,6 +1790,234 @@ mdlc_vips: system-controller@c3460000 {
 			bootph-all;
 		};
 
+		canfd0: can@c1420000 {
+			compatible = "renesas,r8a78000-canfd",
+				     "renesas,rcar-gen5-canfd";
+			reg = <0 0xc1420000 0 0x8500>;
+			interrupts = <GIC_ESPI 610 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 611 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 612 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 613 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 614 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 615 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 616 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 617 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 618 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 619 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 620 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 621 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 622 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 623 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 624 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 625 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 626 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 627 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 628 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 629 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 630 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 631 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 632 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 633 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 634 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 635 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 636 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 637 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 638 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 639 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 640 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 641 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 642 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 643 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 644 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 645 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 646 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 647 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 648 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 649 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 650 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 651 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 652 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 653 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 654 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 655 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 656 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 657 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 658 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 659 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "g_err", "g_recc",
+					  "ch0_err", "ch0_rec", "ch0_trx",
+					  "ch1_err", "ch1_rec", "ch1_trx",
+					  "ch2_err", "ch2_rec", "ch2_trx",
+					  "ch3_err", "ch3_rec", "ch3_trx",
+					  "ch4_err", "ch4_rec", "ch4_trx",
+					  "ch5_err", "ch5_rec", "ch5_trx",
+					  "ch6_err", "ch6_rec", "ch6_trx",
+					  "ch7_err", "ch7_rec", "ch7_trx",
+					  "vm0_tx", "vm0_rx", "vm0_err",
+					  "vm1_tx", "vm1_rx", "vm1_err",
+					  "vm2_tx", "vm2_rx", "vm2_err",
+					  "vm3_tx", "vm3_rx", "vm3_err",
+					  "vm4_tx", "vm4_rx", "vm4_err",
+					  "vm5_tx", "vm5_rx", "vm5_err",
+					  "vm6_tx", "vm6_rx", "vm6_err",
+					  "vm7_tx", "vm7_rx", "vm7_err";
+			clocks = <&cpg R8A78000_CPG_SCPBUSD4_SCP_MAIN>,
+				 <&cpg R8A78000_CPG_CANFD_SCP_MAIN>,
+				 <&can_clk>;
+			clock-names = "fck", "canfd", "can_clk";
+			assigned-clocks = <&cpg R8A78000_CPG_CANFD_SCP_MAIN>;
+			assigned-clock-rates = <80000000>;
+			power-domains = <&mdlc_scp R8A78000_MDLC_PD_SCP 0x72>;
+			resets = <&mdlc_scp 0x72>;
+			status = "disabled";
+
+			channel0 {
+				status = "disabled";
+			};
+
+			channel1 {
+				status = "disabled";
+			};
+
+			channel2 {
+				status = "disabled";
+			};
+
+			channel3 {
+				status = "disabled";
+			};
+
+			channel4 {
+				status = "disabled";
+			};
+
+			channel5 {
+				status = "disabled";
+			};
+
+			channel6 {
+				status = "disabled";
+			};
+
+			channel7 {
+				status = "disabled";
+			};
+		};
+
+		canfd1: can@c1520000 {
+			compatible = "renesas,r8a78000-canfd",
+				     "renesas,rcar-gen5-canfd";
+			reg = <0 0xc1520000 0 0x8500>;
+			interrupts = <GIC_ESPI 660 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 661 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 662 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 663 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 664 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 665 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 666 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 667 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 668 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 669 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 670 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 671 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 672 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 673 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 674 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 675 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 676 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 677 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 678 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 679 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 680 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 681 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 682 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 683 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 684 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 685 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 686 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 687 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 688 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 689 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 690 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 691 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 692 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 693 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 694 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 695 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 696 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 697 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 698 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 699 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 700 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 701 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 702 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 703 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 704 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 705 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 706 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 707 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 708 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_ESPI 709 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "g_err", "g_recc",
+					  "ch0_err", "ch0_rec", "ch0_trx",
+					  "ch1_err", "ch1_rec", "ch1_trx",
+					  "ch2_err", "ch2_rec", "ch2_trx",
+					  "ch3_err", "ch3_rec", "ch3_trx",
+					  "ch4_err", "ch4_rec", "ch4_trx",
+					  "ch5_err", "ch5_rec", "ch5_trx",
+					  "ch6_err", "ch6_rec", "ch6_trx",
+					  "ch7_err", "ch7_rec", "ch7_trx",
+					  "vm0_tx", "vm0_rx", "vm0_err",
+					  "vm1_tx", "vm1_rx", "vm1_err",
+					  "vm2_tx", "vm2_rx", "vm2_err",
+					  "vm3_tx", "vm3_rx", "vm3_err",
+					  "vm4_tx", "vm4_rx", "vm4_err",
+					  "vm5_tx", "vm5_rx", "vm5_err",
+					  "vm6_tx", "vm6_rx", "vm6_err",
+					  "vm7_tx", "vm7_rx", "vm7_err";
+			clocks = <&cpg R8A78000_CPG_SCPBUSD4_SCP_MAIN>,
+				 <&cpg R8A78000_CPG_CANFD_SCP_MAIN>,
+				 <&can_clk>;
+			clock-names = "fck", "canfd", "can_clk";
+			assigned-clocks = <&cpg R8A78000_CPG_CANFD_SCP_MAIN>;
+			assigned-clock-rates = <80000000>;
+			power-domains = <&mdlc_scp R8A78000_MDLC_PD_SCP 0x73>;
+			resets = <&mdlc_scp 0x73>;
+			status = "disabled";
+
+			channel0 {
+				status = "disabled";
+			};
+
+			channel1 {
+				status = "disabled";
+			};
+
+			channel2 {
+				status = "disabled";
+			};
+
+			channel3 {
+				status = "disabled";
+			};
+
+			channel4 {
+				status = "disabled";
+			};
+
+			channel5 {
+				status = "disabled";
+			};
+
+			channel6 {
+				status = "disabled";
+			};
+
+			channel7 {
+				status = "disabled";
+			};
+		};
+
 		msiof0: spi@c1700000 {
 			compatible = "renesas,msiof-r8a78000",
 				     "renesas,rcar-gen5-msiof";
Signature · 1 line
2.43.0
author maintainer
#14 lore raw

PATCH 7/9 clk: renesas: r8a78000: Add CAN-FD clocks

In reply to Geert Uytterhoeven

Add support for the clocks used by the Controller Area Network Flexible Data Rate (CAN-FD) modules on R-Car X5H.
This includes SCMI remapping table entries and a fixed-clock fallback.

---
This depends on "[PATCH/DNI 09/11] clk: renesas: r8a78000: Add PWM clocks"
https://lore.kernel.org/4fc4232a28fe500b270d2cc26412a1909c12f5aa.1793026273.git.geert+renesas@glider.be

---
 drivers/clk/renesas/r8a78000-cpg.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/clk/renesas/r8a78000-cpg.c +5 -0
index 9b1ff5a8ff1bdc31..4e986b6cb79e4631 100644
@@ -40,6 +40,7 @@ enum fixed_clk {
 	FIXED_CLK_66M,
 	FIXED_CLK_100M,
 	FIXED_CLK_133M,
+	FIXED_CLK_150M,
 	FIXED_CLK_266M,
 };
 
@@ -49,6 +50,7 @@ static const unsigned long fixed_clk_rates[] = {
 	[FIXED_CLK_66M] = 66666000,
 	[FIXED_CLK_100M] = 100000000,
 	[FIXED_CLK_133M] = 133330000,
+	[FIXED_CLK_150M] = 150000000,
 	[FIXED_CLK_266M] = 266660000,
 };
 
@@ -297,6 +299,7 @@ static const struct clk_map_in r8a78000_cpg_default[] = {
 	{ R8A78000_CPG_SGASYNCD4_PERW_BUS,	FIXED_CLK(266M) },
 	{ R8A78000_CPG_SGASYNCD8_PERW_BUS,	FIXED_CLK(133M) },
 	{ R8A78000_CPG_SGASYNCD16_PERW_BUS,	FIXED_CLK(66M) },
+	{ R8A78000_CPG_SCPBUSD4_SCP_MAIN,	FIXED_CLK(150M) },
 	{ R8A78000_CPG_SCPBUSD16_SCP_MAIN,	FIXED_CLK(37M5) },
 	{ R8A78000_CPG_S0D24_PERE_MAIN,		FIXED_CLK(33M) },
 	{ R8A78000_CPG_SGD32_PERW_BUS,		FIXED_CLK(33M) },
@@ -312,12 +315,14 @@ static const struct clk_map_in r8a78000_cpg_fw[] = {
 	{ R8A78000_CPG_SGASYNCD16_PERW_BUS,	1663 },
 	{ R8A78000_CPG_MSO_SCP_MAIN,		1459 },
 	{ R8A78000_CPG_MSOCK_PERW_BUS,		1667 },
+	{ R8A78000_CPG_SCPBUSD4_SCP_MAIN,	1451 },
 	{ R8A78000_CPG_SCPBUSD16_SCP_MAIN,	1454 },
 	{ R8A78000_CPG_S0D24_PERE_MAIN,		1690 },
 	{ R8A78000_CPG_SGD32_PERW_BUS,		1660 },
 	{ R8A78000_CPG_S0D24_HSCN_OTHER,	1499 },
 	{ R8A78000_CPG_SGASYNCD16_PERW_MAIN,	1651 },
 	{ R8A78000_CPG_S0ASYNCD8_PERW_MAIN,	1653 },
+	{ R8A78000_CPG_CANFD_SCP_MAIN,		1456 },
 	{ -1 }
 };
 
Signature · 1 line
2.43.0
author maintainer
#15 lore raw

PATCH 8/9 pmdomain: renesas: r8a78000: Add CAN-FD support

In reply to Geert Uytterhoeven

Add support for the Controller Area Network Flexible Data Rate (CAN-FD) modules on R-Car X5H.

---
This depends on "[PATCH v4 7/8] pmdomain: renesas: r8a78000: Add SCMI remapping support"
https://lore.kernel.org/2895c8f3cbe718dc597ad25e16c2461f0d681ab6.1792163045.git.geert+renesas@glider.be/

---
 drivers/pmdomain/renesas/r8a78000-mdlc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/pmdomain/renesas/r8a78000-mdlc.c +2 -0
index 62156bfb8080e6e4..02699952f5c2d83f 100644
@@ -691,6 +691,8 @@ static const struct mod_map_in r8a78000_mdlc_scp_mod_fw[] = {
 	{ 0x51, 777, 1459 },	/* MSI1 / MSO_SCP_MAIN */
 	{ 0x52, 778, 1459 },	/* MSI2 / MSO_SCP_MAIN */
 	{ 0x53, 779, 1459 },	/* MSI3 / MSO_SCP_MAIN */
+	{ 0x72, 799, -1 },	/* CANFD0 */
+	{ 0x73, 800, -1 },	/* CANFD1 */
 	{ -1 }
 };
 
Signature · 1 line
2.43.0
author maintainer
#16 lore raw

PATCH 9/9 arm64: dts: renesas: ironhide: Enable CAN-FD

In reply to Geert Uytterhoeven

CAN-FD channels 1 to 6 and 12 to 15 are wired to CAN connectors CN7B to CN12, CN18, CN19, and CN55 to CN58.

Channel 0 on CAN connector CN7A is not added, as its transceiver is controlled by the System Control Processor (SCP).

---
This depends on out-of-tree pin control support.

---
 .../boot/dts/renesas/r8a78000-ironhide.dts    | 117 +++++++++++++++++-
 1 file changed, 116 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/renesas/r8a78000-ironhide.dts +116 -1
index c2d814da9fd97802..63dd4fa2d737a729 100644
@@ -171,6 +171,66 @@ ecc@1ecccc0000 {
 	};
 };
 
+&can_clk {
+	clock-frequency = <40000000>;
+};
+
+&canfd0 {
+	pinctrl-0 = <&canfd1_pins>,  <&canfd2_pins>, <&canfd3_pins>,
+		    <&canfd4_pins>, <&canfd5_pins>, <&canfd6_pins>;
+	pinctrl-names = "default";
+
+	status = "okay";
+
+	channel1 {
+		status = "okay";
+	};
+
+	channel2 {
+		status = "okay";
+	};
+
+	channel3 {
+		status = "okay";
+	};
+
+	channel4 {
+		status = "okay";
+	};
+
+	channel5 {
+		status = "okay";
+	};
+
+	channel6 {
+		status = "okay";
+	};
+};
+
+&canfd1 {
+	pinctrl-0 = <&canfd12_pins>, <&canfd13_pins>,  <&canfd14_pins>,
+		    <&canfd15_pins>;
+	pinctrl-names = "default";
+
+	status = "okay";
+
+	channel4 {
+		status = "okay";
+	};
+
+	channel5 {
+		status = "okay";
+	};
+
+	channel6 {
+		status = "okay";
+	};
+
+	channel7 {
+		status = "okay";
+	};
+};
+
 &extal_clk {
 	clock-frequency = <16666600>;
 };
@@ -214,9 +274,64 @@ &msiof6 {
 };
 
 &pfc {
-	pinctrl-0 = <&scif_clk_pins>;
+	pinctrl-0 = <&can_clk_pins>, <&scif_clk_pins>;
 	pinctrl-names = "default";
 
+	can_clk_pins: can-clk {
+		groups = "can_clk";
+		function = "can_clk";
+	};
+
+	canfd1_pins: canfd1 {
+		groups = "canfd1_data";
+		function = "canfd1";
+	};
+
+	canfd2_pins: canfd2 {
+		groups = "canfd2_data";
+		function = "canfd2";
+	};
+
+	canfd3_pins: canfd3 {
+		groups = "canfd3_data";
+		function = "canfd3";
+	};
+
+	canfd4_pins: canfd4 {
+		groups = "canfd4_data";
+		function = "canfd4";
+	};
+
+	canfd5_pins: canfd5 {
+		groups = "canfd5_data";
+		function = "canfd5";
+	};
+
+	canfd6_pins: canfd6 {
+		groups = "canfd6_data";
+		function = "canfd6";
+	};
+
+	canfd12_pins: canfd12 {
+		groups = "canfd12_data_b";
+		function = "canfd12";
+	};
+
+	canfd13_pins: canfd13 {
+		groups = "canfd13_data_b";
+		function = "canfd13";
+	};
+
+	canfd14_pins: canfd14 {
+		groups = "canfd14_data_b";
+		function = "canfd14";
+	};
+
+	canfd15_pins: canfd15 {
+		groups = "canfd15_data_b";
+		function = "canfd15";
+	};
+
 	hscif0_pins: hscif0 {
 		groups = "hscif0_data", "hscif0_ctrl";
 		function = "hscif0";
Signature · 1 line
2.43.0