set_vdd_mmc() sets PMIC aldo1 to 1.8 V. On the K1 boards aldo1 is
VCC1833_MMC1, the I/O rail of the SD card pads (vqmmc-supply of
sdhci0), and SD Default and High Speed signal at 3.3 V. The BootROM
sets it to 3.3 V on a cold boot, and with SPL_MMC_IO_VOLTAGE the MMC
core sets it before talking to the card, so the board code should not
touch it.

Drop set_vdd_mmc() and the U-Boot-only "vdd_1v8_mmc" name it looked
up, and the matching line in the sample SPL log. aldo1 keeps
bootph-pre-ram, as the SPL needs it as the vqmmc-supply.

Fixes: 80aa3d316060 ("board: k1: enable pmic in spl")
Suggested-by: Yixun Lan <[email protected]>
Signed-off-by: Tanmay Kathpalia <[email protected]>
---
Changes in v3:
- New patch
---
 arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi | 10 +++++-----
 arch/riscv/dts/k1-musepi-pro-u-boot.dtsi  |  2 +-
 board/spacemit/k1/spl.c                   | 21 ---------------------
 doc/board/spacemit/k1-spl.rst             |  1 -
 4 files changed, 6 insertions(+), 28 deletions(-)

diff --git a/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi 
b/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
index 3077cdee55d..36c1bfc12fb 100644
--- a/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
+++ b/arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi
@@ -57,10 +57,11 @@
 };
 
 /*
- * The kernel pmic@41 nodes use the standard regulator-* properties only;
- * U-Boot's regulator framework looks up suppliers by `regulator-name`.
- * Carry the U-Boot-specific names (vdd_core / vdd_1v8 / vdd_1v8_mmc) here
- * so SPL can program the bucks that DDR training depends on.
+ * The kernel pmic@41 nodes use the standard regulator-* properties only.
+ * The SPL board code looks up the bucks that DDR training depends on by
+ * `regulator-name`, so carry the U-Boot-specific names (vdd_core /
+ * vdd_1v8) here. aldo1 is the vqmmc-supply of sdhci0 and is needed in
+ * SPL as well.
  */
 &i2c8 {
        bootph-pre-ram;
@@ -80,7 +81,6 @@
                        };
 
                        aldo1 {
-                               regulator-name = "vdd_1v8_mmc";
                                bootph-pre-ram;
                        };
                };
diff --git a/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi 
b/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
index d6299c96949..200836cc204 100644
--- a/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
+++ b/arch/riscv/dts/k1-musepi-pro-u-boot.dtsi
@@ -105,9 +105,9 @@
                                regulator-name = "vdd_1v8";
                        };
 
+                       /* vqmmc-supply of sdhci0, set by the MMC core in SPL */
                        aldo1 {
                                bootph-pre-ram;
-                               regulator-name = "vdd_1v8_mmc";
                        };
 
                };
diff --git a/board/spacemit/k1/spl.c b/board/spacemit/k1/spl.c
index ef23db62d6c..87fde0293a9 100644
--- a/board/spacemit/k1/spl.c
+++ b/board/spacemit/k1/spl.c
@@ -275,26 +275,6 @@ static void set_vdd_1v8(void)
        log_info("vdd_1v8, value:%d\n", ret);
 }
 
-static void set_vdd_mmc(void)
-{
-       struct udevice *dev;
-       int ret;
-
-       ret = regulator_get_by_platname("vdd_1v8_mmc", &dev);
-       if (ret)
-               panic("Fail to detect vdd_1v8_mmc (%d)\n", ret);
-       ret = regulator_set_value(dev, 1800000);
-       if (ret)
-               log_warning("Fail to set vdd_1v8_mmc as 1800000 (%d)\n", ret);
-       ret = regulator_set_enable(dev, true);
-       if (ret)
-               log_warning("Fail to enable vdd_1v8_mmc (%d)\n", ret);
-       ret = regulator_get_value(dev);
-       if (ret < 0)
-               log_warning("Fail to read vdd_1v8_mmc (%d)\n", ret);
-       log_info("vdd_1v8_mmc, value:%d\n", ret);
-}
-
 void pmic_init(void)
 {
        struct udevice *pmic_dev;
@@ -305,7 +285,6 @@ void pmic_init(void)
                panic("Fail to detect PMIC (%d)\n", ret);
        set_vdd_core();
        set_vdd_1v8();
-       set_vdd_mmc();
 }
 
 /* Set default value for DDR chips */
diff --git a/doc/board/spacemit/k1-spl.rst b/doc/board/spacemit/k1-spl.rst
index 187eed56e8e..69ebfc5ccb9 100644
--- a/doc/board/spacemit/k1-spl.rst
+++ b/doc/board/spacemit/k1-spl.rst
@@ -211,7 +211,6 @@ shows output like::
     Fail to detect board:-19
     vdd_core, value:900000
     vdd_1v8, value:1800000
-    vdd_1v8_mmc, value:1800000
     DDR firmware: [0xc0815840]:0xf0227179, size:0x8d98
     DDR is ready
     SPL: Unsupported Boot Device!
-- 
2.43.7

Reply via email to