From: Iker Pedrosa <[email protected]>

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 <[email protected]>
Tested-by: Anand Moon <[email protected]>
Tested-by: Margherita Milani <[email protected]>
Tested-by: Aurelien Jarno <[email protected]>
Reviewed-by: Aurelien Jarno <[email protected]>
Signed-off-by: Iker Pedrosa <[email protected]>
Link: 
https://patch.msgid.link/[email protected]
Signed-off-by: Yixun Lan <[email protected]>

[ upstream commit: c76e2f058cbcab84e4a703f26857a58bdf6a0042 ]

(cherry picked from commit 3efd965004f1604c204001dcead9a44f729d5d58)
---
 dts/upstream/src/riscv/spacemit/k1-bananapi-f3.dts | 24 ++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/dts/upstream/src/riscv/spacemit/k1-bananapi-f3.dts 
b/dts/upstream/src/riscv/spacemit/k1-bananapi-f3.dts
index 9429189354d6..9beb8947f12c 100644
--- a/dts/upstream/src/riscv/spacemit/k1-bananapi-f3.dts
+++ b/dts/upstream/src/riscv/spacemit/k1-bananapi-f3.dts
@@ -17,6 +17,8 @@
                spi3 = &spi3;
                i2c2 = &i2c2;
                i2c8 = &i2c8;
+               mmc0 = &emmc;
+               mmc1 = &sdhci0;
        };
 
        chosen {
@@ -221,7 +223,7 @@
                                regulator-always-on;
                        };
 
-                       buck4 {
+                       buck4: buck4 {
                                regulator-min-microvolt = <500000>;
                                regulator-max-microvolt = <3300000>;
                                regulator-ramp-delay = <5000>;
@@ -242,7 +244,7 @@
                                regulator-always-on;
                        };
 
-                       aldo1 {
+                       aldo1: aldo1 {
                                regulator-min-microvolt = <500000>;
                                regulator-max-microvolt = <3400000>;
                                regulator-boot-on;
@@ -374,3 +376,21 @@
                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.51.0

Reply via email to