mmc: core: generalize hw reset functionality for all cards

MMC_CAP_HW_RESET capability was only referring to host driver
capability to toggle eMMC RST_n pin so if the host driver is
unable to toggle this pin, it shouldn't advertise this capability
and in that case, we should exercise power cycling of the eMMC
card to reset it.

CRs-Fixed: 507926
Change-Id: Ia2c6ad5f5bb22cc0cd8cf3bd09835eda73c7a444
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
This commit is contained in:
Subhash Jadavani 2013-06-12 17:57:07 +05:30 committed by Stephen Boyd
parent 0c602ce5aa
commit 989a3a5bb4
1 changed files with 4 additions and 7 deletions

View File

@ -2173,7 +2173,7 @@ int mmc_can_reset(struct mmc_card *card)
if (mmc_card_sdio(card))
return 0;
if (mmc_card_mmc(card)) {
if (mmc_card_mmc(card) && (card->host->caps & MMC_CAP_HW_RESET)) {
rst_n_function = card->ext_csd.rst_n_function;
if ((rst_n_function & EXT_CSD_RST_N_EN_MASK) !=
EXT_CSD_RST_N_ENABLED)
@ -2190,9 +2190,6 @@ static int mmc_do_hw_reset(struct mmc_host *host, int check)
if (!host->bus_ops->power_restore)
return -EOPNOTSUPP;
if (!(host->caps & MMC_CAP_HW_RESET))
return -EOPNOTSUPP;
if (!card)
return -EINVAL;
@ -2202,10 +2199,10 @@ static int mmc_do_hw_reset(struct mmc_host *host, int check)
mmc_host_clk_hold(host);
mmc_set_clock(host, host->f_init);
if (mmc_card_sd(card))
mmc_power_cycle(host);
else if (host->ops->hw_reset)
if (mmc_card_mmc(card) && host->ops->hw_reset)
host->ops->hw_reset(host);
else
mmc_power_cycle(host);
/* If the reset has happened, then a status command will fail */
if (check) {