Remove fixed configuration and detect flash based on DT.

Also increase amount of flash sectors to 2048 because on kc705 flash has
1027 sectors.

Bank # 1: CFI conformant flash (16 x 16)  Size: 128 MB in 1027 Sectors
  Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x8962
  Erase timeout: 4096 ms, write timeout: 2 ms
  Buffer write timeout: 5 ms, buffer size: 1024 bytes

Signed-off-by: Michal Simek <michal.si...@xilinx.com>
---

(no changes since v1)

 configs/microblaze-generic_defconfig |  2 ++
 include/configs/microblaze-generic.h | 41 ++--------------------------
 2 files changed, 5 insertions(+), 38 deletions(-)

diff --git a/configs/microblaze-generic_defconfig 
b/configs/microblaze-generic_defconfig
index 08c88856dcd9..761cc65cbfab 100644
--- a/configs/microblaze-generic_defconfig
+++ b/configs/microblaze-generic_defconfig
@@ -48,8 +48,10 @@ CONFIG_DM_I2C=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
 CONFIG_MTD=y
+CONFIG_DM_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
+CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_PROTECTION=y
diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index c31a7880743f..bc0bf0497378 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -11,26 +11,11 @@
 /* Microblaze is microblaze_0 */
 #define XILINX_FSL_NUMBER      3
 
-/* Flash Memory is FLASH_2Mx32 */
-#define XILINX_FLASH_START     0x2c000000
-#define XILINX_FLASH_SIZE      0x00800000
-
 /* MicroBlaze CPU */
 #define        MICROBLAZE_V5           1
 
 #define CONFIG_SYS_BOOTM_LEN   (64 * 1024 * 1024)
 
-/* linear and spi flash memory */
-#ifdef XILINX_FLASH_START
-#define        FLASH
-#undef SPIFLASH
-#undef RAMENV  /* hold environment in flash */
-#else
-#undef FLASH
-#undef SPIFLASH
-#define        RAMENV  /* hold environment in RAM */
-#endif
-
 /* uart */
 /* The following table includes the supported baudrates */
 # define CONFIG_SYS_BAUDRATE_TABLE \
@@ -45,34 +30,14 @@
 #define CONFIG_SYS_INIT_SP_OFFSET      (CONFIG_SYS_TEXT_BASE - \
                                         CONFIG_SYS_MALLOC_F_LEN)
 
-/*
- * CFI flash memory layout - Example
- * CONFIG_SYS_FLASH_BASE = 0x2200_0000;
- * CONFIG_SYS_FLASH_SIZE = 0x0080_0000;          8MB
- *
- * SECT_SIZE = 0x20000;                        128kB is one sector
- * CONFIG_ENV_SIZE = SECT_SIZE;                128kB environment store
- *
- * 0x2200_0000 CONFIG_SYS_FLASH_BASE
- *                                     FREE            256kB
- * 0x2204_0000 CONFIG_ENV_ADDR
- *                                     ENV_AREA        128kB
- * 0x2206_0000
- *                                     FREE
- * 0x2280_0000 CONFIG_SYS_FLASH_BASE + CONFIG_SYS_FLASH_SIZE
- *
- */
-
-#ifdef FLASH
-# define CONFIG_SYS_FLASH_BASE         XILINX_FLASH_START
-# define CONFIG_SYS_FLASH_SIZE         XILINX_FLASH_SIZE
+#ifdef CONFIG_CFI_FLASH
 /* ?empty sector */
 # define CONFIG_SYS_FLASH_EMPTY_INFO   1
 /* max number of memory banks */
 # define CONFIG_SYS_MAX_FLASH_BANKS    1
 /* max number of sectors on one chip */
-# define CONFIG_SYS_MAX_FLASH_SECT     512
-#endif /* !FLASH */
+# define CONFIG_SYS_MAX_FLASH_SECT     2048
+#endif
 
 #define CONFIG_ICACHE
 #define CONFIG_DCACHE
-- 
2.29.2

Reply via email to