diff options
author | Wolfgang Denk <wd@nyx.(none)> | 2006-02-28 16:42:50 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@nyx.(none)> | 2006-02-28 16:42:50 +0100 |
commit | f6c0068fc1181dc6b6081addd84ee1cfc0a4977b (patch) | |
tree | 8b0d7b23833d77b38d62ab60187e3b7b357ca4ec /board/mcc200/mcc200.c | |
parent | 36d2c5387d22f0d1b14b799afca03c554adb216a (diff) | |
parent | 58ad4978330aefd6bdce72906f809bcfb6c94710 (diff) | |
download | u-boot-imx-f6c0068fc1181dc6b6081addd84ee1cfc0a4977b.zip u-boot-imx-f6c0068fc1181dc6b6081addd84ee1cfc0a4977b.tar.gz u-boot-imx-f6c0068fc1181dc6b6081addd84ee1cfc0a4977b.tar.bz2 |
Merge with Stefan Roese's branch with CFI driver fixes
Diffstat (limited to 'board/mcc200/mcc200.c')
-rw-r--r-- | board/mcc200/mcc200.c | 82 |
1 files changed, 47 insertions, 35 deletions
diff --git a/board/mcc200/mcc200.c b/board/mcc200/mcc200.c index d7f95c8..4707390 100644 --- a/board/mcc200/mcc200.c +++ b/board/mcc200/mcc200.c @@ -36,6 +36,8 @@ #include "mt48lc8m32b2-6-7.h" #endif +extern flash_info_t flash_info[]; /* FLASH chips info */ + //###CHD: wenn RAMBOOT gehen wuerde, .... #ifndef CFG_RAMBOOT static void sdram_start (int hi_addr) @@ -244,46 +246,56 @@ int checkboard (void) return 0; } -void flash_preinit(void) +int misc_init_r (void) { + DECLARE_GLOBAL_DATA_PTR; + /* - * Now, when we are in RAM, enable flash write - * access for detection process. - * Note that CS_BOOT cannot be cleared when - * executing in flash. + * Adjust flash start and offset to detected values */ -#if defined(CONFIG_MGT5100) - *(vu_long *)MPC5XXX_ADDECR &= ~(1 << 25); /* disable CS_BOOT */ - *(vu_long *)MPC5XXX_ADDECR |= (1 << 16); /* enable CS0 */ -#endif - *(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */ -} - -void flash_afterinit(ulong start, ulong size) -{ -#if defined(CONFIG_BOOT_ROM) - /* adjust mapping */ - *(vu_long *)MPC5XXX_CS1_START = - START_REG(start); - *(vu_long *)MPC5XXX_CS1_STOP = - STOP_REG(start, size); -#else - /* adjust mapping */ - *(vu_long *)MPC5XXX_BOOTCS_START = *(vu_long *)MPC5XXX_CS0_START = - START_REG(start); - *(vu_long *)MPC5XXX_BOOTCS_STOP = *(vu_long *)MPC5XXX_CS0_STOP = - STOP_REG(start, size); -#endif -} - + gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize; + gd->bd->bi_flashoffset = 0; -extern flash_info_t flash_info[]; /* info for FLASH chips */ + /* + * Check if boot FLASH isn't max size + */ + if (gd->bd->bi_flashsize < (0 - CFG_FLASH_BASE)) { + /* adjust mapping */ + *(vu_long *)MPC5XXX_BOOTCS_START = *(vu_long *)MPC5XXX_CS0_START = + START_REG(gd->bd->bi_flashstart); + *(vu_long *)MPC5XXX_BOOTCS_STOP = *(vu_long *)MPC5XXX_CS0_STOP = + STOP_REG(gd->bd->bi_flashstart, gd->bd->bi_flashsize); + + /* + * Re-check to get correct base address + */ + flash_get_size(gd->bd->bi_flashstart, CFG_MAX_FLASH_BANKS - 1); + + /* + * Re-do flash protection upon new addresses + */ + flash_protect (FLAG_PROTECT_CLEAR, + gd->bd->bi_flashstart, 0xffffffff, + &flash_info[CFG_MAX_FLASH_BANKS - 1]); + + /* Monitor protection ON by default */ + flash_protect (FLAG_PROTECT_SET, + CFG_MONITOR_BASE, CFG_MONITOR_BASE + monitor_flash_len - 1, + &flash_info[CFG_MAX_FLASH_BANKS - 1]); + + /* Environment protection ON by default */ + flash_protect (FLAG_PROTECT_SET, + CFG_ENV_ADDR, + CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1, + &flash_info[CFG_MAX_FLASH_BANKS - 1]); + + /* Redundant environment protection ON by default */ + flash_protect (FLAG_PROTECT_SET, + CFG_ENV_ADDR_REDUND, + CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1, + &flash_info[CFG_MAX_FLASH_BANKS - 1]); + } -int misc_init_r (void) -{ - DECLARE_GLOBAL_DATA_PTR; - /* adjust flash start */ - gd->bd->bi_flashstart = flash_info[0].start[0]; return (0); } |