linux/drivers/spi
Ned Forrester 393df744e0 pxa2xx_spi: bugfix full duplex dma data corruption
Fixes a data corruption bug in pxa2xx_spi.c when operating in full duplex
mode with DMA and using buffers that overlap.

SPI transmit and receive buffers are allowed to be the same or to overlap.
 However, this driver fails if such overlap is attempted in DMA mode
because it maps the rx and tx buffers in the wrong order.  By mapping
DMA_FROM_DEVICE (read) before DMA_TO_DEVICE (write), it invalidates the
cache before flushing it, thus discarding data which should have been
transmitted.

The patch corrects the order of mapping.  This bug exists in all versions
of pxa2xx_spi.c; similar bugs are in the drivers for two other SPI
controllers (au1500, imx).

A version of this patch has been tested on kernel 2.6.20 using
verification of loopback data with: random transfer length, random
bits-per-word, random positive offsets (both larger and smaller than
transfer length) between the start of the rx and tx buffers, and varying
clock rates.

Signed-off-by: Ned Forrester <nforrester@whoi.edu>
Cc: Vernon Sauder <vernoninhand@gmail.com>
Cc: J. Scott Merritt <merrij3@rpi.edu>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: <stable@kernel.org>		[2.6.27.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-11-19 18:49:58 -08:00
..
Kconfig spi: new orion_spi driver 2008-08-05 14:33:46 -07:00
Makefile spi: new orion_spi driver 2008-08-05 14:33:46 -07:00
at25.c spi: at25 driver is for EEPROM not FLASH 2007-12-05 09:21:18 -08:00
atmel_spi.c atmel_spi: work-around required for new HW bug in AT91SAM9263 Rev.B SPI controller 2008-11-12 17:17:17 -08:00
atmel_spi.h [PATCH] SPI: atmel_spi driver 2007-02-14 08:09:53 -08:00
au1550_spi.c dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
mpc52xx_psc_spi.c mpc52xx_psc_spi: remove code associated with !CONFIG_PPC_MERGE 2008-10-16 11:21:38 -07:00
omap2_mcspi.c [ARM] omap: convert OMAP drivers to use ioremap() 2008-09-05 17:02:30 +01:00
omap_uwire.c [ARM] omap: convert OMAP drivers to use ioremap() 2008-09-05 17:02:30 +01:00
orion_spi.c orion_spi: handle 88F6183 erratum 2008-10-16 11:21:38 -07:00
pxa2xx_spi.c pxa2xx_spi: bugfix full duplex dma data corruption 2008-11-19 18:49:58 -08:00
spi.c spi: core and gpio expanders use subsys_init 2008-10-16 11:21:38 -07:00
spi_bfin5xx.c spi_bfin5xx: use PIO for full duplex, not DMA 2008-05-01 08:04:01 -07:00
spi_bitbang.c spi: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:31 -07:00
spi_butterfly.c minor spi_butterfly cleanup 2007-05-08 11:15:15 -07:00
spi_imx.c [ARM] Move include/asm-arm/arch-* to arch/arm/*/include/mach 2008-08-07 09:55:48 +01:00
spi_lm70llp.c spi doesn't need class_device 2007-10-16 09:43:10 -07:00
spi_mpc83xx.c spi_mpc83xx: reject invalid transfer sizes 2008-09-13 14:41:51 -07:00
spi_s3c24xx.c spi_s3c24xx: pin configuration updates 2008-10-16 11:21:38 -07:00
spi_s3c24xx_gpio.c [ARM] Move include/asm-arm/arch-* to arch/arm/*/include/mach 2008-08-07 09:55:48 +01:00
spi_sh_sci.c spi: fix platform driver hotplug/coldplug 2008-04-11 08:06:43 -07:00
spi_txx9.c spi: fix platform driver hotplug/coldplug 2008-04-11 08:06:43 -07:00
spidev.c device create: misc: convert device_create_drvdata to device_create 2008-10-16 09:24:43 -07:00
tle62x0.c tle62x0 driver stops ignoring read errors 2007-11-14 18:45:42 -08:00
xilinx_spi.c xilinx_spi: test below 0 on unsigned irq in xilinx_spi_probe() 2008-07-24 10:47:30 -07:00