[PATCH] spi: SPI_MASTER_MUST_* with scatter-gather only option and avoiding realloc

Martin Sperl kernel at martin.sperl.org
Thu May 14 04:19:14 PDT 2015

> On 14.05.2015, at 11:58, kernel at martin.sperl.org wrote:
> From: Martin Sperl <kernel at martin.sperl.org>
> Rewrite of spi_map_msg and spi_map_buf so that for SPI_MASTER_MUST_*:
> * short transfers are handled by a page-sized buffer instead of
>  reallocating and freeing memory (if smaller than PAGE_SIZE)
> * with an extra set of flags allows to ONLY create a scatter/gather list
>  that reuses the same page for all the transfers
>  The scatter list produced is a match of the corresponding template
>  scatter list (so tx-sg is the template for the rx-sg and vice versa)
> It also fixes the insufficient cleanup in case __spi_map_msg returns
> an error.
> Signed-off-by: Martin Sperl <kernel at martin.sperl.org>
> ---

Forgot to mention:

Tested on a raspberry pi with the following devices:
* 2x mcp2515
* 1x mmc_spi (with dma)
* 1x enc28j60 (with dma)
* 1x fb_st7735r (with dma)

The fbtft-device played all of the BigBuckBunny movie without any issues.
The spi-ethernet card was able to transfer 64MB without hickups
the fsck of the attached sd card worked flawlessly.

More information about the linux-rpi-kernel mailing list