CFI: allow for dynamically determined flash sizes and addresses
PATCH 1/3 CFI: allow for dynamically determined flash sizes and addresses
The CFI driver allowed only for static initializers in the CFG_FLASH_BANKS_LIST definition, i. e. it did not allow to map several flash banks contiguously if the bank sizes were not known in advance, which kind of violates U-Boot's design philosophy.
(will be used for example by the TQM8xxL boards)
Signed-off-by Wolfgang Denk <[email protected]>
--- drivers/mtd/cfi_flash.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
drivers/mtd/cfi_flash.c +8 -6
@@ -158,13 +158,13 @@ static uint flash_offset_cfi[2] = { FLASH_OFFSET_CFI, FLASH_OFFSET_CFI_ALT };/* use CFG_MAX_FLASH_BANKS_DETECT if defined */ #ifdef CFG_MAX_FLASH_BANKS_DETECT -static ulong bank_base[CFG_MAX_FLASH_BANKS_DETECT ] =CFG_FLASH_BANKS_LIST ; -flash_info_t flash_info[CFG_MAX_FLASH_BANKS_DETECT ];/* FLASH chips info */ +# define CFI_MAX_FLASH_BANKS CFG_MAX_FLASH_BANKS_DETECT#else -static ulong bank_base[CFG_MAX_FLASH_BANKS ] =CFG_FLASH_BANKS_LIST ; -flash_info_t flash_info[CFG_MAX_FLASH_BANKS ];/* FLASH chips info */ +# define CFI_MAX_FLASH_BANKS CFG_MAX_FLASH_BANKS#endif +flash_info_t flash_info[CFI_MAX_FLASH_BANKS ];/* FLASH chips info */ +/* * Check if chip width is defined. If not, start detecting with 8bit. */
@@ -1912,12 +1912,14 @@ unsigned long flash_init (void)char *s =getenv ("unlock" );#endif +#define BANK_BASE (i) (((unsigned long [CFI_MAX_FLASH_BANKS])CFG_FLASH_BANKS_LIST)[i]) +/* Init: no FLASHes known */ for (i =0 ; i <CFG_MAX_FLASH_BANKS ; ++i) { flash_info[i].flash_id =FLASH_UNKNOWN ; -if (!flash_detect_legacy (bank_base[i], i)) -flash_get_size (bank_base[i], i); +if (!flash_detect_legacy (BANK_BASE (i), i)) +flash_get_size (BANK_BASE (i), i); size += flash_info[i].size;if (flash_info[i].flash_id ==FLASH_UNKNOWN ) {#ifndef CFG_FLASH_QUIET_TEST
Signature · 1 line
1.5.4.2
PATCH 2/3 TQM8xxL: fix support for second flash bank
When switching the TQM8xxL modules to use the CFI flash driver, support for the second flash bank was broken because the CFI driver did not support dynamically sized banks. This gets fixed now.
Signed-off-by Wolfgang Denk <[email protected]>
--- include/configs/TQM823L.h | 2 +- include/configs/TQM850L.h | 2 +- include/configs/TQM855L.h | 2 +- include/configs/TQM860L.h | 2 +- include/configs/TQM862L.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
include/configs/TQM823L.h +1 -1
@@ -196,7 +196,7 @@/* use CFI flash driver */ #define CFG_FLASH_CFI 1/* Flash is CFI conformant */ #define CFG_FLASH_CFI_DRIVER 1/* Use the common driver */ -#define CFG_FLASH_BANKS_LIST { CFG_FLASH_BASE } +#define CFG_FLASH_BANKS_LIST { CFG_FLASH_BASE, CFG_FLASH_BASE+flash_info[0].size }#define CFG_FLASH_EMPTY_INFO #define CFG_FLASH_USE_BUFFER_WRITE 1#define CFG_MAX_FLASH_BANKS 2/* max number of memory banks */
include/configs/TQM850L.h +1 -1
@@ -183,7 +183,7 @@/* use CFI flash driver */ #define CFG_FLASH_CFI 1/* Flash is CFI conformant */ #define CFG_FLASH_CFI_DRIVER 1/* Use the common driver */ -#define CFG_FLASH_BANKS_LIST { CFG_FLASH_BASE } +#define CFG_FLASH_BANKS_LIST { CFG_FLASH_BASE, CFG_FLASH_BASE+flash_info[0].size }#define CFG_FLASH_EMPTY_INFO #define CFG_FLASH_USE_BUFFER_WRITE 1#define CFG_MAX_FLASH_BANKS 2/* max number of memory banks */
include/configs/TQM855L.h +1 -1
@@ -187,7 +187,7 @@/* use CFI flash driver */ #define CFG_FLASH_CFI 1/* Flash is CFI conformant */ #define CFG_FLASH_CFI_DRIVER 1/* Use the common driver */ -#define CFG_FLASH_BANKS_LIST { CFG_FLASH_BASE } +#define CFG_FLASH_BANKS_LIST { CFG_FLASH_BASE, CFG_FLASH_BASE+flash_info[0].size }#define CFG_FLASH_EMPTY_INFO #define CFG_FLASH_USE_BUFFER_WRITE 1#define CFG_MAX_FLASH_BANKS 2/* max number of memory banks */
include/configs/TQM860L.h +1 -1
@@ -190,7 +190,7 @@/* use CFI flash driver */ #define CFG_FLASH_CFI 1/* Flash is CFI conformant */ #define CFG_FLASH_CFI_DRIVER 1/* Use the common driver */ -#define CFG_FLASH_BANKS_LIST { CFG_FLASH_BASE } +#define CFG_FLASH_BANKS_LIST { CFG_FLASH_BASE, CFG_FLASH_BASE+flash_info[0].size }#define CFG_FLASH_EMPTY_INFO #define CFG_FLASH_USE_BUFFER_WRITE 1#define CFG_MAX_FLASH_BANKS 2/* max number of memory banks */
include/configs/TQM862L.h +1 -1
@@ -190,7 +190,7 @@/* use CFI flash driver */ #define CFG_FLASH_CFI 1/* Flash is CFI conformant */ #define CFG_FLASH_CFI_DRIVER 1/* Use the common driver */ -#define CFG_FLASH_BANKS_LIST { CFG_FLASH_BASE } +#define CFG_FLASH_BANKS_LIST { CFG_FLASH_BASE, CFG_FLASH_BASE+flash_info[0].size }#define CFG_FLASH_EMPTY_INFO #define CFG_FLASH_USE_BUFFER_WRITE 1#define CFG_MAX_FLASH_BANKS 2/* max number of memory banks */
Signature · 1 line
1.5.4.2
PATCH 3/3 TQM823L: re-enable logo support; update LCD_INFO text
Signed-off-by Wolfgang Denk <[email protected]>
--- common/lcd.c | 2 +- include/configs/TQM823L.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-)
common/lcd.c +1 -1
@@ -793,7 +793,7 @@ static void *lcd_logo (void)sprintf (info,"%s (%s - %s) " ,U_BOOT_VERSION , __DATE__, __TIME__);lcd_drawchars (LCD_INFO_X ,LCD_INFO_Y , (uchar *)info,strlen (info)); -sprintf (info,"(C) 2004 DENX Software Engineering" ); +sprintf (info,"(C) 2008 DENX Software Engineering GmbH" );lcd_drawchars (LCD_INFO_X ,LCD_INFO_Y +VIDEO_FONT_HEIGHT , (uchar *)info,strlen (info));
include/configs/TQM823L.h +2 -0
@@ -37,6 +37,8 @@#define CONFIG_TQM823L 1/* ...on a TQM8xxL module */ #ifdef CONFIG_LCD /* with LCD controller ? */ +#define CONFIG_LCD_LOGO 1/* print our logo on the LCD */ +#define CONFIG_LCD_INFO 1/* ... and some board info */ #define CONFIG_SPLASH_SCREEN /* ... with splashscreen support*/ #endif
Signature · 1 line
1.5.4.2