|
12 | 12 | #include <command.h>
|
13 | 13 | #include <console.h>
|
14 | 14 | #include <fuse.h>
|
| 15 | +#include <mapmem.h> |
15 | 16 | #include <linux/errno.h>
|
16 | 17 |
|
17 | 18 | static int strtou32(const char *str, unsigned int base, u32 *result)
|
@@ -46,6 +47,8 @@ static int do_fuse(struct cmd_tbl *cmdtp, int flag, int argc,
|
46 | 47 | const char *op = argc >= 2 ? argv[1] : NULL;
|
47 | 48 | int confirmed = argc >= 3 && !strcmp(argv[2], "-y");
|
48 | 49 | u32 bank, word, cnt, val, cmp;
|
| 50 | + ulong addr; |
| 51 | + void *buf, *start; |
49 | 52 | int ret, i;
|
50 | 53 |
|
51 | 54 | argc -= 2 + confirmed;
|
@@ -73,6 +76,28 @@ static int do_fuse(struct cmd_tbl *cmdtp, int flag, int argc,
|
73 | 76 | printf(" %.8x", val);
|
74 | 77 | }
|
75 | 78 | putc('\n');
|
| 79 | + } else if (!strcmp(op, "readm")) { |
| 80 | + if (argc == 3) |
| 81 | + cnt = 1; |
| 82 | + else if (argc != 4 || strtou32(argv[3], 0, &cnt)) |
| 83 | + return CMD_RET_USAGE; |
| 84 | + |
| 85 | + addr = simple_strtoul(argv[2], NULL, 16); |
| 86 | + |
| 87 | + start = map_sysmem(addr, 4); |
| 88 | + buf = start; |
| 89 | + |
| 90 | + printf("Reading bank %u len %u to 0x%lx\n", bank, cnt, addr); |
| 91 | + for (i = 0; i < cnt; i++, word++) { |
| 92 | + ret = fuse_read(bank, word, &val); |
| 93 | + if (ret) |
| 94 | + goto err; |
| 95 | + |
| 96 | + *((u32 *)buf) = val; |
| 97 | + buf += 4; |
| 98 | + } |
| 99 | + |
| 100 | + unmap_sysmem(start); |
76 | 101 | } else if (!strcmp(op, "cmp")) {
|
77 | 102 | if (argc != 3 || strtou32(argv[2], 0, &cmp))
|
78 | 103 | return CMD_RET_USAGE;
|
@@ -157,6 +182,8 @@ U_BOOT_CMD(
|
157 | 182 | " starting at 'word'\n"
|
158 | 183 | "fuse cmp <bank> <word> <hexval> - compare 'hexval' to fuse\n"
|
159 | 184 | " at 'word'\n"
|
| 185 | + "fuse readm <bank> <word> <addr> [<cnt>] - read 1 or 'cnt' fuse words,\n" |
| 186 | + " starting at 'word' into memory at 'addr'\n" |
160 | 187 | "fuse sense <bank> <word> [<cnt>] - sense 1 or 'cnt' fuse words,\n"
|
161 | 188 | " starting at 'word'\n"
|
162 | 189 | "fuse prog [-y] <bank> <word> <hexval> [<hexval>...] - program 1 or\n"
|
|
0 commit comments