]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mmc: dw_mmc: reset FIFO after an error
authorJames Hogan <james.hogan@imgtec.com>
Wed, 29 Jun 2011 08:30:47 +0000 (09:30 +0100)
committerChris Ball <cjb@laptop.org>
Wed, 20 Jul 2011 21:21:06 +0000 (17:21 -0400)
If an error occurs mid way through a transaction (such as a missing CRC
status response after the 2nd block written out of 3), then the FIFO may
still contain data which will interfere with the next transaction.
Therefore after an error has been detected, reset the fifo using the
CTRL register.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Will Newton <will.newton@imgtec.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/dw_mmc.c

index 0dac397f37fdfa0b07b42a73c146b452083ca905..0c839d3338db9334f28a19734a9f3d961afa917d 100644 (file)
@@ -849,7 +849,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
        struct mmc_command *cmd;
        enum dw_mci_state state;
        enum dw_mci_state prev_state;
-       u32 status;
+       u32 status, ctrl;
 
        spin_lock(&host->lock);
 
@@ -929,6 +929,16 @@ static void dw_mci_tasklet_func(unsigned long priv)
                                                status);
                                        data->error = -EIO;
                                }
+                               /*
+                                * After an error, there may be data lingering
+                                * in the FIFO, so reset it - doing so
+                                * generates a block interrupt, hence setting
+                                * the scatter-gather pointer to NULL.
+                                */
+                               host->sg = NULL;
+                               ctrl = mci_readl(host, CTRL);
+                               ctrl |= SDMMC_CTRL_FIFO_RESET;
+                               mci_writel(host, CTRL, ctrl);
                        } else {
                                data->bytes_xfered = data->blocks * data->blksz;
                                data->error = 0;