提交 4e6c7178 编写于 作者: G Gwendal Grignou 提交者: Ulf Hansson

mmc: core: Do regular power cycle when lacking eMMC HW reset support

The eMMC HW reset may be implemented either via the host ops ->hw_reset()
callback or through DT and the eMMC pwrseq. Additionally some eMMC cards
don't support HW reset.

To allow a reset to be done for the different combinations of mmc hosts
and eMMC/MMC cards, let's implement a fallback via trying a regular power
cycle. This improves the mmc block layer retry mechanism of failing I/O
requests.
Signed-off-by: NGwendal Grignou <gwendal@chromium.org>
[Ulf: Rewrote changelog]
Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
上级 6aef2eec
...@@ -2456,8 +2456,9 @@ int mmc_hw_reset(struct mmc_host *host) ...@@ -2456,8 +2456,9 @@ int mmc_hw_reset(struct mmc_host *host)
ret = host->bus_ops->reset(host); ret = host->bus_ops->reset(host);
mmc_bus_put(host); mmc_bus_put(host);
if (ret != -EOPNOTSUPP) if (ret)
pr_warn("%s: tried to reset card\n", mmc_hostname(host)); pr_warn("%s: tried to reset card, got error %d\n",
mmc_hostname(host), ret);
return ret; return ret;
} }
......
...@@ -1957,19 +1957,17 @@ static int mmc_reset(struct mmc_host *host) ...@@ -1957,19 +1957,17 @@ static int mmc_reset(struct mmc_host *host)
{ {
struct mmc_card *card = host->card; struct mmc_card *card = host->card;
if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset) if ((host->caps & MMC_CAP_HW_RESET) && host->ops->hw_reset &&
return -EOPNOTSUPP; mmc_can_reset(card)) {
/* If the card accept RST_n signal, send it. */
if (!mmc_can_reset(card)) mmc_set_clock(host, host->f_init);
return -EOPNOTSUPP; host->ops->hw_reset(host);
/* Set initial state and call mmc_set_ios */
mmc_set_clock(host, host->f_init); mmc_set_initial_state(host);
} else {
host->ops->hw_reset(host); /* Do a brute force power cycle */
mmc_power_cycle(host, card->ocr);
/* Set initial state and call mmc_set_ios */ }
mmc_set_initial_state(host);
return mmc_init_card(host, card->ocr, card); return mmc_init_card(host, card->ocr, card);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册