[U-Boot-Users] How to support multiple flash sizes ?

Joao, Nuno (ext) nuno.joao-ext_nbs at siemens.com
Tue May 9 13:10:55 CEST 2006


	Hello,

	I've also a (MPC8541E based) system where I can have 64M or 128M
	flash. I'm using CFI, and have this config:


/*
 * FLASH on the Local Bus.
 * Boot from BR0/OR0 bank.
 */
#define CFG_FLASH_MEM_BASE   0xF8000000          /* Flash start at 128M from end of addr space */
#define CFG_FLASH_MEM_BASE2  0xFC000000          /* Flash start at 64M from end of addr space */

#define CFG_FLASH_BASE          (0 - flash_info[0].size - flash_info[1].size)
#define CFG_FLASH_BANKS_LIST    { CFG_FLASH_MEM_BASE2, CFG_FLASH_MEM_BASE }

#define CFG_LOWEST_FLASH_BASE   CFG_FLASH_MEM_BASE      /* MUST have the lowest possible flash start addr */
/* probe for 64M at CFG_FLASH_MEM_BASE2 and 128M at CFG_FLASH_MEM_BASE */
#define CFG_FLASH_BANKS_SIZES_LIST      { (64 * 1024*1024), (128 * 1024*1024) }
#define CONFIG_FLASH_PREDEFINED_PROBING /* enable predefined flash probing */
 

	and I did the following changes ("CCEP" is our board's name):


drivers/cfi_flash.c:
170a171,173
> #ifdef CONFIG_FLASH_PREDEFINED_PROBING
> static ulong bank_expected_size[CFG_MAX_FLASH_BANKS] = CFG_FLASH_BANKS_SIZES_LIST;
> #endif
338a342,356
> #ifdef CONFIG_FLASH_PREDEFINED_PROBING
>               else
>               {
>                       if (flash_info[i].size != bank_expected_size[i])
>                       {
>                               flash_info[i].flash_id = FLASH_UNKNOWN;
>                               size -= flash_info[i].size;
>                               flash_info[i].size = 0;         /* don't remove this! */
>                       }
>                       else
>                       {
>                               printf("found flash @ 0x%08X: ", bank_base[i]);
>                       }
>               }
> #endif
341,346c359,371
<       /* Monitor protection ON by default */
< #if (CFG_MONITOR_BASE >= CFG_FLASH_BASE)
<       flash_protect (FLAG_PROTECT_SET,
<                      CFG_MONITOR_BASE,
<                      CFG_MONITOR_BASE + monitor_flash_len  - 1,
<                      flash_get_info(CFG_MONITOR_BASE));
---
> #define ENABLE_MONITOR_PROTECTION()   \
>       /* Monitor protection ON by default */  \
>       flash_protect (FLAG_PROTECT_SET,        \
>                      CFG_MONITOR_BASE,        \
>                      CFG_MONITOR_BASE + monitor_flash_len  - 1,       \
>                      flash_get_info(CFG_MONITOR_BASE))
>
> #if defined(CONFIG_CCEP)
>       ENABLE_MONITOR_PROTECTION();
> #else
> #     if (CFG_MONITOR_BASE >= CFG_FLASH_BASE)
>       ENABLE_MONITOR_PROTECTION();
> #     endif


	This is based on u-boot 1.1.3. You will get some "unkown" banks for
	the smaller flashes.
	It's certainly not the best solution, but it's a solution.

	Best Regards


-----Original Message-----
From: u-boot-users-admin at lists.sourceforge.net [mailto:u-boot-users-admin at lists.sourceforge.net] On Behalf Of Laurent Pinchart
Sent: terça-feira, 9 de Maio de 2006 10:08
To: u-boot-users at lists.sourceforge.net
Subject: [U-Boot-Users] How to support multiple flash sizes ?

Hi,

I'm trying to find a way for U-Boot to automatically detect the flash base 
address.

Our custom board can be mounted with different flash options, from 16MB to 
128MB. I would like to avoid programming the board with a different boot 
loader for each flash size, so I was trying a way to create a 
"one-fits-them-all" U-Boot version.

(...)




More information about the U-Boot mailing list