aboutsummaryrefslogtreecommitdiff
path: root/board/evb64260/flash.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-09-02 22:48:03 +0000
committerwdenk <wdenk>2003-09-02 22:48:03 +0000
commit12f34241cb9679c27a1ab3561766562f5a515eff (patch)
treee6408a1701c7dabf3e2ceb1326ce2f5cc8657c96 /board/evb64260/flash.c
parent326428cc8bbdddb30920a96b672abd0d59833ce4 (diff)
downloadu-boot-linaro-stable-12f34241cb9679c27a1ab3561766562f5a515eff.tar.gz
* Add support for PPChameleon Eval Board
* Add support for P3G4 board * Fix problem with MGT5100 FEC driver: add "early" MAC address initialization
Diffstat (limited to 'board/evb64260/flash.c')
-rw-r--r--board/evb64260/flash.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/board/evb64260/flash.c b/board/evb64260/flash.c
index c89739333..e6cf8eb6b 100644
--- a/board/evb64260/flash.c
+++ b/board/evb64260/flash.c
@@ -54,6 +54,7 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
static ulong flash_get_size (int portwidth, vu_long *addr, flash_info_t *info);
static int write_word (flash_info_t *info, ulong dest, ulong data);
static void flash_get_offsets (ulong base, flash_info_t *info);
+static flash_info_t *flash_get_info(ulong base);
/*-----------------------------------------------------------------------
*/
@@ -72,7 +73,11 @@ flash_init (void)
/* the boot flash */
base = CFG_FLASH_BASE;
- size_b0 = flash_get_size(1, (vu_long *)base, &flash_info[0]);
+#ifndef CFG_BOOT_FLASH_WIDTH
+#define CFG_BOOT_FLASH_WIDTH 1
+#endif
+ size_b0 = flash_get_size(CFG_BOOT_FLASH_WIDTH, (vu_long *)base,
+ &flash_info[0]);
printf("[%ldkB@%lx] ", size_b0/1024, base);
@@ -98,6 +103,22 @@ flash_init (void)
base+=size;
}
+#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
+ /* 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));
+#endif
+
+#ifdef CFG_ENV_IS_IN_FLASH
+ /* ENV protection ON by default */
+ flash_protect(FLAG_PROTECT_SET,
+ CFG_ENV_ADDR,
+ CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
+ flash_get_info(CFG_ENV_ADDR));
+#endif
+
flash_size = size_b0 + size_b1;
return flash_size;
}
@@ -148,6 +169,23 @@ flash_get_offsets (ulong base, flash_info_t *info)
/*-----------------------------------------------------------------------
*/
+
+static flash_info_t *flash_get_info(ulong base)
+{
+ int i;
+ flash_info_t * info;
+
+ for (i = 0; i < CFG_MAX_FLASH_BANKS; i ++) {
+ info = & flash_info[i];
+ if (info->start[0] <= base && base <= info->start[0] + info->size - 1)
+ break;
+ }
+
+ return i == CFG_MAX_FLASH_BANKS ? 0 : info;
+}
+
+/*-----------------------------------------------------------------------
+ */
void
flash_print_info (flash_info_t *info)
{
@@ -247,8 +285,11 @@ static inline void flash_cmd(int width, volatile unsigned char *addr, int offset
/* 2x16 */
unsigned long cmd32=(cmd<<16)|cmd;
*(volatile unsigned long *)(addr+offset*2)=cmd32;
+ } else if (width == 2) {
+ /* 1x16 */
+ *(volatile unsigned short *)((unsigned short*)addr+offset)=cmd;
} else {
- /* 1x16 or 1x8 */
+ /* 1x8 */
*(volatile unsigned char *)(addr+offset)=cmd;
}
}