Re: [PATCH] fix random SD/MMC card recognition failures on ARMVersatile

From: Vitaly Wool
Date: Fri Nov 24 2006 - 02:54:48 EST


On Thu, 23 Nov 2006 19:42:36 +0000
Russell King <rmk+lkml@xxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/