summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorAkshay Saraswat <akshay.s@samsung.com>2014-06-18 17:52:41 +0530
committerMinkyu Kang <mk7.kang@samsung.com>2014-06-23 07:47:05 +0900
commite76d2a81bc350aebf4ae56753fb75983c7a4efdd (patch)
tree89fb394497f303f0a25bb06f55838ceed87eb1b3 /drivers/spi
parent4a1883651f7e54ad5589ee98c17133fb07247c6f (diff)
downloadu-boot-e76d2a81bc350aebf4ae56753fb75983c7a4efdd.tar.gz
u-boot-e76d2a81bc350aebf4ae56753fb75983c7a4efdd.tar.bz2
u-boot-e76d2a81bc350aebf4ae56753fb75983c7a4efdd.zip
Exynos: SPI: Fix reading data from SPI flash
SPI recieve and transfer code in exynos_spi driver has a logical bug. We read data in a variable which can hold an integer. Then we assign this integer 32 bit value to another variable which has data type uchar. Latter represents a unit of our recieve buffer. Everytime when we write a value to our recieve buffer we step ahead by 4 units when actually we wrote to one unit. This results in the loss of 3 bytes out of every 4 bytes recieved. This patch intends to fix this bug. Signed-off-by: Akshay Saraswat <akshay.s@samsung.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/exynos_spi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c
index 4d5def2d31..c92276fdf7 100644
--- a/drivers/spi/exynos_spi.c
+++ b/drivers/spi/exynos_spi.c
@@ -302,7 +302,10 @@ static int spi_rx_tx(struct exynos_spi_slave *spi_slave, int todo,
}
} else {
if (rxp || stopping) {
- *rxp = temp;
+ if (step == 4)
+ *(uint32_t *)rxp = temp;
+ else
+ *rxp = temp;
rxp += step;
}
in_bytes -= step;