From 4c1fe83bd5c839ccecabfe7c72ef0d532d30d8b3 Mon Sep 17 00:00:00 2001 From: FUKAUMI Naoki Date: Fri, 26 Jul 2024 07:03:18 +0900 Subject: [PATCH] rockchip: add RTL8723DS support for Radxa ROCK Pi S Radxa ROCK Pi S has a RTL8723DS Wi-Fi 4 on-board device. enable it. Signed-off-by: FUKAUMI Naoki Link: https://github.com/openwrt/openwrt/pull/15910 Signed-off-by: Hauke Mehrtens --- target/linux/rockchip/image/armv8.mk | 2 +- ...domain-Add-RK3308-IO-voltage-domains.patch | 86 ++++++++++++++++ ...ckchip-Add-rk3308-IO-voltage-domains.patch | 28 ++++++ ...ip-Add-io-domains-to-rk3308-rock-pi-.patch | 35 +++++++ ...ip-Update-WIFi-BT-related-nodes-on-r.patch | 97 +++++++++++++++++++ ...s-add-led-aliases-and-stop-heartbeat.patch | 6 +- 6 files changed, 250 insertions(+), 4 deletions(-) create mode 100644 target/linux/rockchip/patches-6.6/010-next-soc-rockchip-io-domain-Add-RK3308-IO-voltage-domains.patch create mode 100644 target/linux/rockchip/patches-6.6/011-v6.11-arm64-dts-rockchip-Add-rk3308-IO-voltage-domains.patch create mode 100644 target/linux/rockchip/patches-6.6/047-v6.11-arm64-dts-rockchip-Add-io-domains-to-rk3308-rock-pi-.patch create mode 100644 target/linux/rockchip/patches-6.6/048-v6.11-arm64-dts-rockchip-Update-WIFi-BT-related-nodes-on-r.patch diff --git a/target/linux/rockchip/image/armv8.mk b/target/linux/rockchip/image/armv8.mk index 2f0d6371dc..52702959e1 100644 --- a/target/linux/rockchip/image/armv8.mk +++ b/target/linux/rockchip/image/armv8.mk @@ -153,7 +153,7 @@ define Device/radxa_rock-pi-s DEVICE_MODEL := ROCK Pi S SOC := rk3308 BOOT_SCRIPT := rock-pi-s - DEVICE_PACKAGES := kmod-usb-net-cdc-ncm kmod-usb-net-rndis + DEVICE_PACKAGES := kmod-rtw88-8723ds kmod-usb-net-cdc-ncm kmod-usb-net-rndis wpad-basic-mbedtls endef TARGET_DEVICES += radxa_rock-pi-s diff --git a/target/linux/rockchip/patches-6.6/010-next-soc-rockchip-io-domain-Add-RK3308-IO-voltage-domains.patch b/target/linux/rockchip/patches-6.6/010-next-soc-rockchip-io-domain-Add-RK3308-IO-voltage-domains.patch new file mode 100644 index 0000000000..bb7f833977 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/010-next-soc-rockchip-io-domain-Add-RK3308-IO-voltage-domains.patch @@ -0,0 +1,86 @@ +From 0536fa6e6fa3e48f4ca11855b586c277be524fbe Mon Sep 17 00:00:00 2001 +From: David Wu +Date: Tue, 21 May 2024 21:10:13 +0000 +Subject: [PATCH] soc: rockchip: io-domain: Add RK3308 IO voltage domains + +Add IO voltage domains support for the RK3308 SoC. + +Signed-off-by: David Wu +Signed-off-by: Jianqun Xu +Signed-off-by: Jonas Karlman +Link: https://lore.kernel.org/r/20240521211029.1236094-11-jonas@kwiboo.se +Signed-off-by: Heiko Stuebner +--- + drivers/soc/rockchip/io-domain.c | 40 ++++++++++++++++++++++++++++++++ + 1 file changed, 40 insertions(+) + +--- a/drivers/soc/rockchip/io-domain.c ++++ b/drivers/soc/rockchip/io-domain.c +@@ -39,6 +39,10 @@ + #define RK3288_SOC_CON2_FLASH0 BIT(7) + #define RK3288_SOC_FLASH_SUPPLY_NUM 2 + ++#define RK3308_SOC_CON0 0x300 ++#define RK3308_SOC_CON0_VCCIO3 BIT(8) ++#define RK3308_SOC_VCCIO3_SUPPLY_NUM 3 ++ + #define RK3328_SOC_CON4 0x410 + #define RK3328_SOC_CON4_VCCIO2 BIT(7) + #define RK3328_SOC_VCCIO2_SUPPLY_NUM 1 +@@ -229,6 +233,25 @@ static void rk3288_iodomain_init(struct + dev_warn(iod->dev, "couldn't update flash0 ctrl\n"); + } + ++static void rk3308_iodomain_init(struct rockchip_iodomain *iod) ++{ ++ int ret; ++ u32 val; ++ ++ /* if no vccio3 supply we should leave things alone */ ++ if (!iod->supplies[RK3308_SOC_VCCIO3_SUPPLY_NUM].reg) ++ return; ++ ++ /* ++ * set vccio3 iodomain to also use this framework ++ * instead of a special gpio. ++ */ ++ val = RK3308_SOC_CON0_VCCIO3 | (RK3308_SOC_CON0_VCCIO3 << 16); ++ ret = regmap_write(iod->grf, RK3308_SOC_CON0, val); ++ if (ret < 0) ++ dev_warn(iod->dev, "couldn't update vccio3 vsel ctrl\n"); ++} ++ + static void rk3328_iodomain_init(struct rockchip_iodomain *iod) + { + int ret; +@@ -376,6 +399,19 @@ static const struct rockchip_iodomain_so + .init = rk3288_iodomain_init, + }; + ++static const struct rockchip_iodomain_soc_data soc_data_rk3308 = { ++ .grf_offset = 0x300, ++ .supply_names = { ++ "vccio0", ++ "vccio1", ++ "vccio2", ++ "vccio3", ++ "vccio4", ++ "vccio5", ++ }, ++ .init = rk3308_iodomain_init, ++}; ++ + static const struct rockchip_iodomain_soc_data soc_data_rk3328 = { + .grf_offset = 0x410, + .supply_names = { +@@ -529,6 +565,10 @@ static const struct of_device_id rockchi + .data = &soc_data_rk3288 + }, + { ++ .compatible = "rockchip,rk3308-io-voltage-domain", ++ .data = &soc_data_rk3308 ++ }, ++ { + .compatible = "rockchip,rk3328-io-voltage-domain", + .data = &soc_data_rk3328 + }, diff --git a/target/linux/rockchip/patches-6.6/011-v6.11-arm64-dts-rockchip-Add-rk3308-IO-voltage-domains.patch b/target/linux/rockchip/patches-6.6/011-v6.11-arm64-dts-rockchip-Add-rk3308-IO-voltage-domains.patch new file mode 100644 index 0000000000..3565acd2e4 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/011-v6.11-arm64-dts-rockchip-Add-rk3308-IO-voltage-domains.patch @@ -0,0 +1,28 @@ +From d1829ba469d5743734e37d59fece73e3668ab084 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Tue, 21 May 2024 21:10:14 +0000 +Subject: [PATCH] arm64: dts: rockchip: Add rk3308 IO voltage domains + +Add a disabled RK3308 IO voltage domains node to SoC DT. + +Signed-off-by: Jonas Karlman +Link: https://lore.kernel.org/r/20240521211029.1236094-12-jonas@kwiboo.se +Signed-off-by: Heiko Stuebner +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -168,6 +168,11 @@ + compatible = "rockchip,rk3308-grf", "syscon", "simple-mfd"; + reg = <0x0 0xff000000 0x0 0x08000>; + ++ io_domains: io-domains { ++ compatible = "rockchip,rk3308-io-voltage-domain"; ++ status = "disabled"; ++ }; ++ + reboot-mode { + compatible = "syscon-reboot-mode"; + offset = <0x500>; diff --git a/target/linux/rockchip/patches-6.6/047-v6.11-arm64-dts-rockchip-Add-io-domains-to-rk3308-rock-pi-.patch b/target/linux/rockchip/patches-6.6/047-v6.11-arm64-dts-rockchip-Add-io-domains-to-rk3308-rock-pi-.patch new file mode 100644 index 0000000000..149cadf863 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/047-v6.11-arm64-dts-rockchip-Add-io-domains-to-rk3308-rock-pi-.patch @@ -0,0 +1,35 @@ +From 100b3bdee6035192f6d4a1847970fe004bb505fb Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Tue, 21 May 2024 21:10:15 +0000 +Subject: [PATCH] arm64: dts: rockchip: Add io-domains to rk3308-rock-pi-s + +The VCCIO4 io-domain used for WiFi/BT is using 1v8 IO signal voltage. + +Add io-domains node with the VCCIO supplies connected on the board. + +Signed-off-by: Jonas Karlman +Link: https://lore.kernel.org/r/20240521211029.1236094-13-jonas@kwiboo.se +Signed-off-by: Heiko Stuebner +--- + arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts +@@ -231,6 +231,16 @@ + status = "okay"; + }; + ++&io_domains { ++ vccio0-supply = <&vcc_io>; ++ vccio1-supply = <&vcc_io>; ++ vccio2-supply = <&vcc_io>; ++ vccio3-supply = <&vcc_io>; ++ vccio4-supply = <&vcc_1v8>; ++ vccio5-supply = <&vcc_io>; ++ status = "okay"; ++}; ++ + &pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&rtc_32k>; diff --git a/target/linux/rockchip/patches-6.6/048-v6.11-arm64-dts-rockchip-Update-WIFi-BT-related-nodes-on-r.patch b/target/linux/rockchip/patches-6.6/048-v6.11-arm64-dts-rockchip-Update-WIFi-BT-related-nodes-on-r.patch new file mode 100644 index 0000000000..976e5f4cdf --- /dev/null +++ b/target/linux/rockchip/patches-6.6/048-v6.11-arm64-dts-rockchip-Update-WIFi-BT-related-nodes-on-r.patch @@ -0,0 +1,97 @@ +From 12c3ec878cbe3709782e85b88124abecc3bb8617 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Tue, 21 May 2024 21:10:16 +0000 +Subject: [PATCH] arm64: dts: rockchip: Update WIFi/BT related nodes on + rk3308-rock-pi-s + +Update WiFi SDIO and BT UART related props to better reflect details +about the optional onboard RTL8723DS WiFi/BT module. + +Also correct the compatible used for bluetooth to match the WiFi/BT +module used on the board. + +Fixes: bc3753aed81f ("arm64: dts: rockchip: rock-pi-s add more peripherals") +Signed-off-by: Jonas Karlman +Link: https://lore.kernel.org/r/20240521211029.1236094-14-jonas@kwiboo.se +Signed-off-by: Heiko Stuebner +--- + .../boot/dts/rockchip/rk3308-rock-pi-s.dts | 40 +++++++++++++++++-- + 1 file changed, 36 insertions(+), 4 deletions(-) + +--- a/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts +@@ -17,6 +17,7 @@ + ethernet0 = &gmac; + mmc0 = &emmc; + mmc1 = &sdmmc; ++ mmc2 = &sdio; + }; + + chosen { +@@ -245,6 +246,20 @@ + pinctrl-names = "default"; + pinctrl-0 = <&rtc_32k>; + ++ bluetooth { ++ bt_reg_on: bt-reg-on { ++ rockchip,pins = <4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ bt_wake_host: bt-wake-host { ++ rockchip,pins = <4 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ host_wake_bt: host-wake-bt { ++ rockchip,pins = <4 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ + gmac { + mac_rst: mac-rst { + rockchip,pins = <0 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; +@@ -294,11 +309,24 @@ + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; +- max-frequency = <1000000>; ++ max-frequency = <100000000>; + mmc-pwrseq = <&sdio_pwrseq>; ++ no-mmc; ++ no-sd; + non-removable; +- sd-uhs-sdr104; ++ sd-uhs-sdr50; ++ vmmc-supply = <&vcc_io>; ++ vqmmc-supply = <&vcc_1v8>; + status = "okay"; ++ ++ rtl8723ds: wifi@1 { ++ reg = <1>; ++ interrupt-parent = <&gpio0>; ++ interrupts = ; ++ interrupt-names = "host-wake"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_host_wake>; ++ }; + }; + + &sdmmc { +@@ -330,12 +358,16 @@ + }; + + &uart4 { ++ uart-has-rtscts; + status = "okay"; + + bluetooth { +- compatible = "realtek,rtl8723bs-bt"; +- device-wake-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>; ++ compatible = "realtek,rtl8723ds-bt"; ++ device-wake-gpios = <&gpio4 RK_PB2 GPIO_ACTIVE_HIGH>; ++ enable-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>; + host-wake-gpios = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&bt_reg_on &bt_wake_host &host_wake_bt>; + }; + }; + diff --git a/target/linux/rockchip/patches-6.6/113-rock-pi-s-add-led-aliases-and-stop-heartbeat.patch b/target/linux/rockchip/patches-6.6/113-rock-pi-s-add-led-aliases-and-stop-heartbeat.patch index 9564c900a2..48a617b09a 100644 --- a/target/linux/rockchip/patches-6.6/113-rock-pi-s-add-led-aliases-and-stop-heartbeat.patch +++ b/target/linux/rockchip/patches-6.6/113-rock-pi-s-add-led-aliases-and-stop-heartbeat.patch @@ -1,9 +1,9 @@ --- a/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts +++ b/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts -@@ -17,6 +17,10 @@ - ethernet0 = &gmac; +@@ -18,6 +18,10 @@ mmc0 = &emmc; mmc1 = &sdmmc; + mmc2 = &sdio; + led-boot = &blue_led; + led-failsafe = &blue_led; + led-running = &blue_led; @@ -11,7 +11,7 @@ }; chosen { -@@ -28,22 +32,19 @@ +@@ -29,22 +33,19 @@ pinctrl-names = "default"; pinctrl-0 = <&green_led>, <&heartbeat_led>; -- 2.30.2