]> git.ipfire.org Git - people/ms/u-boot.git/blob - common/cmd_flash.c
Merge commit '3deca9d'
[people/ms/u-boot.git] / common / cmd_flash.c
1 /*
2 * (C) Copyright 2000
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
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.
12 *
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.
17 *
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,
21 * MA 02111-1307 USA
22 */
23
24 /*
25 * FLASH support
26 */
27 #include <common.h>
28 #include <command.h>
29
30 #ifdef CONFIG_HAS_DATAFLASH
31 #include <dataflash.h>
32 #endif
33
34 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
35 #include <jffs2/jffs2.h>
36
37 /* parition handling routines */
38 int mtdparts_init(void);
39 int id_parse(const char *id, const char **ret_id, u8 *dev_type, u8 *dev_num);
40 int find_dev_and_part(const char *id, struct mtd_device **dev,
41 u8 *part_num, struct part_info **part);
42 #endif
43
44 extern flash_info_t flash_info[]; /* info for FLASH chips */
45
46 /*
47 * The user interface starts numbering for Flash banks with 1
48 * for historical reasons.
49 */
50
51 /*
52 * this routine looks for an abbreviated flash range specification.
53 * the syntax is B:SF[-SL], where B is the bank number, SF is the first
54 * sector to erase, and SL is the last sector to erase (defaults to SF).
55 * bank numbers start at 1 to be consistent with other specs, sector numbers
56 * start at zero.
57 *
58 * returns: 1 - correct spec; *pinfo, *psf and *psl are
59 * set appropriately
60 * 0 - doesn't look like an abbreviated spec
61 * -1 - looks like an abbreviated spec, but got
62 * a parsing error, a number out of range,
63 * or an invalid flash bank.
64 */
65 static int
66 abbrev_spec (char *str, flash_info_t ** pinfo, int *psf, int *psl)
67 {
68 flash_info_t *fp;
69 int bank, first, last;
70 char *p, *ep;
71
72 if ((p = strchr (str, ':')) == NULL)
73 return 0;
74 *p++ = '\0';
75
76 bank = simple_strtoul (str, &ep, 10);
77 if (ep == str || *ep != '\0' ||
78 bank < 1 || bank > CFG_MAX_FLASH_BANKS ||
79 (fp = &flash_info[bank - 1])->flash_id == FLASH_UNKNOWN)
80 return -1;
81
82 str = p;
83 if ((p = strchr (str, '-')) != NULL)
84 *p++ = '\0';
85
86 first = simple_strtoul (str, &ep, 10);
87 if (ep == str || *ep != '\0' || first >= fp->sector_count)
88 return -1;
89
90 if (p != NULL) {
91 last = simple_strtoul (p, &ep, 10);
92 if (ep == p || *ep != '\0' ||
93 last < first || last >= fp->sector_count)
94 return -1;
95 } else {
96 last = first;
97 }
98
99 *pinfo = fp;
100 *psf = first;
101 *psl = last;
102
103 return 1;
104 }
105
106 /*
107 * This function computes the start and end addresses for both
108 * erase and protect commands. The range of the addresses on which
109 * either of the commands is to operate can be given in two forms:
110 * 1. <cmd> start end - operate on <'start', 'end')
111 * 2. <cmd> start +length - operate on <'start', start + length)
112 * If the second form is used and the end address doesn't fall on the
113 * sector boundary, than it will be adjusted to the next sector boundary.
114 * If it isn't in the flash, the function will fail (return -1).
115 * Input:
116 * arg1, arg2: address specification (i.e. both command arguments)
117 * Output:
118 * addr_first, addr_last: computed address range
119 * Return:
120 * 1: success
121 * -1: failure (bad format, bad address).
122 */
123 static int
124 addr_spec(char *arg1, char *arg2, ulong *addr_first, ulong *addr_last)
125 {
126 char *ep;
127 char len_used; /* indicates if the "start +length" form used */
128 char found;
129 ulong bank;
130
131 *addr_first = simple_strtoul(arg1, &ep, 16);
132 if (ep == arg1 || *ep != '\0')
133 return -1;
134
135 len_used = 0;
136 if (arg2 && *arg2 == '+'){
137 len_used = 1;
138 ++arg2;
139 }
140
141 *addr_last = simple_strtoul(arg2, &ep, 16);
142 if (ep == arg2 || *ep != '\0')
143 return -1;
144
145 if (len_used){
146 /*
147 * *addr_last has the length, compute correct *addr_last
148 * XXX watch out for the integer overflow! Right now it is
149 * checked for in both the callers.
150 */
151 *addr_last = *addr_first + *addr_last - 1;
152
153 /*
154 * It may happen that *addr_last doesn't fall on the sector
155 * boundary. We want to round such an address to the next
156 * sector boundary, so that the commands don't fail later on.
157 */
158
159 /* find the end addr of the sector where the *addr_last is */
160 found = 0;
161 for (bank = 0; bank < CFG_MAX_FLASH_BANKS && !found; ++bank){
162 int i;
163 flash_info_t *info = &flash_info[bank];
164 for (i = 0; i < info->sector_count && !found; ++i){
165 /* get the end address of the sector */
166 ulong sector_end_addr;
167 if (i == info->sector_count - 1){
168 sector_end_addr =
169 info->start[0] + info->size - 1;
170 } else {
171 sector_end_addr =
172 info->start[i+1] - 1;
173 }
174 if (*addr_last <= sector_end_addr &&
175 *addr_last >= info->start[i]){
176 /* sector found */
177 found = 1;
178 /* adjust *addr_last if necessary */
179 if (*addr_last < sector_end_addr){
180 *addr_last = sector_end_addr;
181 }
182 }
183 } /* sector */
184 } /* bank */
185 if (!found){
186 /* error, addres not in flash */
187 printf("Error: end address (0x%08lx) not in flash!\n",
188 *addr_last);
189 return -1;
190 }
191 } /* "start +length" from used */
192
193 return 1;
194 }
195
196 static int
197 flash_fill_sect_ranges (ulong addr_first, ulong addr_last,
198 int *s_first, int *s_last,
199 int *s_count )
200 {
201 flash_info_t *info;
202 ulong bank;
203 int rcode = 0;
204
205 *s_count = 0;
206
207 for (bank=0; bank < CFG_MAX_FLASH_BANKS; ++bank) {
208 s_first[bank] = -1; /* first sector to erase */
209 s_last [bank] = -1; /* last sector to erase */
210 }
211
212 for (bank=0,info=&flash_info[0];
213 (bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last);
214 ++bank, ++info) {
215 ulong b_end;
216 int sect;
217 short s_end;
218
219 if (info->flash_id == FLASH_UNKNOWN) {
220 continue;
221 }
222
223 b_end = info->start[0] + info->size - 1; /* bank end addr */
224 s_end = info->sector_count - 1; /* last sector */
225
226
227 for (sect=0; sect < info->sector_count; ++sect) {
228 ulong end; /* last address in current sect */
229
230 end = (sect == s_end) ? b_end : info->start[sect + 1] - 1;
231
232 if (addr_first > end)
233 continue;
234 if (addr_last < info->start[sect])
235 continue;
236
237 if (addr_first == info->start[sect]) {
238 s_first[bank] = sect;
239 }
240 if (addr_last == end) {
241 s_last[bank] = sect;
242 }
243 }
244 if (s_first[bank] >= 0) {
245 if (s_last[bank] < 0) {
246 if (addr_last > b_end) {
247 s_last[bank] = s_end;
248 } else {
249 puts ("Error: end address"
250 " not on sector boundary\n");
251 rcode = 1;
252 break;
253 }
254 }
255 if (s_last[bank] < s_first[bank]) {
256 puts ("Error: end sector"
257 " precedes start sector\n");
258 rcode = 1;
259 break;
260 }
261 sect = s_last[bank];
262 addr_first = (sect == s_end) ? b_end + 1: info->start[sect + 1];
263 (*s_count) += s_last[bank] - s_first[bank] + 1;
264 } else if (addr_first >= info->start[0] && addr_first < b_end) {
265 puts ("Error: start address not on sector boundary\n");
266 rcode = 1;
267 break;
268 } else if (s_last[bank] >= 0) {
269 puts ("Error: cannot span across banks when they are"
270 " mapped in reverse order\n");
271 rcode = 1;
272 break;
273 }
274 }
275
276 return rcode;
277 }
278
279 int do_flinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
280 {
281 ulong bank;
282
283 #ifdef CONFIG_HAS_DATAFLASH
284 dataflash_print_info();
285 #endif
286
287 if (argc == 1) { /* print info for all FLASH banks */
288 for (bank=0; bank <CFG_MAX_FLASH_BANKS; ++bank) {
289 printf ("\nBank # %ld: ", bank+1);
290
291 flash_print_info (&flash_info[bank]);
292 }
293 return 0;
294 }
295
296 bank = simple_strtoul(argv[1], NULL, 16);
297 if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
298 printf ("Only FLASH Banks # 1 ... # %d supported\n",
299 CFG_MAX_FLASH_BANKS);
300 return 1;
301 }
302 printf ("\nBank # %ld: ", bank);
303 flash_print_info (&flash_info[bank-1]);
304 return 0;
305 }
306
307 int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
308 {
309 flash_info_t *info;
310 ulong bank, addr_first, addr_last;
311 int n, sect_first, sect_last;
312 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
313 struct mtd_device *dev;
314 struct part_info *part;
315 u8 dev_type, dev_num, pnum;
316 #endif
317 int rcode = 0;
318
319 if (argc < 2) {
320 printf ("Usage:\n%s\n", cmdtp->usage);
321 return 1;
322 }
323
324 if (strcmp(argv[1], "all") == 0) {
325 for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) {
326 printf ("Erase Flash Bank # %ld ", bank);
327 info = &flash_info[bank-1];
328 rcode = flash_erase (info, 0, info->sector_count-1);
329 }
330 return rcode;
331 }
332
333 if ((n = abbrev_spec(argv[1], &info, &sect_first, &sect_last)) != 0) {
334 if (n < 0) {
335 puts ("Bad sector specification\n");
336 return 1;
337 }
338 printf ("Erase Flash Sectors %d-%d in Bank # %d ",
339 sect_first, sect_last, (info-flash_info)+1);
340 rcode = flash_erase(info, sect_first, sect_last);
341 return rcode;
342 }
343
344 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
345 /* erase <part-id> - erase partition */
346 if ((argc == 2) && (id_parse(argv[1], NULL, &dev_type, &dev_num) == 0)) {
347 mtdparts_init();
348 if (find_dev_and_part(argv[1], &dev, &pnum, &part) == 0) {
349 if (dev->id->type == MTD_DEV_TYPE_NOR) {
350 bank = dev->id->num;
351 info = &flash_info[bank];
352 addr_first = part->offset + info->start[0];
353 addr_last = addr_first + part->size - 1;
354
355 printf ("Erase Flash Parition %s, "
356 "bank %d, 0x%08lx - 0x%08lx ",
357 argv[1], bank, addr_first,
358 addr_last);
359
360 rcode = flash_sect_erase(addr_first, addr_last);
361 return rcode;
362 }
363
364 printf("cannot erase, not a NOR device\n");
365 return 1;
366 }
367 }
368 #endif
369
370 if (argc != 3) {
371 printf ("Usage:\n%s\n", cmdtp->usage);
372 return 1;
373 }
374
375 if (strcmp(argv[1], "bank") == 0) {
376 bank = simple_strtoul(argv[2], NULL, 16);
377 if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
378 printf ("Only FLASH Banks # 1 ... # %d supported\n",
379 CFG_MAX_FLASH_BANKS);
380 return 1;
381 }
382 printf ("Erase Flash Bank # %ld ", bank);
383 info = &flash_info[bank-1];
384 rcode = flash_erase (info, 0, info->sector_count-1);
385 return rcode;
386 }
387
388 if (addr_spec(argv[1], argv[2], &addr_first, &addr_last) < 0){
389 printf ("Bad address format\n");
390 return 1;
391 }
392
393 if (addr_first >= addr_last) {
394 printf ("Usage:\n%s\n", cmdtp->usage);
395 return 1;
396 }
397
398 rcode = flash_sect_erase(addr_first, addr_last);
399 return rcode;
400 }
401
402 int flash_sect_erase (ulong addr_first, ulong addr_last)
403 {
404 flash_info_t *info;
405 ulong bank;
406 #ifdef CFG_MAX_FLASH_BANKS_DETECT
407 int s_first[CFG_MAX_FLASH_BANKS_DETECT], s_last[CFG_MAX_FLASH_BANKS_DETECT];
408 #else
409 int s_first[CFG_MAX_FLASH_BANKS], s_last[CFG_MAX_FLASH_BANKS];
410 #endif
411 int erased = 0;
412 int planned;
413 int rcode = 0;
414
415 rcode = flash_fill_sect_ranges (addr_first, addr_last,
416 s_first, s_last, &planned );
417
418 if (planned && (rcode == 0)) {
419 for (bank=0,info=&flash_info[0];
420 (bank < CFG_MAX_FLASH_BANKS) && (rcode == 0);
421 ++bank, ++info) {
422 if (s_first[bank]>=0) {
423 erased += s_last[bank] - s_first[bank] + 1;
424 debug ("Erase Flash from 0x%08lx to 0x%08lx "
425 "in Bank # %ld ",
426 info->start[s_first[bank]],
427 (s_last[bank] == info->sector_count) ?
428 info->start[0] + info->size - 1:
429 info->start[s_last[bank]+1] - 1,
430 bank+1);
431 rcode = flash_erase (info, s_first[bank], s_last[bank]);
432 }
433 }
434 printf ("Erased %d sectors\n", erased);
435 } else if (rcode == 0) {
436 puts ("Error: start and/or end address"
437 " not on sector boundary\n");
438 rcode = 1;
439 }
440 return rcode;
441 }
442
443 int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
444 {
445 flash_info_t *info;
446 ulong bank, addr_first, addr_last;
447 int i, p, n, sect_first, sect_last;
448 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
449 struct mtd_device *dev;
450 struct part_info *part;
451 u8 dev_type, dev_num, pnum;
452 #endif
453 int rcode = 0;
454 #ifdef CONFIG_HAS_DATAFLASH
455 int status;
456 #endif
457
458 if (argc < 3) {
459 printf ("Usage:\n%s\n", cmdtp->usage);
460 return 1;
461 }
462
463 if (strcmp(argv[1], "off") == 0) {
464 p = 0;
465 } else if (strcmp(argv[1], "on") == 0) {
466 p = 1;
467 } else {
468 printf ("Usage:\n%s\n", cmdtp->usage);
469 return 1;
470 }
471
472 #ifdef CONFIG_HAS_DATAFLASH
473 if ((strcmp(argv[2], "all") != 0) && (strcmp(argv[2], "bank") != 0)) {
474 addr_first = simple_strtoul(argv[2], NULL, 16);
475 addr_last = simple_strtoul(argv[3], NULL, 16);
476
477 if (addr_dataflash(addr_first) && addr_dataflash(addr_last)) {
478 status = dataflash_real_protect(p,addr_first,addr_last);
479 if (status < 0){
480 puts ("Bad DataFlash sector specification\n");
481 return 1;
482 }
483 printf("%sProtect %d DataFlash Sectors\n",
484 p ? "" : "Un-", status);
485 return 0;
486 }
487 }
488 #endif
489
490 if (strcmp(argv[2], "all") == 0) {
491 for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) {
492 info = &flash_info[bank-1];
493 if (info->flash_id == FLASH_UNKNOWN) {
494 continue;
495 }
496 printf ("%sProtect Flash Bank # %ld\n",
497 p ? "" : "Un-", bank);
498
499 for (i=0; i<info->sector_count; ++i) {
500 #if defined(CFG_FLASH_PROTECTION)
501 if (flash_real_protect(info, i, p))
502 rcode = 1;
503 putc ('.');
504 #else
505 info->protect[i] = p;
506 #endif /* CFG_FLASH_PROTECTION */
507 }
508 #if defined(CFG_FLASH_PROTECTION)
509 if (!rcode) puts (" done\n");
510 #endif /* CFG_FLASH_PROTECTION */
511 }
512 return rcode;
513 }
514
515 if ((n = abbrev_spec(argv[2], &info, &sect_first, &sect_last)) != 0) {
516 if (n < 0) {
517 puts ("Bad sector specification\n");
518 return 1;
519 }
520 printf("%sProtect Flash Sectors %d-%d in Bank # %d\n",
521 p ? "" : "Un-", sect_first, sect_last,
522 (info-flash_info)+1);
523 for (i = sect_first; i <= sect_last; i++) {
524 #if defined(CFG_FLASH_PROTECTION)
525 if (flash_real_protect(info, i, p))
526 rcode = 1;
527 putc ('.');
528 #else
529 info->protect[i] = p;
530 #endif /* CFG_FLASH_PROTECTION */
531 }
532
533 #if defined(CFG_FLASH_PROTECTION)
534 if (!rcode) puts (" done\n");
535 #endif /* CFG_FLASH_PROTECTION */
536
537 return rcode;
538 }
539
540 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
541 /* protect on/off <part-id> */
542 if ((argc == 3) && (id_parse(argv[2], NULL, &dev_type, &dev_num) == 0)) {
543 mtdparts_init();
544 if (find_dev_and_part(argv[2], &dev, &pnum, &part) == 0) {
545 if (dev->id->type == MTD_DEV_TYPE_NOR) {
546 bank = dev->id->num;
547 info = &flash_info[bank];
548 addr_first = part->offset + info->start[0];
549 addr_last = addr_first + part->size - 1;
550
551 printf ("%sProtect Flash Parition %s, "
552 "bank %d, 0x%08lx - 0x%08lx\n",
553 p ? "" : "Un", argv[1],
554 bank, addr_first, addr_last);
555
556 rcode = flash_sect_protect (p, addr_first, addr_last);
557 return rcode;
558 }
559
560 printf("cannot %sprotect, not a NOR device\n",
561 p ? "" : "un");
562 return 1;
563 }
564 }
565 #endif
566
567 if (argc != 4) {
568 printf ("Usage:\n%s\n", cmdtp->usage);
569 return 1;
570 }
571
572 if (strcmp(argv[2], "bank") == 0) {
573 bank = simple_strtoul(argv[3], NULL, 16);
574 if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
575 printf ("Only FLASH Banks # 1 ... # %d supported\n",
576 CFG_MAX_FLASH_BANKS);
577 return 1;
578 }
579 printf ("%sProtect Flash Bank # %ld\n",
580 p ? "" : "Un-", bank);
581 info = &flash_info[bank-1];
582
583 if (info->flash_id == FLASH_UNKNOWN) {
584 puts ("missing or unknown FLASH type\n");
585 return 1;
586 }
587 for (i=0; i<info->sector_count; ++i) {
588 #if defined(CFG_FLASH_PROTECTION)
589 if (flash_real_protect(info, i, p))
590 rcode = 1;
591 putc ('.');
592 #else
593 info->protect[i] = p;
594 #endif /* CFG_FLASH_PROTECTION */
595 }
596
597 #if defined(CFG_FLASH_PROTECTION)
598 if (!rcode) puts (" done\n");
599 #endif /* CFG_FLASH_PROTECTION */
600
601 return rcode;
602 }
603
604 if (addr_spec(argv[2], argv[3], &addr_first, &addr_last) < 0){
605 printf("Bad address format\n");
606 return 1;
607 }
608
609 if (addr_first >= addr_last) {
610 printf ("Usage:\n%s\n", cmdtp->usage);
611 return 1;
612 }
613 rcode = flash_sect_protect (p, addr_first, addr_last);
614 return rcode;
615 }
616
617
618 int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
619 {
620 flash_info_t *info;
621 ulong bank;
622 #ifdef CFG_MAX_FLASH_BANKS_DETECT
623 int s_first[CFG_MAX_FLASH_BANKS_DETECT], s_last[CFG_MAX_FLASH_BANKS_DETECT];
624 #else
625 int s_first[CFG_MAX_FLASH_BANKS], s_last[CFG_MAX_FLASH_BANKS];
626 #endif
627 int protected, i;
628 int planned;
629 int rcode;
630
631 rcode = flash_fill_sect_ranges( addr_first, addr_last, s_first, s_last, &planned );
632
633 protected = 0;
634
635 if (planned && (rcode == 0)) {
636 for (bank=0,info=&flash_info[0]; bank < CFG_MAX_FLASH_BANKS; ++bank, ++info) {
637 if (info->flash_id == FLASH_UNKNOWN) {
638 continue;
639 }
640
641 if (s_first[bank]>=0 && s_first[bank]<=s_last[bank]) {
642 debug ("%sProtecting sectors %d..%d in bank %ld\n",
643 p ? "" : "Un-",
644 s_first[bank], s_last[bank], bank+1);
645 protected += s_last[bank] - s_first[bank] + 1;
646 for (i=s_first[bank]; i<=s_last[bank]; ++i) {
647 #if defined(CFG_FLASH_PROTECTION)
648 if (flash_real_protect(info, i, p))
649 rcode = 1;
650 putc ('.');
651 #else
652 info->protect[i] = p;
653 #endif /* CFG_FLASH_PROTECTION */
654 }
655 }
656 }
657 #if defined(CFG_FLASH_PROTECTION)
658 puts (" done\n");
659 #endif /* CFG_FLASH_PROTECTION */
660
661 printf ("%sProtected %d sectors\n",
662 p ? "" : "Un-", protected);
663 } else if (rcode == 0) {
664 puts ("Error: start and/or end address"
665 " not on sector boundary\n");
666 rcode = 1;
667 }
668 return rcode;
669 }
670
671
672 /**************************************************/
673 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
674 # define TMP_ERASE "erase <part-id>\n - erase partition\n"
675 # define TMP_PROT_ON "protect on <part-id>\n - protect partition\n"
676 # define TMP_PROT_OFF "protect off <part-id>\n - make partition writable\n"
677 #else
678 # define TMP_ERASE /* empty */
679 # define TMP_PROT_ON /* empty */
680 # define TMP_PROT_OFF /* empty */
681 #endif
682
683 U_BOOT_CMD(
684 flinfo, 2, 1, do_flinfo,
685 "flinfo - print FLASH memory information\n",
686 "\n - print information for all FLASH memory banks\n"
687 "flinfo N\n - print information for FLASH memory bank # N\n"
688 );
689
690 U_BOOT_CMD(
691 erase, 3, 0, do_flerase,
692 "erase - erase FLASH memory\n",
693 "start end\n"
694 " - erase FLASH from addr 'start' to addr 'end'\n"
695 "erase start +len\n"
696 " - erase FLASH from addr 'start' to the end of sect "
697 "w/addr 'start'+'len'-1\n"
698 "erase N:SF[-SL]\n - erase sectors SF-SL in FLASH bank # N\n"
699 "erase bank N\n - erase FLASH bank # N\n"
700 TMP_ERASE
701 "erase all\n - erase all FLASH banks\n"
702 );
703
704 U_BOOT_CMD(
705 protect, 4, 0, do_protect,
706 "protect - enable or disable FLASH write protection\n",
707 "on start end\n"
708 " - protect FLASH from addr 'start' to addr 'end'\n"
709 "protect on start +len\n"
710 " - protect FLASH from addr 'start' to end of sect "
711 "w/addr 'start'+'len'-1\n"
712 "protect on N:SF[-SL]\n"
713 " - protect sectors SF-SL in FLASH bank # N\n"
714 "protect on bank N\n - protect FLASH bank # N\n"
715 TMP_PROT_ON
716 "protect on all\n - protect all FLASH banks\n"
717 "protect off start end\n"
718 " - make FLASH from addr 'start' to addr 'end' writable\n"
719 "protect off start +len\n"
720 " - make FLASH from addr 'start' to end of sect "
721 "w/addr 'start'+'len'-1 wrtable\n"
722 "protect off N:SF[-SL]\n"
723 " - make sectors SF-SL writable in FLASH bank # N\n"
724 "protect off bank N\n - make FLASH bank # N writable\n"
725 TMP_PROT_OFF
726 "protect off all\n - make all FLASH banks writable\n"
727 );
728
729 #undef TMP_ERASE
730 #undef TMP_PROT_ON
731 #undef TMP_PROT_OFF