Skip to contentSkip to conversation

arm64: dts: renesas: Add CAN-FD support for R-Car V4M and Gray Hawk Single

PATCH In review Geert Uytterhoeven 2 participants 4 messages Aug 1, 2024

Subsystems (2)
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

v2 cover arm64: dts: renesas: Add CAN-FD support for R-Car V4M and Gray Hawk Single

Hi all,

This patch series adds support for CAN-FD on the R-Car V4M SoC and the Gray Hawk Single development board.

The CAN-FD module on R-Car V4M is very similar to the one on R-Car V4H, but differs in some hardware parameters, as reflected by the Parameter Status Information part of the Global IP Version Register. However, none of this parameterization should have any impact on the driver, as the driver does not access any register that is impacted by the parameterization (except for the number of channels).

Just like on R-Car V4H and on the White Hawk development board, channels 0 and 1 work fine, while channel 2 does not seem to work at all, and channel 3 works for transmit only. Hence this patch keeps channels 2 and 3 disabled.

Changes compared to v1[1]:
- Spun off clock and DT binding patches,
- Add missing pinctrl-names,
- Correct TJR1443AT Enable GPIO,
- Reword now channels 0 and 1 work.

I plan to queue this is renesas-devel for v6.12.

Thanks for your comments!

[1] https://lore.kernel.org/[email protected]

Duy Nguyen (1):
arm64: dts: renesas: r8a779h0: Add CAN-FD node

Geert Uytterhoeven (1):
arm64: dts: renesas: gray-hawk-single: Add CAN-FD support

 .../dts/renesas/r8a779h0-gray-hawk-single.dts | 41 +++++++++++++++++++
 arch/arm64/boot/dts/renesas/r8a779h0.dtsi     | 41 +++++++++++++++++++
 2 files changed, 82 insertions(+)
Signature · 12 lines
2.34.1

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 v2 1/2 arm64: dts: renesas: r8a779h0: Add CAN-FD node

From: Duy Nguyen <[email protected]>

Add device nodes for the CAN-FD interface and the related external CAN clock on the Renesas R-Car V4M (R8A779H0) SoC.

---
v2:
- No changes.

Changes compared to the BSP:
- Add can_clk comment,
- Add "-clk" suffix to clock node name.

---
 arch/arm64/boot/dts/renesas/r8a779h0.dtsi | 41 +++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm64/boot/dts/renesas/r8a779h0.dtsi +41 -0
index 7147f88401893d3d..c18a70b5552fef93 100644
@@ -21,6 +21,13 @@ audio_clkin: audio_clkin {
 		clock-frequency = <0>;
 	};
 
+	/* External CAN clock - to be overridden by boards that provide it */
+	can_clk: can-clk {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <0>;
+	};
+
 	cluster0_opp: opp-table-0 {
 		compatible = "operating-points-v2";
 
@@ -641,6 +648,40 @@ hscif3: serial@e66a0000 {
 			status = "disabled";
 		};
 
+		canfd: can@e6660000 {
+			compatible = "renesas,r8a779h0-canfd",
+				     "renesas,rcar-gen4-canfd";
+			reg = <0 0xe6660000 0 0x8500>;
+			interrupts = <GIC_SPI 412 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 413 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "ch_int", "g_int";
+			clocks = <&cpg CPG_MOD 328>,
+				 <&cpg CPG_CORE R8A779H0_CLK_CANFD>,
+				 <&can_clk>;
+			clock-names = "fck", "canfd", "can_clk";
+			assigned-clocks = <&cpg CPG_CORE R8A779H0_CLK_CANFD>;
+			assigned-clock-rates = <80000000>;
+			power-domains = <&sysc R8A779H0_PD_ALWAYS_ON>;
+			resets = <&cpg 328>;
+			status = "disabled";
+
+			channel0 {
+				status = "disabled";
+			};
+
+			channel1 {
+				status = "disabled";
+			};
+
+			channel2 {
+				status = "disabled";
+			};
+
+			channel3 {
+				status = "disabled";
+			};
+		};
+
 		avb0: ethernet@e6800000 {
 			compatible = "renesas,etheravb-r8a779h0",
 				     "renesas,etheravb-rcar-gen4";
Signature · 1 line
2.34.1
author maintainer
#2 lore raw

PATCH v2 2/2 arm64: dts: renesas: gray-hawk-single: Add CAN-FD support

In reply to Geert Uytterhoeven

Enable confirmed-working CAN-FD channels 0 and 1 on the Gray Hawk Single development board:
- Channel 0 uses an NXP TJR1443AT CAN transceiver, which must be enabled through a GPIO,
- Channels 1-3 use Microchip MCP2558FD-H/SN CAN transceivers, which do not need explicit description, but channels 2-3 do not seem to work.

Inspired by a patch for Gray Hawk in the BSP by Duy Nguyen.

---
v2:
- Add missing pinctrl-names,
- Correct TJR1443AT Enable GPIO,
- Reword now channels 0 and 1 work.

Changes compared to the BSP:
- Add can_clk,
- Add missing can_transceiver0,
- Keep channels 2 and 3 disabled,
- Preserve sort order.

---
 .../dts/renesas/r8a779h0-gray-hawk-single.dts | 41 +++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm64/boot/dts/renesas/r8a779h0-gray-hawk-single.dts +41 -0
index 88f813562832c21b..9a1917b87f6138af 100644
@@ -47,6 +47,13 @@ aliases {
 		ethernet0 = &avb0;
 	};
 
+	can_transceiver0: can-phy0 {
+		compatible = "nxp,tjr1443";
+		#phy-cells = <0>;
+		enable-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
+		max-bitrate = <5000000>;
+	};
+
 	chosen {
 		bootargs = "ignore_loglevel rw root=/dev/nfs ip=on";
 		stdout-path = "serial0:921600n8";
@@ -174,6 +181,25 @@ phy0: ethernet-phy@0 {
 	};
 };
 
+&can_clk {
+	clock-frequency = <40000000>;
+};
+
+&canfd {
+	pinctrl-0 = <&canfd0_pins>, <&canfd1_pins>, <&can_clk_pins>;
+	pinctrl-names = "default";
+	status = "okay";
+
+	channel0 {
+		status = "okay";
+		phys = <&can_transceiver0>;
+	};
+
+	channel1 {
+		status = "okay";
+	};
+};
+
 &extal_clk {
 	clock-frequency = <16666666>;
 };
@@ -305,6 +331,21 @@ pins_mii {
 		};
 	};
 
+	can_clk_pins: can-clk {
+		groups = "can_clk";
+		function = "can_clk";
+	};
+
+	canfd0_pins: canfd0 {
+		groups = "canfd0_data";
+		function = "canfd0";
+	};
+
+	canfd1_pins: canfd1 {
+		groups = "canfd1_data";
+		function = "canfd1";
+	};
+
 	hscif0_pins: hscif0 {
 		groups = "hscif0_data", "hscif0_ctrl";
 		function = "hscif0";
Signature · 1 line
2.34.1
#3 lore raw
In reply to Geert Uytterhoeven
Quoted 44 lines · Geert Uytterhoeven

Hi all,

This patch series adds support for CAN-FD on the R-Car V4M SoC and the Gray Hawk Single development board.

The CAN-FD module on R-Car V4M is very similar to the one on R-Car V4H, but differs in some hardware parameters, as reflected by the Parameter Status Information part of the Global IP Version Register. However, none of this parameterization should have any impact on the driver, as the driver does not access any register that is impacted by the parameterization (except for the number of channels).

Just like on R-Car V4H and on the White Hawk development board, channels 0 and 1 work fine, while channel 2 does not seem to work at all, and channel 3 works for transmit only. Hence this patch keeps channels 2 and 3 disabled.

Changes compared to v1[1]:
- Spun off clock and DT binding patches,
- Add missing pinctrl-names,
- Correct TJR1443AT Enable GPIO,
- Reword now channels 0 and 1 work.

I plan to queue this is renesas-devel for v6.12.

Thanks for your comments!

[1] https://lore.kernel.org/[email protected]

Duy Nguyen (1):
arm64: dts: renesas: r8a779h0: Add CAN-FD node

Geert Uytterhoeven (1):
arm64: dts: renesas: gray-hawk-single: Add CAN-FD support

 .../dts/renesas/r8a779h0-gray-hawk-single.dts | 41 +++++++++++++++++++
 arch/arm64/boot/dts/renesas/r8a779h0.dtsi     | 41 +++++++++++++++++++
 2 files changed, 82 insertions(+)

--
2.34.1

Gr{oetje,eeting}s,

Quoted 10 lines

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

My bot found new DTB warnings on the .dts files added or changed in this series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:

  pip3 install dtschema --upgrade

New warnings running 'make CHECK_DTBS=y renesas/r8a779h0-gray-hawk-single.dtb' for [email protected]:

arch/arm64/boot/dts/renesas/r8a779h0-gray-hawk-single.dtb: can@e6660000: compatible: 'oneOf' conditional failed, one must be fixed:

	'renesas,r8a779h0-canfd' is not one of ['renesas,r8a774a1-canfd', 'renesas,r8a774b1-canfd', 'renesas,r8a774c0-canfd', 'renesas,r8a774e1-canfd', 'renesas,r8a7795-canfd', 'renesas,r8a7796-canfd', 'renesas,r8a77961-canfd', 'renesas,r8a77965-canfd', 'renesas,r8a77970-canfd', 'renesas,r8a77980-canfd', 'renesas,r8a77990-canfd', 'renesas,r8a77995-canfd']
	'renesas,r8a779h0-canfd' is not one of ['renesas,r8a779a0-canfd', 'renesas,r8a779g0-canfd']
	'renesas,r8a779h0-canfd' is not one of ['renesas,r9a07g043-canfd', 'renesas,r9a07g044-canfd', 'renesas,r9a07g054-canfd']
	'renesas,rcar-gen3-canfd' was expected
	'renesas,rzg2l-canfd' was expected
	from schema $id: http://devicetree.org/schemas/net/can/renesas,rcar-canfd.yaml#

arch/arm64/boot/dts/renesas/r8a779h0-gray-hawk-single.dtb: can@e6660000: Unevaluated properties are not allowed ('compatible' was unexpected)
from schema $id: http://devicetree.org/schemas/net/can/renesas,rcar-canfd.yaml#