The PL180 FIFO burst loops use eight individual readl() or writel() calls. On ARM each accessor adds an ordering barrier, which makes PIO transfers unnecessarily expensive.
Use readsl() and writesl() for complete eight-word bursts. These helpers are intended for FIFO data ports and avoid a barrier around every word. Keep the existing single-word accessors for transfer tails. Signed-off-by: Linus Walleij <[email protected]> --- drivers/mmc/arm_pl180_mmci.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c index 5912e9d721ce..7d58c64df11d 100644 --- a/drivers/mmc/arm_pl180_mmci.c +++ b/drivers/mmc/arm_pl180_mmci.c @@ -141,7 +141,6 @@ static int do_command(struct mmc *dev, struct mmc_cmd *cmd) static int read_bytes(struct mmc *dev, u32 *dest, u32 blkcount, u32 blksize) { u32 *tempbuff = dest; - int i; u64 xfercount = blkcount * blksize; struct pl180_mmc_host *host = dev->priv; u32 status, status_err; @@ -154,8 +153,8 @@ static int read_bytes(struct mmc *dev, u32 *dest, u32 blkcount, u32 blksize) while (!status_err && xfercount >= SDI_FIFO_BURST_SIZE * sizeof(u32)) { if (status & SDI_STA_RXFIFOBR) { - for (i = 0; i < SDI_FIFO_BURST_SIZE; i++) - *(tempbuff + i) = readl(&host->base->fifo); + readsl(&host->base->fifo, tempbuff, + SDI_FIFO_BURST_SIZE); tempbuff += SDI_FIFO_BURST_SIZE; xfercount -= SDI_FIFO_BURST_SIZE * sizeof(u32); } @@ -210,7 +209,6 @@ static int read_bytes(struct mmc *dev, u32 *dest, u32 blkcount, u32 blksize) static int write_bytes(struct mmc *dev, u32 *src, u32 blkcount, u32 blksize) { u32 *tempbuff = src; - int i; u64 xfercount = blkcount * blksize; struct pl180_mmc_host *host = dev->priv; u32 status, status_err; @@ -222,9 +220,8 @@ static int write_bytes(struct mmc *dev, u32 *src, u32 blkcount, u32 blksize) while (!status_err && xfercount) { if (status & SDI_STA_TXFIFOBW) { if (xfercount >= SDI_FIFO_BURST_SIZE * sizeof(u32)) { - for (i = 0; i < SDI_FIFO_BURST_SIZE; i++) - writel(*(tempbuff + i), - &host->base->fifo); + writesl(&host->base->fifo, tempbuff, + SDI_FIFO_BURST_SIZE); tempbuff += SDI_FIFO_BURST_SIZE; xfercount -= SDI_FIFO_BURST_SIZE * sizeof(u32); } else { -- 2.55.0
