[U-Boot] [U-Boot, 6/8] rockchip: spi: add optimised receive-only implementation
Philipp Tomsich
philipp.tomsich at theobroma-systems.com
Tue Apr 23 14:31:21 UTC 2019
> 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 at theobroma-systems.com>
> Reported-by: Klaus Goger <klaus.goger at theobroma-systems.com>
>
> Series-Cc: Klaus Goger <klaus.goger at theobroma-systems.com>
> Series-Cc: Christoph Muellner <christoph.muellner at theobroma-systems.com>
> ---
>
> drivers/spi/rk_spi.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 88 insertions(+), 1 deletion(-)
>
Applied to u-boot-rockchip, thanks!
More information about the U-Boot
mailing list