public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support
@ 2024-10-14 17:54 Drew Fustini
  2024-10-14 17:54 ` [PATCH 1/8] riscv: dts: thead: Add TH1520 pin control nodes Drew Fustini
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Drew Fustini @ 2024-10-14 17:54 UTC (permalink / raw)
  To: Emil Renner Berthing, Drew Fustini, Guo Ren, Fu Wei,
	Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Thomas Bonnefille,
	Kanak Shilledar
  Cc: linux-riscv, devicetree, linux-kernel, Drew Fustini

This series of device tree patches enables the TH1520 pin controllers on
the BeagleV Ahead and Lichee Pi 4A boards.

Patches 1-7 have all been cherry picked from esmil's th1520 branch [1].
They do not have the issues pointed out in the previous series [2] that
I sent out which contained out dated versions of the patches.

The final patch was suggested by Emil as there are not currently any
users of the spi0 node so there is no need to enable it in the board dts
files.

I have tested on the BeagleV Ahead and the LicheePi 4A. The leds on the
BeagleV can be controlled as expected through sysfs.

[1] https://github.com/esmil/linux
[2] https://lore.kernel.org/lkml/20240930-th1520-pinctrl-v3-0-32cea2bdbecb@tenstorrent.com/

---
Drew Fustini (1):
      riscv: dts: thead: remove enabled property for spi0

Emil Renner Berthing (7):
      riscv: dts: thead: Add TH1520 pin control nodes
      riscv: dts: thead: Add TH1520 GPIO ranges
      riscv: dts: thead: Adjust TH1520 GPIO labels
      riscv: dts: thead: Add Lichee Pi 4M GPIO line names
      riscv: dts: thead: Add TH1520 pinctrl settings for UART0
      riscv: dtb: thead: Add BeagleV Ahead LEDs
      riscv: dts: thead: Add missing GPIO clock-names

 arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts | 86 +++++++++++++++++++++-
 .../boot/dts/thead/th1520-lichee-module-4a.dtsi    | 39 ++++++++++
 arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts  | 30 +++++++-
 arch/riscv/boot/dts/thead/th1520.dtsi              | 70 ++++++++++++++----
 4 files changed, 202 insertions(+), 23 deletions(-)
---
base-commit: 66f5c917cba075cb2cdf8cad2019f72a1df0328f
change-id: 20241013-th1520-pinctrl-dts-54275cc4fdb0

Best regards,
-- 
Drew Fustini <dfustini@tenstorrent.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH 1/8] riscv: dts: thead: Add TH1520 pin control nodes
  2024-10-14 17:54 [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Drew Fustini
@ 2024-10-14 17:54 ` Drew Fustini
  2024-10-14 17:54 ` [PATCH 2/8] riscv: dts: thead: Add TH1520 GPIO ranges Drew Fustini
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Drew Fustini @ 2024-10-14 17:54 UTC (permalink / raw)
  To: Emil Renner Berthing, Drew Fustini, Guo Ren, Fu Wei,
	Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Thomas Bonnefille,
	Kanak Shilledar
  Cc: linux-riscv, devicetree, linux-kernel, Drew Fustini

From: Emil Renner Berthing <emil.renner.berthing@canonical.com>

Add nodes for pin controllers on the T-Head TH1520 RISC-V SoC.

Add the missing aonsys_clk for the always-on pin controller as there is
not yet an aon subsys clock controller driver.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
[dfustini: modify description as there is now an ap_subsys clk driver]
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
---
 arch/riscv/boot/dts/thead/th1520.dtsi | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi
index 6992060e6a54..93c17f52fbe9 100644
--- a/arch/riscv/boot/dts/thead/th1520.dtsi
+++ b/arch/riscv/boot/dts/thead/th1520.dtsi
@@ -216,6 +216,13 @@ osc_32k: 32k-oscillator {
 		#clock-cells = <0>;
 	};
 
+	aonsys_clk: clock-73728000 {
+		compatible = "fixed-clock";
+		clock-frequency = <73728000>;
+		clock-output-names = "aonsys_clk";
+		#clock-cells = <0>;
+	};
+
 	soc {
 		compatible = "simple-bus";
 		interrupt-parent = <&plic>;
@@ -354,6 +361,13 @@ portd: gpio-controller@0 {
 			};
 		};
 
+		padctrl1_apsys: pinctrl@ffe7f3c000 {
+			compatible = "thead,th1520-pinctrl";
+			reg = <0xff 0xe7f3c000 0x0 0x1000>;
+			clocks = <&clk CLK_PADCTRL1>;
+			thead,pad-group = <2>;
+		};
+
 		gpio0: gpio@ffec005000 {
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff 0xec005000 0x0 0x1000>;
@@ -392,6 +406,13 @@ portb: gpio-controller@0 {
 			};
 		};
 
+		padctrl0_apsys: pinctrl@ffec007000 {
+			compatible = "thead,th1520-pinctrl";
+			reg = <0xff 0xec007000 0x0 0x1000>;
+			clocks = <&clk CLK_PADCTRL0>;
+			thead,pad-group = <3>;
+		};
+
 		uart2: serial@ffec010000 {
 			compatible = "snps,dw-apb-uart";
 			reg = <0xff 0xec010000 0x0 0x4000>;
@@ -538,6 +559,13 @@ porte: gpio-controller@0 {
 			};
 		};
 
+		padctrl_aosys: pinctrl@fffff4a000 {
+			compatible = "thead,th1520-pinctrl";
+			reg = <0xff 0xfff4a000 0x0 0x2000>;
+			clocks = <&aonsys_clk>;
+			thead,pad-group = <1>;
+		};
+
 		ao_gpio1: gpio@fffff52000 {
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff 0xfff52000 0x0 0x1000>;

-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH 2/8] riscv: dts: thead: Add TH1520 GPIO ranges
  2024-10-14 17:54 [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Drew Fustini
  2024-10-14 17:54 ` [PATCH 1/8] riscv: dts: thead: Add TH1520 pin control nodes Drew Fustini
@ 2024-10-14 17:54 ` Drew Fustini
  2024-10-14 17:54 ` [PATCH 3/8] riscv: dts: thead: Adjust TH1520 GPIO labels Drew Fustini
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Drew Fustini @ 2024-10-14 17:54 UTC (permalink / raw)
  To: Emil Renner Berthing, Drew Fustini, Guo Ren, Fu Wei,
	Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Thomas Bonnefille,
	Kanak Shilledar
  Cc: linux-riscv, devicetree, linux-kernel, Drew Fustini

From: Emil Renner Berthing <emil.renner.berthing@canonical.com>

Add gpio-ranges properties to the TH1520 device tree, so user space can
change basic pinconf settings for GPIOs and are not allowed to use pads
already used by other functions.

Adjust number of GPIOs available for the different controllers.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
---
 arch/riscv/boot/dts/thead/th1520.dtsi | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi
index 93c17f52fbe9..9c6cbb4fc3d7 100644
--- a/arch/riscv/boot/dts/thead/th1520.dtsi
+++ b/arch/riscv/boot/dts/thead/th1520.dtsi
@@ -335,6 +335,7 @@ portc: gpio-controller@0 {
 				gpio-controller;
 				#gpio-cells = <2>;
 				ngpios = <32>;
+				gpio-ranges = <&padctrl0_apsys 0 0 32>;
 				reg = <0>;
 				interrupt-controller;
 				#interrupt-cells = <2>;
@@ -353,7 +354,8 @@ portd: gpio-controller@0 {
 				compatible = "snps,dw-apb-gpio-port";
 				gpio-controller;
 				#gpio-cells = <2>;
-				ngpios = <32>;
+				ngpios = <23>;
+				gpio-ranges = <&padctrl0_apsys 0 32 23>;
 				reg = <0>;
 				interrupt-controller;
 				#interrupt-cells = <2>;
@@ -380,6 +382,7 @@ porta: gpio-controller@0 {
 				gpio-controller;
 				#gpio-cells = <2>;
 				ngpios = <32>;
+				gpio-ranges = <&padctrl1_apsys 0 0 32>;
 				reg = <0>;
 				interrupt-controller;
 				#interrupt-cells = <2>;
@@ -398,7 +401,8 @@ portb: gpio-controller@0 {
 				compatible = "snps,dw-apb-gpio-port";
 				gpio-controller;
 				#gpio-cells = <2>;
-				ngpios = <32>;
+				ngpios = <31>;
+				gpio-ranges = <&padctrl1_apsys 0 32 31>;
 				reg = <0>;
 				interrupt-controller;
 				#interrupt-cells = <2>;
@@ -551,7 +555,8 @@ porte: gpio-controller@0 {
 				compatible = "snps,dw-apb-gpio-port";
 				gpio-controller;
 				#gpio-cells = <2>;
-				ngpios = <32>;
+				ngpios = <16>;
+				gpio-ranges = <&padctrl_aosys 0 9 16>;
 				reg = <0>;
 				interrupt-controller;
 				#interrupt-cells = <2>;
@@ -576,7 +581,8 @@ portf: gpio-controller@0 {
 				compatible = "snps,dw-apb-gpio-port";
 				gpio-controller;
 				#gpio-cells = <2>;
-				ngpios = <32>;
+				ngpios = <23>;
+				gpio-ranges = <&padctrl_aosys 0 25 22>, <&padctrl_aosys 22 7 1>;
 				reg = <0>;
 				interrupt-controller;
 				#interrupt-cells = <2>;

-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH 3/8] riscv: dts: thead: Adjust TH1520 GPIO labels
  2024-10-14 17:54 [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Drew Fustini
  2024-10-14 17:54 ` [PATCH 1/8] riscv: dts: thead: Add TH1520 pin control nodes Drew Fustini
  2024-10-14 17:54 ` [PATCH 2/8] riscv: dts: thead: Add TH1520 GPIO ranges Drew Fustini
@ 2024-10-14 17:54 ` Drew Fustini
  2024-10-14 17:54 ` [PATCH 4/8] riscv: dts: thead: Add Lichee Pi 4M GPIO line names Drew Fustini
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Drew Fustini @ 2024-10-14 17:54 UTC (permalink / raw)
  To: Emil Renner Berthing, Drew Fustini, Guo Ren, Fu Wei,
	Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Thomas Bonnefille,
	Kanak Shilledar
  Cc: linux-riscv, devicetree, linux-kernel, Drew Fustini

From: Emil Renner Berthing <emil.renner.berthing@canonical.com>

Adjust labels for the TH1520 GPIO controllers such that GPIOs can be
referenced by the names used by the documentation. Eg.

GPIO0_X  -> <&gpio0 X Y>
GPIO1_X  -> <&gpio1 X Y>
GPIO2_X  -> <&gpio2 X Y>
GPIO3_X  -> <&gpio3 X Y>
GPIO4_X  -> <&gpio4 X Y>
AOGPIO_X -> <&aogpio X Y>

Remove labels for the parent GPIO devices that shouldn't need to be
referenced.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
---
 arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts |  2 ++
 arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts  |  2 ++
 arch/riscv/boot/dts/thead/th1520.dtsi              | 24 +++++++++++-----------
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
index 497d961456f3..1a4154a6ff3b 100644
--- a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
+++ b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
@@ -17,6 +17,8 @@ aliases {
 		gpio1 = &gpio1;
 		gpio2 = &gpio2;
 		gpio3 = &gpio3;
+		gpio4 = &gpio4;
+		gpio5 = &aogpio;
 		serial0 = &uart0;
 		serial1 = &uart1;
 		serial2 = &uart2;
diff --git a/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts b/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
index 7738d2895c5a..58ad381fc1c3 100644
--- a/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
+++ b/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
@@ -14,6 +14,8 @@ aliases {
 		gpio1 = &gpio1;
 		gpio2 = &gpio2;
 		gpio3 = &gpio3;
+		gpio4 = &gpio4;
+		gpio5 = &aogpio;
 		serial0 = &uart0;
 		serial1 = &uart1;
 		serial2 = &uart2;
diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi
index 9c6cbb4fc3d7..31725c3a13d7 100644
--- a/arch/riscv/boot/dts/thead/th1520.dtsi
+++ b/arch/riscv/boot/dts/thead/th1520.dtsi
@@ -323,14 +323,14 @@ uart3: serial@ffe7f04000 {
 			status = "disabled";
 		};
 
-		gpio2: gpio@ffe7f34000 {
+		gpio@ffe7f34000 {
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff 0xe7f34000 0x0 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <0>;
 			clocks = <&clk CLK_GPIO2>;
 
-			portc: gpio-controller@0 {
+			gpio2: gpio-controller@0 {
 				compatible = "snps,dw-apb-gpio-port";
 				gpio-controller;
 				#gpio-cells = <2>;
@@ -343,14 +343,14 @@ portc: gpio-controller@0 {
 			};
 		};
 
-		gpio3: gpio@ffe7f38000 {
+		gpio@ffe7f38000 {
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff 0xe7f38000 0x0 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <0>;
 			clocks = <&clk CLK_GPIO3>;
 
-			portd: gpio-controller@0 {
+			gpio3: gpio-controller@0 {
 				compatible = "snps,dw-apb-gpio-port";
 				gpio-controller;
 				#gpio-cells = <2>;
@@ -370,14 +370,14 @@ padctrl1_apsys: pinctrl@ffe7f3c000 {
 			thead,pad-group = <2>;
 		};
 
-		gpio0: gpio@ffec005000 {
+		gpio@ffec005000 {
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff 0xec005000 0x0 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <0>;
 			clocks = <&clk CLK_GPIO0>;
 
-			porta: gpio-controller@0 {
+			gpio0: gpio-controller@0 {
 				compatible = "snps,dw-apb-gpio-port";
 				gpio-controller;
 				#gpio-cells = <2>;
@@ -390,14 +390,14 @@ porta: gpio-controller@0 {
 			};
 		};
 
-		gpio1: gpio@ffec006000 {
+		gpio@ffec006000 {
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff 0xec006000 0x0 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <0>;
 			clocks = <&clk CLK_GPIO1>;
 
-			portb: gpio-controller@0 {
+			gpio1: gpio-controller@0 {
 				compatible = "snps,dw-apb-gpio-port";
 				gpio-controller;
 				#gpio-cells = <2>;
@@ -545,13 +545,13 @@ timer7: timer@ffffc3303c {
 			status = "disabled";
 		};
 
-		ao_gpio0: gpio@fffff41000 {
+		gpio@fffff41000 {
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff 0xfff41000 0x0 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <0>;
 
-			porte: gpio-controller@0 {
+			aogpio: gpio-controller@0 {
 				compatible = "snps,dw-apb-gpio-port";
 				gpio-controller;
 				#gpio-cells = <2>;
@@ -571,13 +571,13 @@ padctrl_aosys: pinctrl@fffff4a000 {
 			thead,pad-group = <1>;
 		};
 
-		ao_gpio1: gpio@fffff52000 {
+		gpio@fffff52000 {
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff 0xfff52000 0x0 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <0>;
 
-			portf: gpio-controller@0 {
+			gpio4: gpio-controller@0 {
 				compatible = "snps,dw-apb-gpio-port";
 				gpio-controller;
 				#gpio-cells = <2>;

-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH 4/8] riscv: dts: thead: Add Lichee Pi 4M GPIO line names
  2024-10-14 17:54 [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Drew Fustini
                   ` (2 preceding siblings ...)
  2024-10-14 17:54 ` [PATCH 3/8] riscv: dts: thead: Adjust TH1520 GPIO labels Drew Fustini
@ 2024-10-14 17:54 ` Drew Fustini
  2024-10-14 17:54 ` [PATCH 5/8] riscv: dts: thead: Add TH1520 pinctrl settings for UART0 Drew Fustini
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Drew Fustini @ 2024-10-14 17:54 UTC (permalink / raw)
  To: Emil Renner Berthing, Drew Fustini, Guo Ren, Fu Wei,
	Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Thomas Bonnefille,
	Kanak Shilledar
  Cc: linux-riscv, devicetree, linux-kernel, Drew Fustini

From: Emil Renner Berthing <emil.renner.berthing@canonical.com>

Add names for the GPIO00-GPIO14 lines of the SO-DIMM module.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
---
 .../boot/dts/thead/th1520-lichee-module-4a.dtsi    | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi b/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
index 78977bdbbe3d..724d9645471d 100644
--- a/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
+++ b/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
@@ -25,6 +25,12 @@ &osc_32k {
 	clock-frequency = <32768>;
 };
 
+&aogpio {
+	gpio-line-names = "", "", "",
+			  "GPIO00",
+			  "GPIO04";
+};
+
 &dmac0 {
 	status = "okay";
 };
@@ -39,6 +45,39 @@ &emmc {
 	status = "okay";
 };
 
+&gpio0 {
+	gpio-line-names = "", "", "", "", "", "", "", "", "", "",
+			  "", "", "", "", "", "", "", "", "", "",
+			  "", "", "", "",
+			  "GPIO07",
+			  "GPIO08",
+			  "",
+			  "GPIO01",
+			  "GPIO02";
+};
+
+&gpio1 {
+	gpio-line-names = "", "", "",
+			  "GPIO11",
+			  "GPIO12",
+			  "GPIO13",
+			  "GPIO14",
+			  "", "", "", "", "", "", "", "", "", "",
+			  "", "", "", "", "",
+			  "GPIO06";
+};
+
+&gpio2 {
+	gpio-line-names = "GPIO03",
+			  "GPIO05";
+};
+
+&gpio3 {
+	gpio-line-names = "", "",
+			  "GPIO09",
+			  "GPIO10";
+};
+
 &sdio0 {
 	bus-width = <4>;
 	max-frequency = <198000000>;

-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH 5/8] riscv: dts: thead: Add TH1520 pinctrl settings for UART0
  2024-10-14 17:54 [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Drew Fustini
                   ` (3 preceding siblings ...)
  2024-10-14 17:54 ` [PATCH 4/8] riscv: dts: thead: Add Lichee Pi 4M GPIO line names Drew Fustini
@ 2024-10-14 17:54 ` Drew Fustini
  2024-10-14 17:54 ` [PATCH 6/8] riscv: dtb: thead: Add BeagleV Ahead LEDs Drew Fustini
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Drew Fustini @ 2024-10-14 17:54 UTC (permalink / raw)
  To: Emil Renner Berthing, Drew Fustini, Guo Ren, Fu Wei,
	Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Thomas Bonnefille,
	Kanak Shilledar
  Cc: linux-riscv, devicetree, linux-kernel, Drew Fustini

From: Emil Renner Berthing <emil.renner.berthing@canonical.com>

Add pinctrl settings for UART0 used as the default debug console on
both the Lichee Pi 4A and BeagleV Ahead boards.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
---
 arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts | 26 ++++++++++++++++++++++
 arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts  | 26 ++++++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
index 1a4154a6ff3b..0484fb390be4 100644
--- a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
+++ b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
@@ -61,6 +61,30 @@ &emmc {
 	status = "okay";
 };
 
+&padctrl0_apsys {
+	uart0_pins: uart0-0 {
+		tx-pins {
+			pins = "UART0_TXD";
+			function = "uart";
+			bias-disable;
+			drive-strength = <3>;
+			input-disable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+
+		rx-pins {
+			pins = "UART0_RXD";
+			function = "uart";
+			bias-pull-up;
+			drive-strength = <1>;
+			input-enable;
+			input-schmitt-enable;
+			slew-rate = <0>;
+		};
+	};
+};
+
 &sdio0 {
 	bus-width = <4>;
 	max-frequency = <198000000>;
@@ -68,6 +92,8 @@ &sdio0 {
 };
 
 &uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins>;
 	status = "okay";
 };
 
diff --git a/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts b/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
index 58ad381fc1c3..f60b1879192d 100644
--- a/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
+++ b/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
@@ -30,7 +30,33 @@ chosen {
 	};
 };
 
+&padctrl0_apsys {
+	uart0_pins: uart0-0 {
+		tx-pins {
+			pins = "UART0_TXD";
+			function = "uart";
+			bias-disable;
+			drive-strength = <3>;
+			input-disable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+
+		rx-pins {
+			pins = "UART0_RXD";
+			function = "uart";
+			bias-disable;
+			drive-strength = <1>;
+			input-enable;
+			input-schmitt-enable;
+			slew-rate = <0>;
+		};
+	};
+};
+
 &uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins>;
 	status = "okay";
 };
 

-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH 6/8] riscv: dtb: thead: Add BeagleV Ahead LEDs
  2024-10-14 17:54 [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Drew Fustini
                   ` (4 preceding siblings ...)
  2024-10-14 17:54 ` [PATCH 5/8] riscv: dts: thead: Add TH1520 pinctrl settings for UART0 Drew Fustini
@ 2024-10-14 17:54 ` Drew Fustini
  2024-10-14 17:54 ` [PATCH 7/8] riscv: dts: thead: Add missing GPIO clock-names Drew Fustini
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Drew Fustini @ 2024-10-14 17:54 UTC (permalink / raw)
  To: Emil Renner Berthing, Drew Fustini, Guo Ren, Fu Wei,
	Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Thomas Bonnefille,
	Kanak Shilledar
  Cc: linux-riscv, devicetree, linux-kernel, Drew Fustini

From: Emil Renner Berthing <emil.renner.berthing@canonical.com>

Add nodes for the 5 user controllable LEDs on the BeagleV Ahead board.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
---
 arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
index 0484fb390be4..c0cf9b086f81 100644
--- a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
+++ b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
@@ -7,6 +7,8 @@
 /dts-v1/;
 
 #include "th1520.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
 
 / {
 	model = "BeagleV Ahead";
@@ -35,7 +37,42 @@ chosen {
 	memory@0 {
 		device_type = "memory";
 		reg = <0x0  0x00000000  0x1 0x00000000>;
+	};
+
+	leds {
+		pinctrl-names = "default";
+		pinctrl-0 = <&led_pins>;
+		compatible = "gpio-leds";
+
+		led-1 {
+			gpios = <&gpio4 8 GPIO_ACTIVE_HIGH>;
+			color = <LED_COLOR_ID_BLUE>;
+			label = "led1";
+		};
+
+		led-2 {
+			gpios = <&gpio4 9 GPIO_ACTIVE_HIGH>;
+			color = <LED_COLOR_ID_BLUE>;
+			label = "led2";
+		};
+
+		led-3 {
+			gpios = <&gpio4 10 GPIO_ACTIVE_HIGH>;
+			color = <LED_COLOR_ID_BLUE>;
+			label = "led3";
+		};
+
+		led-4 {
+			gpios = <&gpio4 11 GPIO_ACTIVE_HIGH>;
+			color = <LED_COLOR_ID_BLUE>;
+			label = "led4";
+		};
 
+		led-5 {
+			gpios = <&gpio4 12 GPIO_ACTIVE_HIGH>;
+			color = <LED_COLOR_ID_BLUE>;
+			label = "led5";
+		};
 	};
 };
 
@@ -61,6 +98,23 @@ &emmc {
 	status = "okay";
 };
 
+&padctrl_aosys {
+	led_pins: led-0 {
+		led-pins {
+			pins = "AUDIO_PA8",  /* GPIO4_8 */
+			       "AUDIO_PA9",  /* GPIO4_9 */
+			       "AUDIO_PA10", /* GPIO4_10 */
+			       "AUDIO_PA11", /* GPIO4_11 */
+			       "AUDIO_PA12"; /* GPIO4_12 */
+			bias-disable;
+			drive-strength = <3>;
+			input-disable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+	};
+};
+
 &padctrl0_apsys {
 	uart0_pins: uart0-0 {
 		tx-pins {

-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH 7/8] riscv: dts: thead: Add missing GPIO clock-names
  2024-10-14 17:54 [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Drew Fustini
                   ` (5 preceding siblings ...)
  2024-10-14 17:54 ` [PATCH 6/8] riscv: dtb: thead: Add BeagleV Ahead LEDs Drew Fustini
@ 2024-10-14 17:54 ` Drew Fustini
  2024-10-14 17:54 ` [PATCH 8/8] riscv: dts: thead: remove enabled property for spi0 Drew Fustini
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Drew Fustini @ 2024-10-14 17:54 UTC (permalink / raw)
  To: Emil Renner Berthing, Drew Fustini, Guo Ren, Fu Wei,
	Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Thomas Bonnefille,
	Kanak Shilledar
  Cc: linux-riscv, devicetree, linux-kernel, Drew Fustini

From: Emil Renner Berthing <emil.renner.berthing@canonical.com>

The gpio-dwapb looks for clock named "bus" so add clock-names property
for the gpio controller nodes.

Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
[dfustini: add two more lines to the commit message]
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
---
 arch/riscv/boot/dts/thead/th1520.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi
index 31725c3a13d7..cd835aea07d2 100644
--- a/arch/riscv/boot/dts/thead/th1520.dtsi
+++ b/arch/riscv/boot/dts/thead/th1520.dtsi
@@ -329,6 +329,7 @@ gpio@ffe7f34000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
 			clocks = <&clk CLK_GPIO2>;
+			clock-names = "bus";
 
 			gpio2: gpio-controller@0 {
 				compatible = "snps,dw-apb-gpio-port";
@@ -349,6 +350,7 @@ gpio@ffe7f38000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
 			clocks = <&clk CLK_GPIO3>;
+			clock-names = "bus";
 
 			gpio3: gpio-controller@0 {
 				compatible = "snps,dw-apb-gpio-port";
@@ -376,6 +378,7 @@ gpio@ffec005000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
 			clocks = <&clk CLK_GPIO0>;
+			clock-names = "bus";
 
 			gpio0: gpio-controller@0 {
 				compatible = "snps,dw-apb-gpio-port";
@@ -396,6 +399,7 @@ gpio@ffec006000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
 			clocks = <&clk CLK_GPIO1>;
+			clock-names = "bus";
 
 			gpio1: gpio-controller@0 {
 				compatible = "snps,dw-apb-gpio-port";

-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH 8/8] riscv: dts: thead: remove enabled property for spi0
  2024-10-14 17:54 [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Drew Fustini
                   ` (6 preceding siblings ...)
  2024-10-14 17:54 ` [PATCH 7/8] riscv: dts: thead: Add missing GPIO clock-names Drew Fustini
@ 2024-10-14 17:54 ` Drew Fustini
  2024-10-15 17:19 ` [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Conor Dooley
  2024-10-15 17:49 ` Drew Fustini
  9 siblings, 0 replies; 12+ messages in thread
From: Drew Fustini @ 2024-10-14 17:54 UTC (permalink / raw)
  To: Emil Renner Berthing, Drew Fustini, Guo Ren, Fu Wei,
	Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Thomas Bonnefille,
	Kanak Shilledar
  Cc: linux-riscv, devicetree, linux-kernel, Drew Fustini

There are currently no nodes that use spi0 so remove the enabled
property for it in the beaglev ahead and lpi4a dts files. It can be
re-enabled in the future if any peripherals will use it. The definition
of spi0 remains in the th1520.dtsi file.

Suggested-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
---
 arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts | 4 ----
 arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts  | 4 ----
 2 files changed, 8 deletions(-)

diff --git a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
index c0cf9b086f81..86feb3df02c8 100644
--- a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
+++ b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
@@ -150,7 +150,3 @@ &uart0 {
 	pinctrl-0 = <&uart0_pins>;
 	status = "okay";
 };
-
-&spi0 {
-	status = "okay";
-};
diff --git a/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts b/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
index f60b1879192d..4020c727f09e 100644
--- a/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
+++ b/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
@@ -59,7 +59,3 @@ &uart0 {
 	pinctrl-0 = <&uart0_pins>;
 	status = "okay";
 };
-
-&spi0 {
-	status = "okay";
-};

-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support
  2024-10-14 17:54 [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Drew Fustini
                   ` (7 preceding siblings ...)
  2024-10-14 17:54 ` [PATCH 8/8] riscv: dts: thead: remove enabled property for spi0 Drew Fustini
@ 2024-10-15 17:19 ` Conor Dooley
  2024-10-15 17:35   ` Drew Fustini
  2024-10-15 17:49 ` Drew Fustini
  9 siblings, 1 reply; 12+ messages in thread
From: Conor Dooley @ 2024-10-15 17:19 UTC (permalink / raw)
  To: Drew Fustini
  Cc: Emil Renner Berthing, Drew Fustini, Guo Ren, Fu Wei,
	Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Thomas Bonnefille,
	Kanak Shilledar, linux-riscv, devicetree, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 917 bytes --]

On Mon, Oct 14, 2024 at 10:54:17AM -0700, Drew Fustini wrote:
> This series of device tree patches enables the TH1520 pin controllers on
> the BeagleV Ahead and Lichee Pi 4A boards.
> 
> Patches 1-7 have all been cherry picked from esmil's th1520 branch [1].
> They do not have the issues pointed out in the previous series [2] that
> I sent out which contained out dated versions of the patches.
> 
> The final patch was suggested by Emil as there are not currently any
> users of the spi0 node so there is no need to enable it in the board dts
> files.
> 
> I have tested on the BeagleV Ahead and the LicheePi 4A. The leds on the
> BeagleV can be controlled as expected through sysfs.
> 
> [1] https://github.com/esmil/linux
> [2] https://lore.kernel.org/lkml/20240930-th1520-pinctrl-v3-0-32cea2bdbecb@tenstorrent.com/

btw, this should have continued the version numbering from [2] and been
v4

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

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support
  2024-10-15 17:19 ` [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Conor Dooley
@ 2024-10-15 17:35   ` Drew Fustini
  0 siblings, 0 replies; 12+ messages in thread
From: Drew Fustini @ 2024-10-15 17:35 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Emil Renner Berthing, Drew Fustini, Guo Ren, Fu Wei,
	Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Thomas Bonnefille,
	Kanak Shilledar, linux-riscv, devicetree, linux-kernel

On Tue, Oct 15, 2024 at 06:19:19PM +0100, Conor Dooley wrote:
> On Mon, Oct 14, 2024 at 10:54:17AM -0700, Drew Fustini wrote:
> > This series of device tree patches enables the TH1520 pin controllers on
> > the BeagleV Ahead and Lichee Pi 4A boards.
> > 
> > Patches 1-7 have all been cherry picked from esmil's th1520 branch [1].
> > They do not have the issues pointed out in the previous series [2] that
> > I sent out which contained out dated versions of the patches.
> > 
> > The final patch was suggested by Emil as there are not currently any
> > users of the spi0 node so there is no need to enable it in the board dts
> > files.
> > 
> > I have tested on the BeagleV Ahead and the LicheePi 4A. The leds on the
> > BeagleV can be controlled as expected through sysfs.
> > 
> > [1] https://github.com/esmil/linux
> > [2] https://lore.kernel.org/lkml/20240930-th1520-pinctrl-v3-0-32cea2bdbecb@tenstorrent.com/
> 
> btw, this should have continued the version numbering from [2] and been
> v4

Thanks, I'll keep that in mind for the future.

-Drew

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support
  2024-10-14 17:54 [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Drew Fustini
                   ` (8 preceding siblings ...)
  2024-10-15 17:19 ` [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Conor Dooley
@ 2024-10-15 17:49 ` Drew Fustini
  9 siblings, 0 replies; 12+ messages in thread
From: Drew Fustini @ 2024-10-15 17:49 UTC (permalink / raw)
  To: Emil Renner Berthing, Drew Fustini, Guo Ren, Fu Wei,
	Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Thomas Bonnefille,
	Kanak Shilledar
  Cc: linux-riscv, devicetree, linux-kernel

On Mon, Oct 14, 2024 at 10:54:17AM -0700, Drew Fustini wrote:
> This series of device tree patches enables the TH1520 pin controllers on
> the BeagleV Ahead and Lichee Pi 4A boards.
> 
> Patches 1-7 have all been cherry picked from esmil's th1520 branch [1].
> They do not have the issues pointed out in the previous series [2] that
> I sent out which contained out dated versions of the patches.
>
> [...]

I have applied all patches in this series to thead-dt-for-next [1].

Thanks,
Drew

[1] https://github.com/pdp7/linux/commits/thead-dt-for-next/

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2024-10-15 17:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-14 17:54 [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Drew Fustini
2024-10-14 17:54 ` [PATCH 1/8] riscv: dts: thead: Add TH1520 pin control nodes Drew Fustini
2024-10-14 17:54 ` [PATCH 2/8] riscv: dts: thead: Add TH1520 GPIO ranges Drew Fustini
2024-10-14 17:54 ` [PATCH 3/8] riscv: dts: thead: Adjust TH1520 GPIO labels Drew Fustini
2024-10-14 17:54 ` [PATCH 4/8] riscv: dts: thead: Add Lichee Pi 4M GPIO line names Drew Fustini
2024-10-14 17:54 ` [PATCH 5/8] riscv: dts: thead: Add TH1520 pinctrl settings for UART0 Drew Fustini
2024-10-14 17:54 ` [PATCH 6/8] riscv: dtb: thead: Add BeagleV Ahead LEDs Drew Fustini
2024-10-14 17:54 ` [PATCH 7/8] riscv: dts: thead: Add missing GPIO clock-names Drew Fustini
2024-10-14 17:54 ` [PATCH 8/8] riscv: dts: thead: remove enabled property for spi0 Drew Fustini
2024-10-15 17:19 ` [PATCH 0/8] riscv: dts: thead: Add TH1520 pin controller support Conor Dooley
2024-10-15 17:35   ` Drew Fustini
2024-10-15 17:49 ` Drew Fustini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox