command/cache: Add flush_cache command
PATCH v2 1/1 command/cache: Add flush_cache command
When we copy code/data to the main memory, we may need to flush the cache if required by architecture. It uses the existing function flush_cache. Syntax is
flush_cache <addr> <size>
The addr and size are given in hexadecimal. Like memory command, there is no sanity check for the parameters.
Signed-off-by York Sun <[email protected]>
--- README | 5 ++++- common/cmd_cache.c | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-)
README +4 -1
@@ -809,6 +809,7 @@ The following options need to be configured: CONFIG_CMD_BSP * Board specific commands CONFIG_CMD_BOOTD bootd CONFIG_CMD_CACHE * icache, dcache + CONFIG_CMD_CACHE_FLUSH * flush cache by the address and range CONFIG_CMD_CONSOLE coninfo CONFIG_CMD_CRC32 * crc32 CONFIG_CMD_DATE * support for RTC, date/time...
@@ -912,7 +913,9 @@ The following options need to be configured: 8260 (where accesses to the IMMR region must be uncached), and it cannot be disabled on all other systems where we (mis-) use the data cache to hold an - initial stack and some data. + initial stack and some data. The CONFIG_CMD_CACHE_FLUSH + macro enables flushing cache by the address and range to + maintain coherency if required by architecture. XXX - this list needs to get updated!
common/cmd_cache.c +26 -0
@@ -120,3 +120,29 @@ U_BOOT_CMD("[on, off, flush]\n" " - enable, disable, or flush data (writethrough) cache" ); + +#ifdef CONFIG_CMD_CACHE_FLUSH +int do_flush_cache (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +ulong addr, size; + +switch (argc) { +case 3 : + addr =simple_strtoul (argv[1 ],NULL ,16 ); + size =simple_strtoul (argv[2 ],NULL ,16 ); +flush_cache (addr, size); +break ; +default : +return cmd_usage (cmdtp); + } +return 0 ; + +} + +U_BOOT_CMD ( + flush_cache,3 ,0 , do_flush_cache, +"flush cache for a range" , +"<addr> <size>\n" +" - flush cache for specificed range" +); +#endif
Signature · 1 line
1.7.9.5