[U-Boot-Users] Reset chip selects in cfi_flash.c

Shlomo_Kut at mksinst.com Shlomo_Kut at mksinst.com
Thu Feb 19 09:07:10 CET 2004


Hi,

I have made this small change to my cfi_flash init_flash() function to 
reconfigure the MPC850 chip selects after the chip has been sized. I 
suggest adding something like this to the cfi_flash driver. This works 
fine on our MPC850 platform.

unsigned long flash_init (void)
{
                 unsigned long size = 0;
                 int i;
#if defined(CONFIG_MPC850)
                 volatile immap_t     *immap  = (immap_t *)CFG_IMMR;
                 volatile memctl8xx_t *memctl = &immap->im_memctl;
#endif
                 /* Init: no FLASHes known */
                 for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i) {
                                  flash_info[i].flash_id = FLASH_UNKNOWN;
                                  size += flash_info[i].size = flash_get_size (bank_base[i], i);
                                  if (flash_info[i].flash_id == FLASH_UNKNOWN) {
                                                   printf ("## Unknown FLASH on Bank %d - Size = 0x%08lx = %ld MB\n", i, flash_info[i].size, flash_info[i].size << 20);
                                  }
                 }
#if defined(CONFIG_MPC850)
                 /* Remap FLASH according to real size */
                 memctl->memc_or0 = CFG_OR_TIMING_FLASH | (-size & 0xFFFF8000);
    memctl->memc_br0 = (CFG_FLASH_BASE & BR_BA_MSK) | BR_MS_GPCM | BR_V;
#endif
                 /* Monitor protection ON by default */
#if (CFG_MONITOR_BASE >= CFG_FLASH_BASE)
                 flash_protect (FLAG_PROTECT_SET,
                                         CFG_MONITOR_BASE,
                                         CFG_MONITOR_BASE + CFG_MONITOR_LEN - 1,
                                         &flash_info[0]);
#endif

                 return (size);
}



regards

Shlomo Kut

Software Engineer
MKS Instruments
Tenta Products
Tel: 972-8-9181015
Fax: 972-8-9181020
www.mksinst.com





More information about the U-Boot mailing list