diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/mtd/Kconfig | 27 | ||||
| -rw-r--r-- | drivers/mtd/cfi_flash.c | 6 | ||||
| -rw-r--r-- | drivers/mtd/cfi_mtd.c | 4 | ||||
| -rw-r--r-- | drivers/mtd/spi/spi-nor-core.c | 4 |
4 files changed, 34 insertions, 7 deletions
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig index a9c8c48ae6f..bde3004171a 100644 --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig @@ -31,6 +31,7 @@ config SYS_MTDPARTS_RUNTIME config FLASH_CFI_DRIVER bool "Enable CFI Flash driver" + select USE_SYS_MAX_FLASH_BANKS help The Common Flash Interface specification was developed by Intel, AMD and other flash manufactures. It provides a universal method @@ -82,6 +83,7 @@ config SYS_FLASH_CFI config ALTERA_QSPI bool "Altera Generic Quad SPI Controller" depends on DM_MTD + select USE_SYS_MAX_FLASH_BANKS help This enables access to Altera EPCQ/EPCS flash chips using the Altera Generic Quad SPI Controller. The controller converts SPI @@ -91,6 +93,7 @@ config ALTERA_QSPI config FLASH_PIC32 bool "Microchip PIC32 Flash driver" depends on MACH_PIC32 && DM_MTD + select USE_SYS_MAX_FLASH_BANKS help This enables access to Microchip PIC32 internal non-CFI flash chips through PIC32 Non-Volatile-Memory Controller. @@ -112,10 +115,34 @@ config HBMC_AM654 config STM32_FLASH bool "STM32 MCU Flash driver" depends on ARCH_STM32 + select USE_SYS_MAX_FLASH_BANKS help This is the driver of embedded flash for some STMicroelectronics STM32 MCU. +config USE_SYS_MAX_FLASH_BANKS + bool "Enable Max number of Flash memory banks" + help + When this option is enabled, the CONFIG_SYS_MAX_FLASH_BANKS + will be defined. + +config SYS_MAX_FLASH_BANKS + int "Max number of Flash memory banks" + depends on USE_SYS_MAX_FLASH_BANKS + default 1 + help + Max number of Flash memory banks using by the MTD framework, in the + flash CFI driver and in some other driver to define the flash_info + struct declaration. + +config SYS_MAX_FLASH_BANKS_DETECT + bool "Detection of flash banks number in CFI driver" + depends on CFI_FLASH && FLASH_CFI_DRIVER + help + This enables detection of number of flash banks in CFI driver, + to reduce the effective number of flash bank, between 0 and + CONFIG_SYS_MAX_FLASH_BANKS + source "drivers/mtd/nand/Kconfig" config SYS_NAND_MAX_CHIPS diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 9c27fea5d88..aae3ea0d1b4 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -96,7 +96,7 @@ static u16 cfi_flash_config_reg(int i) } #if defined(CONFIG_SYS_MAX_FLASH_BANKS_DETECT) -int cfi_flash_num_flash_banks = CONFIG_SYS_MAX_FLASH_BANKS_DETECT; +int cfi_flash_num_flash_banks = CFI_MAX_FLASH_BANKS; #else int cfi_flash_num_flash_banks; #endif @@ -191,7 +191,7 @@ static flash_info_t *flash_get_info(ulong base) int i; flash_info_t *info; - for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) { + for (i = 0; i < CFI_FLASH_BANKS; i++) { info = &flash_info[i]; if (info->size && info->start[0] <= base && base <= info->start[0] + info->size - 1) @@ -2419,7 +2419,7 @@ unsigned long flash_init(void) #endif /* Init: no FLASHes known */ - for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; ++i) { + for (i = 0; i < CFI_FLASH_BANKS; ++i) { flash_info[i].flash_id = FLASH_UNKNOWN; /* Optionally write flash configuration register */ diff --git a/drivers/mtd/cfi_mtd.c b/drivers/mtd/cfi_mtd.c index 2295bb7220b..f998ffaf26f 100644 --- a/drivers/mtd/cfi_mtd.c +++ b/drivers/mtd/cfi_mtd.c @@ -207,10 +207,10 @@ int cfi_mtd_init(void) int error, i; #ifdef CONFIG_MTD_CONCAT int devices_found = 0; - struct mtd_info *mtd_list[CONFIG_SYS_MAX_FLASH_BANKS]; + struct mtd_info *mtd_list[CFI_FLASH_BANKS]; #endif - for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) { + for (i = 0; i < CFI_FLASH_BANKS; i++) { fi = &flash_info[i]; mtd = &cfi_mtd_info[i]; diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 4388a08a90d..a70fbda4bbc 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -3707,8 +3707,8 @@ int spi_nor_scan(struct spi_nor *nor) int ret; int cfi_mtd_nb = 0; -#ifdef CONFIG_SYS_MAX_FLASH_BANKS - cfi_mtd_nb = CONFIG_SYS_MAX_FLASH_BANKS; +#ifdef CONFIG_FLASH_CFI_MTD + cfi_mtd_nb = CFI_FLASH_BANKS; #endif /* Reset SPI protocol for all commands. */ |
