[PATCH v4 3/4] spi/spi-bcm2835: Remove DMA transfer size cap

Noralf Trønnes noralf at tronnes.org
Thu Apr 11 16:42:34 UTC 2019


From: Meghana Madhyastha <meghana.madhyastha at gmail.com>

The spi core splits up transfers larger than ->max_dma_len now so we can
remove the upper bound on DMA transfers. Limit max_dma_len to 65532,
because the scatter gather segment is required to be a multiple of 4.

Signed-off-by: Meghana Madhyastha <meghana.madhyastha at gmail.com>
Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
---
 drivers/spi/spi-bcm2835.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index 35aebdfd3b4e..caf33da01ac1 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -630,19 +630,6 @@ static bool bcm2835_spi_can_dma(struct spi_master *master,
 	if (tfr->len < BCM2835_SPI_DMA_MIN_LENGTH)
 		return false;
 
-	/* BCM2835_SPI_DLEN has defined a max transfer size as
-	 * 16 bit, so max is 65535
-	 * we can revisit this by using an alternative transfer
-	 * method - ideally this would get done without any more
-	 * interaction...
-	 */
-	if (tfr->len > 65535) {
-		dev_warn_once(&spi->dev,
-			      "transfer size of %d too big for dma-transfer\n",
-			      tfr->len);
-		return false;
-	}
-
 	/* return OK */
 	return true;
 }
@@ -707,7 +694,7 @@ static void bcm2835_dma_init(struct spi_master *master, struct device *dev)
 
 	/* all went well, so set can_dma */
 	master->can_dma = bcm2835_spi_can_dma;
-	master->max_dma_len = 65535; /* limitation by BCM2835_SPI_DLEN */
+	master->max_dma_len = 65532; /* limitation by BCM2835_SPI_DLEN */
 	/* need to do TX AND RX DMA, so we need dummy buffers */
 	master->flags = SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX;
 
-- 
2.20.1



More information about the dri-devel mailing list