mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-25 13:14:19 +08:00
sf: Add memory mapped read support
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> Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
This commit is contained in:
parent
62d206dc31
commit
004f15b600
@ -269,7 +269,9 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
|
||||
|
||||
/* Handle memory-mapped SPI */
|
||||
if (flash->memory_map) {
|
||||
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);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -203,6 +203,7 @@ struct spi_flash *spi_flash_validate_params(struct spi_slave *spi, u8 *idcode)
|
||||
flash->page_size = (ext_jedec == 0x4d00) ? 512 : 256;
|
||||
flash->sector_size = params->sector_size;
|
||||
flash->size = flash->sector_size * params->nr_sectors;
|
||||
flash->memory_map = spi->memory_map;
|
||||
|
||||
/* Compute erase sector and command */
|
||||
if (params->flags & SECT_4K) {
|
||||
|
@ -27,6 +27,8 @@
|
||||
/* SPI transfer flags */
|
||||
#define SPI_XFER_BEGIN 0x01 /* Assert CS before transfer */
|
||||
#define SPI_XFER_END 0x02 /* Deassert CS after transfer */
|
||||
#define SPI_XFER_MMAP 0x08 /* Memory Mapped start */
|
||||
#define SPI_XFER_MMAP_END 0x10 /* Memory Mapped End */
|
||||
|
||||
/* Header byte that marks the start of the message */
|
||||
#define SPI_PREAMBLE_END_BYTE 0xec
|
||||
@ -46,6 +48,7 @@ struct spi_slave {
|
||||
unsigned int bus;
|
||||
unsigned int cs;
|
||||
unsigned int max_write_size;
|
||||
void *memory_map;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user