aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/mmci.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2006-01-04 11:24:05 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-01-04 11:24:05 -0500
commite9c091b47409255cefa1672041479d850b7b991a (patch)
tree4a88257e054c186dc878a26ffa66f370b287195e /drivers/mmc/mmci.c
parentce11a161c11868f268964274edc7a26a3e063e08 (diff)
[MMC] mmci: add data cache coherency
Since MMCI currently uses PIO to read data, we have to take steps to ensure data cache coherency on aliasing CPU caches. Add the necessary flush_dcache_page() calls. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mmc/mmci.c')
-rw-r--r--drivers/mmc/mmci.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/mmc/mmci.c b/drivers/mmc/mmci.c
index 166c9b0ad04e..6d161c70014a 100644
--- a/drivers/mmc/mmci.c
+++ b/drivers/mmc/mmci.c
@@ -20,6 +20,7 @@
20#include <linux/mmc/host.h> 20#include <linux/mmc/host.h>
21#include <linux/mmc/protocol.h> 21#include <linux/mmc/protocol.h>
22 22
23#include <asm/cacheflush.h>
23#include <asm/div64.h> 24#include <asm/div64.h>
24#include <asm/io.h> 25#include <asm/io.h>
25#include <asm/scatterlist.h> 26#include <asm/scatterlist.h>
@@ -157,6 +158,13 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
157 else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) 158 else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN))
158 data->error = MMC_ERR_FIFO; 159 data->error = MMC_ERR_FIFO;
159 status |= MCI_DATAEND; 160 status |= MCI_DATAEND;
161
162 /*
163 * We hit an error condition. Ensure that any data
164 * partially written to a page is properly coherent.
165 */
166 if (host->sg_len && data->flags & MMC_DATA_READ)
167 flush_dcache_page(host->sg_ptr->page);
160 } 168 }
161 if (status & MCI_DATAEND) { 169 if (status & MCI_DATAEND) {
162 mmci_stop_data(host); 170 mmci_stop_data(host);
@@ -301,6 +309,13 @@ static irqreturn_t mmci_pio_irq(int irq, void *dev_id, struct pt_regs *regs)
301 if (remain) 309 if (remain)
302 break; 310 break;
303 311
312 /*
313 * If we were reading, and we have completed this
314 * page, ensure that the data cache is coherent.
315 */
316 if (status & MCI_RXACTIVE)
317 flush_dcache_page(host->sg_ptr->page);
318
304 if (!mmci_next_sg(host)) 319 if (!mmci_next_sg(host))
305 break; 320 break;
306 321