diff options
Diffstat (limited to 'lib_blackfin')
-rw-r--r-- | lib_blackfin/board.c | 32 | ||||
-rw-r--r-- | lib_blackfin/cache.c | 42 |
2 files changed, 63 insertions, 11 deletions
diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c index 537f69abaa..49465d2a05 100644 --- a/lib_blackfin/board.c +++ b/lib_blackfin/board.c @@ -291,6 +291,25 @@ void board_init_f(ulong bootflag) board_init_r((gd_t *) gd, 0x20000010); } +static void board_net_init_r(bd_t *bd) +{ +#ifdef CONFIG_CMD_NET + uchar enetaddr[6]; + char *s; + + if ((s = getenv("bootfile")) != NULL) + copy_filename(BootFile, s, sizeof(BootFile)); + + bd->bi_ip_addr = getenv_IPaddr("ipaddr"); + + printf("Net: "); + eth_initialize(gd->bd); + + eth_getenv_enetaddr("ethaddr", enetaddr); + printf("MAC: %pM\n", enetaddr); +#endif +} + void board_init_r(gd_t * id, ulong dest_addr) { extern void malloc_bin_reloc(void); @@ -308,8 +327,8 @@ void board_init_r(gd_t * id, ulong dest_addr) #if !defined(CONFIG_SYS_NO_FLASH) /* Initialize the flash and protect u-boot by default */ extern flash_info_t flash_info[]; - ulong size = flash_init(); puts("Flash: "); + ulong size = flash_init(); print_size(size, "\n"); flash_protect(FLAG_PROTECT_SET, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE + CONFIG_SYS_MONITOR_LEN - 1, @@ -349,22 +368,13 @@ void board_init_r(gd_t * id, ulong dest_addr) /* Initialize from environment */ if ((s = getenv("loadaddr")) != NULL) load_addr = simple_strtoul(s, NULL, 16); -#ifdef CONFIG_CMD_NET - if ((s = getenv("bootfile")) != NULL) - copy_filename(BootFile, s, sizeof(BootFile)); -#endif #if defined(CONFIG_MISC_INIT_R) /* miscellaneous platform dependent initialisations */ misc_init_r(); #endif -#ifdef CONFIG_CMD_NET - /* IP Address */ - bd->bi_ip_addr = getenv_IPaddr("ipaddr"); - printf("Net: "); - eth_initialize(gd->bd); -#endif + board_net_init_r(bd); display_global_data(); diff --git a/lib_blackfin/cache.c b/lib_blackfin/cache.c index 1557864f9c..0a321a448f 100644 --- a/lib_blackfin/cache.c +++ b/lib_blackfin/cache.c @@ -36,6 +36,44 @@ void flush_cache(unsigned long addr, unsigned long size) blackfin_dcache_flush_range(start_addr, end_addr); } +#ifdef CONFIG_DCACHE_WB +static void flushinv_all_dcache(void) +{ + u32 way, bank, subbank, set; + u32 status, addr; + u32 dmem_ctl = bfin_read_DMEM_CONTROL(); + + for (bank = 0; bank < 2; ++bank) { + if (!(dmem_ctl & (1 << (DMC1_P - bank)))) + continue; + + for (way = 0; way < 2; ++way) + for (subbank = 0; subbank < 4; ++subbank) + for (set = 0; set < 64; ++set) { + + bfin_write_DTEST_COMMAND( + way << 26 | + bank << 23 | + subbank << 16 | + set << 5 + ); + CSYNC(); + status = bfin_read_DTEST_DATA0(); + + /* only worry about valid/dirty entries */ + if ((status & 0x3) != 0x3) + continue; + + /* construct the address using the tag */ + addr = (status & 0xFFFFC800) | (subbank << 12) | (set << 5); + + /* flush it */ + __asm__ __volatile__("FLUSHINV[%0];" : : "a"(addr)); + } + } +} +#endif + void icache_enable(void) { bfin_write_IMEM_CONTROL(IMC | ENICPLB); @@ -61,6 +99,10 @@ void dcache_enable(void) void dcache_disable(void) { +#ifdef CONFIG_DCACHE_WB + bfin_write_DMEM_CONTROL(bfin_read_DMEM_CONTROL() & ~(ENDCPLB)); + flushinv_all_dcache(); +#endif bfin_write_DMEM_CONTROL(0); SSYNC(); } |