Devicetree
 help / color / mirror / Atom feed
* [PATCH v2 0/2] riscv: dts: thead: Enable Lichee Pi 4A WiFi
@ 2026-05-08 11:44 MoeLeak
  2026-05-08 11:44 ` [PATCH v2 1/2] riscv: dts: thead: Add TH1520 I2C1 controller MoeLeak
  2026-05-08 11:44 ` [PATCH v2 2/2] riscv: dts: thead: Enable WiFi on Lichee Pi 4A MoeLeak
  0 siblings, 2 replies; 4+ messages in thread
From: MoeLeak @ 2026-05-08 11:44 UTC (permalink / raw)
  To: Drew Fustini, Guo Ren, Fu Wei
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, linux-riscv,
	devicetree, linux-kernel, MoeLeak

Enable the RTL8723DS WiFi module on the Sipeed Lichee Pi 4A.

The module is connected to the TH1520 SDIO1 controller, while its reset
line is controlled through a PCA9557 GPIO expander on I2C1. Add the I2C1
controller to the TH1520 SoC description first, then enable the board
specific I2C1, GPIO expander, MMC power sequencing, and SDIO1 wiring.

Thanks to Drew for the detailed review and for pointing out the missing
commit message, recipient list, revision notes, and patch split. This v2
series follows that feedback.

Changes in v2:
- Split the TH1520 I2C1 controller addition into a separate patch.
- Add commit messages describing why the changes are needed.
- Add revision number to the patch subjects.
- Add MAINTAINERS-derived To/Cc recipients from get_maintainer.pl.

Signed-off-by: MoeLeak <i@leak.moe>
---
MoeLeak (2):
      riscv: dts: thead: Add TH1520 I2C1 controller
      riscv: dts: thead: Enable WiFi on Lichee Pi 4A

 arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts | 47 +++++++++++++++++++++++
 arch/riscv/boot/dts/thead/th1520.dtsi             | 11 ++++++
 2 files changed, 58 insertions(+)
---
base-commit: 897d54018cc9aa97fd1529ca08a53b429d05a566
change-id: 20260508-lichee-pi-4a-wifi-26b722a4df13

Best regards,
--  
MoeLeak <i@leak.moe>


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

* [PATCH v2 1/2] riscv: dts: thead: Add TH1520 I2C1 controller
  2026-05-08 11:44 [PATCH v2 0/2] riscv: dts: thead: Enable Lichee Pi 4A WiFi MoeLeak
@ 2026-05-08 11:44 ` MoeLeak
  2026-05-08 11:44 ` [PATCH v2 2/2] riscv: dts: thead: Enable WiFi on Lichee Pi 4A MoeLeak
  1 sibling, 0 replies; 4+ messages in thread
From: MoeLeak @ 2026-05-08 11:44 UTC (permalink / raw)
  To: Drew Fustini, Guo Ren, Fu Wei
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, linux-riscv,
	devicetree, linux-kernel, MoeLeak

Describe the TH1520 I2C1 controller so boards can enable devices attached
to that bus.

The controller is disabled by default because pinmuxing and connected
peripherals are board-specific.

Signed-off-by: MoeLeak <i@leak.moe>
---
 arch/riscv/boot/dts/thead/th1520.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi
index 5e91dc1d2b9b..94932c51b7e3 100644
--- a/arch/riscv/boot/dts/thead/th1520.dtsi
+++ b/arch/riscv/boot/dts/thead/th1520.dtsi
@@ -411,6 +411,17 @@ uart3: serial@ffe7f04000 {
 			status = "disabled";
 		};
 
+		i2c1: i2c@ffe7f24000 {
+			compatible = "thead,th1520-i2c", "snps,designware-i2c";
+			reg = <0xff 0xe7f24000 0x0 0x4000>;
+			interrupts = <45 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&clk CLK_I2C1>, <&clk CLK_PERI_APB_PCLK>;
+			clock-names = "ref", "pclk";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
 		gpio@ffe7f34000 {
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff 0xe7f34000 0x0 0x1000>;

-- 
2.53.0


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

* [PATCH v2 2/2] riscv: dts: thead: Enable WiFi on Lichee Pi 4A
  2026-05-08 11:44 [PATCH v2 0/2] riscv: dts: thead: Enable Lichee Pi 4A WiFi MoeLeak
  2026-05-08 11:44 ` [PATCH v2 1/2] riscv: dts: thead: Add TH1520 I2C1 controller MoeLeak
@ 2026-05-08 11:44 ` MoeLeak
  2026-05-08 20:39   ` sashiko-bot
  1 sibling, 1 reply; 4+ messages in thread
From: MoeLeak @ 2026-05-08 11:44 UTC (permalink / raw)
  To: Drew Fustini, Guo Ren, Fu Wei
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, linux-riscv,
	devicetree, linux-kernel, MoeLeak

The Lichee Pi 4A has an RTL8723DS WiFi module connected to the TH1520
SDIO1 controller. The module reset line is driven through a PCA9557 GPIO
expander on the I2C1 bus.

Enable I2C1 for the GPIO expander and configure SDIO1 as a non-removable
4-bit SDIO bus using an mmc-pwrseq-simple reset sequence so the WiFi
device can be powered and enumerated.

Signed-off-by: MoeLeak <i@leak.moe>
---
 arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts | 47 +++++++++++++++++++++++
 1 file changed, 47 insertions(+)

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 7cb7d28683bc..af6f25ebbf60 100644
--- a/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
+++ b/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
@@ -4,6 +4,7 @@
  */
 
 #include "th1520-lichee-module-4a.dtsi"
+#include <dt-bindings/gpio/gpio.h>
 
 / {
 	model = "Sipeed Lichee Pi 4A";
@@ -40,6 +41,12 @@ hdmi_con_in: endpoint {
 		};
 	};
 
+	wifi_pwrseq: wifi-pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		reset-gpios = <&ioexp2 4 GPIO_ACTIVE_LOW>;
+		post-power-on-delay-ms = <200>;
+	};
+
 	thermal-zones {
 		cpu-thermal {
 			polling-delay = <1000>;
@@ -96,6 +103,20 @@ fan: pwm-fan {
 
 };
 
+&padctrl1_apsys {
+	i2c1_pins: i2c1-0 {
+		i2c-pins {
+			pins = "I2C1_SCL", "I2C1_SDA";
+			function = "i2c";
+			bias-pull-up = <2100>;
+			drive-strength = <7>;
+			input-enable;
+			input-schmitt-enable;
+			slew-rate = <0>;
+		};
+	};
+};
+
 &padctrl0_apsys {
 	fan_pins: fan-0 {
 		pwm1-pins {
@@ -132,6 +153,32 @@ rx-pins {
 	};
 };
 
+&i2c1 {
+	clock-frequency = <400000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c1_pins>;
+	status = "okay";
+
+	ioexp2: gpio@18 {
+		compatible = "nxp,pca9557";
+		reg = <0x18>;
+		gpio-controller;
+		#gpio-cells = <2>;
+	};
+};
+
+&sdio1 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	bus-width = <4>;
+	max-frequency = <198000000>;
+	cap-sdio-irq;
+	keep-power-in-suspend;
+	mmc-pwrseq = <&wifi_pwrseq>;
+	non-removable;
+	status = "okay";
+};
+
 &dpu {
 	status = "okay";
 };

-- 
2.53.0


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

* Re: [PATCH v2 2/2] riscv: dts: thead: Enable WiFi on Lichee Pi 4A
  2026-05-08 11:44 ` [PATCH v2 2/2] riscv: dts: thead: Enable WiFi on Lichee Pi 4A MoeLeak
@ 2026-05-08 20:39   ` sashiko-bot
  0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-05-08 20:39 UTC (permalink / raw)
  To: MoeLeak; +Cc: conor+dt, devicetree, krzk+dt, robh

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The `&sdio1` node specifies `#address-cells = <1>;` and `#size-cells = <0>;` but contains no child nodes.
--

commit 89c378a34273e40ecc4c5313fff87bf9f739222c
Author: MoeLeak <i@leak.moe>

riscv: dts: thead: Enable WiFi on Lichee Pi 4A

This commit enables the RTL8723DS WiFi module on the Lichee Pi 4A. It
configures the SDIO1 controller and sets up the I2C1 bus for the GPIO
expander used to drive the module reset line.

> 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 7cb7d28683bce..af6f25ebbf607 100644
> --- a/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
> +++ b/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts

[ ... ]

> @@ -132,6 +153,32 @@ rx-pins {
>  	};
>  };
>  

[ ... ]

> +&sdio1 {
> +	#address-cells = <1>;
> +	#size-cells = <0>;

This isn't a bug, but since this node does not contain any child nodes,
will including #address-cells and #size-cells trigger the dtc compiler
warning for avoid_unnecessary_addr_size?

Should these properties be removed if no child node is being explicitly
added for the WiFi module?

> +	bus-width = <4>;
> +	max-frequency = <198000000>;
> +	cap-sdio-irq;
> +	keep-power-in-suspend;
> +	mmc-pwrseq = <&wifi_pwrseq>;
> +	non-removable;
> +	status = "okay";
> +};

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260508-lichee-pi-4a-wifi-v2-0-7acf63559e62@leak.moe?part=2

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

end of thread, other threads:[~2026-05-08 20:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-08 11:44 [PATCH v2 0/2] riscv: dts: thead: Enable Lichee Pi 4A WiFi MoeLeak
2026-05-08 11:44 ` [PATCH v2 1/2] riscv: dts: thead: Add TH1520 I2C1 controller MoeLeak
2026-05-08 11:44 ` [PATCH v2 2/2] riscv: dts: thead: Enable WiFi on Lichee Pi 4A MoeLeak
2026-05-08 20:39   ` sashiko-bot

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