u-boot/arch/arm/include/asm/arch-sunxi
Andre Przywara 9faae5457f mmc: sunxi: Increase MMIO FIFO read performance
To avoid the complexity of DMA operations (with chained descriptors), we
use repeated MMIO reads and writes to the SD_FIFO_REG, which allows us
to drain or fill the MMC data buffer FIFO very easily.

However those MMIO accesses are somewhat costly, so this limits our MMC
performance, to between 17 and 22 MB/s, but down to 9.5 MB/s on the H6
(partly due to the lower AHB1 frequency).

As it turns out we read the FIFO status register after *every* word we
read or write, which effectively doubles the number of MMIO accesses,
thus effectively more than halving our performance.

To avoid this overhead, we can make use of the FIFO level bits, which are
in the very same FIFO status registers.
So for a read request, we now can collect as many words as the FIFO
level originally indicated, and only then need to update the status
register.

We don't know for sure the size of the FIFO (and it seems to differ
across SoCs anyway), so writing is more fragile, which is why we still
use the old method for that. If we find a minimum FIFO size available on
all SoCs, we could use that, in a later optimisation.

This patch increases the eMMC read speed on a Pine64-LTS from about
22MB/s to 44 MB/s. SD card reads don't gain that much, but with 23 MB/s
we now reach the practical limit for 3.3V SD cards.
On the H6 we double our transfer speed, from 9.5 MB/s to 19.7 MB/s.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2021-07-10 01:22:09 +01:00
..
boot0.h sunxi: Introduce common symbol for H6 like SoCs 2021-01-25 21:52:00 +00:00
ccu.h common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
clock.h sunxi: Introduce common symbol for H6 like SoCs 2021-01-25 21:52:00 +00:00
clock_sun4i.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
clock_sun6i.h sunxi: R40: add gigabit ethernet clocks 2018-07-16 12:27:27 +05:30
clock_sun8i_a83t.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
clock_sun9i.h common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
clock_sun50i_h6.h mmc: sunxi: Fix MMC clock parent selection 2021-07-10 01:22:09 +01:00
cpu.h sunxi: Introduce common symbol for H6 like SoCs 2021-01-25 21:52:00 +00:00
cpu_sun4i.h usb: sunxi: Use proper reg_mask for clock gate, reset 2018-06-29 10:52:18 +02:00
cpu_sun9i.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
cpu_sun50i_h6.h sunxi: Add support for H616 SoC 2021-01-25 21:52:01 +00:00
cpucfg.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
display.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
display2.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
dma.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
dma_sun4i.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
dram.h sunxi: Add H616 DRAM support 2021-01-25 21:52:01 +00:00
dram_sun4i.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
dram_sun6i.h common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
dram_sun8i_a23.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
dram_sun8i_a33.h common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
dram_sun8i_a83t.h common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
dram_sun9i.h common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
dram_sun50i_h6.h common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
dram_sun50i_h616.h sunxi: Add H616 DRAM support 2021-01-25 21:52:01 +00:00
dram_sunxi_dw.h sunxi: support asymmetric dual rank DRAM on A64/R40 2021-04-16 01:12:58 +01:00
gpio.h sunxi: support boot console on uart1 for sun8i 2021-02-19 23:28:50 +00:00
gtbus.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
gtbus_sun9i.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
i2c.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
lcdc.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
mmc.h mmc: sunxi: Increase MMIO FIFO read performance 2021-07-10 01:22:09 +01:00
p2wi.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pmic_bus.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
prcm.h sunxi: prcm: Add memory map for H6 like SoCs 2021-01-25 21:52:00 +00:00
prcm_sun6i.h sunxi: prcm: Add memory map for H6 like SoCs 2021-01-25 21:52:00 +00:00
prcm_sun50i.h sunxi: prcm: Add memory map for H6 like SoCs 2021-01-25 21:52:00 +00:00
pwm.h common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
rsb.h arm: Don't include common.h in header files 2020-05-18 14:54:24 -04:00
spl.h sunxi: Fix is_boot0_magic macro 2021-01-11 23:19:34 +00:00
sys_proto.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
timer.h sunxi: Introduce common symbol for H6 like SoCs 2021-01-25 21:52:00 +00:00
tve.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
tzpc.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
watchdog.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00