Skip to contentSkip to conversation

riscv: dts: spacemit: k1-musepi-pro: add SD card support with UHS modes

PATCH New Andre Heider 2 participants 2 messages May 20

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v11 1/1 riscv: dts: spacemit: k1-musepi-pro: add SD card support with UHS modes

From: Trevor Gamblin <[email protected]>

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)

[1] https://lore.kernel.org/linux-riscv/[email protected]/T/#

---

Hi,

this is just a rebase of Iker's v10 4/4 patch[0] on top of my merged musepi-pro series[1].

[0] https://lore.kernel.org/all/[email protected]/
[1] https://lore.kernel.org/all/[email protected]/

 .../riscv/boot/dts/spacemit/k1-musepi-pro.dts | 22 ++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts +21 -1
index 4aef287353cab..0d809e4ad3b1f 100644
@@ -19,6 +19,8 @@ aliases {
 		serial0 = &uart0;
 		i2c2 = &i2c2;
 		i2c8 = &i2c8;
+		mmc0 = &emmc;
+		mmc1 = &sdhci0;
 	};
 
 	chosen {
@@ -218,7 +220,7 @@ buck6 {
 				regulator-always-on;
 			};
 
-			aldo1 {
+			aldo1: aldo1 {
 				regulator-min-microvolt = <500000>;
 				regulator-max-microvolt = <3400000>;
 				regulator-boot-on;
@@ -384,3 +386,21 @@ hub_3_0: hub@2 {
 		reset-gpios = <&gpio K1_GPIO(123) GPIO_ACTIVE_LOW>; /* HUB_RST */
 	};
 };
+
+&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_3v3>;
+	vqmmc-supply = <&aldo1>;
+	sd-uhs-sdr25;
+	sd-uhs-sdr50;
+	sd-uhs-sdr104;
+	status = "okay";
+};
Signature · 1 line
2.53.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Inverted SD card detect polarity in `cd-gpios` property. --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Inverted SD card detect polarity in cd-gpios property.
--

commit b8da2f3ea83cbd0820dd4246075e26e687bac678
Author: Trevor Gamblin <[email protected]>

riscv: dts: spacemit: k1-musepi-pro: add SD card support with UHS modes

This commit updates the Muse Pi Pro device tree to add SD card support, enabling the sdhci0 controller with a 4-bit bus, UHS-I modes, and voltage switching.

Quoted 3 lines
arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts +0 -0

[ ... ]

arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts hub_3_0: hub@2 { · line 395

Quoted 6 lines

+&sdhci0 {

arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts +5 -0
+	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)>;

[Severity: High]
Should this cd-gpios property use GPIO_ACTIVE_LOW?

With an internal pull-up enabled, the physical card-detect switch usually connects the pin to ground when a card is inserted, driving the signal low. Using GPIO_ACTIVE_HIGH might cause the MMC subsystem to assume a card is inserted when the slot is empty, and report a removal event when a card is actually inserted.

The commit message mentions matching the OrangePi RV2 configuration, which would typically use GPIO_ACTIVE_LOW for a pulled-up card detect signal.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1