Skip to content

Commit 2858333

Browse files
authored
nanopi-r76s: fix slow WiFi by enabling SDIO SDR104 (#9929)
* rockchip64: mmc: skip SDIO 1.8V switch when host already at 1.8V A UHS SDIO card can report S18A=1 even on a fixed-1.8V rail, so the core ran CMD11 and stalled the dw_mmc voltage switch, capping the bus at HS 50MHz. Guard the switch on signal_voltage, mirroring mmc_sd_init_card. Added for current, edge and bleedingedge. Signed-off-by: SuperKali <hello@superkali.me> * nanopi-r76s: add cap-sd-highspeed to SDIO WiFi node Gives the RTL8822CS a clean 50MHz high-speed fallback if SDR104 tuning fails, instead of dropping to 25MHz legacy. With the mmc CMD11 fix the WiFi now links at SDR104 200MHz, ~210 Mbit/s down versus 51 before. Signed-off-by: SuperKali <hello@superkali.me> --------- Signed-off-by: SuperKali <hello@superkali.me>
1 parent 107075b commit 2858333

6 files changed

Lines changed: 129 additions & 0 deletions

patch/kernel/archive/rockchip64-6.18/dt/rk3576-nanopi-r76s.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@
753753
&sdio {
754754
max-frequency = <200000000>;
755755
bus-width = <4>;
756+
cap-sd-highspeed;
756757
cap-sdio-irq;
757758
disable-wp;
758759
keep-power-in-suspend;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: SuperKali <hello@superkali.me>
3+
Date: Wed, 3 Jun 2026 17:28:00 +0000
4+
Subject: mmc: sdio: skip the 1.8V switch when the host already signals at 1.8V
5+
6+
A UHS-capable SDIO card can report S18A=1 even when the host signalling
7+
is already pinned to 1.8V. The core then issues CMD11 anyway, and with no
8+
real 3.3V to 1.8V transition the controller can stall on the voltage-switch
9+
clock update and fall back to high speed.
10+
11+
Skip the switch when ios.signal_voltage is already 1.8V, the same guard
12+
mmc_sd_init_card() uses on the SD path. This lets an RTL8822CS on a
13+
fixed-1.8V rail come up at SDR104.
14+
15+
Signed-off-by: SuperKali <hello@superkali.me>
16+
---
17+
drivers/mmc/core/sdio.c | 8 +++++++-
18+
1 file changed, 7 insertions(+), 1 deletion(-)
19+
20+
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
21+
index 111111111111..222222222222 100644
22+
--- a/drivers/mmc/core/sdio.c
23+
+++ b/drivers/mmc/core/sdio.c
24+
@@ -738,8 +738,14 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
25+
* fails to check rocr & R4_18V_PRESENT, but we still need to
26+
* try to init uhs card. sdio_read_cccr will take over this task
27+
* to make sure which speed mode should work.
28+
+ *
29+
+ * If the host already signals at 1.8V there is nothing to switch.
30+
+ * Some cards still report S18A=1, so guard CMD11 explicitly to avoid
31+
+ * a redundant voltage switch that can stall the controller. Mirrors
32+
+ * mmc_sd_init_card().
33+
*/
34+
- if (rocr & ocr & R4_18V_PRESENT) {
35+
+ if ((rocr & ocr & R4_18V_PRESENT) &&
36+
+ host->ios.signal_voltage != MMC_SIGNAL_VOLTAGE_180) {
37+
err = mmc_set_uhs_voltage(host, ocr_card);
38+
if (err == -EAGAIN) {
39+
mmc_sdio_pre_init(host, ocr_card, card);
40+
--
41+
Armbian
42+

patch/kernel/archive/rockchip64-7.0/dt/rk3576-nanopi-r76s.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@
753753
&sdio {
754754
max-frequency = <200000000>;
755755
bus-width = <4>;
756+
cap-sd-highspeed;
756757
cap-sdio-irq;
757758
disable-wp;
758759
keep-power-in-suspend;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: SuperKali <hello@superkali.me>
3+
Date: Wed, 3 Jun 2026 17:28:00 +0000
4+
Subject: mmc: sdio: skip the 1.8V switch when the host already signals at 1.8V
5+
6+
A UHS-capable SDIO card can report S18A=1 even when the host signalling
7+
is already pinned to 1.8V. The core then issues CMD11 anyway, and with no
8+
real 3.3V to 1.8V transition the controller can stall on the voltage-switch
9+
clock update and fall back to high speed.
10+
11+
Skip the switch when ios.signal_voltage is already 1.8V, the same guard
12+
mmc_sd_init_card() uses on the SD path. This lets an RTL8822CS on a
13+
fixed-1.8V rail come up at SDR104.
14+
15+
Signed-off-by: SuperKali <hello@superkali.me>
16+
---
17+
drivers/mmc/core/sdio.c | 8 +++++++-
18+
1 file changed, 7 insertions(+), 1 deletion(-)
19+
20+
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
21+
index 111111111111..222222222222 100644
22+
--- a/drivers/mmc/core/sdio.c
23+
+++ b/drivers/mmc/core/sdio.c
24+
@@ -738,8 +738,14 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
25+
* fails to check rocr & R4_18V_PRESENT, but we still need to
26+
* try to init uhs card. sdio_read_cccr will take over this task
27+
* to make sure which speed mode should work.
28+
+ *
29+
+ * If the host already signals at 1.8V there is nothing to switch.
30+
+ * Some cards still report S18A=1, so guard CMD11 explicitly to avoid
31+
+ * a redundant voltage switch that can stall the controller. Mirrors
32+
+ * mmc_sd_init_card().
33+
*/
34+
- if (rocr & ocr & R4_18V_PRESENT) {
35+
+ if ((rocr & ocr & R4_18V_PRESENT) &&
36+
+ host->ios.signal_voltage != MMC_SIGNAL_VOLTAGE_180) {
37+
err = mmc_set_uhs_voltage(host, ocr_card);
38+
if (err == -EAGAIN) {
39+
mmc_sdio_pre_init(host, ocr_card, card);
40+
--
41+
Armbian
42+

patch/kernel/archive/rockchip64-7.1/dt/rk3576-nanopi-r76s.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@
753753
&sdio {
754754
max-frequency = <200000000>;
755755
bus-width = <4>;
756+
cap-sd-highspeed;
756757
cap-sdio-irq;
757758
disable-wp;
758759
keep-power-in-suspend;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: SuperKali <hello@superkali.me>
3+
Date: Wed, 3 Jun 2026 17:28:00 +0000
4+
Subject: mmc: sdio: skip the 1.8V switch when the host already signals at 1.8V
5+
6+
A UHS-capable SDIO card can report S18A=1 even when the host signalling
7+
is already pinned to 1.8V. The core then issues CMD11 anyway, and with no
8+
real 3.3V to 1.8V transition the controller can stall on the voltage-switch
9+
clock update and fall back to high speed.
10+
11+
Skip the switch when ios.signal_voltage is already 1.8V, the same guard
12+
mmc_sd_init_card() uses on the SD path. This lets an RTL8822CS on a
13+
fixed-1.8V rail come up at SDR104.
14+
15+
Signed-off-by: SuperKali <hello@superkali.me>
16+
---
17+
drivers/mmc/core/sdio.c | 8 +++++++-
18+
1 file changed, 7 insertions(+), 1 deletion(-)
19+
20+
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
21+
index 111111111111..222222222222 100644
22+
--- a/drivers/mmc/core/sdio.c
23+
+++ b/drivers/mmc/core/sdio.c
24+
@@ -738,8 +738,14 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
25+
* fails to check rocr & R4_18V_PRESENT, but we still need to
26+
* try to init uhs card. sdio_read_cccr will take over this task
27+
* to make sure which speed mode should work.
28+
+ *
29+
+ * If the host already signals at 1.8V there is nothing to switch.
30+
+ * Some cards still report S18A=1, so guard CMD11 explicitly to avoid
31+
+ * a redundant voltage switch that can stall the controller. Mirrors
32+
+ * mmc_sd_init_card().
33+
*/
34+
- if (rocr & ocr & R4_18V_PRESENT) {
35+
+ if ((rocr & ocr & R4_18V_PRESENT) &&
36+
+ host->ios.signal_voltage != MMC_SIGNAL_VOLTAGE_180) {
37+
err = mmc_set_uhs_voltage(host, ocr_card);
38+
if (err == -EAGAIN) {
39+
mmc_sdio_pre_init(host, ocr_card, card);
40+
--
41+
Armbian
42+

0 commit comments

Comments
 (0)