Re: [PATCH v2 7/7] riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes
From: Trevor Gamblin
Date: Fri Mar 13 2026 - 13:13:08 EST
On 2026-03-13 10:42, Anand Moon wrote:
Hi Trevor,Yes, my mistake - with 7.0-rc3 it works for me:
On Fri, 13 Mar 2026 at 19:26, Trevor Gamblin<tgamblin@xxxxxxxxxxxx> wrote:
On 2026-03-09 07:40, Iker Pedrosa wrote:I used the same example on the K1-OrangePi-RV2 DTS,
Add complete SD card controller support with UHS high-speed modes.Hello again,
- Enable sdhci0 controller with 4-bit bus width
- Configure card detect GPIO with inversion
- Connect vmmc-supply to buck4 for 3.3V card power
- Connect vqmmc-supply to aldo1 for 1.8V/3.3V I/O switching
- Add dual pinctrl states for voltage-dependent pin configuration
- Support UHS-I SDR25, SDR50, and SDR104 modes
This enables full SD card functionality including high-speed UHS modes
for improved performance.
Signed-off-by: Iker Pedrosa<ikerpedrosam@xxxxxxxxx>
---
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts b/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
index 414b03f5e6480f05f5d7eeaaa0afb4e86425ae36..361135269801f436703b6f1d768c91325a52f07f 100644
--- a/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
@@ -140,3 +140,22 @@ sd_vqmmc: aldo1 {
};
};
};
+
+&sdhci0 {
+ pinctrl-names = "default", "state_uhs";
+ pinctrl-0 = <&mmc1_cfg>;
+ pinctrl-1 = <&mmc1_uhs_cfg>;
+ bus-width = <4>;
+ cd-gpios = <&gpio K1_GPIO(80) GPIO_ACTIVE_HIGH>;
+ cd-inverted;
+ no-mmc;
+ no-sdio;
+ disable-wp;
+ cap-sd-highspeed;
+ vmmc-supply = <&sd_vmmc>;
+ vqmmc-supply = <&sd_vqmmc>;
+ sd-uhs-sdr25;
+ sd-uhs-sdr50;
+ sd-uhs-sdr104;
+ status = "okay";
+};
Thanks for doing this work. My colleagues and I have been testing this
on an OrangePi RV2, and also a Muse Pi Pro board (making a similar tweak
to this patch in k1-musepi-pro.dts). To do the testing on my end, I'm
applying the patch series on top of 6.19 in a Yocto BSP.
I've been finding that I see issues with the UHS support on my side
(this log comes from an image built and flashed to an SD card):
[ 1.072417] sdhci-spacemit d4280000.mmc: Got CD GPIO
[ 1.109741] mmc0: SDHCI controller on d4280000.mmc [d4280000.mmc] using
ADMA
[ 1.114589] clk: Disabling unused clocks
[ 1.118421] PM: genpd: Disabling unused power domains
[ 1.123249] ALSA device list:
[ 1.126[ 1.129949] check access for rdinit=/init failed: -2, ignoring
[ 1.133284] Waiting for root device
PARTUUID=e94bfdd7-a36f-4315-a480-476e2a12403d...
[ 1.176569] mmc0: new UHS-I speed DDR50 SDHC card at address aaaa
[ 1.180732] mmcblk0: mmc0:aaaa SS16G 14.8 GiB
[ 1.276268] mmcblk0: recovery failed!
[ 1.277351] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags
0x800000 phys_seg 1 prio class 2
[ 1.286346] Buffer I/O error on dev mmcblk0, logical block 0, async page
read
[ 1.293891] mmcblk0: recovery failed!
[ 1.297289] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags
0x800000 phys_seg 1 prio class 2
[ 1.306269] Buffer I/O error on dev mmcblk0, logical block 0, async page
read
[ 1.313522] mmcblk0: unable to read partition table
At first I wondered if maybe there was an issue with the card itself,
but by changing the sdhci0 section to this, I'm able to read the SD just
fine:
But it’s slightly different from the one you’re working with.
I tested on the latest 7.0-rc3.
&sdhci0 {+
pinctrl-names = "default";
pinctrl-0 = <&mmc1_cfg>;
bus-width = <4>;
cd-gpios = <&gpio K1_GPIO(80) GPIO_ACTIVE_HIGH>;
cd-inverted;
no-mmc;
no-sdio;
disable-wp;
vmmc-supply = <&sd_vmmc>;
vqmmc-supply = <&sd_vqmmc>;
no-1-8-v;
status = "okay";
};
+&sdhci0 {
+ pinctrl-names = "default", "state_uhs";
+ pinctrl-0 = <&mmc1_cfg>;
+ pinctrl-1 = <&mmc1_uhs_cfg>;
+ bus-width = <4>;
+ cd-gpios = <&gpio K1_GPIO(80) GPIO_ACTIVE_HIGH>;
+ cd-inverted;
+ no-mmc;
+ no-sdio;
+ disable-wp;
+ cap-sd-highspeed;
+ vmmc-supply = <&sd_vmmc>;
+ vqmmc-supply = <&sd_vqmmc>;
+ sd-uhs-sdr25;
+ sd-uhs-sdr50;
+ sd-uhs-sdr104;
+ status = "okay";
+};
Thanks
-Anand
[ 1.071767] sdhci-spacemit d4280000.mmc: Got CD GPIO
[ 1.110368] mmc0: SDHCI controller on d4280000.mmc [d4280000.mmc] using ADMA
[ 1.115231] clk: Disabling unused clocks
[ 1.119072] PM: genpd: Disabling unused power domains
[ 1.123875] ALSA device list:
[ 1.1268[ 1.130718] Waiting for root device PARTUUID=e94bfdd7-a36f-4315-a480-476e2a12403d...
[ 1.181158] mmc0: new UHS-I speed DDR50 SDHC card at address aaaa
[ 1.185341] mmcblk0: mmc0:aaaa SS16G 14.8 GiB
[ 1.198009] GPT:Primary header thinks Alt. header is not at the end of the disk.
[ 1.202874] GPT:1134331 != 31116287
[ 1.206388] GPT:Alternate GPT header not at the end of the disk.
[ 1.212468] GPT:1134331 != 31116287
[ 1.215993] GPT: Use GNU Parted to correct GPT errors.
[ 1.221230] mmcblk0: p1 p2 p3
[ 1.529978] EXT4-fs (mmcblk0p3): mounted filesystem dbc76877-092e-4f8a-9f06-bf286309d8de r/w with ordered data mode. Quota mode: disabled.
[ 1.540069] VFS: Mounted root (ext4 filesystem) on device 179:3.
In which case:
Tested-by: Trevor Gamblin <tgamblin@xxxxxxxxxxxx>