diff options
author | Jonas Karlman <jonas@kwiboo.se> | 2023-07-19 21:20:59 +0000 |
---|---|---|
committer | Jaehoon Chung <jh80.chung@samsung.com> | 2024-10-18 11:06:21 +0900 |
commit | 6834e6f543c1a83c9e192cdf80f8c24af3882546 (patch) | |
tree | 3bdf519e49ab1153ae83ffe11a1070c4c1ca31c9 | |
parent | 03893a7ca6968b6bb07776c1e34d9e7bc98bc2ec (diff) | |
download | u-boot-6834e6f543c1a83c9e192cdf80f8c24af3882546.tar.gz u-boot-6834e6f543c1a83c9e192cdf80f8c24af3882546.tar.bz2 u-boot-6834e6f543c1a83c9e192cdf80f8c24af3882546.zip |
mmc: Use regulator_set_enable_if_allowed
With the commit 4fcba5d556b4 ("regulator: implement basic reference
counter") the return value of regulator_set_enable may be EALREADY or
EBUSY for fixed/gpio regulators.
Change to use the more relaxed regulator_set_enable_if_allowed to
continue if regulator already was enabled or disabled.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # P895 Tegra 3;
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> # rockpro64-rk3399
[backport of the commit d3de38554a35e96872e43644b683e32f018c46a8 from mainline]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I3cb6dc82d7dbc54103266af5960b807e4af1692c
-rw-r--r-- | drivers/mmc/mmc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 31cfda2885..089a044256 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -2775,9 +2775,10 @@ static int mmc_power_on(struct mmc *mmc) { #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_REGULATOR) if (mmc->vmmc_supply) { - int ret = regulator_set_enable(mmc->vmmc_supply, true); + int ret = regulator_set_enable_if_allowed(mmc->vmmc_supply, + true); - if (ret && ret != -EACCES) { + if (ret && ret != -ENOSYS) { printf("Error enabling VMMC supply : %d\n", ret); return ret; } @@ -2791,9 +2792,10 @@ static int mmc_power_off(struct mmc *mmc) mmc_set_clock(mmc, 0, MMC_CLK_DISABLE); #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_REGULATOR) if (mmc->vmmc_supply) { - int ret = regulator_set_enable(mmc->vmmc_supply, false); + int ret = regulator_set_enable_if_allowed(mmc->vmmc_supply, + false); - if (ret && ret != -EACCES) { + if (ret && ret != -ENOSYS) { pr_debug("Error disabling VMMC supply : %d\n", ret); return ret; } |