summaryrefslogtreecommitdiffstats
path: root/drivers/mci/pxamci.c
diff options
context:
space:
mode:
authorRobert Jarzmik <robert.jarzmik@free.fr>2011-12-19 10:17:19 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-12-21 11:15:31 +0100
commitedd0f1cede7fd568035da7820b329432cdb2220a (patch)
tree3105afe9328fce8d4b33224a1366f5b60435895c /drivers/mci/pxamci.c
parent64aa9692c82071c0199b8a1403f2ee90d674cab7 (diff)
downloadbarebox-edd0f1cede7fd568035da7820b329432cdb2220a.tar.gz
barebox-edd0f1cede7fd568035da7820b329432cdb2220a.tar.xz
drivers/mci: pxa read data performance boost
Increase pxa reading performance by reading 4 bytes at a time instead of 4 reads of 1 byte. As the mci controller FIFO accepts reads on bytes, halfwords or words, use words whenether possible. The boost is for a 250KBytes file read and display (bmp): - before: 6900ms - after: 6000ms Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mci/pxamci.c')
-rw-r--r--drivers/mci/pxamci.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/mci/pxamci.c b/drivers/mci/pxamci.c
index a3f8f228f8..1634a1d775 100644
--- a/drivers/mci/pxamci.c
+++ b/drivers/mci/pxamci.c
@@ -74,8 +74,9 @@ static void pxamci_setup_data(struct pxamci_host *host, struct mci_data *data)
static int pxamci_read_data(struct pxamci_host *host, unsigned char *dst,
unsigned len)
{
- int trf_len, ret = 0;
+ int trf_len, trf_len1, trf_len4, ret = 0;
uint64_t start;
+ u32 *dst4;
mci_dbg("dst=%p, len=%u\n", dst, len);
while (!ret && len > 0) {
@@ -85,8 +86,13 @@ static int pxamci_read_data(struct pxamci_host *host, unsigned char *dst,
ret && !is_timeout(start, 10 * MSECOND);)
if (mmc_readl(MMC_I_REG) & RXFIFO_RD_REQ)
ret = 0;
- for (; !ret && trf_len > 0; trf_len--, len--)
+ trf_len1 = trf_len % 4;
+ trf_len4 = trf_len / 4;
+ for (dst4 = (u32 *)dst; !ret && trf_len4 > 0; trf_len4--)
+ *dst4++ = mmc_readl(MMC_RXFIFO);
+ for (dst = (u8 *)dst4; !ret && trf_len1 > 0; trf_len1--)
*dst++ = mmc_readb(MMC_RXFIFO);
+ len -= trf_len;
}
if (!ret)