linux/drivers/spi
Ricardo Ribalda Delgado eca37c7c11 spi/spi-xilinx: Fix race condition on last word read
Some users have reported that in polled mode the driver fails randomly
to read the last word of the transfer.

The end condition used for the transmissions (in polled and irq mode)
has been the TX_EMPTY flag. But Lars-Peter Clausen has identified a delay
from the TX_EMPTY to the actual end of the data rx.

I believe that this race condition has not been detected until now
because of the latency added by the IRQ handler or the PCIe bridge.
This bugs affects setups with low latency access to the spi core.

This patch replaces the readout logic:

For all the words, except the last one, the TX_EMPTY flag is used (and
cached).

If !TX_EMPY or is the last word. The status register is read and the
RX_EMPTY flag is used.

The performance is not affected: there is an extra read of the
Status Register, but the readout can start as soon as there is a word
in the buffer.

Reported-by: Edward Kigwana <ekigwana@scires.com>
Initial-fix-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2015-10-29 09:03:42 +09:00
..
Kconfig Merge remote-tracking branches 'spi/topic/ti-qspi', 'spi/topic/xcomm' and 'spi/topic/xlp' into spi-next 2015-08-31 14:45:45 +01:00
Makefile Merge remote-tracking branches 'spi/topic/ti-qspi', 'spi/topic/xcomm' and 'spi/topic/xlp' into spi-next 2015-08-31 14:45:45 +01:00
spi-adi-v3.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-altera.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-ath79.c spi: spi-ath79: Set the initial state of CS0 2015-04-27 15:44:57 +01:00
spi-atmel.c spi: atmel: remove useless include 2015-08-10 19:07:04 +01:00
spi-au1550.c spi: Remove FSF mailing addresses 2014-12-22 15:32:42 +00:00
spi-bcm53xx.c Merge remote-tracking branches 'spi/topic/atmel', 'spi/topic/bcm2385', 'spi/topic/bcm2835', 'spi/topic/bcm53xx' and 'spi/topic/bitbang' into spi-next 2015-04-11 23:09:03 +01:00
spi-bcm53xx.h spi: bcm53xx: driver for SPI controller on Broadcom bcma SoC 2014-08-19 11:30:55 -05:00
spi-bcm63xx-hsspi.c spi/bcm63xx-hsspi: add support for dual spi read/write 2015-08-25 17:33:49 +01:00
spi-bcm63xx.c spi: Remove FSF mailing addresses 2014-12-22 15:32:42 +00:00
spi-bcm2835.c spi: bcm2835: set up spi-mode before asserting cs-gpio 2015-08-14 19:09:09 +01:00
spi-bfin5xx.c spi: spi-bfin5xx: Initialize cr_width in bfin_spi_pump_transfers() 2015-04-01 21:28:56 +01:00
spi-bfin-sport.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-bitbang-txrx.h spi: Fix regression in spi-bitbang-txrx.h 2015-07-29 15:01:07 +01:00
spi-bitbang.c spi: bitbang: Make setup_transfer() callback optional 2015-04-18 12:01:03 +01:00
spi-butterfly.c spi: Remove FSF mailing addresses 2014-12-22 15:32:42 +00:00
spi-cadence.c Merge remote-tracking branches 'spi/topic/atmel', 'spi/topic/cadence', 'spi/topic/dw' and 'spi/topic/fsl-cpm' into spi-next 2014-12-08 12:17:12 +00:00
spi-clps711x.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-coldfire-qspi.c spi: Remove FSF mailing addresses 2014-12-22 15:32:42 +00:00
spi-davinci.c spi: davinci: Choose correct pre-scaler limit based on SOC 2015-07-24 17:35:51 +01:00
spi-dln2.c spi/dln2: simplify return flow for dln2_spi_transfer_setup and dln2_spi_enable 2015-01-06 17:02:50 +00:00
spi-dw-mid.c spi: dw-spi: Convert 16bit accesses to 32bit accesses 2015-03-17 12:27:09 +00:00
spi-dw-mmio.c spi: dw: Allow interface drivers to limit data I/O to word sizes 2015-08-21 10:25:28 -07:00
spi-dw-pci.c spi: dw-pci: correct number of chip selects 2015-02-24 16:59:32 +09:00
spi-dw.c spi: dw: Allow interface drivers to limit data I/O to word sizes 2015-08-21 10:25:28 -07:00
spi-dw.h spi: dw: Allow interface drivers to limit data I/O to word sizes 2015-08-21 10:25:28 -07:00
spi-efm32.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-ep93xx.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-falcon.c Merge remote-tracking branches 'spi/topic/falcon', 'spi/topic/fsf', 'spi/topic/fsl', 'spi/topic/fsl-dspi' and 'spi/topic/gpio' into spi-next 2015-02-08 11:16:46 +08:00
spi-fsl-cpm.c spi: fsl-spi: fix devm_ioremap_resource() error case 2015-04-24 13:27:53 +01:00
spi-fsl-cpm.h
spi-fsl-dspi.c spi: fsl-dspi: Use pinctrl PM helpers 2015-06-12 18:28:13 +01:00
spi-fsl-espi.c spi: fsl-(e)spi: Fix checking return value of devm_ioremap_resource 2015-08-30 12:14:36 +01:00
spi-fsl-lib.c spi: fsl-(e)spi: simplify cleanup code 2015-08-28 18:15:18 +01:00
spi-fsl-lib.h spi: fsl-(e)spi: simplify cleanup code 2015-08-28 18:15:18 +01:00
spi-fsl-spi.c spi: fsl-(e)spi: Fix checking return value of devm_ioremap_resource 2015-08-30 12:14:36 +01:00
spi-fsl-spi.h
spi-gpio.c Merge remote-tracking branches 'spi/topic/falcon', 'spi/topic/fsf', 'spi/topic/fsl', 'spi/topic/fsl-dspi' and 'spi/topic/gpio' into spi-next 2015-02-08 11:16:46 +08:00
spi-img-spfi.c Merge remote-tracking branches 'spi/topic/dw', 'spi/topic/fsl-espi', 'spi/topic/img-spfi' and 'spi/topic/mpc512x-psc' into spi-next 2015-08-31 14:45:32 +01:00
spi-imx.c spi: imx: Fix small DMA transfers 2015-07-24 16:08:55 +01:00
spi-lm70llp.c spi: Remove FSF mailing addresses 2014-12-22 15:32:42 +00:00
spi-meson-spifc.c spi: meson: Constify struct regmap_config 2015-01-05 20:11:32 +00:00
spi-mpc52xx-psc.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-mpc52xx.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-mpc512x-psc.c spi: mpc512x-psc: fix compiler warning about uninitialized variable 2015-07-21 11:24:42 +01:00
spi-mt65xx.c spi: mediatek: fix SPI_CMD_PAUSE_IE macro error 2015-08-27 20:31:00 +01:00
spi-mxs.c spi: mxs: cleanup wait_for_completion return handling 2015-02-05 18:04:57 +00:00
spi-nuc900.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-oc-tiny.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-octeon.c spi: constify of_device_id array 2015-03-17 12:15:22 +00:00
spi-omap2-mcspi.c spi: omap2-mcspi: add runtime PM to set_cs() 2015-07-24 17:40:40 +01:00
spi-omap-100k.c spi/omap100k: Convert to runtime PM 2015-03-17 12:25:48 +00:00
spi-omap-uwire.c spi: omap-uwire: Remove needless include asm/irq.h 2015-03-23 09:43:37 -07:00
spi-orion.c spi: orion: On a38x, implement "50MHZ SPI AC timing" Erratum No. FE-9144572 2015-08-11 17:21:08 +01:00
spi-pl022.c Merge remote-tracking branches 'spi/topic/omap-100k', 'spi/topic/omap-uwire', 'spi/topic/pl022', 'spi/topic/pm' and 'spi/topic/pxa2xx' into spi-next 2015-04-11 23:09:18 +01:00
spi-ppc4xx.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-pxa2xx-dma.c spi: pxa2xx: Cleanup register access macros 2014-12-22 20:17:23 +00:00
spi-pxa2xx-pci.c spi: spi-pxa2xx: Remove clk.h include 2015-07-15 12:35:02 +01:00
spi-pxa2xx.c spi: spi-pxa2xx: Remove unused legacy null dma buffer and allocation for it 2015-08-05 10:27:27 +01:00
spi-pxa2xx.h spi: spi-pxa2xx: Remove unused legacy null dma buffer and allocation for it 2015-08-05 10:27:27 +01:00
spi-qup.c Merge remote-tracking branches 'spi/topic/qup', 'spi/topic/rockchip', 'spi/topic/rspi', 'spi/topic/s3c64xx' and 'spi/topic/sc18is602' into spi-next 2015-04-11 23:09:25 +01:00
spi-rb4xx.c spi: rb4xx: Fix checking return value of devm_ioremap_resource() 2015-05-01 17:35:54 +01:00
spi-rockchip.c spi/rockchip: remove unnecessary memset of rockchip_spi 2015-07-07 13:12:50 +01:00
spi-rspi.c spi: rspi: Make qspi_set_send_trigger() return "unsigned int" 2015-07-03 13:52:10 +01:00
spi-s3c24xx-fiq.h
spi-s3c24xx-fiq.S
spi-s3c24xx.c spi/s3c24xx: remove unnecessary memset of s3c24xx_spi 2015-07-07 13:11:27 +01:00
spi-s3c64xx.c spi: s3c64xx: print fifo size on probe. 2015-07-28 15:50:01 +01:00
spi-sc18is602.c Merge remote-tracking branches 'spi/topic/qup', 'spi/topic/rockchip', 'spi/topic/rspi', 'spi/topic/s3c64xx' and 'spi/topic/sc18is602' into spi-next 2015-04-11 23:09:25 +01:00
spi-sh-hspi.c spi: Remove FSF mailing addresses 2014-12-22 15:32:42 +00:00
spi-sh-msiof.c spi: sh-msiof: Fix FIFO size to 64 word from 256 word 2015-08-31 14:42:40 +01:00
spi-sh-sci.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-sh.c spi: Remove FSF mailing addresses 2014-12-22 15:32:42 +00:00
spi-sirf.c spi: sirf: add the reset for USP-based SPI 2015-05-26 11:39:16 +01:00
spi-st-ssc4.c spi: constify of_device_id array 2015-03-17 12:15:22 +00:00
spi-sun4i.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-sun6i.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-tegra20-sflash.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-tegra20-slink.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-tegra114.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-ti-qspi.c spi: ti-qspi: use 128 bit transfer mode where possible 2015-08-20 10:56:42 -07:00
spi-tle62x0.c spi: tle62x0: remove unnecessary OOM messages 2014-04-29 12:01:42 -07:00
spi-topcliff-pch.c spi: Remove FSF mailing addresses 2014-12-22 15:32:42 +00:00
spi-txx9.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
spi-xcomm.c spi: xcomm: Export I2C module alias information 2015-07-31 18:14:57 +01:00
spi-xilinx.c spi/spi-xilinx: Fix race condition on last word read 2015-10-29 09:03:42 +09:00
spi-xlp.c spi/xlp: SPI controller driver for Netlogic XLP SoCs 2015-08-28 18:22:19 +01:00
spi-xtensa-xtfpga.c spi: drop owner assignment from platform_drivers 2014-10-20 16:21:36 +02:00
spi-zynqmp-gqspi.c spi: zynq: missing break statement 2015-07-07 19:47:50 +01:00
spi.c Merge remote-tracking branches 'spi/topic/s3c64xx', 'spi/topic/sg', 'spi/topic/sh-msiof', 'spi/topic/spidev' and 'spi/topic/stats' into spi-next 2015-08-31 14:45:41 +01:00
spidev.c Merge remote-tracking branches 'spi/topic/s3c64xx', 'spi/topic/sg', 'spi/topic/sh-msiof', 'spi/topic/spidev' and 'spi/topic/stats' into spi-next 2015-08-31 14:45:41 +01:00