From: Dongjin Kim <dongjin.kim@agreeyamobility.net>
To: linux-mmc@vger.kernel.org
Subject: mmc: dw_mmc: release hardware lock error
Date: Tue, 28 Feb 2012 05:32:09 +0000 (UTC) [thread overview]
Message-ID: <loom.20120228T060529-421@post.gmane.org> (raw)
Hello,
I encountered the problem that my hardware is frozen while switching clock from
400kHz to others. This is caused that hardware locked error was triggered when
CMD register was written and interrupt was pended. Tested IP version is 2.10a
Cheers,
Dongjin.
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 2f7f5ee..05ccee8 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -520,15 +520,33 @@ static void mci_send_cmd(struct dw_mci_slot *slot, u32
cmd, u32 arg)
struct dw_mci *host = slot->host;
unsigned long timeout = jiffies + msecs_to_jiffies(500);
unsigned int cmd_status = 0;
+ u32 ctrl;
+resend:
mci_writel(host, CMDARG, arg);
wmb();
mci_writel(host, CMD, SDMMC_CMD_START | cmd);
+
while (time_before(jiffies, timeout)) {
cmd_status = mci_readl(host, CMD);
if (!(cmd_status & SDMMC_CMD_START))
return;
+
+ if (host->cmd_status & SDMMC_INT_HLE) {
+ dev_err(&slot->mmc->class_dev,
+ "Hardware locked error (cmd %#x arg %#x)\n",
+ cmd, arg);
+
+ ctrl = mci_readl(host, CTRL);
+ ctrl |= SDMMC_CTRL_RESET;
+ mci_writel(host, CTRL, ctrl);
+
+ host->cmd_status &= ~SDMMC_INT_HLE;
+
+ goto resend;
+ }
}
+
dev_err(&slot->mmc->class_dev,
"Timeout sending command (cmd %#x arg %#x status %#x)\n",
cmd, arg, cmd_status);
@@ -1429,6 +1447,12 @@ static irqreturn_t dw_mci_interrupt(int irq, void
*dev_id)
if (!pending)
break;
+ if (pending & SDMMC_INT_HLE) {
+ mci_writel(host, RINTSTS, SDMMC_INT_HLE);
+ host->cmd_status = status;
+ smp_wmb();
+ }
+
if (pending & DW_MCI_CMD_ERROR_FLAGS) {
mci_writel(host, RINTSTS, DW_MCI_CMD_ERROR_FLAGS);
host->cmd_status = status;
next reply other threads:[~2012-02-28 5:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-28 5:32 Dongjin Kim [this message]
2012-02-28 6:42 ` mmc: dw_mmc: release hardware lock error Jaehoon Chung
2012-02-28 7:31 ` Dongjin Kim
2012-02-28 7:44 ` Jaehoon Chung
2012-02-28 10:09 ` Dongjin Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=loom.20120228T060529-421@post.gmane.org \
--to=dongjin.kim@agreeyamobility.net \
--cc=linux-mmc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox