summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorPoddar, Sourav <sourav.poddar@ti.com>2013-11-14 21:01:15 +0530
committerJagannadha Sutradharudu Teki <jaganna@xilinx.com>2013-12-19 12:23:22 +0530
commitac5cce38de8f97a120b8c98f34be0d5eec50a6fb (patch)
tree74d5d9b3302c59998ced38d04347a3ae6458439c /drivers/mtd
parent2c57b03bab960b77303043cb9736050173d36fb9 (diff)
driver: mtd: sf_ops: claim bus while doing memcpy
claim spi bus while doing memory copy, this will set up the spi controller device control register before doing a memory read. Signed-off-by: Sourav Poddar <sourav.poddar@ti.com> Tested-by: Yebio Mesfin <ymesfin@ti.com> Reviewed-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/spi/sf_ops.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c
index 108665f441..e316a692a8 100644
--- a/drivers/mtd/spi/sf_ops.c
+++ b/drivers/mtd/spi/sf_ops.c
@@ -273,9 +273,15 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
/* Handle memory-mapped SPI */
if (flash->memory_map) {
+ ret = spi_claim_bus(flash->spi);
+ if (ret) {
+ debug("SF: unable to claim SPI bus\n");
+ return ret;
+ }
spi_xfer(flash->spi, 0, NULL, NULL, SPI_XFER_MMAP);
memcpy(data, flash->memory_map + offset, len);
spi_xfer(flash->spi, 0, NULL, NULL, SPI_XFER_MMAP_END);
+ spi_release_bus(flash->spi);
return 0;
}