mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: barebox@lists.infradead.org
Subject: [PATCH] drivers/mci: pxa read data performance boost
Date: Mon, 19 Dec 2011 10:17:19 +0100	[thread overview]
Message-ID: <1324286241-23083-3-git-send-email-robert.jarzmik@free.fr> (raw)
In-Reply-To: <1324286241-23083-1-git-send-email-robert.jarzmik@free.fr>

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>
---
 drivers/mci/pxamci.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mci/pxamci.c b/drivers/mci/pxamci.c
index a3f8f22..1634a1d 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)
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2011-12-19  9:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-19  9:17 [PATCH] usb/gadget: add special treatment for PXA cpus Robert Jarzmik
2011-12-19  9:17 ` [PATCH] drivers/mci: pxa writedata timeout Robert Jarzmik
2011-12-19  9:17 ` Robert Jarzmik [this message]
2011-12-19  9:17 ` [PATCH] commands: add hexdump command Robert Jarzmik
2011-12-19 11:29   ` Antony Pavlov
2011-12-19 12:15     ` Robert Jarzmik
2011-12-19  9:17 ` [PATCH] arch/arm: mmu: add map_io_range() Robert Jarzmik

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=1324286241-23083-3-git-send-email-robert.jarzmik@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=barebox@lists.infradead.org \
    /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