lkml.org 
[lkml]   [2006]   [Nov]   [24]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateFri, 24 Nov 2006 10:54:23 +0300
FromVitaly Wool <>
SubjectRe: [PATCH] fix random SD/MMC card recognition failures on ARM Versatile
On Thu, 23 Nov 2006 19:42:36 +0000
Russell King <rmk+lkml@arm.linux.org.uk> wrote:
> Ah, I see it.  In that case we need to call mmc_stop_data() when
> we're ending the initial command due to an error.  IOW, like this:
<snip> 

I'd suggest arranging that in a bit different way. It looks like it works better when MMCIDATACTRL/MMCIMASK1 are cleared after MMCICOMMAND (and I think it makes more sense to clear the command register first, thus we have less change to get spurious interrupts after MMCIMASK1 is set).

diff --git a/drivers/mmc/mmci.c b/drivers/mmc/mmci.c
index 828503c..afbb63b 100644
--- a/drivers/mmc/mmci.c
+++ b/drivers/mmc/mmci.c
@@ -37,11 +37,21 @@ #define DBG(host,fmt,args...)	\
 
 static unsigned int fmax = 515633;
 
+static void mmci_stop_data(struct mmci_host *host)
+{
+	writel(0, host->base + MMCIDATACTRL);
+	writel(0, host->base + MMCIMASK1);
+	host->data = NULL;
+}
+
 static void
 mmci_request_end(struct mmci_host *host, struct mmc_request *mrq)
 {
 	writel(0, host->base + MMCICOMMAND);
 
+	if (host->data)
+		mmci_stop_data(host);
+
 	host->mrq = NULL;
 	host->cmd = NULL;
 
@@ -57,13 +67,6 @@ mmci_request_end(struct mmci_host *host,
 	spin_lock(&host->lock);
 }
 
-static void mmci_stop_data(struct mmci_host *host)
-{
-	writel(0, host->base + MMCIDATACTRL);
-	writel(0, host->base + MMCIMASK1);
-	host->data = NULL;
-}
-
 static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
 {
 	unsigned int datactrl, timeout, irqmask;
@@ -168,8 +171,6 @@ mmci_data_irq(struct mmci_host *host, st
 			flush_dcache_page(host->sg_ptr->page);
 	}
 	if (status & MCI_DATAEND) {
-		mmci_stop_data(host);
-
 		if (!data->stop) {
 			mmci_request_end(host, data->mrq);
 		} else {

Vitaly
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-11-24 07:57    [from the cache]
©2003-2008