Commit 18280fff authored by ben@fluff.org.uk's avatar ben@fluff.org.uk Committed by Pierre Ossman

s3cmci: fix continual accesses to host->pio_ptr

The s3cmci driver uses the host->pio_ptr field to
point to the current position into the buffer for data
transfer. During the transfers it does the following:

	while (fifo_words--)
		*(host->pio_ptr++) = readl(from_ptr);

This is inefficent, as host->pio_ptr is not used in any
other part of the transfer but the compiler emits code
which does the following:

	while (fifo_words--) {
		u32 *ptr = host->pio_ptr;
		*ptr = readl(from_ptr);
		ptr++;
		host->pio_ptr = ptr;
	}

This is obviously a waste of a load and store each time
around the loop, which could be up to 16 times depending
on how much needs to be transfered.

Move the ptr accesses to outside the while loop so that
we do not end up reloading/re-writing the pointer.

Note, this seems to make the code 16 bytes larger.
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent 088a78af
...@@ -238,6 +238,7 @@ static void do_pio_read(struct s3cmci_host *host) ...@@ -238,6 +238,7 @@ static void do_pio_read(struct s3cmci_host *host)
{ {
int res; int res;
u32 fifo; u32 fifo;
u32 *ptr;
u32 fifo_words; u32 fifo_words;
void __iomem *from_ptr; void __iomem *from_ptr;
...@@ -283,8 +284,10 @@ static void do_pio_read(struct s3cmci_host *host) ...@@ -283,8 +284,10 @@ static void do_pio_read(struct s3cmci_host *host)
host->pio_count += fifo; host->pio_count += fifo;
fifo_words = fifo >> 2; fifo_words = fifo >> 2;
ptr = host->pio_ptr;
while (fifo_words--) while (fifo_words--)
*(host->pio_ptr++) = readl(from_ptr); *ptr++ = readl(from_ptr);
host->pio_ptr = ptr;
if (fifo & 3) { if (fifo & 3) {
u32 n = fifo & 3; u32 n = fifo & 3;
...@@ -319,6 +322,7 @@ static void do_pio_write(struct s3cmci_host *host) ...@@ -319,6 +322,7 @@ static void do_pio_write(struct s3cmci_host *host)
void __iomem *to_ptr; void __iomem *to_ptr;
int res; int res;
u32 fifo; u32 fifo;
u32 *ptr;
to_ptr = host->base + host->sdidata; to_ptr = host->base + host->sdidata;
...@@ -353,8 +357,10 @@ static void do_pio_write(struct s3cmci_host *host) ...@@ -353,8 +357,10 @@ static void do_pio_write(struct s3cmci_host *host)
host->pio_count += fifo; host->pio_count += fifo;
fifo = (fifo + 3) >> 2; fifo = (fifo + 3) >> 2;
ptr = host->pio_ptr;
while (fifo--) while (fifo--)
writel(*(host->pio_ptr++), to_ptr); writel(*ptr++, to_ptr);
host->pio_ptr = ptr;
} }
enable_imask(host, S3C2410_SDIIMSK_TXFIFOHALF); enable_imask(host, S3C2410_SDIIMSK_TXFIFOHALF);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment