2011/8/2 Jason Liu <liu.h.ja...@gmail.com>: > Hi, Aneesh, > > 2011/8/1 Aneesh V <ane...@ti.com>: >> c2dd0d45540397704de9b13287417d21049d34c6 added dcache_enable() >> to board_init_r(). This enables d-cache for all ARM boards. >> As a result some of the arm boards that are not cache-ready >> are broken. Revert this change and allow platform code to >> take the decision on d-cache enabling. >> >> Also add some documentation for cache usage in ARM. >> >> Signed-off-by: Aneesh V <ane...@ti.com> >> --- >> MAKEALL pending. Will update the results tomorrow. >> --- >> arch/arm/lib/board.c | 8 +++----- >> arch/arm/lib/cache.c | 12 ++++++++++++ >> doc/README.arm-caches | 40 ++++++++++++++++++++++++++++++++++++++++ >> include/common.h | 1 + >> 4 files changed, 56 insertions(+), 5 deletions(-) >> create mode 100644 doc/README.arm-caches >> >> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c >> index 90709d0..d093d5b 100644 >> --- a/arch/arm/lib/board.c >> +++ b/arch/arm/lib/board.c >> @@ -446,11 +446,9 @@ void board_init_r (gd_t *id, ulong dest_addr) >> gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */ >> >> monitor_flash_len = _end_ofs; >> - /* >> - * Enable D$: >> - * I$, if needed, must be already enabled in start.S >> - */ >> - dcache_enable(); >> + >> + /* Enable caches */ >> + enable_caches(); >> >> debug ("monitor flash len: %08lX\n", monitor_flash_len); >> board_init(); /* Setup chipselects */ >> diff --git a/arch/arm/lib/cache.c b/arch/arm/lib/cache.c >> index 92b61a2..b545fb7 100644 >> --- a/arch/arm/lib/cache.c >> +++ b/arch/arm/lib/cache.c >> @@ -53,3 +53,15 @@ void __flush_dcache_all(void) >> } >> void flush_dcache_all(void) >> __attribute__((weak, alias("__flush_dcache_all"))); >> + >> + >> +/* >> + * Default implementation of enable_caches() >> + * Real implementation should be in platform code >> + */ >> +void __enable_caches(void) >> +{ >> + puts("WARNING: Caches not enabled\n"); >> +} >> +void enable_caches(void) >> + __attribute__((weak, alias("__enable_caches"))); > > > What about the following change? > > #ifndef CONFIG_SYS_DCACHE_OFF > dcache_enable(); > #else > puts("WARNING: Caches not enabled\n"); > #endif
Or better: #ifdef CONFIG_SYS_DCACHE_ON dcache_enable(); #else puts("WARNING: Caches not enabled\n"); #endif In fact, we can turn on I-cache safely by default, turn-off D-cache by default, But give big warning to board-maintainer to fix it later if turn off D-cache. This can keep the most of config file not change and keep using the only one copy of common d-cache enable function to avoid code duplication on every board. Jason _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot