From 2f60e351633044dee88b63fb1600e284d2476e9c Mon Sep 17 00:00:00 2001 From: MoeLeak Date: Fri, 8 May 2026 19:44:13 +0800 Subject: [PATCH 1/3] riscv: dts: thead: Add TH1520 I2C1 controller 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 Signed-off-by: Drew Fustini --- 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>; From a20241c08385c875c4d0deb6c8ffc15f13f5b388 Mon Sep 17 00:00:00 2001 From: MoeLeak Date: Fri, 8 May 2026 19:44:14 +0800 Subject: [PATCH 2/3] riscv: dts: thead: Enable WiFi on Lichee Pi 4A 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 Signed-off-by: Drew Fustini --- .../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 / { 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"; }; From 3a5791956edbfa84d7256224167941931cbc46e7 Mon Sep 17 00:00:00 2001 From: Thomas Gerner Date: Thu, 14 May 2026 20:32:01 +0200 Subject: [PATCH 3/3] riscv: dts: thead: Enable wifi on the BeagleV-Ahead The BeagleV-Ahead board uses an AP6203BM WiFi chip from AMPAK Technology Inc. connected to SDIO1. The chip is compatible to the broadcom wireless driver. The AP6203BM is a dual-band 2.4GHz/5GHz Wi-Fi 4 (802.11a/b/g/n) and Bluetooth 5.4 module. Bluetooth is not enabled by this patch. Signed-off-by: Thomas Gerner Signed-off-by: Drew Fustini --- .../boot/dts/thead/th1520-beaglev-ahead.dts | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts index 91f3f9b987bc..e16484a47653 100644 --- a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +++ b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts @@ -86,6 +86,11 @@ hdmi_con_in: endpoint { }; }; }; + + wifi_pwrseq: wifi-pwrseq { + compatible = "mmc-pwrseq-simple"; + reset-gpios = <&gpio2 31 GPIO_ACTIVE_LOW>; /* WL-REG-ON */ + }; }; &osc { @@ -239,6 +244,28 @@ rx-pins { slew-rate = <0>; }; }; + + wifi_pins: wifi-0 { + host-wake-pins { + pins = "GPIO2_25"; + function = "gpio"; + bias-disable; + drive-strength = <1>; + input-enable; + input-schmitt-disable; + slew-rate = <0>; + }; + + reg-on-pins { + pins = "GPIO2_31"; + function = "gpio"; + bias-disable; + drive-strength = <3>; + input-disable; + input-schmitt-disable; + slew-rate = <0>; + }; + }; }; &sdio0 { @@ -247,6 +274,27 @@ &sdio0 { status = "okay"; }; +&sdio1 { + bus-width = <4>; + max-frequency = <198000000>; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_pins>; + #address-cells = <1>; + #size-cells = <0>; + non-removable; + keep-power-in-suspend; + mmc-pwrseq = <&wifi_pwrseq>; + status = "okay"; + + wifi@1 { + compatible = "cypress,cyw43012-fmac", "brcm,bcm4329-fmac"; + reg = <1>; + interrupt-parent = <&gpio2>; + interrupts = <25 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "host-wake"; + }; +}; + &dpu { status = "okay"; };