summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@foss.st.com>2022-01-04 14:23:58 +0100
committerTom Rini <trini@konsulko.com>2022-01-21 14:01:35 -0500
commit98150e7e8c78b851a7710e18b156f279f8485cbe (patch)
tree82c493969d61e48171c439e866148e96e7d8eb71 /drivers
parentc8363b12b26d7ef990fe00ca92071c3a26f70396 (diff)
mtd: cfi: introduce CFI_FLASH_BANKS
Replace CONFIG_SYS_MAX_FLASH_BANKS by CFI_FLASH_BANKS to prepare Kconfig migration and avoid to redefine CONFIG_SYS_MAX_FLASH_BANKS in cfi_flash.h. After this patch CONFIG_SYS_MAX_FLASH_BANKS should be never used in the cfi code: use CFI_MAX_FLASH_BANKS for struct size or CFI_FLASH_BANKS for number of CFI banks which can be dynamic. This patch modify all the files which include mtd/cfi_flash.h. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/cfi_flash.c4
-rw-r--r--drivers/mtd/cfi_mtd.c4
-rw-r--r--drivers/mtd/spi/spi-nor-core.c5
3 files changed, 6 insertions, 7 deletions
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 9c27fea5d88..71cefc125f1 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -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..6acaa84d2b0 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -3707,9 +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;
-#endif
+ if (IS_ENABLED(CONFIG_FLASH_CFI_MTD))
+ cfi_mtd_nb = CFI_FLASH_BANKS;
/* Reset SPI protocol for all commands. */
nor->reg_proto = SNOR_PROTO_1_1_1;