]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
spi: spi-fsl-dspi: Increase target mode DMA buffer size
authorJames Clark <james.clark@linaro.org>
Tue, 2 Sep 2025 12:44:58 +0000 (13:44 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 3 Sep 2025 13:30:33 +0000 (14:30 +0100)
commit7d9baf1e530930e28b45805e3855a4a465a9e36e
tree3701cf9a406a2e0e7d3f740bbfa83ef91d9d1c88
parentfbb618e11fa7976c5295facb28afbf1a08393f51
spi: spi-fsl-dspi: Increase target mode DMA buffer size

When the device is configured as a target, the host won't stop sending
data while we're draining the buffer which leads to FIFO underflows
and corruption.

Increase the DMA buffer size to the maximum words that edma can
transfer once to reduce the chance of this happening.

In host mode, the driver is able to split up a transfer into smaller
chunks so we don't need to increase the size. While in target mode, the
length of the transfer is determined by the remote host and can be
larger than whatever default buffer size we pick. Keeping the buffer
small in host mode avoids wasting memory, but allocating the largest
possible in target mode gives the lowest possible chance of dropping any
data from the host.

While we could allocate per-transfer using the exact size of the
transfer, 128K is quite a large allocation and there is a chance it
could fail due to memory fragmentation unless it's allocated once at
init time.

Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Message-ID: <20250902-james-nxp-spi-dma-v6-6-f7aa2c5e56e2@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-dspi.c