提交 a87852c6 编写于 作者: N Niklas Söderlund 提交者: Ulf Hansson

mmc: tmio: fix reset operation

SD / MMC did not operate properly when suspend transition failed.
Because the SCC was not reset at resume, issue of the command failed.
Call the host specific reset function and reset the hardware in order to
add reset of SCC. This change also fixes tuning on some stubborn cards
on Gen2.

Based on work from Masaharu Hayakawa.
Signed-off-by: NNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: NSimon Horman <horms+renesas@verge.net.au>
Reviewed-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
上级 ac1e25c8
...@@ -171,6 +171,18 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host) ...@@ -171,6 +171,18 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host)
} }
} }
static void tmio_mmc_hw_reset(struct mmc_host *mmc)
{
struct tmio_mmc_host *host = mmc_priv(mmc);
host->reset(host);
tmio_mmc_abort_dma(host);
if (host->hw_reset)
host->hw_reset(host);
}
static void tmio_mmc_reset_work(struct work_struct *work) static void tmio_mmc_reset_work(struct work_struct *work)
{ {
struct tmio_mmc_host *host = container_of(work, struct tmio_mmc_host, struct tmio_mmc_host *host = container_of(work, struct tmio_mmc_host,
...@@ -209,12 +221,11 @@ static void tmio_mmc_reset_work(struct work_struct *work) ...@@ -209,12 +221,11 @@ static void tmio_mmc_reset_work(struct work_struct *work)
spin_unlock_irqrestore(&host->lock, flags); spin_unlock_irqrestore(&host->lock, flags);
host->reset(host); tmio_mmc_hw_reset(host->mmc);
/* Ready for new calls */ /* Ready for new calls */
host->mrq = NULL; host->mrq = NULL;
tmio_mmc_abort_dma(host);
mmc_request_done(host->mmc, mrq); mmc_request_done(host->mmc, mrq);
} }
...@@ -696,14 +707,6 @@ static int tmio_mmc_start_data(struct tmio_mmc_host *host, ...@@ -696,14 +707,6 @@ static int tmio_mmc_start_data(struct tmio_mmc_host *host,
return 0; return 0;
} }
static void tmio_mmc_hw_reset(struct mmc_host *mmc)
{
struct tmio_mmc_host *host = mmc_priv(mmc);
if (host->hw_reset)
host->hw_reset(host);
}
static int tmio_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode) static int tmio_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
{ {
struct tmio_mmc_host *host = mmc_priv(mmc); struct tmio_mmc_host *host = mmc_priv(mmc);
...@@ -1226,7 +1229,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) ...@@ -1226,7 +1229,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
_host->sdio_irq_mask = TMIO_SDIO_MASK_ALL; _host->sdio_irq_mask = TMIO_SDIO_MASK_ALL;
_host->set_clock(_host, 0); _host->set_clock(_host, 0);
_host->reset(_host); tmio_mmc_hw_reset(mmc);
_host->sdcard_irq_mask = sd_ctrl_read16_and_16_as_32(_host, CTL_IRQ_MASK); _host->sdcard_irq_mask = sd_ctrl_read16_and_16_as_32(_host, CTL_IRQ_MASK);
tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL); tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL);
...@@ -1327,7 +1330,7 @@ int tmio_mmc_host_runtime_resume(struct device *dev) ...@@ -1327,7 +1330,7 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
struct tmio_mmc_host *host = dev_get_drvdata(dev); struct tmio_mmc_host *host = dev_get_drvdata(dev);
tmio_mmc_clk_enable(host); tmio_mmc_clk_enable(host);
host->reset(host); tmio_mmc_hw_reset(host->mmc);
if (host->clk_cache) if (host->clk_cache)
host->set_clock(host, host->clk_cache); host->set_clock(host, host->clk_cache);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册