From c15cb3f7540562afa86801c2511fc6d983af5fc6 Mon Sep 17 00:00:00 2001 From: Jesse Gilles Date: Wed, 7 Jan 2015 12:32:24 -0600 Subject: linux-3.12.27: add linux-3.12-spi-atmel-dma-min.patch, build spi-atmel as module Forces spi-atmel to always use DMA mode instead of switching between PIO and DMA depending on the transfer size. Switching between the two can cause Rx buffer corruption with the 3.12 driver. This comes at the cost of lower performance (15 to 20%) for small transfers (1-15 bytes), but improves reliability for protocols that use small and large transfers regularly. For large transfers (1024 bytes), DMA mode is 300% faster than PIO. https://lkml.org/lkml/2013/10/21/534 --- .../linux-3.12.27/linux-3.12-spi-atmel-dma-min.patch | 18 ++++++++++++++++++ recipes-kernel/linux/linux-3.12.27/mtcdt/defconfig | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 recipes-kernel/linux/linux-3.12.27/linux-3.12-spi-atmel-dma-min.patch (limited to 'recipes-kernel/linux/linux-3.12.27') diff --git a/recipes-kernel/linux/linux-3.12.27/linux-3.12-spi-atmel-dma-min.patch b/recipes-kernel/linux/linux-3.12.27/linux-3.12-spi-atmel-dma-min.patch new file mode 100644 index 0000000..4aba504 --- /dev/null +++ b/recipes-kernel/linux/linux-3.12.27/linux-3.12-spi-atmel-dma-min.patch @@ -0,0 +1,18 @@ +Index: linux-3.12.27/drivers/spi/spi-atmel.c +=================================================================== +--- linux-3.12.27.orig/drivers/spi/spi-atmel.c ++++ linux-3.12.27/drivers/spi/spi-atmel.c +@@ -187,7 +187,12 @@ + /* use PIO for small transfers, avoiding DMA setup/teardown overhead and + * cache operations; better heuristics consider wordsize and bitrate. + */ +-#define DMA_MIN_BYTES 16 ++ ++/* MTS: set DMA_MIN_BYTES=0 to use DMA all the time due to Rx buffer issues ++ * when switching between smaller PIO and larger DMA transfers ++ * https://lkml.org/lkml/2013/10/21/534 ++ */ ++#define DMA_MIN_BYTES 0 + + struct atmel_spi_dma { + struct dma_chan *chan_rx; diff --git a/recipes-kernel/linux/linux-3.12.27/mtcdt/defconfig b/recipes-kernel/linux/linux-3.12.27/mtcdt/defconfig index 8950cdd..e0476e8 100644 --- a/recipes-kernel/linux/linux-3.12.27/mtcdt/defconfig +++ b/recipes-kernel/linux/linux-3.12.27/mtcdt/defconfig @@ -1425,7 +1425,7 @@ CONFIG_SPI_MASTER=y # SPI Master Controller Drivers # # CONFIG_SPI_ALTERA is not set -CONFIG_SPI_ATMEL=y +CONFIG_SPI_ATMEL=m # CONFIG_SPI_BITBANG is not set # CONFIG_SPI_GPIO is not set # CONFIG_SPI_FSL_SPI is not set -- cgit v1.2.3