From: Catalin Marinas <catalin.marinas@arm.com>
To: linux-arch@vger.kernel.org
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
Russell King <rmk@arm.linux.org.uk>
Subject: [RFC PATCH v2 5/5] pio-mapping: Use the PIO mapping API in the MMCI PL18x driver
Date: Thu, 11 Feb 2010 17:55:38 +0000 [thread overview]
Message-ID: <20100211175538.7848.1886.stgit@pc1117.cambridge.arm.com> (raw)
In-Reply-To: <20100211175417.7848.41807.stgit@pc1117.cambridge.arm.com>
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@arm.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Russell King <rmk@arm.linux.org.uk>
---
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);
}
prev parent reply other threads:[~2010-02-11 17:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-11 17:55 [RFC PATCH v2 0/5] PIO drivers and cache coherency Catalin Marinas
2010-02-11 17:55 ` [RFC PATCH v2 1/5] pio-mapping: Add generic support for PIO mapping API Catalin Marinas
2010-02-11 17:55 ` [RFC PATCH v2 2/5] pio-mapping: Add ARM support for the " Catalin Marinas
2010-02-11 17:55 ` [RFC PATCH v2 3/5] pio-mapping: Use the PIO mapping API in libata-sff.c Catalin Marinas
2010-02-11 17:55 ` [RFC PATCH v2 4/5] pio-mapping: Use the PIO mapping API in the ISP1760 HCD driver Catalin Marinas
2010-02-11 17:55 ` Catalin Marinas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100211175538.7848.1886.stgit@pc1117.cambridge.arm.com \
--to=catalin.marinas@arm.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-arch@vger.kernel.org \
--cc=rmk@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).