mbox series

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

Message ID 20190413182415.38543-1-noralf@tronnes.org (mailing list archive)
Headers show
Series Chunk splitting of spi transfers | expand

Message

Noralf Trønnes April 13, 2019, 6:24 p.m. UTC
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(-)