[PATCH 6/9] mmc: enable/disable VQMMC regulator only during MMC power cycle
    Kaustabh Chakraborty 
    kauschluss at disroot.org
       
    Fri Oct 17 17:24:11 CEST 2025
    
    
  
Disrupting the regulator voltage during ios configuration messes with
the MMC initialization sequence. Move the VQMMC regulator enable/disable
functions to the MMC power cycle function, similar to how its done for
the VMMC regulator.
Signed-off-by: Kaustabh Chakraborty <kauschluss at disroot.org>
---
 drivers/mmc/dw_mmc.c |  8 --------
 drivers/mmc/mmc.c    | 20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index 9b143f9931e69531a53caa0196399e9392ddd348..f3c0cc5cd8e5045a870b5d5d2952da21bfba7e4d 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -644,20 +644,12 @@ static int dwmci_set_ios(struct mmc *mmc)
 	if (mmc->vqmmc_supply) {
 		int ret;
 
-		ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, false);
-		if (ret)
-			return ret;
-
 		if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180)
 			ret = regulator_set_value(mmc->vqmmc_supply, 1800000);
 		else
 			ret = regulator_set_value(mmc->vqmmc_supply, 3300000);
 		if (ret && ret != -ENOSYS)
 			return ret;
-
-		ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, true);
-		if (ret)
-			return ret;
 	}
 #endif
 
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index b1cfa3cd7c22fac07fa16fac1cdb9500d2470a50..55dd021897c98b3af0ffddc9f64c035bf2e6484b 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -2844,6 +2844,16 @@ static int mmc_power_on(struct mmc *mmc)
 			return ret;
 		}
 	}
+
+	if (mmc->vqmmc_supply) {
+		int ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply,
+							  true);
+
+		if (ret && ret != -ENOSYS) {
+			printf("Error enabling VQMMC supply : %d\n", ret);
+			return ret;
+		}
+	}
 #endif
 	return 0;
 }
@@ -2861,6 +2871,16 @@ static int mmc_power_off(struct mmc *mmc)
 			return ret;
 		}
 	}
+
+	if (mmc->vqmmc_supply) {
+		int ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply,
+							  false);
+
+		if (ret && ret != -ENOSYS) {
+			pr_debug("Error disabling VQMMC supply : %d\n", ret);
+			return ret;
+		}
+	}
 #endif
 	return 0;
 }
-- 
2.51.0
    
    
More information about the U-Boot
mailing list