Skip to content

Commit

Permalink
spi: imx: Fix small DMA transfers
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
saschahauer authored and broonie committed Jul 24, 2015
1 parent bc0195a commit f6ee9b5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/spi/spi-imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi,
{
struct spi_imx_data *spi_imx = spi_master_get_devdata(master);

if (spi_imx->dma_is_inited && (transfer->len > spi_imx->rx_wml)
&& (transfer->len > spi_imx->tx_wml))
if (spi_imx->dma_is_inited
&& transfer->len > spi_imx->rx_wml * sizeof(u32)
&& transfer->len > spi_imx->tx_wml * sizeof(u32))
return true;
return false;
}
Expand Down

0 comments on commit f6ee9b5

Please sign in to comment.