[PATCH v5 0/4] Chunk splitting of spi transfers

Noralf Trønnes noralf at tronnes.org
Sat Apr 13 18:24:11 UTC 2019


spi-bcm2835 has a ~64kB upper limit on DMA transfers. Drivers in
drivers/gpu/drm/tinydrm work around this limitation by splitting the
buffer into multiple transfers. This patchset lifts this driver
limitation by splitting affected transfers using
spi_split_transfers_maxsize().

Based on the feedback on the previous version, I now understand that
->max_dma_len is used to make scatter gather entries that the DMA engine
can handle. For a BCM2835 Lite DMA channel this is 65535 bytes, the same
limitation that the SPI block has on the combined DMA transfer length
through its DLEN register. The SPI block in DMA mode accesses the FIFO 4
bytes at a time, so the aligned maximum length is thus 65532 bytes.

Since this is a BCM2835 SPI block limitation and not a common DMA
limitation that drivers face, I've moved the splitting to the driver.

I also found out why buffer unmapping happened on the original transfer
instead of the split one. spi_res_release() restored the original
transfer before the message was finalized. AFAICT reordering this
shouldn't cause any problems.

Noralf.

Meghana Madhyastha (2):
  spi/spi-bcm2835: Split transfers that exceed DLEN
  drm/tinydrm: Remove chunk splitting in tinydrm_spi_transfer

Noralf Trønnes (2):
  spi: Remove warning in spi_split_transfers_maxsize()
  spi: Release spi_res after finalizing message

 .../gpu/drm/tinydrm/core/tinydrm-helpers.c    | 83 ++-----------------
 drivers/gpu/drm/tinydrm/mipi-dbi.c            | 10 +--
 drivers/spi/spi-bcm2835.c                     | 39 +++------
 drivers/spi/spi.c                             |  9 +-
 4 files changed, 20 insertions(+), 121 deletions(-)

-- 
2.20.1



More information about the dri-devel mailing list