linux-yocto/drivers/spi
James Clark 54f62d542d spi: spi-fsl-dspi: Clear completion counter before initiating transfer
[ Upstream commit fa60c094c1 ]

In target mode, extra interrupts can be received between the end of a
transfer and halting the module if the host continues sending more data.
If the interrupt from this occurs after the reinit_completion() then the
completion counter is left at a non-zero value. The next unrelated
transfer initiated by userspace will then complete immediately without
waiting for the interrupt or writing to the RX buffer.

Fix it by resetting the counter before the transfer so that lingering
values are cleared. This is done after clearing the FIFOs and the
status register but before the transfer is initiated, so no interrupts
should be received at this point resulting in other race conditions.

Fixes: 4f5ee75ea1 ("spi: spi-fsl-dspi: Replace interruptible wait queue with a simple completion")
Signed-off-by: James Clark <james.clark@linaro.org>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20250627-james-nxp-spi-dma-v4-1-178dba20c120@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-07-10 15:57:45 +02:00
..
atmel-quadspi.c spi: atmel-quadspi: Fix register name in verbose logging function 2024-12-14 19:51:09 +01:00
internals.h
Kconfig spi: spi-zynqmp-gqspi: fix driver kconfig dependencies 2024-01-25 14:52:33 -08:00
Makefile
spi-altera-core.c
spi-altera-dfl.c
spi-altera-platform.c
spi-amd.c
spi-ar934x.c
spi-armada-3700.c
spi-at91-usart.c
spi-ath79.c
spi-atmel.c
spi-au1550.c
spi-axi-spi-engine.c
spi-bcm-qspi.c spi: bcm-qspi: fix SFDP BFPT read by usig mspi read 2024-02-23 08:54:35 +01:00
spi-bcm-qspi.h
spi-bcm63xx-hsspi.c spi: bcm63xx-hsspi: fix shared reset 2025-06-27 11:05:17 +01:00
spi-bcm63xx.c spi: bcm63xx-spi: fix shared reset 2025-06-27 11:05:17 +01:00
spi-bcm2835.c
spi-bcm2835aux.c
spi-bitbang-txrx.h
spi-bitbang.c
spi-brcmstb-qspi.c
spi-butterfly.c
spi-cadence-quadspi.c spi: cadence-qspi: Fix probe on AM62A LP SK 2025-05-02 07:44:00 +02:00
spi-cadence.c
spi-cavium-octeon.c
spi-cavium-thunderx.c
spi-cavium.c
spi-cavium.h
spi-clps711x.c
spi-coldfire-qspi.c
spi-davinci.c
spi-dln2.c
spi-dw-bt1.c spi: dw: Fix PM disable depth imbalance in dw_spi_bt1_probe 2022-10-26 12:34:45 +02:00
spi-dw-core.c spi: dw: Round of n_bytes to power of 2 2023-07-23 13:46:50 +02:00
spi-dw-dma.c spi: dw-dma: decrease reference count in dw_spi_dma_init_mfld() 2022-12-02 17:41:03 +01:00
spi-dw-mmio.c
spi-dw-pci.c
spi-dw.h
spi-ep93xx.c
spi-falcon.c
spi-fsi.c
spi-fsl-cpm.c spi: fsl-cpm: Use 16 bit mode for large transfers with even size 2023-05-30 13:55:29 +01:00
spi-fsl-cpm.h
spi-fsl-dspi.c spi: spi-fsl-dspi: Clear completion counter before initiating transfer 2025-07-10 15:57:45 +02:00
spi-fsl-espi.c
spi-fsl-lib.c
spi-fsl-lib.h
spi-fsl-lpspi.c spi: spi-fsl-lpspi: Use IRQF_NO_AUTOEN flag in request_irq() 2024-12-14 19:50:46 +01:00
spi-fsl-qspi.c
spi-fsl-spi.c spi: fsl-cpm: Use 16 bit mode for large transfers with even size 2023-05-30 13:55:29 +01:00
spi-fsl-spi.h
spi-geni-qcom.c spi: spi-geni-qcom: Correct CS_TOGGLE bit in SPI_TRANS_CFG 2023-07-23 13:46:49 +02:00
spi-gpio.c spi: spi-gpio: Don't set MOSI as an input if not 3WIRE mode 2022-12-31 13:14:18 +01:00
spi-hisi-kunpeng.c spi: hisi-kunpeng: Delete the dump interface of data registers in debugfs 2024-05-17 11:50:47 +02:00
spi-hisi-sfc-v3xx.c spi: hisi-sfc-v3xx: Return IRQ_NONE if no interrupts were detected 2024-03-01 13:21:44 +01:00
spi-img-spfi.c
spi-imx.c spi: spi-imx: Fix pm_runtime_set_suspended() with runtime pm enabled 2024-10-17 15:11:33 +02:00
spi-iproc-qspi.c
spi-jcore.c
spi-lantiq-ssc.c
spi-lm70llp.c
spi-loopback-test.c spi: loopback-test: Do not split 1024-byte hexdumps 2025-05-22 14:08:21 +02:00
spi-lp8841-rtc.c
spi-mem.c
spi-meson-spicc.c spi: meson-spicc: do not rely on busy flag in pow2 clk ops 2022-10-26 12:34:42 +02:00
spi-meson-spifc.c
spi-mpc52xx-psc.c
spi-mpc52xx.c spi: mpc52xx: Add cancel_work_sync before module remove 2024-12-14 19:51:30 +01:00
spi-mpc512x-psc.c
spi-mt65xx.c spi: spi-mt65xx: Fix NULL pointer access in interrupt handler 2024-03-26 18:21:37 -04:00
spi-mt7621.c
spi-mtk-nor.c
spi-mux.c spi: mux: set ctlr->bits_per_word_mask 2024-07-27 10:46:14 +02:00
spi-mxic.c
spi-mxs.c spi-mxs: Fix chipselect glitch 2025-03-13 12:51:11 +01:00
spi-npcm-fiu.c spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0 2023-11-08 17:26:47 +01:00
spi-npcm-pspi.c
spi-nxp-fspi.c spi: nxp-fspi: fix the KASAN report out-of-bounds bug 2024-10-17 15:10:37 +02:00
spi-oc-tiny.c
spi-omap-100k.c spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe 2022-10-26 12:34:46 +02:00
spi-omap-uwire.c
spi-omap2-mcspi.c
spi-orion.c
spi-pic32-sqi.c
spi-pic32.c
spi-pl022.c
spi-ppc4xx.c spi: ppc4xx: Avoid returning 0 when failed to parse and map IRQ 2024-10-17 15:10:48 +02:00
spi-pxa2xx-dma.c
spi-pxa2xx-pci.c
spi-pxa2xx.c
spi-pxa2xx.h
spi-qcom-qspi.c
spi-qup.c spi: qup: Request DMA before enabling clocks 2023-06-14 11:13:00 +02:00
spi-rb4xx.c
spi-realtek-rtl.c
spi-rockchip-sfc.c spi: spi-rockchip: Fix missing unwind goto in rockchip_sfc_probe() 2023-04-26 13:51:49 +02:00
spi-rockchip.c
spi-rpc-if.c
spi-rspi.c
spi-s3c24xx-regs.h
spi-s3c24xx.c
spi-s3c64xx.c spi: s3c64xx: fix timeout counters in flush_fifo 2024-10-17 15:11:33 +02:00
spi-sc18is602.c
spi-sh-hspi.c
spi-sh-msiof.c spi: sh-msiof: Fix maximum DMA transfer size 2025-06-27 11:05:10 +01:00
spi-sh-sci.c
spi-sh.c
spi-sifive.c
spi-slave-mt27xx.c
spi-slave-system-control.c
spi-slave-time.c
spi-sprd-adi.c
spi-sprd.c
spi-st-ssc4.c
spi-stm32-qspi.c
spi-stm32.c spi: stm32: Don't warn about spurious interrupts 2024-06-16 13:39:51 +02:00
spi-sun4i.c spi: spi-sun4i: fix early activation 2025-06-04 14:38:08 +02:00
spi-sun6i.c spi: sun6i: fix race between DMA RX transfer completion and RX FIFO drain 2023-10-06 13:18:15 +02:00
spi-synquacer.c spi: synquacer: Fix timeout handling in synquacer_spi_transfer_one() 2023-03-10 09:39:31 +01:00
spi-tegra20-sflash.c spi: tegra20-sflash: fix to check return value of platform_get_irq() in tegra_sflash_probe() 2023-09-19 12:22:32 +02:00
spi-tegra20-slink.c spi: tegra: Fix missing IRQ check in tegra_slink_probe() 2023-11-20 11:08:16 +01:00
spi-tegra114.c
spi-tegra210-quad.c spi: tegra210-quad: Avoid shift-out-of-bounds 2024-12-14 19:50:49 +01:00
spi-test.h
spi-ti-qspi.c
spi-tle62x0.c
spi-topcliff-pch.c
spi-uniphier.c
spi-xcomm.c
spi-xilinx.c
spi-xlp.c
spi-xtensa-xtfpga.c
spi-zynq-qspi.c spi: zynq-qspi: Add check for clk_enable() 2025-03-13 12:49:53 +01:00
spi-zynqmp-gqspi.c spi: zynqmp-gqspi: Always acknowledge interrupts 2025-06-04 14:38:04 +02:00
spi.c spi: Fix acpi deferred irq probe 2024-12-14 19:51:15 +01:00
spidev.c spi: spidev: Add missing spi_device_id for jg10309-01 2024-10-17 15:10:40 +02:00