3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 * Cache support: switch on or off, get status
29 #include <linux/compiler.h>
31 static int parse_argv(const char *);
33 void __weak flush_icache(void)
35 /* please define arch specific flush_icache */
36 puts("No arch specific flush_icache available!\n");
39 int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
42 case 2: /* on / off */
43 switch (parse_argv(argv[1])) {
44 case 0: icache_disable();
46 case 1: icache_enable ();
48 case 2: flush_icache();
52 case 1: /* get status */
53 printf ("Instruction Cache is %s\n",
54 icache_status() ? "ON" : "OFF");
57 return cmd_usage(cmdtp);
62 void __weak flush_dcache(void)
64 puts("No arch specific flush_dcache available!\n");
65 /* please define arch specific flush_dcache */
68 int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
71 case 2: /* on / off */
72 switch (parse_argv(argv[1])) {
73 case 0: dcache_disable();
75 case 1: dcache_enable ();
77 case 2: flush_dcache();
81 case 1: /* get status */
82 printf ("Data (writethrough) Cache is %s\n",
83 dcache_status() ? "ON" : "OFF");
86 return cmd_usage(cmdtp);
92 static int parse_argv(const char *s)
94 if (strcmp(s, "flush") == 0) {
96 } else if (strcmp(s, "on") == 0) {
98 } else if (strcmp(s, "off") == 0) {
106 icache, 2, 1, do_icache,
107 "enable or disable instruction cache",
109 " - enable, disable, or flush instruction cache"
113 dcache, 2, 1, do_dcache,
114 "enable or disable data cache",
116 " - enable, disable, or flush data (writethrough) cache"