]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
spi: bcm2835: only split transfers that exceed DLEN if DMA available
authorNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Thu, 9 May 2019 14:39:59 +0000 (16:39 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 13 May 2019 12:14:38 +0000 (13:14 +0100)
There is no use for this when performing non DMA operations. So we
bypass the split.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-bcm2835.c

index 3a9b2187787a55945ac66b0c1a7f01b8feddd46d..f87a023a445abf1d8c84fdcefc074e22a63d3267 100644 (file)
@@ -895,15 +895,17 @@ static int bcm2835_spi_prepare_message(struct spi_master *master,
        u32 cs = bcm2835_rd(bs, BCM2835_SPI_CS);
        int ret;
 
-       /*
-        * DMA transfers are limited to 16 bit (0 to 65535 bytes) by the SPI HW
-        * due to DLEN. Split up transfers (32-bit FIFO aligned) if the limit is
-        * exceeded.
-        */
-       ret = spi_split_transfers_maxsize(master, msg, 65532,
-                                         GFP_KERNEL | GFP_DMA);
-       if (ret)
-               return ret;
+       if (master->can_dma) {
+               /*
+                * DMA transfers are limited to 16 bit (0 to 65535 bytes) by
+                * the SPI HW due to DLEN. Split up transfers (32-bit FIFO
+                * aligned) if the limit is exceeded.
+                */
+               ret = spi_split_transfers_maxsize(master, msg, 65532,
+                                                 GFP_KERNEL | GFP_DMA);
+               if (ret)
+                       return ret;
+       }
 
        cs &= ~(BCM2835_SPI_CS_CPOL | BCM2835_SPI_CS_CPHA);