]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/mtd/cfi_flash.h
cfi_flash: Simplify dynamic flash bank number detection
[karo-tx-uboot.git] / include / mtd / cfi_flash.h
index 2aa6911237bb197bfe1017f128f8e6be2aa95d4b..2ff00f2fdd877b9339801c4a5051b360b0443e22 100644 (file)
@@ -151,6 +151,24 @@ struct cfi_pri_hdr {
        u8      minor_version;
 } __attribute__((packed));
 
+#ifndef CONFIG_SYS_FLASH_BANKS_LIST
+#define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE }
+#endif
+
+/*
+ * CFI_MAX_FLASH_BANKS only used for flash_info struct declaration.
+ *
+ * Use CONFIG_SYS_MAX_FLASH_BANKS_DETECT if defined
+ */
+#if defined(CONFIG_SYS_MAX_FLASH_BANKS_DETECT)
+#define CONFIG_SYS_MAX_FLASH_BANKS     (cfi_flash_num_flash_banks)
+#define CFI_MAX_FLASH_BANKS    CONFIG_SYS_MAX_FLASH_BANKS_DETECT
+/* board code can update this variable before CFI detection */
+extern int cfi_flash_num_flash_banks;
+#else
+#define CFI_MAX_FLASH_BANKS    CONFIG_SYS_MAX_FLASH_BANKS
+#endif
+
 void flash_write_cmd(flash_info_t * info, flash_sect_t sect,
                     uint offset, u32 cmd);