.. | .. |
---|
54 | 54 | |
---|
55 | 55 | static int do_dcache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
---|
56 | 56 | { |
---|
| 57 | + ulong start, size; |
---|
| 58 | + |
---|
57 | 59 | switch (argc) { |
---|
| 60 | + case 4: |
---|
| 61 | + start = simple_strtoul(argv[2], NULL, 16); |
---|
| 62 | + size = simple_strtoul(argv[3], NULL, 16); |
---|
| 63 | + |
---|
| 64 | + switch (parse_argv(argv[1])) { |
---|
| 65 | + case 2: |
---|
| 66 | + printf("flush dcache: 0x%08lx - 0x%08lx\n", start, start + size); |
---|
| 67 | + flush_dcache_range(start, start + size); |
---|
| 68 | + break; |
---|
| 69 | + case 3: |
---|
| 70 | + printf("invalidate dcache: 0x%08lx - 0x%08lx\n", start, start + size); |
---|
| 71 | + invalidate_dcache_range(start, start + size); |
---|
| 72 | + break; |
---|
| 73 | + } |
---|
| 74 | + break; |
---|
58 | 75 | case 2: /* on / off */ |
---|
59 | 76 | switch (parse_argv(argv[1])) { |
---|
60 | 77 | case 0: |
---|
.. | .. |
---|
65 | 82 | break; |
---|
66 | 83 | case 2: |
---|
67 | 84 | flush_dcache_all(); |
---|
| 85 | + break; |
---|
| 86 | + case 3: |
---|
| 87 | + printf("error: dcache invalidate require [start] [size]\n"); |
---|
68 | 88 | break; |
---|
69 | 89 | } |
---|
70 | 90 | break; |
---|
.. | .. |
---|
80 | 100 | |
---|
81 | 101 | static int parse_argv(const char *s) |
---|
82 | 102 | { |
---|
83 | | - if (strcmp(s, "flush") == 0) |
---|
| 103 | + if (strcmp(s, "invalidate") == 0) |
---|
| 104 | + return 3; |
---|
| 105 | + else if (strcmp(s, "flush") == 0) |
---|
84 | 106 | return 2; |
---|
85 | 107 | else if (strcmp(s, "on") == 0) |
---|
86 | 108 | return 1; |
---|
.. | .. |
---|
99 | 121 | ); |
---|
100 | 122 | |
---|
101 | 123 | U_BOOT_CMD( |
---|
102 | | - dcache, 2, 1, do_dcache, |
---|
| 124 | + dcache, 4, 1, do_dcache, |
---|
103 | 125 | "enable or disable data cache", |
---|
104 | | - "[on, off, flush]\n" |
---|
| 126 | + "[on, off, flush, invalidate] [start] [size]\n" |
---|
105 | 127 | " - enable, disable, or flush data (writethrough) cache" |
---|
106 | 128 | ); |
---|