1 // SPDX-License-Identifier: GPL-2.0+
8 * Cache support: switch on or off, get status
12 #include <linux/compiler.h>
14 static int parse_argv(const char *);
16 static int do_icache(struct cmd_tbl *cmdtp, int flag, int argc,
20 case 2: /* on / off / flush */
21 switch (parse_argv(argv[1])) {
29 invalidate_icache_all();
35 case 1: /* get status */
36 printf("Instruction Cache is %s\n",
37 icache_status() ? "ON" : "OFF");
45 static int do_dcache(struct cmd_tbl *cmdtp, int flag, int argc,
49 case 2: /* on / off / flush */
50 switch (parse_argv(argv[1])) {
56 #ifdef CONFIG_SYS_NONCACHED_MEMORY
57 noncached_set_region();
67 case 1: /* get status */
68 printf("Data (writethrough) Cache is %s\n",
69 dcache_status() ? "ON" : "OFF");
77 static int parse_argv(const char *s)
79 if (strcmp(s, "flush") == 0)
81 else if (strcmp(s, "on") == 0)
83 else if (strcmp(s, "off") == 0)
90 icache, 2, 1, do_icache,
91 "enable or disable instruction cache",
93 " - enable, disable, or flush instruction cache"
97 dcache, 2, 1, do_dcache,
98 "enable or disable data cache",
100 " - enable, disable, or flush data (writethrough) cache"