Skip to content

Commit f6ee9b5

Browse files
saschahauerbroonie
authored andcommitted
spi: imx: Fix small DMA transfers
DMA transfers must be greater than the watermark level size. spi_imx->rx_wml and spi_imx->tx_wml contain the watermark level in 32bit words whereas struct spi_transfer contains the transfer len in bytes. Fix the check if DMA is possible for a transfer accordingly. This fixes transfers with sizes between 33 and 128 bytes for which previously was claimed that DMA is possible. Fixes: f62cacc (spi: spi-imx: add DMA support) Signed-off-by: Sascha Hauer <[email protected]> Cc: [email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent bc0195a commit f6ee9b5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/spi/spi-imx.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,9 @@ static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi,
201201
{
202202
struct spi_imx_data *spi_imx = spi_master_get_devdata(master);
203203

204-
if (spi_imx->dma_is_inited && (transfer->len > spi_imx->rx_wml)
205-
&& (transfer->len > spi_imx->tx_wml))
204+
if (spi_imx->dma_is_inited
205+
&& transfer->len > spi_imx->rx_wml * sizeof(u32)
206+
&& transfer->len > spi_imx->tx_wml * sizeof(u32))
206207
return true;
207208
return false;
208209
}

0 commit comments

Comments
 (0)