Commit 812513c7 authored by Ludovic Barre's avatar Ludovic Barre Committed by Ulf Hansson

mmc: mmci: Cleanup mmci_cmd_irq() for busy detect

Let's cleanup the mmci_cmd_irq() a bit, to make the busy detect code more
clear.
Signed-off-by: default avatarLudovic Barre <ludovic.barre@st.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 7a019f9b
...@@ -1205,12 +1205,13 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, ...@@ -1205,12 +1205,13 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,
unsigned int status) unsigned int status)
{ {
void __iomem *base = host->base; void __iomem *base = host->base;
bool sbc; bool sbc, busy_resp;
if (!cmd) if (!cmd)
return; return;
sbc = (cmd == host->mrq->sbc); sbc = (cmd == host->mrq->sbc);
busy_resp = !!(cmd->flags & MMC_RSP_BUSY);
/* /*
* We need to be one of these interrupts to be considered worth * We need to be one of these interrupts to be considered worth
...@@ -1224,8 +1225,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, ...@@ -1224,8 +1225,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,
/* /*
* ST Micro variant: handle busy detection. * ST Micro variant: handle busy detection.
*/ */
if (host->variant->busy_detect) { if (busy_resp && host->variant->busy_detect) {
bool busy_resp = !!(cmd->flags & MMC_RSP_BUSY);
/* We are busy with a command, return */ /* We are busy with a command, return */
if (host->busy_status && if (host->busy_status &&
...@@ -1238,7 +1238,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, ...@@ -1238,7 +1238,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,
* that the special busy status bit is still set before * that the special busy status bit is still set before
* proceeding. * proceeding.
*/ */
if (!host->busy_status && busy_resp && if (!host->busy_status &&
!(status & (MCI_CMDCRCFAIL|MCI_CMDTIMEOUT)) && !(status & (MCI_CMDCRCFAIL|MCI_CMDTIMEOUT)) &&
(readl(base + MMCISTATUS) & host->variant->busy_detect_flag)) { (readl(base + MMCISTATUS) & host->variant->busy_detect_flag)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment