mtd: spi: Add 4bytes extend address support
PATCH 1/1 mtd: spi: Add 4bytes extend address support
Current SPI flash framework only supports to set bank register (CONFIG_SPI_FLASH_BAR) for flash with size > 16MiB. But some new flash device (for example, mt35xu512g) does not support this way, it only supports 4bytes extend address.
To access the whole memory size for such flash device, we add the support for this 4bytes extend address mode to SPI flash framework.
The configuration CONFIG_SPI_FLASH_4BYTES_ADDR is used to enable the feature.
Signed-off-by Ye Li <[email protected]>
--- drivers/mtd/spi/Kconfig | 7 ++++ drivers/mtd/spi/sf_internal.h | 8 +++++ drivers/mtd/spi/spi_flash.c | 75 ++++++++++++++++++++++++++++++++++++++----- 3 files changed, 82 insertions(+), 8 deletions(-)
drivers/mtd/spi/Kconfig +7 -0
@@ -42,6 +42,13 @@ config SPI_FLASH_BAR Bank/Extended address registers are used to access the flash which has size > 16MiB in 3-byte addressing. +config SPI_FLASH_4BYTES_ADDR + bool "SPI flash 4bytes (32) address mode support" + depends on SPI_FLASH && !SPI_FLASH_BAR + help + Enable the SPI flash 4bytes extend address mode support to access the flash + which has size > 16MiB. + config SF_DUAL_FLASH bool "SPI DUAL flash memory support" depends on SPI_FLASH
drivers/mtd/spi/sf_internal.h +8 -0
@@ -63,6 +63,14 @@ enum spi_nor_option_flags {#define CMD_READ_CONFIG 0x35#define CMD_FLAG_STATUS 0x70 +#ifdef CONFIG_SPI_FLASH_4BYTES_ADDR +#define CMD_READ_ARRAY_FAST_4B 0x0c +#define CMD_PAGE_PROGRAM_4B 0x12 +#define CMD_ERASE_64K_4B 0xdc +#define CMD_ERASE_4K_4B 0x21 +#define CMD_EN4B 0xB7 +#endif +/* Bank addr access commands */ #ifdef CONFIG_SPI_FLASH_BAR # define CMD_BANKADDR_BRWR 0x17
drivers/mtd/spi/spi_flash.c +67 -8
148 lines not on this page · raw message
Signature · 1 line
2.7.4