arm64: dts: rockchip: Enable Wi-Fi on the NanoPi M5
Subsystems (2)
PATCH 1/1 arm64: dts: rockchip: Enable Wi-Fi on the NanoPi M5
The NanoPi M5 has an M.2 E-key slot for SDIO Wi-Fi modules such as the RTL8822CS-based AC200. The SDIO controller is disabled and the module's power sequence is not described, preventing the card from enumerating.
Enable the controller in four-bit SDR104 mode and connect its 3.3 V card and 1.8 V I/O supplies. Describe the active-low reset on GPIO1_C2, the 200 ms power-on delay used by the vendor device tree, and the external 32.768 kHz clock from the HYM8563 RTC. Keep the card powered during suspend as required by the rtw88 SDIO driver.
--- .../boot/dts/rockchip/rk3576-nanopi-m5.dts | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+)
arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts +34 -0
@@ -23,6 +23,7 @@ aliases { ethernet0 = &gmac0; ethernet1 = &gmac1; mmc0 = &sdmmc; + mmc1 = &sdio; }; chosen {
@@ -212,6 +213,16 @@ vcc_3v3_s0: regulator-vcc-3v3-s0 { vin-supply = <&vcc_3v3_s3>; }; + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&hym8563>; + clock-names = "ext_clock"; + pinctrl-0 = <&wifi_reg_on_h>; + pinctrl-names = "default"; + post-power-on-delay-ms = <200>; + reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; + }; + sound { compatible = "simple-audio-card"; pinctrl-names = "default";
@@ -855,6 +866,12 @@ pcie0_perstn: pcie0-perstn { }; }; + sdio-pwrseq { + wifi_reg_on_h: wifi-reg-on-h { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + sdmmc { sdmmc0_pwren_h: sdmmc0-pwren-h { rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>;
@@ -890,6 +907,23 @@ &saradc { status = "okay"; }; +&sdio { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + disable-wp; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + no-mmc; + no-sd; + non-removable; + sd-uhs-sdr104; + vmmc-supply = <&vcc_3v3_s3>; + vqmmc-supply = <&vcc_1v8_s3>; + + status = "okay"; +}; + &sdmmc { bus-width = <4>; cap-sd-highspeed;
Signature · 1 line
2.47.3
Quoted 58 lines · Leonard Lausen
The NanoPi M5 has an M.2 E-key slot for SDIO Wi-Fi modules such as the RTL8822CS-based AC200. The SDIO controller is disabled and the module's power sequence is not described, preventing the card from enumerating.
Enable the controller in four-bit SDR104 mode and connect its 3.3 V card and 1.8 V I/O supplies. Describe the active-low reset on
GPIO1_C2, the 200 ms power-on delay used by the vendor device tree, and the external 32.768 kHz clock from the HYM8563 RTC. Keep the card powered during suspend as required by the rtw88 SDIO driver.Signed-off-by Leonard Lausen <[email protected]>--- .../boot/dts/rockchip/rk3576-nanopi-m5.dts | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+)arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts +17
-0@@ -23,6 +23,7 @@ aliases { ethernet0 = &gmac0; ethernet1 = &gmac1; mmc0 = &sdmmc; + mmc1 = &sdio; }; chosen {@@ -212,6 +213,16 @@ vcc_3v3_s0: regulator-vcc-3v3-s0 { vin-supply = <&vcc_3v3_s3>; }; + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&hym8563>; + clock-names = "ext_clock"; + pinctrl-0 = <&wifi_reg_on_h>; + pinctrl-names = "default"; + post-power-on-delay-ms = <200>; + reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; + }; + sound { compatible = "simple-audio-card"; pinctrl-names = "default";@@ -855,6 +866,12 @@ pcie0_perstn: pcie0-perstn { }; }; + sdio-pwrseq { + wifi_reg_on_h: wifi-reg-on-h { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + sdmmc { sdmmc0_pwren_h: sdmmc0-pwren-h { rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>;
arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts &saradc { · line 914
Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts +5
-0@@ -890,6 +907,23 @@ &saradc { status = "okay"; }; +&sdio { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + disable-wp;
disable-wp is for sd cards, please drop it.
Quoted 15 lines
arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts +12
-0+ keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + no-mmc; + no-sd; + non-removable; + sd-uhs-sdr104; + vmmc-supply = <&vcc_3v3_s3>; + vqmmc-supply = <&vcc_1v8_s3>; + + status = "okay"; +}; + &sdmmc { bus-width = <4>; cap-sd-highspeed;
PATCH v2 1/1 arm64: dts: rockchip: Enable Wi-Fi on the NanoPi M5
The NanoPi M5 has an M.2 E-key slot for SDIO Wi-Fi modules such as the RTL8822CS-based AC200. The SDIO controller is disabled and the module's power sequence is not described, preventing the card from enumerating.
Enable the controller in four-bit SDR104 mode and connect its 3.3 V card and 1.8 V I/O supplies. Describe the active-low reset on GPIO1_C2, the 200 ms power-on delay used by the vendor device tree, and the external 32.768 kHz clock from the HYM8563 RTC. Keep the card powered during suspend as required by the rtw88 SDIO driver.
The SDIO wiring and reset timing are based on FriendlyElec's NanoPi M5 vendor device tree by jensen <[email protected]>.
---
Hi Shawn,
Quoted 1 line
disable-wp is for sd cards, please drop it.
Thank you. Dropped it from the SDIO controller in v2. This was mistakenly copied from vendor source.
Changes in v2:
- Drop disable-wp from the SDIO controller (Shawn Lin).
- Credit the original vendor source and document AI assistance.
AI assistance was used to inspect the vendor DTS and schematics, draft the DTS changes and commit message, and run build/style checks.
.../boot/dts/rockchip/rk3576-nanopi-m5.dts | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+)
arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts +33 -0
@@ -23,6 +23,7 @@ aliases { ethernet0 = &gmac0; ethernet1 = &gmac1; mmc0 = &sdmmc; + mmc1 = &sdio; }; chosen {
@@ -212,6 +213,16 @@ vcc_3v3_s0: regulator-vcc-3v3-s0 { vin-supply = <&vcc_3v3_s3>; }; + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&hym8563>; + clock-names = "ext_clock"; + pinctrl-0 = <&wifi_reg_on_h>; + pinctrl-names = "default"; + post-power-on-delay-ms = <200>; + reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; + }; + sound { compatible = "simple-audio-card"; pinctrl-names = "default";
@@ -855,6 +866,12 @@ pcie0_perstn: pcie0-perstn { }; }; + sdio-pwrseq { + wifi_reg_on_h: wifi-reg-on-h { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + sdmmc { sdmmc0_pwren_h: sdmmc0-pwren-h { rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>;
@@ -890,6 +907,22 @@ &saradc { status = "okay"; }; +&sdio { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + no-mmc; + no-sd; + non-removable; + sd-uhs-sdr104; + vmmc-supply = <&vcc_3v3_s3>; + vqmmc-supply = <&vcc_1v8_s3>; + + status = "okay"; +}; + &sdmmc { bus-width = <4>; cap-sd-highspeed;
base-commit: ae965b9856f033145e292b0c29082a26bcc45efd
Signature · 1 line
2.47.3
Hi Leonard,
Quoted 4 lines · Leonard Lausen
The NanoPi M5 has an M.2 E-key slot for SDIO Wi-Fi modules such as the RTL8822CS-based AC200. The SDIO controller is disabled and the module's power sequence is not described, preventing the card from enumerating.
I suspect RTL8822CS doesn't work as-is, unless you need to apply it[1]. Please double check it.
[1] https://lore.kernel.org/linux-mmc/[email protected]/T/#t
Quoted 97 lines
Enable the controller in four-bit SDR104 mode and connect its 3.3 V card and 1.8 V I/O supplies. Describe the active-low reset on
GPIO1_C2, the 200 ms power-on delay used by the vendor device tree, and the external 32.768 kHz clock from the HYM8563 RTC. Keep the card powered during suspend as required by the rtw88 SDIO driver.The SDIO wiring and reset timing are based on FriendlyElec's NanoPi M5 vendor device tree by jensen <[email protected]>.
Assisted-by LLMSigned-off-by Leonard Lausen <[email protected]>---
Hi Shawn,Quoted 1 line
disable-wp is for sd cards, please drop it.
Thank you. Dropped it from the SDIO controller in v2. This was mistakenly copied from vendor source.
Changes in v2:
- Drop disable-wp from the SDIO controller (Shawn Lin).
- Credit the original vendor source and document AI assistance.AI assistance was used to inspect the vendor DTS and schematics, draft the DTS changes and commit message, and run build/style checks.
.../boot/dts/rockchip/rk3576-nanopi-m5.dts | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+)arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts +33
-0@@ -23,6 +23,7 @@ aliases { ethernet0 = &gmac0; ethernet1 = &gmac1; mmc0 = &sdmmc; + mmc1 = &sdio; }; chosen {@@ -212,6 +213,16 @@ vcc_3v3_s0: regulator-vcc-3v3-s0 { vin-supply = <&vcc_3v3_s3>; }; + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&hym8563>; + clock-names = "ext_clock"; + pinctrl-0 = <&wifi_reg_on_h>; + pinctrl-names = "default"; + post-power-on-delay-ms = <200>; + reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; + }; + sound { compatible = "simple-audio-card"; pinctrl-names = "default";@@ -855,6 +866,12 @@ pcie0_perstn: pcie0-perstn { }; }; + sdio-pwrseq { + wifi_reg_on_h: wifi-reg-on-h { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + sdmmc { sdmmc0_pwren_h: sdmmc0-pwren-h { rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>;@@ -890,6 +907,22 @@ &saradc { status = "okay"; }; +&sdio { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + no-mmc; + no-sd; + non-removable; + sd-uhs-sdr104; + vmmc-supply = <&vcc_3v3_s3>; + vqmmc-supply = <&vcc_1v8_s3>; + + status = "okay"; +}; + &sdmmc { bus-width = <4>; cap-sd-highspeed;base-commit:
ae965b9856f033145e292b0c29082a26bcc45efd
Quoted 7 lines
Quoted 4 lines
The NanoPi M5 has an M.2 E-key slot for SDIO Wi-Fi modules such as the RTL8822CS-based AC200. The SDIO controller is disabled and the module's power sequence is not described, preventing the card from enumerating.
I suspect RTL8822CS doesn't work as-is, unless you need to apply it[1]. Please double check it.
Thank you, Shawn Confirmed your series fixes SDR104 and improves the wifi throughput. Throughput still stays substantially below the 792 Mbit/s raw SDIO bandwidth. I prepared a few commits to remove overhead. First two are at https://lore.kernel.org/linux-wireless/[email protected]/
Quoted 11 lines · Leonard Lausen
The NanoPi M5 has an M.2 E-key slot for SDIO Wi-Fi modules such as the RTL8822CS-based AC200. The SDIO controller is disabled and the module's power sequence is not described, preventing the card from enumerating.
Enable the controller in four-bit SDR104 mode and connect its 3.3 V card and 1.8 V I/O supplies. Describe the active-low reset on
GPIO1_C2, the 200 ms power-on delay used by the vendor device tree, and the external 32.768 kHz clock from the HYM8563 RTC. Keep the card powered during suspend as required by the rtw88 SDIO driver.[...]
Applied, thanks!
[1/1] arm64: dts: rockchip: Enable Wi-Fi on the NanoPi M5
commit: 2712e8fa4d1108b33ce3a49c9459d9b88489f639
Best regards,
Signature · 1 line
Heiko Stuebner <[email protected]>