* [PATCH v2] Fix CMD6 timeout issue @ 2017-01-03 8:49 Yong Mao 2017-01-03 8:49 ` [PATCH v2 1/2] mmc: core: " Yong Mao [not found] ` <1483433397-11756-1-git-send-email-yong.mao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 0 siblings, 2 replies; 3+ messages in thread From: Yong Mao @ 2017-01-03 8:49 UTC (permalink / raw) To: Ulf Hansson Cc: Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Matthias Brugger, Chunfeng Yun, Eddie Huang, Greg Kroah-Hartman, Philipp Zabel, Adrian Hunter, Shawn Lin, Baolin Wang, Russell King, Linus Walleij, Chaotian Jing, Douglas Anderson, Nicolas Boichat, Javier Martinez Canillas, yong yong mao (2): mmc: core: Fix CMD6 timeout issue mmc: mediatek: correct the implementation of msdc_card_busy drivers/mmc/core/core.c | 19 +++++++++++++++++++ drivers/mmc/host/mtk-sd.c | 7 ++----- 2 files changed, 21 insertions(+), 5 deletions(-) -- 1.8.1.1.dirty -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/2] mmc: core: Fix CMD6 timeout issue 2017-01-03 8:49 [PATCH v2] Fix CMD6 timeout issue Yong Mao @ 2017-01-03 8:49 ` Yong Mao [not found] ` <1483433397-11756-1-git-send-email-yong.mao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 1 sibling, 0 replies; 3+ messages in thread From: Yong Mao @ 2017-01-03 8:49 UTC (permalink / raw) To: Ulf Hansson Cc: Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Matthias Brugger, Chunfeng Yun, Eddie Huang, Greg Kroah-Hartman, Philipp Zabel, Adrian Hunter, Shawn Lin, Baolin Wang, Russell King, Linus Walleij, Chaotian Jing, Douglas Anderson, Nicolas Boichat, Javier Martinez Canillas, yong From: yong mao <yong.mao@mediatek.com> When initializing EMMC, after switch to HS400, it will issue CMD6 to change ext_csd, if first CMD6 got CRC error, the repeat CMD6 may get timeout, that's because card is not back to transfer state immediately. For resolving this issue, it need check if card is busy before sending repeat CMD6. Not only CMD6 here has this issue, but also other R1B CMD has the same issue. Signed-off-by: Yong Mao <yong.mao@mediatek.com> Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com> --- drivers/mmc/core/core.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 1076b9d..8674dbb 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -566,6 +566,25 @@ void mmc_wait_for_req_done(struct mmc_host *host, struct mmc_request *mrq) mmc_retune_recheck(host); + /* + * If a R1B CMD such as CMD6 occur CRC error, + * it will retry 3 times here. + * But before retrying, it must ensure card is in + * transfer state. + * Otherwise, the next retried CMD will got TMO error. + */ + if (mmc_resp_type(cmd) == MMC_RSP_R1B && host->ops->card_busy) { + int tries = 500; /* Wait aprox 500ms at maximum */ + + while (host->ops->card_busy(host) && --tries) + mmc_delay(1); + + if (tries == 0) { + cmd->error = -EBUSY; + break; + } + } + pr_debug("%s: req failed (CMD%u): %d, retrying...\n", mmc_hostname(host), cmd->opcode, cmd->error); cmd->retries--; -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 3+ messages in thread
[parent not found: <1483433397-11756-1-git-send-email-yong.mao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>]
* [PATCH v2 2/2] mmc: mediatek: correct the implementation of msdc_card_busy [not found] ` <1483433397-11756-1-git-send-email-yong.mao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> @ 2017-01-03 8:49 ` Yong Mao 0 siblings, 0 replies; 3+ messages in thread From: Yong Mao @ 2017-01-03 8:49 UTC (permalink / raw) To: Ulf Hansson Cc: Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon, Matthias Brugger, Chunfeng Yun, Eddie Huang, Greg Kroah-Hartman, Philipp Zabel, Adrian Hunter, Shawn Lin, Baolin Wang, Russell King, Linus Walleij, Chaotian Jing, Douglas Anderson, Nicolas Boichat, Javier Martinez Canillas, yong From: yong mao <yong.mao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> msdc_card_busy only need check if the data0 is low. In sdio data1 irq mode, data1 may be low because of interruption. Signed-off-by: Yong Mao <yong.mao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> Signed-off-by: Chaotian Jing <chaotian.jing-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> --- drivers/mmc/host/mtk-sd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 10ef2ae..80ba034 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -1074,11 +1074,8 @@ static int msdc_card_busy(struct mmc_host *mmc) struct msdc_host *host = mmc_priv(mmc); u32 status = readl(host->base + MSDC_PS); - /* check if any pin between dat[0:3] is low */ - if (((status >> 16) & 0xf) != 0xf) - return 1; - - return 0; + /* only check if data0 is low */ + return !(status & BIT(16)); } static void msdc_request_timeout(struct work_struct *work) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-03 8:49 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-01-03 8:49 [PATCH v2] Fix CMD6 timeout issue Yong Mao 2017-01-03 8:49 ` [PATCH v2 1/2] mmc: core: " Yong Mao [not found] ` <1483433397-11756-1-git-send-email-yong.mao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 2017-01-03 8:49 ` [PATCH v2 2/2] mmc: mediatek: correct the implementation of msdc_card_busy Yong Mao
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).