@@ -136,6 +136,7 @@ struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode)
flash->page_size = 256;
flash->sector_size = 256 * params->pages_per_sector;
flash->size = flash->sector_size * params->nr_sectors;
+ flash->memory_map = spi->memory_map;
return flash;
}
@@ -287,7 +287,9 @@ int spi_flash_cmd_read_quad(struct spi_flash *flash, u32 offset,
/* Handle memory-mapped SPI */
if (flash->memory_map) {
+ spi_xfer(flash->spi, 0, NULL, NULL, SPI_XFER_MEM_MAP);
memcpy(data, flash->memory_map + offset, len);
+ spi_xfer(flash->spi, 0, NULL, NULL, SPI_XFER_MEM_MAP_END);
return 0;
}
@@ -338,7 +340,9 @@ int spi_flash_cmd_read_fast(struct spi_flash *flash, u32 offset,
/* Handle memory-mapped SPI */
if (flash->memory_map) {
+ spi_xfer(flash->spi, 0, NULL, NULL, SPI_XFER_MEM_MAP);
memcpy(data, flash->memory_map + offset, len);
+ spi_xfer(flash->spi, 0, NULL, NULL, SPI_XFER_MEM_MAP_END);
return 0;
}
@@ -28,6 +28,8 @@
#define SPI_XFER_BEGIN 0x01 /* Assert CS before transfer */
#define SPI_XFER_END 0x02 /* Deassert CS after transfer */
#define SPI_QUAD 0x04 /* Use QUAD read command */
+#define SPI_XFER_MEM_MAP 0x08 /* Memory Mapped start */
+#define SPI_XFER_MEM_MAP_END 0x10 /* Memory Mapped End */
/* Header byte that marks the start of the message */
#define SPI_PREAMBLE_END_BYTE 0xec
@@ -47,6 +49,7 @@ struct spi_slave {
unsigned int cs;
unsigned int max_write_size;
bool quad_enable;
+ void *memory_map;
};
/*-----------------------------------------------------------------------
Qspi controller can have a memory mapped port which can be used for data read. Added support to enable memory mapped port read. This patch enables the following: - It enables exchange of memory map address between mtd and qspi through the introduction of "memory_map" flag. - Add support to communicate to the driver that memory mapped transfer is to be started through introduction of new flags like "SPI_XFER_MEM_MAP" and "SPI_XFER_MEM_MAP_END". This will enable the spi controller to do memory mapped configurations if required. Signed-off-by: Sourav Poddar <sourav.poddar@ti.com> --- drivers/mtd/spi/spansion.c | 1 + drivers/mtd/spi/spi_flash.c | 4 ++++ include/spi.h | 3 +++ 3 files changed, 8 insertions(+), 0 deletions(-)