Skip to contentSkip to conversation

Add R8A7791/Henninger board CAN DT support

PATCH Superseded Sergei Shtylyov 2 participants 8 messages Dec 26, 2014 – Jan 5, 2015

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add R8A7791/Henninger board CAN DT support

Hello.

Here's the set of 3 patches against Simon Horman's 'renesas.git' repo,
'renesas-devel-20141223-v3.19-rc1' tag. Here we add the CAN device tree support for the R8A7791-based Henninger board. It depends on the clk driver RCAN clock patch posted recently in order to work.

[1/3] ARM: shmobile: r8a7791: add CAN clocks [2/3] ARM: shmobile: r8a7791: add CAN DT support [3/3] ARM: shmobile: henninger: add CAN0 DT support

WBR, Sergei

#1 lore raw

PATCH v4 1/3 ARM: shmobile: r8a7791: add CAN clocks

The R-Car CAN controllers can derive the CAN bus clock not only from their peripheral clock input (clkp1) but also from the other internal clock (clkp2) and external clock fed on CAN_CLK pin. Describe those clocks in the device tree, along with the USB_EXTAL clock from which clkp2 is derived.

---
Changes in version 4:
- refreshed the patch.

Changes in version 3:
- new patch.

 arch/arm/boot/dts/r8a7791.dtsi            |   23 +++++++++++++++++++++--
 include/dt-bindings/clock/r8a7791-clock.h |    1 +
 2 files changed, 22 insertions(+), 2 deletions(-)
arch/arm/boot/dts/r8a7791.dtsi +21 -2
Index: renesas/arch/arm/boot/dts/r8a7791.dtsi
===================================================================
@@ -862,15 +862,34 @@
 			status = "disabled";
 		};
 
+		/* External USB clock - can be overridden by the board */
+		usb_extal_clk: usb_extal_clk {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+			clock-frequency = <48000000>;
+			clock-output-names = "usb_extal";
+		};
+
+		/* External CAN clock */
+		can_clk: can_clk {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+			/* This value must be overriden by the board. */
+			clock-frequency = <0>;
+			clock-output-names = "can_clk";
+			status = "disabled";
+		};
+
 		/* Special CPG clocks */
 		cpg_clocks: cpg_clocks at e6150000 {
 			compatible = "renesas,r8a7791-cpg-clocks",
 				     "renesas,rcar-gen2-cpg-clocks";
 			reg = <0 0xe6150000 0 0x1000>;
-			clocks = <&extal_clk>;
+			clocks = <&extal_clk &usb_extal_clk>;
 			#clock-cells = <1>;
 			clock-output-names = "main", "pll0", "pll1", "pll3",
-					     "lb", "qspi", "sdh", "sd0", "z";
+					     "lb", "qspi", "sdh", "sd0", "z",
+					     "rcan";
 		};
 
 		/* Variable factor clocks */
include/dt-bindings/clock/r8a7791-clock.h +1 -0
Index: renesas/include/dt-bindings/clock/r8a7791-clock.h
===================================================================
@@ -20,6 +20,7 @@
 #define R8A7791_CLK_SDH			6
 #define R8A7791_CLK_SD0			7
 #define R8A7791_CLK_Z			8
+#define R8A7791_CLK_RCAN		9
 
 /* MSTP0 */
 #define R8A7791_CLK_MSIOF0		0
#2 lore raw

PATCH v4 1/3 ARM: shmobile: r8a7791: add CAN clocks

Quoted 6 lines · Sergei Shtylyov

The R-Car CAN controllers can derive the CAN bus clock not only from their peripheral clock input (clkp1) but also from the other internal clock (clkp2) and external clock fed on CAN_CLK pin. Describe those clocks in the device tree, along with the USB_EXTAL clock from which clkp2 is derived.

Acked-by arch/arm/boot/dts/r8a7790.dtsi

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at 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

#3 lore raw

PATCH v4 1/3 ARM: shmobile: r8a7791: add CAN clocks

Quoted 10 lines · Geert Uytterhoeven
Quoted 6 lines · Sergei Shtylyov

The R-Car CAN controllers can derive the CAN bus clock not only from their peripheral clock input (clkp1) but also from the other internal clock (clkp2) and external clock fed on CAN_CLK pin. Describe those clocks in the device tree, along with the USB_EXTAL clock from which clkp2 is derived.

Acked-by arch/arm/boot/dts/r8a7790.dtsi

Bummer...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at 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

#4 lore raw

PATCH v4 2/3 ARM: shmobile: r8a7791: add CAN DT support

In reply to Sergei Shtylyov

Define the generic R8A7791 parts of the CAN0/1 device nodes.

---
Changes in version 4:
- refreshed the patch.

Changes in version 3:
- added 2 more CAN clocks along with "clock-names" property in the CAN0/1 device nodes;
- refreshed the patch.

Changes in version 2:
- fixed the "compatible" property in the CAN device nodes.

 arch/arm/boot/dts/r8a7791.dtsi |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm/boot/dts/r8a7791.dtsi +20 -0
Index: renesas/arch/arm/boot/dts/r8a7791.dtsi
===================================================================
@@ -816,6 +816,26 @@
 		};
 	};
 
+	can0: can at e6e80000 {
+		compatible = "renesas,can-r8a7791";
+		reg = <0 0xe6e80000 0 0x1000>;
+		interrupts = <0 186 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp9_clks R8A7791_CLK_RCAN0>,
+		       	 <&cpg_clocks R8A7791_CLK_RCAN>, <&can_clk>;
+		clock-names = "clkp1", "clkp2", "can_clk";
+		status = "disabled";
+	};
+
+	can1: can at e6e88000 {
+		compatible = "renesas,can-r8a7791";
+		reg = <0 0xe6e88000 0 0x1000>;
+		interrupts = <0 187 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp9_clks R8A7791_CLK_RCAN1>,
+		       	 <&cpg_clocks R8A7791_CLK_RCAN>, <&can_clk>;
+		clock-names = "clkp1", "clkp2", "can_clk";
+		status = "disabled";
+	};
+
 	clocks {
 		#address-cells = <2>;
 		#size-cells = <2>;
#5 lore raw

PATCH v4 2/3 ARM: shmobile: r8a7791: add CAN DT support

Quoted 3 lines · Sergei Shtylyov

Define the generic R8A7791 parts of the CAN0/1 device nodes.

Apart from the minor nit below:

arch/arm/boot/dts/r8a7791.dtsi line 824

Quoted 12 lines
arch/arm/boot/dts/r8a7791.dtsi +6 -0
@@ -816,6 +816,26 @@
                };
        };
 
+       can0: can at e6e80000 {
+               compatible = "renesas,can-r8a7791";
+               reg = <0 0xe6e80000 0 0x1000>;
+               interrupts = <0 186 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&mstp9_clks R8A7791_CLK_RCAN0>,
+                        <&cpg_clocks R8A7791_CLK_RCAN>, <&can_clk>;

.git/rebase-apply/patch:18: space before tab in indent.

      <&cpg_clocks R8A7790_CLK_RCAN>, <&can_clk>;

arch/arm/boot/dts/r8a7791.dtsi line 834

Quoted 10 lines
arch/arm/boot/dts/r8a7791.dtsi +10 -0
+               clock-names = "clkp1", "clkp2", "can_clk";
+               status = "disabled";
+       };
+
+       can1: can at e6e88000 {
+               compatible = "renesas,can-r8a7791";
+               reg = <0 0xe6e88000 0 0x1000>;
+               interrupts = <0 187 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&mstp9_clks R8A7791_CLK_RCAN1>,
+                        <&cpg_clocks R8A7791_CLK_RCAN>, <&can_clk>;

.git/rebase-apply/patch:28: space before tab in indent.

      <&cpg_clocks R8A7790_CLK_RCAN>, <&can_clk>;

warning: 2 lines add whitespace errors.

Quoted 4 lines
arch/arm/boot/dts/r8a7791.dtsi +4 -0
+               clock-names = "clkp1", "clkp2", "can_clk";
+               status = "disabled";
+       };
+
Signature · 10 lines
Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at 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
#6 lore raw

PATCH v4 2/3 ARM: shmobile: r8a7791: add CAN DT support

Quoted 5 lines · Geert Uytterhoeven

Review

Quoted 2 lines
(quoted diff) +2 -0
+               clocks = <&mstp9_clks R8A7791_CLK_RCAN0>,
+                        <&cpg_clocks R8A7791_CLK_RCAN>, <&can_clk>;

.git/rebase-apply/patch:18: space before tab in indent.

      <&cpg_clocks R8A7790_CLK_RCAN>, <&can_clk>;

Sorry, my copy-'n-paste-foo has deteriorated over the holidays...

s/7790/7791/

Quoted 11 lines

arch/arm/boot/dts/r8a7791.dtsi line 834

Quoted 10 lines
arch/arm/boot/dts/r8a7791.dtsi +10 -0
+               clock-names = "clkp1", "clkp2", "can_clk";
+               status = "disabled";
+       };
+
+       can1: can at e6e88000 {
+               compatible = "renesas,can-r8a7791";
+               reg = <0 0xe6e88000 0 0x1000>;
+               interrupts = <0 187 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&mstp9_clks R8A7791_CLK_RCAN1>,
+                        <&cpg_clocks R8A7791_CLK_RCAN>, <&can_clk>;
Quoted 2 lines

.git/rebase-apply/patch:28: space before tab in indent.

      <&cpg_clocks R8A7790_CLK_RCAN>, <&can_clk>;

s/7790/7791/

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at 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

#7 lore raw

PATCH v4 3/3 ARM: shmobile: henninger: add CAN0 DT support

In reply to Sergei Shtylyov

Define the Henninger board dependent part of the CAN0 device node.

---
Changes in version 4:
- refreshed the patch.

Changes in version 3:
- changed "can0_data_a" to "can0_data", removed "can_clk_d" in the "renesas,groups" property;
- moved CAN0 node to go after all others;
- refreshed the patch.

 arch/arm/boot/dts/r8a7791-henninger.dts |   11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/r8a7791-henninger.dts +11 -0
Index: renesas/arch/arm/boot/dts/r8a7791-henninger.dts
===================================================================
@@ -147,6 +147,11 @@
 		renesas,groups = "vin0_data8", "vin0_clk";
 		renesas,function = "vin0";
 	};
+
+	can0_pins: can0 {
+		renesas,groups = "can0_data";
+		renesas,function = "can0";
+	};
 };
 
 &scif0 {
@@ -321,3 +326,9 @@
 		};
 	};
 };
+
+&can0 {
+	pinctrl-0 = <&can0_pins>;
+	pinctrl-names = "default";
+	status = "okay";
+};