linux/drivers/spi
Tobias Schramm 1f11f4202c
spi: sun6i: fix race between DMA RX transfer completion and RX FIFO drain
Previously the transfer complete IRQ immediately drained to RX FIFO to
read any data remaining in FIFO to the RX buffer. This behaviour is
correct when dealing with SPI in interrupt mode. However in DMA mode the
transfer complete interrupt still fires as soon as all bytes to be
transferred have been stored in the FIFO. At that point data in the FIFO
still needs to be picked up by the DMA engine. Thus the drain procedure
and DMA engine end up racing to read from RX FIFO, corrupting any data
read. Additionally the RX buffer pointer is never adjusted according to
DMA progress in DMA mode, thus calling the RX FIFO drain procedure in DMA
mode is a bug.
Fix corruptions in DMA RX mode by draining RX FIFO only in interrupt mode.
Also wait for completion of RX DMA when in DMA mode before returning to
ensure all data has been copied to the supplied memory buffer.

Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
Link: https://lore.kernel.org/r/20230827152558.5368-3-t.schramm@manjaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-04 13:55:29 +01:00
..
atmel-quadspi.c spi: atmel-quadspi: Convert to platform remove callback returning void 2023-03-17 15:47:51 +00:00
internals.h
Kconfig spi: rzv2m-csi: Fix SoC product name 2023-07-03 13:04:53 +01:00
Makefile spi: Add support for Renesas CSI 2023-06-23 11:04:20 +01:00
spi-altera-core.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-altera-dfl.c spi: spi-altera-dfl: switch to use modern name 2022-12-29 13:22:04 +00:00
spi-altera-platform.c spi: spi-altera-platform: switch to use modern name 2022-12-29 13:22:05 +00:00
spi-amd.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-amlogic-spifc-a1.c spi: add support for Amlogic A1 SPI Flash Controller 2023-04-11 12:40:30 +01:00
spi-ar934x.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-armada-3700.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-aspeed-smc.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-at91-usart.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-ath79.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-atmel.c spi: atmel: Prevent false timeouts on long transfers 2023-06-22 22:22:49 +01:00
spi-au1550.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-axi-spi-engine.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-bcm-qspi.c spi: bcm-qspi: return error if neither hif_mspi nor mspi is available 2023-06-30 14:53:52 +01:00
spi-bcm-qspi.h spi: bcm-qspi: Make bcm_qspi_remove() return void 2022-10-18 19:16:53 +01:00
spi-bcm63xx-hsspi.c spi: bcm{63xx,bca}-hsspi: update my email address 2023-07-04 13:54:19 +01:00
spi-bcm63xx.c spi: bcm63xx: fix max prepend length 2023-07-10 10:01:27 +01:00
spi-bcm2835.c spi: bcm2835: Convert to platform remove callback returning void 2023-03-31 12:54:07 +01:00
spi-bcm2835aux.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-bcmbca-hsspi.c spi: bcm{63xx,bca}-hsspi: update my email address 2023-07-04 13:54:19 +01:00
spi-bitbang-txrx.h spi: bitbang: Fix lsb-first Rx 2022-08-15 01:26:20 +01:00
spi-bitbang.c
spi-brcmstb-qspi.c spi: brcmstb-qspi: Convert to platform remove callback returning void 2023-03-06 12:31:15 +00:00
spi-butterfly.c
spi-cadence-quadspi.c spi: Updates for v6.5 2023-06-28 13:48:42 -07:00
spi-cadence-xspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-cadence.c spi: spi-cadence: Fix data corruption issues in slave mode 2023-08-21 13:09:57 +01:00
spi-cavium-octeon.c spi: cavium-octeon: Convert to platform remove callback returning void 2023-03-06 12:31:17 +00:00
spi-cavium-thunderx.c
spi-cavium.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-cavium.h
spi-clps711x.c spi: clps711x: Use syscon_regmap_lookup_by_phandle 2022-04-25 14:01:09 +01:00
spi-coldfire-qspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-davinci.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-dln2.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-dw-bt1.c spi: dw-bt1: Convert to platform remove callback returning void 2023-03-06 12:31:21 +00:00
spi-dw-core.c spi: dw: Drop empty line from DebugFS init function 2023-05-31 12:25:17 +01:00
spi-dw-dma.c spi: dw: Add DMA address widths capability check 2023-05-15 10:46:17 +09:00
spi-dw-mmio.c spi: Updates for v6.5 2023-06-28 13:48:42 -07:00
spi-dw-pci.c spi: dw: Put the driver entities naming in order 2021-11-16 14:30:05 +00:00
spi-dw.h spi: dw: Add DMA address widths capability check 2023-05-15 10:46:17 +09:00
spi-ep93xx.c spi: ep93xx: Convert to platform remove callback returning void 2023-03-06 12:31:23 +00:00
spi-falcon.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-fsi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-fsl-cpm.c spi: fsl-cpm: Use 16 bit mode for large transfers with even size 2023-04-05 12:33:34 +01:00
spi-fsl-cpm.h
spi-fsl-dspi.c spi: fsl-dspi: avoid SCK glitches with continuous transfers 2023-06-06 16:49:20 +01:00
spi-fsl-espi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-fsl-lib.c
spi-fsl-lib.h
spi-fsl-lpspi.c spi: spi-fsl-lpspi: downgrade log level for pio mode 2023-05-31 12:25:16 +01:00
spi-fsl-qspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-fsl-spi.c spi: fsl-spi: No need to check transfer length versus word size 2023-04-05 12:33:36 +01:00
spi-fsl-spi.h
spi-geni-qcom.c spi: Fixes for v6.5 2023-07-06 19:24:11 -07:00
spi-gpio.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-gxp.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-hisi-kunpeng.c spi: hisi-kunpeng: Fix error checking 2023-05-18 19:26:36 +09:00
spi-hisi-sfc-v3xx.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-img-spfi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-imx.c spi: spi-imx: fix mixing of native and gpio chipselects for imx51/imx53/imx6 variants 2023-06-02 13:15:14 +01:00
spi-ingenic.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-intel-pci.c spi: intel-pci: Add support for Meteor Lake-S SPI serial flash 2023-03-31 12:54:07 +01:00
spi-intel-platform.c mtd: spi-nor: intel-spi: Convert to SPI MEM 2022-02-14 12:53:09 +00:00
spi-intel.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-intel.h mtd: spi-nor: intel-spi: Convert to SPI MEM 2022-02-14 12:53:09 +00:00
spi-iproc-qspi.c spi: iproc-qspi: Convert to platform remove callback returning void 2023-03-06 12:31:31 +00:00
spi-jcore.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-lantiq-ssc.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-lm70llp.c
spi-loopback-test.c spi: spi-loopback-test: Add module param for iteration length 2023-04-13 11:42:20 +01:00
spi-lp8841-rtc.c
spi-mem.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-meson-spicc.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-meson-spifc.c spi: meson-spifc: Convert to platform remove callback returning void 2023-03-06 12:31:33 +00:00
spi-microchip-core-qspi.c spi: microchip-core-qspi: Convert to platform remove callback returning void 2023-03-06 12:31:34 +00:00
spi-microchip-core.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-mpc52xx-psc.c spi: mpc5xxx-psc: Consistently use device property APIs 2023-03-07 13:58:34 +00:00
spi-mpc52xx.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-mpc512x-psc.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-mt65xx.c spi: Merge up fixes to help CI 2023-05-30 18:38:18 +01:00
spi-mt7621.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-mtk-nor.c spi: mtk-nor: Convert to platform remove callback returning void 2023-03-06 21:17:45 +00:00
spi-mtk-snfi.c spi: mtk-snfi: Convert to platform remove callback returning void 2023-03-06 21:17:46 +00:00
spi-mux.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-mxic.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-mxs.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-npcm-fiu.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-npcm-pspi.c spi: npcm-pspi: Convert to platform remove callback returning void 2023-03-06 21:17:50 +00:00
spi-nxp-fspi.c spi: spi-nxp-fspi: use DLL calibration when clock rate > 100MHz 2023-03-22 13:17:43 +00:00
spi-oc-tiny.c spi: oc-tiny: Convert to platform remove callback returning void 2023-03-06 21:17:51 +00:00
spi-omap-uwire.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-omap2-mcspi.c spi: omap2-mcspi: Use devm_platform_get_and_ioremap_resource() 2023-03-27 12:42:32 +01:00
spi-orion.c spi: orion: Use devm_platform_get_and_ioremap_resource() 2023-03-27 12:42:33 +01:00
spi-pci1xxxx.c spi: mchp-pci1xxxx: Fix improper implementation of disabling chip select lines 2023-04-05 12:33:28 +01:00
spi-pic32-sqi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-pic32.c spi: pic32: Use devm_platform_get_and_ioremap_resource() 2023-03-27 12:42:34 +01:00
spi-pl022.c spi: spl022: Probe defer is no error 2023-06-02 19:15:42 +01:00
spi-ppc4xx.c spi: ppc4xx: Convert to platform remove callback returning void 2023-03-06 21:17:57 +00:00
spi-pxa2xx-dma.c
spi-pxa2xx-pci.c spi: pxa2xx-pci: Constify struct pxa_spi_info variables 2022-02-28 12:10:27 +00:00
spi-pxa2xx.c spi: pxa2xx: Mark OF related data as maybe unused 2023-03-13 14:09:11 +00:00
spi-pxa2xx.h spi: pxa2xx: Get rid of unused ->cs_control() 2021-11-29 12:19:59 +00:00
spi-qcom-qspi.c spi: spi-qcom-qspi: Add mem_ops to avoid PIO for badly sized reads 2023-07-26 12:47:20 +01:00
spi-qup.c spi: qup: Request DMA before enabling clocks 2023-05-30 13:43:31 +01:00
spi-rb4xx.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-realtek-rtl.c
spi-rockchip-sfc.c spi: Updates for v6.4 2023-04-27 11:02:26 -07:00
spi-rockchip.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-rpc-if.c spi: rpc-if: Convert to platform remove callback returning void 2023-03-06 21:18:02 +00:00
spi-rspi.c spi: rspi: Mark OF related data as maybe unused 2023-03-13 14:09:15 +00:00
spi-rzv2m-csi.c spi: Add support for Renesas CSI 2023-06-23 11:04:20 +01:00
spi-s3c64xx.c spi: s3c64xx: clear loopback bit after loopback test 2023-07-12 13:11:06 +01:00
spi-sc18is602.c spi: Switch i2c drivers back to use .probe() 2023-05-26 16:35:29 +01:00
spi-sh-hspi.c spi: sh-hspi: Convert to platform remove callback returning void 2023-03-06 21:18:06 +00:00
spi-sh-msiof.c spi: struct spi_device constification 2023-03-13 18:19:31 +00:00
spi-sh-sci.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-sh.c spi: sh: Convert to platform remove callback returning void 2023-03-06 21:18:08 +00:00
spi-sifive.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-slave-mt27xx.c spi: slave-mt27xx: Convert to platform remove callback returning void 2023-03-06 21:18:10 +00:00
spi-slave-system-control.c spi: make remove callback a void function 2022-02-09 13:00:45 +00:00
spi-slave-time.c spi: make remove callback a void function 2022-02-09 13:00:45 +00:00
spi-sn-f-ospi.c spi: spi-sn-f-ospi: Make read-only array width_available static const 2023-05-30 13:47:03 +01:00
spi-sprd-adi.c spi: sprd-adi: Use devm_platform_get_and_ioremap_resource() 2023-03-27 12:42:35 +01:00
spi-sprd.c spi: sprd: Use devm_platform_get_and_ioremap_resource() 2023-03-27 12:42:35 +01:00
spi-st-ssc4.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-stm32-qspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-stm32.c spi: stm32: fix accidential revert to byte-sized transfer splitting 2023-08-21 13:09:56 +01:00
spi-sun4i.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-sun6i.c spi: sun6i: fix race between DMA RX transfer completion and RX FIFO drain 2023-09-04 13:55:29 +01:00
spi-sunplus-sp7021.c spi: sunplus-sp7021: Convert to platform remove callback returning void 2023-03-06 21:18:18 +00:00
spi-synquacer.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-tegra20-sflash.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-tegra20-slink.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-tegra114.c spi: tegra114: Use devm_platform_get_and_ioremap_resource() 2023-04-04 12:46:56 +01:00
spi-tegra210-quad.c spi: tegra210-quad: Enable TPM wait polling 2023-04-21 14:37:04 +01:00
spi-test.h
spi-ti-qspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-tle62x0.c spi: make remove callback a void function 2022-02-09 13:00:45 +00:00
spi-topcliff-pch.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-uniphier.c spi: uniphier: Convert to platform remove callback returning void 2023-03-06 21:18:24 +00:00
spi-wpcm-fiu.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-xcomm.c spi: Switch i2c drivers back to use .probe() 2023-05-26 16:35:29 +01:00
spi-xilinx.c spi: xilinx: Use devm_platform_get_and_ioremap_resource() 2023-03-28 14:49:37 +01:00
spi-xlp.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-xtensa-xtfpga.c spi: xtensa-xtfpga: Convert to platform remove callback returning void 2023-03-06 21:18:26 +00:00
spi-zynq-qspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi-zynqmp-gqspi.c spi: Replace all spi->chip_select and spi->cs_gpiod references with function call 2023-03-11 12:34:01 +00:00
spi.c Char/Misc drivers for 6.4-rc1 2023-04-27 12:07:50 -07:00
spidev.c spi: Updates for v6.5 2023-06-28 13:48:42 -07:00