* [PATCH v10 1/4] riscv: dts: spacemit: k1: add SD card controller and pinctrl support
2026-05-15 10:48 [PATCH v10 0/4] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Iker Pedrosa
@ 2026-05-15 10:48 ` Iker Pedrosa
2026-05-15 10:49 ` [PATCH v10 2/4] riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes Iker Pedrosa
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Iker Pedrosa @ 2026-05-15 10:48 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Adrian Hunter,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Yixun Lan, Ulf Hansson, Ulf Hansson, Yixun Lan
Cc: Troy Mitchell, Michael Opdenacker, Javier Martinez Canillas,
linux-mmc, devicetree, linux-riscv, spacemit, linux-kernel,
Iker Pedrosa, Anand Moon, Trevor Gamblin, Vincent Legoll
Add SD card controller infrastructure for SpacemiT K1 SoC with complete
pinctrl support for both standard and UHS modes.
- Add sdhci0 controller definition with clocks, resets and interrupts
- Add mmc1_cfg pinctrl for 3.3V standard SD operation
- Add mmc1_uhs_cfg pinctrl for 1.8V UHS high-speed operation
- Configure appropriate drive strength and power-source properties
This provides complete SD card infrastructure that K1-based boards can
enable.
Tested-by: Anand Moon <linux.amoon@gmail.com>
Tested-by: Trevor Gamblin <tgamblin@baylibre.com>
Tested-by: Vincent Legoll <legoll@online.fr>
Reviewed-by: Troy Mitchell <troy.mitchell@linux.dev>
Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
---
arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi | 40 ++++++++++++++++++++++++++++
arch/riscv/boot/dts/spacemit/k1.dtsi | 13 +++++++++
2 files changed, 53 insertions(+)
diff --git a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
index 34d88334e95e..4e9a62d0e85b 100644
--- a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
@@ -590,4 +590,44 @@ ssp3-0-frm-pins {
power-source = <3300>;
};
};
+
+ mmc1_cfg: mmc1-cfg {
+ mmc1-data-cmd-pins {
+ pinmux = <K1_PADCONF(104, 0)>, /* mmc1_d3 */
+ <K1_PADCONF(105, 0)>, /* mmc1_d2 */
+ <K1_PADCONF(106, 0)>, /* mmc1_d1 */
+ <K1_PADCONF(107, 0)>, /* mmc1_d0 */
+ <K1_PADCONF(108, 0)>; /* mmc1_cmd */
+ bias-pull-up = <1>;
+ drive-strength = <19>;
+ power-source = <3300>;
+ };
+
+ mmc1-clk-pins {
+ pinmux = <K1_PADCONF(109, 0)>; /* mmc1_clk */
+ bias-pull-down = <1>;
+ drive-strength = <19>;
+ power-source = <3300>;
+ };
+ };
+
+ mmc1_uhs_cfg: mmc1-uhs-cfg {
+ mmc1-data-cmd-pins {
+ pinmux = <K1_PADCONF(104, 0)>, /* mmc1_d3 */
+ <K1_PADCONF(105, 0)>, /* mmc1_d2 */
+ <K1_PADCONF(106, 0)>, /* mmc1_d1 */
+ <K1_PADCONF(107, 0)>, /* mmc1_d0 */
+ <K1_PADCONF(108, 0)>; /* mmc1_cmd */
+ bias-pull-up = <1>;
+ drive-strength = <42>;
+ power-source = <1800>;
+ };
+
+ mmc1-clk-pins {
+ pinmux = <K1_PADCONF(109, 0)>; /* mmc1_clk */
+ bias-pull-down = <1>;
+ drive-strength = <42>;
+ power-source = <1800>;
+ };
+ };
};
diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spacemit/k1.dtsi
index 24becab4c959..06469c364eef 100644
--- a/arch/riscv/boot/dts/spacemit/k1.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1.dtsi
@@ -1214,6 +1214,19 @@ usb_dwc3: usb@c0a00000 {
status = "disabled";
};
+ sdhci0: mmc@d4280000 {
+ compatible = "spacemit,k1-sdhci";
+ reg = <0x0 0xd4280000 0x0 0x200>;
+ clocks = <&syscon_apmu CLK_SDH_AXI>,
+ <&syscon_apmu CLK_SDH0>;
+ clock-names = "core", "io";
+ resets = <&syscon_apmu RESET_SDH_AXI>,
+ <&syscon_apmu RESET_SDH0>;
+ reset-names = "axi", "sdh";
+ interrupts = <99>;
+ status = "disabled";
+ };
+
emmc: mmc@d4281000 {
compatible = "spacemit,k1-sdhci";
reg = <0x0 0xd4281000 0x0 0x200>;
--
2.54.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v10 2/4] riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes
2026-05-15 10:48 [PATCH v10 0/4] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Iker Pedrosa
2026-05-15 10:48 ` [PATCH v10 1/4] riscv: dts: spacemit: k1: add SD card controller and pinctrl support Iker Pedrosa
@ 2026-05-15 10:49 ` Iker Pedrosa
2026-05-15 11:27 ` sashiko-bot
2026-05-15 10:49 ` [PATCH v10 3/4] riscv: dts: spacemit: k1-bananapi-f3: " Iker Pedrosa
2026-05-15 10:49 ` [PATCH v10 4/4] riscv: dts: spacemit: k1-musepi-pro: " Iker Pedrosa
3 siblings, 1 reply; 8+ messages in thread
From: Iker Pedrosa @ 2026-05-15 10:49 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Adrian Hunter,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Yixun Lan, Ulf Hansson, Ulf Hansson, Yixun Lan
Cc: Troy Mitchell, Michael Opdenacker, Javier Martinez Canillas,
linux-mmc, devicetree, linux-riscv, spacemit, linux-kernel,
Iker Pedrosa, Anand Moon, Trevor Gamblin, Vincent Legoll
Add complete SD card controller support with UHS high-speed modes.
- Enable sdhci0 controller with 4-bit bus width
- Configure card detect GPIO with GPIO_ACTIVE_LOW logic
- 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
- Add stable MMC device aliases (mmc0 = eMMC, mmc1 = SD card)
This enables full SD card functionality including high-speed UHS modes
for improved performance.
Tested-by: Anand Moon <linux.amoon@gmail.com>
Tested-by: Trevor Gamblin <tgamblin@baylibre.com>
Tested-by: Michael Opdenacker <michael.opdenacker@rootcommit.com>
Tested-by: Vincent Legoll <legoll@online.fr>
Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
---
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts b/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
index c95ca38e3d4a..bd40bc9011e2 100644
--- a/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
@@ -17,6 +17,8 @@ aliases {
serial0 = &uart0;
ethernet0 = ð0;
ethernet1 = ð1;
+ mmc0 = &emmc;
+ mmc1 = &sdhci0;
};
chosen {
@@ -202,7 +204,7 @@ buck6 {
regulator-always-on;
};
- aldo1 {
+ aldo1: aldo1 {
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <3400000>;
regulator-boot-on;
@@ -319,3 +321,21 @@ hub_3_0: hub@2 {
vdd-supply = <&vcc_5v0>;
};
};
+
+&sdhci0 {
+ pinctrl-names = "default", "uhs";
+ pinctrl-0 = <&mmc1_cfg>;
+ pinctrl-1 = <&mmc1_uhs_cfg>;
+ bus-width = <4>;
+ cd-gpios = <&gpio K1_GPIO(80) GPIO_ACTIVE_LOW>;
+ no-mmc;
+ no-sdio;
+ disable-wp;
+ cap-sd-highspeed;
+ vmmc-supply = <&buck4_3v3>;
+ vqmmc-supply = <&aldo1>;
+ sd-uhs-sdr25;
+ sd-uhs-sdr50;
+ sd-uhs-sdr104;
+ status = "okay";
+};
--
2.54.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v10 2/4] riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes
2026-05-15 10:49 ` [PATCH v10 2/4] riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes Iker Pedrosa
@ 2026-05-15 11:27 ` sashiko-bot
0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-05-15 11:27 UTC (permalink / raw)
To: Iker Pedrosa; +Cc: robh, krzk+dt, devicetree, conor+dt
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The intended 'uhs' pinctrl state will never be applied because the underlying host driver (`sdhci-of-k1.c`) lacks dynamic pinctrl state switching logic.
- [Medium] The pinctrl state name 'uhs' deviates from the established MMC subsystem standard 'state_uhs'.
--
commit d986961bd58045bfd797f79421e91fffcf930dbd
Author: Iker Pedrosa <ikerpedrosam@gmail.com>
riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes
This commit adds complete SD card controller support with UHS high-speed
modes for the SpacemiT K1 Orange Pi RV2. It enables the sdhci0 controller
with 4-bit bus width, configures power supplies, and sets up pinctrl states
for voltage-dependent pin configuration.
> diff --git a/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts b/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
> index 3a829e3c9cbcd..74665795b9e88 100644
> --- a/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
> +++ b/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
[ ... ]
> @@ -309,3 +311,21 @@ hub_3_0: hub@2 {
> vdd-supply = <&vcc_5v0>;
> };
> };
> +
> +&sdhci0 {
> + pinctrl-names = "default", "uhs";
Is this pinctrl state name standard for the MMC subsystem? Other device
tree bindings typically use state_uhs rather than uhs for the alternate
UHS pin state. Using state_uhs would align with the established standard
across the subsystem.
> + pinctrl-0 = <&mmc1_cfg>;
> + pinctrl-1 = <&mmc1_uhs_cfg>;
Does the underlying host driver (sdhci-of-k1.c) actually switch to this
alternate pinctrl state during voltage changes?
The generic MMC and SDHCI core frameworks do not automatically switch
pinctrl states when entering 1.8V UHS modes. If the host driver lacks the
explicit pinctrl_lookup_state() or pinctrl_select_state() logic, the
physical IO pins will remain permanently stuck in the default 3.3V hardware
state.
Can operating in high-speed modes with mismatched physical signaling
constraints lead to signal integrity failures or data corruption?
> + bus-width = <4>;
> + cd-gpios = <&gpio K1_GPIO(80) GPIO_ACTIVE_LOW>;
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260515-orangepi-sd-card-uhs-v10-0-094af27e310d@gmail.com?part=2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v10 3/4] riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes
2026-05-15 10:48 [PATCH v10 0/4] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Iker Pedrosa
2026-05-15 10:48 ` [PATCH v10 1/4] riscv: dts: spacemit: k1: add SD card controller and pinctrl support Iker Pedrosa
2026-05-15 10:49 ` [PATCH v10 2/4] riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes Iker Pedrosa
@ 2026-05-15 10:49 ` Iker Pedrosa
2026-05-15 11:43 ` sashiko-bot
2026-05-15 10:49 ` [PATCH v10 4/4] riscv: dts: spacemit: k1-musepi-pro: " Iker Pedrosa
3 siblings, 1 reply; 8+ messages in thread
From: Iker Pedrosa @ 2026-05-15 10:49 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Adrian Hunter,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Yixun Lan, Ulf Hansson, Ulf Hansson, Yixun Lan
Cc: Troy Mitchell, Michael Opdenacker, Javier Martinez Canillas,
linux-mmc, devicetree, linux-riscv, spacemit, linux-kernel,
Iker Pedrosa, Anand Moon, Margherita Milani, Aurelien Jarno
Add complete SD card controller support with UHS high-speed modes.
- Enable sdhci0 controller with 4-bit bus width
- Configure card detect GPIO with GPIO_ACTIVE_LOW and internal pull-up
support
- 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
- Add stable MMC device aliases (mmc0 = eMMC, mmc1 = SD card)
This enables full SD card functionality including high-speed UHS modes
for improved performance.
Suggested-by: Anand Moon <linux.amoon@gmail.com>
Tested-by: Anand Moon <linux.amoon@gmail.com>
Tested-by: Margherita Milani <margherita.milani@amarulasolutions.com>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
---
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
index e20daa50a152..72f77e9edd63 100644
--- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
@@ -17,6 +17,8 @@ aliases {
spi3 = &spi3;
i2c2 = &i2c2;
i2c8 = &i2c8;
+ mmc0 = &emmc;
+ mmc1 = &sdhci0;
};
chosen {
@@ -221,7 +223,7 @@ buck3_1v8: buck3 {
regulator-always-on;
};
- buck4 {
+ buck4: buck4 {
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <3300000>;
regulator-ramp-delay = <5000>;
@@ -242,7 +244,7 @@ buck6 {
regulator-always-on;
};
- aldo1 {
+ aldo1: aldo1 {
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <3400000>;
regulator-boot-on;
@@ -374,3 +376,21 @@ hub_3_0: hub@2 {
reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
};
};
+
+&sdhci0 {
+ pinctrl-names = "default", "uhs";
+ pinctrl-0 = <&mmc1_cfg>;
+ pinctrl-1 = <&mmc1_uhs_cfg>;
+ bus-width = <4>;
+ cd-gpios = <&gpio K1_GPIO(80) (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ no-mmc;
+ no-sdio;
+ disable-wp;
+ cap-sd-highspeed;
+ vmmc-supply = <&buck4>;
+ vqmmc-supply = <&aldo1>;
+ sd-uhs-sdr25;
+ sd-uhs-sdr50;
+ sd-uhs-sdr104;
+ status = "okay";
+};
--
2.54.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v10 3/4] riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes
2026-05-15 10:49 ` [PATCH v10 3/4] riscv: dts: spacemit: k1-bananapi-f3: " Iker Pedrosa
@ 2026-05-15 11:43 ` sashiko-bot
0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-05-15 11:43 UTC (permalink / raw)
To: Iker Pedrosa; +Cc: devicetree, robh, krzk+dt, conor+dt
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing driver support for UHS pinctrl state switching in SpacemiT SDHCI driver
--
commit dccbc831846f54656728199aecf02388bd320143
Author: Iker Pedrosa <ikerpedrosam@gmail.com>
riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes
This commit adds complete SD card controller support with UHS high-speed
modes for the SpacemiT K1 Banana Pi F3. It configures the sdhci0
controller, including regulators for power switching and dual pinctrl
states for voltage-dependent pin configuration.
> diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> index e20daa50a152f..72f77e9edd63d 100644
> --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
[ ... ]
> @@ -374,3 +376,21 @@ hub_3_0: hub@2 {
> reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
> };
> };
> +
> +&sdhci0 {
> + pinctrl-names = "default", "uhs";
> + pinctrl-0 = <&mmc1_cfg>;
> + pinctrl-1 = <&mmc1_uhs_cfg>;
Does the host controller driver (sdhci-of-k1) support switching to the "uhs"
pinctrl state?
The generic mmc and sdhci core subsystems do not automatically parse or
switch to a "uhs" pinctrl state, unlike standard states like "default" or
"sleep".
> + bus-width = <4>;
> + cd-gpios = <&gpio K1_GPIO(80) (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + no-mmc;
> + no-sdio;
> + disable-wp;
> + cap-sd-highspeed;
> + vmmc-supply = <&buck4>;
> + vqmmc-supply = <&aldo1>;
If the driver does not manually look up and select the "uhs" state when
dropping the vqmmc-supply to 1.8V for UHS modes, will the pads remain
locked to the 3.3V configuration?
Could this mismatch between the pad configuration and the supplied power
cause signal integrity issues or data corruption when operating in sdr25,
sdr50, or sdr104 modes?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260515-orangepi-sd-card-uhs-v10-0-094af27e310d@gmail.com?part=3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v10 4/4] riscv: dts: spacemit: k1-musepi-pro: add SD card support with UHS modes
2026-05-15 10:48 [PATCH v10 0/4] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Iker Pedrosa
` (2 preceding siblings ...)
2026-05-15 10:49 ` [PATCH v10 3/4] riscv: dts: spacemit: k1-bananapi-f3: " Iker Pedrosa
@ 2026-05-15 10:49 ` Iker Pedrosa
2026-05-15 11:59 ` sashiko-bot
3 siblings, 1 reply; 8+ messages in thread
From: Iker Pedrosa @ 2026-05-15 10:49 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Adrian Hunter,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Yixun Lan, Ulf Hansson, Ulf Hansson, Yixun Lan
Cc: Troy Mitchell, Michael Opdenacker, Javier Martinez Canillas,
linux-mmc, devicetree, linux-riscv, spacemit, linux-kernel,
Iker Pedrosa, Trevor Gamblin, Andre Heider
From: Trevor Gamblin <tgamblin@baylibre.com>
Update the Muse Pi Pro devicetree with SD card support to match what
was done for the OrangePi RV2 in [1]. More precisely:
- Enable sdhci0 controller with 4-bit bus width
- Configure card detect GPIO with internal pull-up support
- 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
- Add stable MMC device aliases (mmc0 = eMMC, mmc1 = SD card)
- Update PMIC configuration to use per-regulator supply properties
[1] https://lore.kernel.org/linux-riscv/20260316-orangepi-sd-card-uhs-v3-0-aefd3b7832df@gmail.com/T/#
Tested-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
---
arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts | 60 ++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts b/arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts
index 29e333b670cf..81d3ce85d460 100644
--- a/arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts
@@ -17,8 +17,20 @@ / {
aliases {
ethernet0 = ð0;
serial0 = &uart0;
+ mmc0 = &emmc;
+ mmc1 = &sdhci0;
};
+ reg_vcc_4v: vcc-4v {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc_4v";
+ regulator-min-microvolt = <4000000>;
+ regulator-max-microvolt = <4000000>;
+ regulator-boot-on;
+ regulator-always-on;
+ };
+
+
chosen {
stdout-path = "serial0";
};
@@ -77,3 +89,51 @@ &uart0 {
pinctrl-names = "default";
status = "okay";
};
+
+&i2c8 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c8_cfg>;
+ status = "okay";
+
+ pmic@41 {
+ compatible = "spacemit,p1";
+ reg = <0x41>;
+ interrupts = <64>;
+ vin4-supply = <®_vcc_4v>;
+ aldoin-supply = <®_vcc_4v>;
+
+ regulators {
+ buck4: buck4 {
+ regulator-min-microvolt = <500000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-ramp-delay = <5000>;
+ regulator-always-on;
+ };
+
+ aldo1: aldo1 {
+ regulator-min-microvolt = <500000>;
+ regulator-max-microvolt = <3400000>;
+ regulator-boot-on;
+ regulator-always-on;
+ };
+ };
+ };
+};
+
+&sdhci0 {
+ pinctrl-names = "default", "uhs";
+ pinctrl-0 = <&mmc1_cfg>;
+ pinctrl-1 = <&mmc1_uhs_cfg>;
+ bus-width = <4>;
+ cd-gpios = <&gpio K1_GPIO(80) (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
+ no-mmc;
+ no-sdio;
+ disable-wp;
+ cap-sd-highspeed;
+ vmmc-supply = <&buck4>;
+ vqmmc-supply = <&aldo1>;
+ sd-uhs-sdr25;
+ sd-uhs-sdr50;
+ sd-uhs-sdr104;
+ status = "okay";
+};
--
2.54.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v10 4/4] riscv: dts: spacemit: k1-musepi-pro: add SD card support with UHS modes
2026-05-15 10:49 ` [PATCH v10 4/4] riscv: dts: spacemit: k1-musepi-pro: " Iker Pedrosa
@ 2026-05-15 11:59 ` sashiko-bot
0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-05-15 11:59 UTC (permalink / raw)
To: Iker Pedrosa; +Cc: devicetree, krzk+dt, conor+dt, robh
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The SD card detect GPIO (`cd-gpios`) is configured with incorrect active polarity (`GPIO_ACTIVE_HIGH`), which will invert card detection.
- [Medium] The UHS-I I/O voltage supply (`aldo1`) is incorrectly marked `regulator-always-on`, preventing the MMC core from physically power-cycling the SD card during error recovery.
--
commit 6129b29ed8762cd8d45153d74898125f35ee85bc
Author: Trevor Gamblin <tgamblin@baylibre.com>
riscv: dts: spacemit: k1-musepi-pro: add SD card support with UHS modes
This commit updates the Muse Pi Pro devicetree with SD card support to match
the OrangePi RV2. It enables the sdhci0 controller, configures the pmic
regulators for card power and I/O switching, and adds UHS-I mode support.
Link: https://lore.kernel.org/linux-riscv/20260316-orangepi-sd-card-uhs-v3-0-aefd3b7832df@gmail.com/T/#
> diff --git a/arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts b/arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts
> --- a/arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts
> +++ b/arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts
[ ... ]
> + pmic@41 {
> + compatible = "spacemit,p1";
> + reg = <0x41>;
[ ... ]
> + regulators {
> + buck4: buck4 {
> + regulator-min-microvolt = <500000>;
> + regulator-max-microvolt = <3300000>;
> + regulator-ramp-delay = <5000>;
> + regulator-always-on;
> + };
> +
> + aldo1: aldo1 {
> + regulator-min-microvolt = <500000>;
> + regulator-max-microvolt = <3400000>;
> + regulator-boot-on;
> + regulator-always-on;
Will marking aldo1 as regulator-always-on prevent the MMC subsystem from
power-cycling the SD card during error recovery?
If a UHS-I voltage switch fails, the MMC core calls regulator_disable() on
vqmmc to drop the voltage to 0V and reset the card's internal state
machine.
The commit message notes this matches the OrangePi RV2, but the OrangePi
RV2 leaves aldo1 without the regulator-always-on constraint.
> + };
> + };
> + };
> +};
> +
> +&sdhci0 {
> + pinctrl-names = "default", "uhs";
> + pinctrl-0 = <&mmc1_cfg>;
> + pinctrl-1 = <&mmc1_uhs_cfg>;
> + bus-width = <4>;
> + cd-gpios = <&gpio K1_GPIO(80) (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
Does using GPIO_ACTIVE_HIGH invert the card detection logic?
With the internal pull-up enabled, the physical pin inherently reads high
when the slot is empty. To map the physical low state of a card insertion
to a logical true, this usually requires GPIO_ACTIVE_LOW.
The commit message mentions matching the OrangePi RV2, which uses
GPIO_ACTIVE_LOW for this same pin.
> + no-mmc;
> + no-sdio;
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260515-orangepi-sd-card-uhs-v10-0-094af27e310d@gmail.com?part=4
^ permalink raw reply [flat|nested] 8+ messages in thread