summaryrefslogtreecommitdiff
path: root/drivers/mmc/mmc.c
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2017-09-21 16:30:03 +0200
committerJaehoon Chung <jh80.chung@samsung.com>2018-01-12 18:11:04 +0900
commit35f6782055c99410fbeae33ab28ea68de154360c (patch)
treea9687137937bbd349e0d72e6e73de756e809d0c7 /drivers/mmc/mmc.c
parentfb7c3beb5178e5c81a00642e71a4b73427b52429 (diff)
mmc: add a new mmc parameter to disable mmc clock
mmc clock has to be disabled in certain cases like during the voltage switch sequence. Modify mmc_set_clock function to take disable as an argument that signifies if the clock has to be enabled or disabled. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Diffstat (limited to 'drivers/mmc/mmc.c')
-rw-r--r--drivers/mmc/mmc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 0ffe7bf417c..664b71affd8 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1214,7 +1214,7 @@ static int mmc_set_ios(struct mmc *mmc)
}
#endif
-int mmc_set_clock(struct mmc *mmc, uint clock)
+int mmc_set_clock(struct mmc *mmc, uint clock, bool disable)
{
if (clock > mmc->cfg->f_max)
clock = mmc->cfg->f_max;
@@ -1223,6 +1223,7 @@ int mmc_set_clock(struct mmc *mmc, uint clock)
clock = mmc->cfg->f_min;
mmc->clock = clock;
+ mmc->clk_disable = disable;
return mmc_set_ios(mmc);
}
@@ -1322,7 +1323,7 @@ static int sd_select_mode_and_width(struct mmc *mmc)
/* configure the bus mode (host) */
mmc_select_mode(mmc, mwt->mode);
- mmc_set_clock(mmc, mmc->tran_speed);
+ mmc_set_clock(mmc, mmc->tran_speed, false);
err = sd_read_ssr(mmc);
if (!err)
@@ -1333,7 +1334,7 @@ static int sd_select_mode_and_width(struct mmc *mmc)
error:
/* revert to a safer bus speed */
mmc_select_mode(mmc, SD_LEGACY);
- mmc_set_clock(mmc, mmc->tran_speed);
+ mmc_set_clock(mmc, mmc->tran_speed, false);
}
}
}
@@ -1476,7 +1477,7 @@ static int mmc_select_mode_and_width(struct mmc *mmc)
/* configure the bus mode (host) */
mmc_select_mode(mmc, mwt->mode);
- mmc_set_clock(mmc, mmc->tran_speed);
+ mmc_set_clock(mmc, mmc->tran_speed, false);
/* do a transfer to check the configuration */
err = mmc_read_and_compare_ext_csd(mmc);
@@ -1950,7 +1951,7 @@ static void mmc_set_initial_state(struct mmc *mmc)
mmc_select_mode(mmc, MMC_LEGACY);
mmc_set_bus_width(mmc, 1);
- mmc_set_clock(mmc, 0);
+ mmc_set_clock(mmc, 0, false);
}
static int mmc_power_on(struct mmc *mmc)