This driver currently uses kmap + flush_dcache_page. This patch changes the code to the pio_kmap/pio_kunmap without the additional flush_dcache_page call. Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> Cc: Russell King <rmk@xxxxxxxxxxxxxxxx> --- drivers/mmc/host/mmci.c | 17 ++++++++--------- drivers/mmc/host/mmci.h | 13 +++++++++---- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 90d168a..a72aa80 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -313,6 +313,7 @@ static irqreturn_t mmci_pio_irq(int irq, void *dev_id) unsigned long flags; unsigned int remain, len; char *buffer; + enum dma_data_direction dir = DMA_NONE; /* * For write, we only need to test the half-empty flag @@ -324,10 +325,15 @@ static irqreturn_t mmci_pio_irq(int irq, void *dev_id) if (!(status & (MCI_TXFIFOHALFEMPTY|MCI_RXDATAAVLBL))) break; + if (status & MCI_RXACTIVE) + dir = DMA_FROM_DEVICE; + if (status & MCI_TXACTIVE) + dir = DMA_TO_DEVICE; + /* * Map the current scatter buffer. */ - buffer = mmci_kmap_atomic(host, &flags) + host->sg_off; + buffer = mmci_kmap_atomic(host, &flags, dir) + host->sg_off; remain = host->sg_ptr->length - host->sg_off; len = 0; @@ -339,7 +345,7 @@ static irqreturn_t mmci_pio_irq(int irq, void *dev_id) /* * Unmap the buffer. */ - mmci_kunmap_atomic(host, buffer, &flags); + mmci_kunmap_atomic(host, buffer, &flags, dir); host->sg_off += len; host->size -= len; @@ -348,13 +354,6 @@ static irqreturn_t mmci_pio_irq(int irq, void *dev_id) if (remain) break; - /* - * If we were reading, and we have completed this - * page, ensure that the data cache is coherent. - */ - if (status & MCI_RXACTIVE) - flush_dcache_page(sg_page(host->sg_ptr)); - if (!mmci_next_sg(host)) break; diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index 1ceb9a9..0f19e18 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h @@ -7,6 +7,9 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ + +#include <linux/pio-mapping.h> + #define MMCIPOWER 0x000 #define MCI_PWR_OFF 0x00 #define MCI_PWR_UP 0x02 @@ -195,16 +198,18 @@ static inline int mmci_next_sg(struct mmci_host *host) return --host->sg_len; } -static inline char *mmci_kmap_atomic(struct mmci_host *host, unsigned long *flags) +static inline char *mmci_kmap_atomic(struct mmci_host *host, unsigned long *flags, + enum dma_data_direction dir) { struct scatterlist *sg = host->sg_ptr; local_irq_save(*flags); - return kmap_atomic(sg_page(sg), KM_BIO_SRC_IRQ) + sg->offset; + return pio_kmap_atomic(sg_page(sg), KM_BIO_SRC_IRQ, dir) + sg->offset; } -static inline void mmci_kunmap_atomic(struct mmci_host *host, void *buffer, unsigned long *flags) +static inline void mmci_kunmap_atomic(struct mmci_host *host, void *buffer, unsigned long *flags, + enum dma_data_direction dir) { - kunmap_atomic(buffer, KM_BIO_SRC_IRQ); + pio_kunmap_atomic(buffer, KM_BIO_SRC_IRQ, dir); local_irq_restore(*flags); } -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html