]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - common/cmd_cache.c
OMAP5: ADD chip detection for OMAP5432 SOC
[karo-tx-uboot.git] / common / cmd_cache.c
index 5cdd8341f287045a9e0c610c7525b568283b42f5..9c228e219dca2af64f5afc76c7e63848ff17a74a 100644 (file)
  */
 #include <common.h>
 #include <command.h>
+#include <linux/compiler.h>
 
-static int on_off (const char *);
+static int parse_argv(const char *);
+
+void __weak invalidate_icache_all(void)
+{
+       /* please define arch specific invalidate_icache_all */
+       puts("No arch specific invalidate_icache_all available!\n");
+}
 
 int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        switch (argc) {
        case 2:                 /* on / off     */
-               switch (on_off(argv[1])) {
+               switch (parse_argv(argv[1])) {
                case 0: icache_disable();
                        break;
                case 1: icache_enable ();
                        break;
+               case 2: invalidate_icache_all();
+                       break;
                }
                /* FALL TROUGH */
        case 1:                 /* get status */
@@ -45,20 +54,28 @@ int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        icache_status() ? "ON" : "OFF");
                return 0;
        default:
-               return cmd_usage(cmdtp);
+               return CMD_RET_USAGE;
        }
        return 0;
 }
 
+void __weak flush_dcache_all(void)
+{
+       puts("No arch specific flush_dcache_all available!\n");
+       /* please define arch specific flush_dcache_all */
+}
+
 int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        switch (argc) {
        case 2:                 /* on / off     */
-               switch (on_off(argv[1])) {
+               switch (parse_argv(argv[1])) {
                case 0: dcache_disable();
                        break;
                case 1: dcache_enable ();
                        break;
+               case 2: flush_dcache_all();
+                       break;
                }
                /* FALL TROUGH */
        case 1:                 /* get status */
@@ -66,15 +83,17 @@ int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        dcache_status() ? "ON" : "OFF");
                return 0;
        default:
-               return cmd_usage(cmdtp);
+               return CMD_RET_USAGE;
        }
        return 0;
 
 }
 
-static int on_off (const char *s)
+static int parse_argv(const char *s)
 {
-       if (strcmp(s, "on") == 0) {
+       if (strcmp(s, "flush") == 0) {
+               return (2);
+       } else if (strcmp(s, "on") == 0) {
                return (1);
        } else if (strcmp(s, "off") == 0) {
                return (0);
@@ -86,13 +105,13 @@ static int on_off (const char *s)
 U_BOOT_CMD(
        icache,   2,   1,     do_icache,
        "enable or disable instruction cache",
-       "[on, off]\n"
-       "    - enable or disable instruction cache"
+       "[on, off, flush]\n"
+       "    - enable, disable, or flush instruction cache"
 );
 
 U_BOOT_CMD(
        dcache,   2,   1,     do_dcache,
        "enable or disable data cache",
-       "[on, off]\n"
-       "    - enable or disable data (writethrough) cache"
+       "[on, off, flush]\n"
+       "    - enable, disable, or flush data (writethrough) cache"
 );