spi: imx: use PIO mode if size is small
authorRobin Gong <yibin.gong@nxp.com>
Wed, 10 Oct 2018 10:32:48 +0000 (10:32 +0000)
committerMark Brown <broonie@kernel.org>
Fri, 12 Oct 2018 16:54:02 +0000 (18:54 +0200)
Use PIO mode instead if size is smaller than fifo size, since
dma may be less efficient.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-imx.c

index 037abbb852a4defa87925bccbbec2c8126b15458..dd1ce12aa386a75c1747d6081881feacc356a231 100644 (file)
@@ -224,6 +224,9 @@ static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi,
        if (spi_imx->slave_mode)
                return false;
 
+       if (transfer->len < spi_imx->devtype_data->fifo_size)
+               return false;
+
        spi_imx->dynamic_burst = 0;
 
        return true;