u-boot/drivers/spi
Philipp Tomsich 8aa6c921f7 rockchip: spi: add optimised receive-only implementation
For the RK3399-Q7 we recommend storing SPL and u-boot.itb in the
on-module 32MBit (and sometimes even larger, if requested as part of a
configure-to-order configuration) SPI-NOR flash that is clocked for a
bitrate of 49.5MBit/s and connected in a single-IO configuration (the
RK3399 only supports single-IO for SPI).

Unfortunately, the existing SPI driver is excruciatingly slow at
reading out large chunks of data (in fact it is just as slow for small
chunks of data, but the overheads of the driver-framework make it less
noticeable): before this change, the throughput on a 4MB read from
SPI-NOR is 8.47MBit/s which equates a 17.11% bus-utilisation.

To improve on this, this commit adds an optimised receive-only
transfer (i.e.: out == NULL) handler that hooks into the main transfer
function and processes data in 16bit frames (utilising the full with
of each FIFO element).  As of now, the receive-only handler requires
the in-buffer to be 16bit aligned.  Any lingering data (i.e. either if
the in-buffer was not 16-bit aligned or if an odd number of bytes are
to be received) will be handled by the original 8bit reader/wirter.

Given that the SPI controller's documentation does not guarantuee any
interlocking between the RXFIFO and the master SCLK, the transfer loop
will be restarted for each chunk of 32 frames (i.e. 64 bytes).

With this new receive-only transfer handler, the throughput for a 4MB
read increases to 36.28MBit/s (i.e. 73.29% bus-utilisation): this is a
4x improvement over the baseline.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reported-by: Klaus Goger <klaus.goger@theobroma-systems.com>

Series-Cc: Klaus Goger <klaus.goger@theobroma-systems.com>
Series-Cc: Christoph Muellner <christoph.muellner@theobroma-systems.com>
2019-05-01 00:00:04 +02:00
..
altera_spi.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
atcspi200_spi.c Merge branch 'master' of git://git.denx.de/u-boot-spi 2018-05-30 14:51:37 -04:00
ath79_spi.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
atmel_spi.c spi: Remove unused spi_init 2018-11-27 21:06:53 +05:30
atmel_spi.h Revert "spi: atmel: Drop non-dm code" 2018-04-07 09:19:00 -04:00
bcm63xx_hsspi.c spi: bcm63xx_hsspi: convert to use live dt 2018-06-01 15:56:02 +02:00
bcm63xx_spi.c spi: bcm63xx_spi: convert to use live dt 2018-06-01 15:56:02 +02:00
bcmstb_spi.c board: arm: Add support for Broadcom BCM7445 2018-07-10 16:55:57 -04:00
cadence_qspi.c spi: cadence_qspi: add reset handling 2019-04-17 22:20:17 +02:00
cadence_qspi.h spi: cadence_qspi: add reset handling 2019-04-17 22:20:17 +02:00
cadence_qspi_apb.c spi: cadence_qspi: Add quad write support 2019-04-12 10:54:03 +05:30
cf_spi.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
davinci_spi.c spi: Remove unused spi_init 2018-11-27 21:06:53 +05:30
designware_spi.c spi: designware: Change include order 2019-03-04 17:56:26 +05:30
exynos_spi.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
fsl_dspi.c spi: fsl_dspi fix to stop extra transmissions 2019-04-12 11:24:24 +05:30
fsl_espi.c spi: Remove unused spi_init 2018-11-27 21:06:53 +05:30
fsl_qspi.c driver/spi: fsl_qspi: Remove non-DM stuff 2018-10-02 22:13:58 +05:30
fsl_qspi.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
ich.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
ich.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
Kconfig spi: ti_qspi: Drop non DM code 2019-04-17 17:43:19 +05:30
kirkwood_spi.c spi: kirkwood: add orion-spi compatible string 2018-08-03 11:14:02 +05:30
lpc32xx_ssp.c spi: Remove unused spi_init 2018-11-27 21:06:53 +05:30
Makefile spi: ti_qspi: Drop non DM code 2019-04-17 17:43:19 +05:30
meson_spifc.c spi: Add Amlogic Meson SPI Flash Controller driver 2018-11-24 14:41:12 +05:30
mpc8xx_spi.c spi, mpc8xx: migrate to DM_SPI 2018-12-03 10:44:10 -05:00
mpc8xxx_spi.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
mscc_bb_spi.c mips: spi: mscc: Add fast bitbang SPI driver 2019-01-16 13:56:43 +01:00
mt7621_spi.c spi: Add SPI driver for MT76xx SoCs 2018-10-04 18:27:28 +05:30
mtk_qspi.c spi: mtk_qspi: add qspi driver for MT7629 SoC 2018-11-24 14:41:12 +05:30
mvebu_a3700_spi.c spi: mvebu_a3700_spi: Use Armada 37xx clk driver for SPI clock frequency 2018-05-14 10:00:15 +02:00
mxc_spi.c spi: mxc_spi: Fix build warning on ARM64 platforms 2019-01-28 20:35:47 +01:00
mxs_spi.c spi: Remove unused spi_init 2018-11-27 21:06:53 +05:30
omap3_spi.c spi: omap3: fix set_wordlen() reading from incorrect address for CHCONF 2019-02-28 14:21:46 -05:00
pic32_spi.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pl022_spi.c dm: platform_data: spi: s/pl022_spi.h/spi_pl022.h 2018-11-27 21:06:46 +05:30
renesas_rpc_spi.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
rk_spi.c rockchip: spi: add optimised receive-only implementation 2019-05-01 00:00:04 +02:00
rk_spi.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
sandbox_spi.c sandbox: spi: Add more logging 2018-10-09 04:40:27 -06:00
sh_qspi.c spi: Remove unused spi_init 2018-11-27 21:06:53 +05:30
sh_spi.c spi: Remove unused spi_init 2018-11-27 21:06:53 +05:30
sh_spi.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
soft_spi.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
soft_spi_legacy.c spi: Remove unused spi_init 2018-11-27 21:06:53 +05:30
spi-emul-uclass.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
spi-mem-nodm.c spi: Add non DM version of SPI_MEM 2019-02-07 15:33:21 +05:30
spi-mem.c spi: spi-mem: Check if exec_op function is set before calling it 2019-04-12 11:17:39 +05:30
spi-sunxi.c spi: Rename sun4i_spi.c into spi-sunxi.c 2019-03-04 18:08:56 +05:30
spi-uclass.c dm: spi: Read default speed and mode values from DT 2019-04-12 11:54:50 +05:30
spi.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
stm32_qspi.c spi: stm32_qspi: move to exec_op 2019-04-12 16:09:13 +02:00
tegra20_sflash.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
tegra20_slink.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
tegra114_spi.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
tegra210_qspi.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
tegra_spi.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
ti_qspi.c spi: ti_qspi: Convert to spi-mem ops 2019-04-17 17:43:54 +05:30
xilinx_spi.c spi: xilinx_spi: convert to livetree 2018-07-16 14:01:20 +05:30
zynq_qspi.c spi: zynq_qspi: Fixed incorrect return value error 2018-06-25 14:13:57 +05:30
zynq_spi.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
zynqmp_gqspi.c spi: zynqmp_gqspi: Fix tap delay values at 100MHz and 150MHz 2019-04-16 11:51:34 +02:00