aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini2022-05-13 09:18:27 -0400
committerTom Rini2022-06-06 12:09:00 -0400
commit2f57139c211d193debddd25f45c02b738cefd871 (patch)
treebbdf215e6fab764f7827c227d3090a43c3cae9cf /drivers
parentd498c670541a010899b25f9653713a804575606e (diff)
Convert CONFIG_SYS_FLASH_CFI_WIDTH to Kconfig
This converts the following to Kconfig: CONFIG_SYS_FLASH_CFI_WIDTH Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/Kconfig29
-rw-r--r--drivers/mtd/cfi_flash.c7
2 files changed, 29 insertions, 7 deletions
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index 4088267dd11..c3f5455347e 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -48,6 +48,35 @@ config FLASH_CFI_DRIVER
option. Visit <http://www.amd.com/products/nvd/overview/cfi.html>
for more information on CFI.
+choice
+ prompt "Data-width of the flash device"
+ depends on FLASH_CFI_DRIVER
+ default SYS_FLASH_CFI_WIDTH_8BIT
+
+config SYS_FLASH_CFI_WIDTH_8BIT
+ bool "Data-width of the device is 8-bit"
+
+config SYS_FLASH_CFI_WIDTH_16BIT
+ bool "Data-width of the device is 16-bit"
+
+config SYS_FLASH_CFI_WIDTH_32BIT
+ bool "Data-width of the device is 32-bit"
+
+config SYS_FLASH_CFI_WIDTH_64BIT
+ bool "Data-width of the device is 64-bit"
+
+endchoice
+
+config SYS_FLASH_CFI_WIDTH
+ hex
+ depends on FLASH_CFI_DRIVER
+ default 0x1 if SYS_FLASH_CFI_WIDTH_8BIT
+ default 0x2 if SYS_FLASH_CFI_WIDTH_16BIT
+ default 0x4 if SYS_FLASH_CFI_WIDTH_32BIT
+ default 0x8 if SYS_FLASH_CFI_WIDTH_64BIT
+ help
+ This must be kept in sync with the table in include/flash.h
+
config CFI_FLASH
bool "Enable Driver Model for CFI Flash driver"
depends on DM_MTD
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index aae3ea0d1b4..49504107065 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -68,13 +68,6 @@ static uint flash_verbose = 1;
flash_info_t flash_info[CFI_MAX_FLASH_BANKS]; /* FLASH chips info */
-/*
- * Check if chip width is defined. If not, start detecting with 8bit.
- */
-#ifndef CONFIG_SYS_FLASH_CFI_WIDTH
-#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_8BIT
-#endif
-
#ifdef CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS
#define __maybe_weak __weak
#else