MINI2440: Add a command to re-init CFI NOR
[u-boot-openmoko/mini2440.git] / common / cmd_flash.c
blob1c8fa83db3434f9569f837508e07a20efe325b26
1 /*
2 * (C) Copyright 2000
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
6 * project.
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,
21 * MA 02111-1307 USA
25 * FLASH support
27 #include <common.h>
28 #include <command.h>
30 #ifdef CONFIG_HAS_DATAFLASH
31 #include <dataflash.h>
32 #endif
34 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
35 #include <jffs2/jffs2.h>
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
44 #ifndef CFG_NO_FLASH
45 extern flash_info_t flash_info[]; /* info for FLASH chips */
48 * The user interface starts numbering for Flash banks with 1
49 * for historical reasons.
53 * this routine looks for an abbreviated flash range specification.
54 * the syntax is B:SF[-SL], where B is the bank number, SF is the first
55 * sector to erase, and SL is the last sector to erase (defaults to SF).
56 * bank numbers start at 1 to be consistent with other specs, sector numbers
57 * start at zero.
59 * returns: 1 - correct spec; *pinfo, *psf and *psl are
60 * set appropriately
61 * 0 - doesn't look like an abbreviated spec
62 * -1 - looks like an abbreviated spec, but got
63 * a parsing error, a number out of range,
64 * or an invalid flash bank.
66 static int
67 abbrev_spec (char *str, flash_info_t ** pinfo, int *psf, int *psl)
69 flash_info_t *fp;
70 int bank, first, last;
71 char *p, *ep;
73 if ((p = strchr (str, ':')) == NULL)
74 return 0;
75 *p++ = '\0';
77 bank = simple_strtoul (str, &ep, 10);
78 if (ep == str || *ep != '\0' ||
79 bank < 1 || bank > CFG_MAX_FLASH_BANKS ||
80 (fp = &flash_info[bank - 1])->flash_id == FLASH_UNKNOWN)
81 return -1;
83 str = p;
84 if ((p = strchr (str, '-')) != NULL)
85 *p++ = '\0';
87 first = simple_strtoul (str, &ep, 10);
88 if (ep == str || *ep != '\0' || first >= fp->sector_count)
89 return -1;
91 if (p != NULL) {
92 last = simple_strtoul (p, &ep, 10);
93 if (ep == p || *ep != '\0' ||
94 last < first || last >= fp->sector_count)
95 return -1;
96 } else {
97 last = first;
100 *pinfo = fp;
101 *psf = first;
102 *psl = last;
104 return 1;
108 * This function computes the start and end addresses for both
109 * erase and protect commands. The range of the addresses on which
110 * either of the commands is to operate can be given in two forms:
111 * 1. <cmd> start end - operate on <'start', 'end')
112 * 2. <cmd> start +length - operate on <'start', start + length)
113 * If the second form is used and the end address doesn't fall on the
114 * sector boundary, than it will be adjusted to the next sector boundary.
115 * If it isn't in the flash, the function will fail (return -1).
116 * Input:
117 * arg1, arg2: address specification (i.e. both command arguments)
118 * Output:
119 * addr_first, addr_last: computed address range
120 * Return:
121 * 1: success
122 * -1: failure (bad format, bad address).
124 static int
125 addr_spec(char *arg1, char *arg2, ulong *addr_first, ulong *addr_last)
127 char *ep;
128 char len_used; /* indicates if the "start +length" form used */
129 char found;
130 ulong bank;
132 *addr_first = simple_strtoul(arg1, &ep, 16);
133 if (ep == arg1 || *ep != '\0')
134 return -1;
136 len_used = 0;
137 if (arg2 && *arg2 == '+'){
138 len_used = 1;
139 ++arg2;
142 *addr_last = simple_strtoul(arg2, &ep, 16);
143 if (ep == arg2 || *ep != '\0')
144 return -1;
146 if (len_used){
148 * *addr_last has the length, compute correct *addr_last
149 * XXX watch out for the integer overflow! Right now it is
150 * checked for in both the callers.
152 *addr_last = *addr_first + *addr_last - 1;
155 * It may happen that *addr_last doesn't fall on the sector
156 * boundary. We want to round such an address to the next
157 * sector boundary, so that the commands don't fail later on.
160 /* find the end addr of the sector where the *addr_last is */
161 found = 0;
162 for (bank = 0; bank < CFG_MAX_FLASH_BANKS && !found; ++bank){
163 int i;
164 flash_info_t *info = &flash_info[bank];
165 for (i = 0; i < info->sector_count && !found; ++i){
166 /* get the end address of the sector */
167 ulong sector_end_addr;
168 if (i == info->sector_count - 1){
169 sector_end_addr =
170 info->start[0] + info->size - 1;
171 } else {
172 sector_end_addr =
173 info->start[i+1] - 1;
175 if (*addr_last <= sector_end_addr &&
176 *addr_last >= info->start[i]){
177 /* sector found */
178 found = 1;
179 /* adjust *addr_last if necessary */
180 if (*addr_last < sector_end_addr){
181 *addr_last = sector_end_addr;
184 } /* sector */
185 } /* bank */
186 if (!found){
187 /* error, addres not in flash */
188 printf("Error: end address (0x%08lx) not in flash!\n",
189 *addr_last);
190 return -1;
192 } /* "start +length" from used */
194 return 1;
197 static int
198 flash_fill_sect_ranges (ulong addr_first, ulong addr_last,
199 int *s_first, int *s_last,
200 int *s_count )
202 flash_info_t *info;
203 ulong bank;
204 int rcode = 0;
206 *s_count = 0;
208 for (bank=0; bank < CFG_MAX_FLASH_BANKS; ++bank) {
209 s_first[bank] = -1; /* first sector to erase */
210 s_last [bank] = -1; /* last sector to erase */
213 for (bank=0,info=&flash_info[0];
214 (bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last);
215 ++bank, ++info) {
216 ulong b_end;
217 int sect;
218 short s_end;
220 if (info->flash_id == FLASH_UNKNOWN) {
221 continue;
224 b_end = info->start[0] + info->size - 1; /* bank end addr */
225 s_end = info->sector_count - 1; /* last sector */
228 for (sect=0; sect < info->sector_count; ++sect) {
229 ulong end; /* last address in current sect */
231 end = (sect == s_end) ? b_end : info->start[sect + 1] - 1;
233 if (addr_first > end)
234 continue;
235 if (addr_last < info->start[sect])
236 continue;
238 if (addr_first == info->start[sect]) {
239 s_first[bank] = sect;
241 if (addr_last == end) {
242 s_last[bank] = sect;
245 if (s_first[bank] >= 0) {
246 if (s_last[bank] < 0) {
247 if (addr_last > b_end) {
248 s_last[bank] = s_end;
249 } else {
250 puts ("Error: end address"
251 " not on sector boundary\n");
252 rcode = 1;
253 break;
256 if (s_last[bank] < s_first[bank]) {
257 puts ("Error: end sector"
258 " precedes start sector\n");
259 rcode = 1;
260 break;
262 sect = s_last[bank];
263 addr_first = (sect == s_end) ? b_end + 1: info->start[sect + 1];
264 (*s_count) += s_last[bank] - s_first[bank] + 1;
265 } else if (addr_first >= info->start[0] && addr_first < b_end) {
266 puts ("Error: start address not on sector boundary\n");
267 rcode = 1;
268 break;
269 } else if (s_last[bank] >= 0) {
270 puts ("Error: cannot span across banks when they are"
271 " mapped in reverse order\n");
272 rcode = 1;
273 break;
277 return rcode;
279 #endif /* CFG_NO_FLASH */
281 int do_flinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
283 #ifndef CFG_NO_FLASH
284 ulong bank;
285 #endif
287 #ifdef CONFIG_HAS_DATAFLASH
288 dataflash_print_info();
289 #endif
291 #ifndef CFG_NO_FLASH
292 if (argc == 1) { /* print info for all FLASH banks */
293 for (bank=0; bank <CFG_MAX_FLASH_BANKS; ++bank) {
294 printf ("\nBank # %ld: ", bank+1);
296 flash_print_info (&flash_info[bank]);
298 return 0;
301 bank = simple_strtoul(argv[1], NULL, 16);
302 if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
303 printf ("Only FLASH Banks # 1 ... # %d supported\n",
304 CFG_MAX_FLASH_BANKS);
305 return 1;
307 printf ("\nBank # %ld: ", bank);
308 flash_print_info (&flash_info[bank-1]);
309 #endif /* CFG_NO_FLASH */
310 return 0;
313 int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
315 #ifndef CFG_NO_FLASH
316 flash_info_t *info;
317 ulong bank, addr_first, addr_last;
318 int n, sect_first, sect_last;
319 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
320 struct mtd_device *dev;
321 struct part_info *part;
322 u8 dev_type, dev_num, pnum;
323 #endif
324 int rcode = 0;
326 if (argc < 2) {
327 printf ("Usage:\n%s\n", cmdtp->usage);
328 return 1;
331 if (strcmp(argv[1], "all") == 0) {
332 for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) {
333 printf ("Erase Flash Bank # %ld ", bank);
334 info = &flash_info[bank-1];
335 rcode = flash_erase (info, 0, info->sector_count-1);
337 return rcode;
340 if ((n = abbrev_spec(argv[1], &info, &sect_first, &sect_last)) != 0) {
341 if (n < 0) {
342 puts ("Bad sector specification\n");
343 return 1;
345 printf ("Erase Flash Sectors %d-%d in Bank # %d ",
346 sect_first, sect_last, (info-flash_info)+1);
347 rcode = flash_erase(info, sect_first, sect_last);
348 return rcode;
351 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
352 /* erase <part-id> - erase partition */
353 if ((argc == 2) && (id_parse(argv[1], NULL, &dev_type, &dev_num) == 0)) {
354 mtdparts_init();
355 if (find_dev_and_part(argv[1], &dev, &pnum, &part) == 0) {
356 if (dev->id->type == MTD_DEV_TYPE_NOR) {
357 bank = dev->id->num;
358 info = &flash_info[bank];
359 addr_first = part->offset + info->start[0];
360 addr_last = addr_first + part->size - 1;
362 printf ("Erase Flash Parition %s, "
363 "bank %d, 0x%08lx - 0x%08lx ",
364 argv[1], bank, addr_first,
365 addr_last);
367 rcode = flash_sect_erase(addr_first, addr_last);
368 return rcode;
371 printf("cannot erase, not a NOR device\n");
372 return 1;
375 #endif
377 if (argc != 3) {
378 printf ("Usage:\n%s\n", cmdtp->usage);
379 return 1;
382 if (strcmp(argv[1], "bank") == 0) {
383 bank = simple_strtoul(argv[2], NULL, 16);
384 if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
385 printf ("Only FLASH Banks # 1 ... # %d supported\n",
386 CFG_MAX_FLASH_BANKS);
387 return 1;
389 printf ("Erase Flash Bank # %ld ", bank);
390 info = &flash_info[bank-1];
391 rcode = flash_erase (info, 0, info->sector_count-1);
392 return rcode;
395 if (addr_spec(argv[1], argv[2], &addr_first, &addr_last) < 0){
396 printf ("Bad address format\n");
397 return 1;
400 if (addr_first >= addr_last) {
401 printf ("Usage:\n%s\n", cmdtp->usage);
402 return 1;
405 rcode = flash_sect_erase(addr_first, addr_last);
406 return rcode;
407 #else
408 return 0;
409 #endif /* CFG_NO_FLASH */
412 #ifndef CFG_NO_FLASH
413 int flash_sect_erase (ulong addr_first, ulong addr_last)
415 flash_info_t *info;
416 ulong bank;
417 #ifdef CFG_MAX_FLASH_BANKS_DETECT
418 int s_first[CFG_MAX_FLASH_BANKS_DETECT], s_last[CFG_MAX_FLASH_BANKS_DETECT];
419 #else
420 int s_first[CFG_MAX_FLASH_BANKS], s_last[CFG_MAX_FLASH_BANKS];
421 #endif
422 int erased = 0;
423 int planned;
424 int rcode = 0;
426 rcode = flash_fill_sect_ranges (addr_first, addr_last,
427 s_first, s_last, &planned );
429 if (planned && (rcode == 0)) {
430 for (bank=0,info=&flash_info[0];
431 (bank < CFG_MAX_FLASH_BANKS) && (rcode == 0);
432 ++bank, ++info) {
433 if (s_first[bank]>=0) {
434 erased += s_last[bank] - s_first[bank] + 1;
435 debug ("Erase Flash from 0x%08lx to 0x%08lx "
436 "in Bank # %ld ",
437 info->start[s_first[bank]],
438 (s_last[bank] == info->sector_count) ?
439 info->start[0] + info->size - 1:
440 info->start[s_last[bank]+1] - 1,
441 bank+1);
442 rcode = flash_erase (info, s_first[bank], s_last[bank]);
445 printf ("Erased %d sectors\n", erased);
446 } else if (rcode == 0) {
447 puts ("Error: start and/or end address"
448 " not on sector boundary\n");
449 rcode = 1;
451 return rcode;
453 #endif /* CFG_NO_FLASH */
455 int do_flinit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
457 #ifndef CFG_NO_FLASH
458 flash_init();
459 #endif
462 int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
464 #ifndef CFG_NO_FLASH
465 flash_info_t *info;
466 ulong bank;
467 int i, n, sect_first, sect_last;
468 #endif /* CFG_NO_FLASH */
469 ulong addr_first, addr_last;
470 int p;
471 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
472 struct mtd_device *dev;
473 struct part_info *part;
474 u8 dev_type, dev_num, pnum;
475 #endif
476 int rcode = 0;
477 #ifdef CONFIG_HAS_DATAFLASH
478 int status;
479 #endif
481 if (argc < 3) {
482 printf ("Usage:\n%s\n", cmdtp->usage);
483 return 1;
486 if (strcmp(argv[1], "off") == 0) {
487 p = 0;
488 } else if (strcmp(argv[1], "on") == 0) {
489 p = 1;
490 } else {
491 printf ("Usage:\n%s\n", cmdtp->usage);
492 return 1;
495 #ifdef CONFIG_HAS_DATAFLASH
496 if ((strcmp(argv[2], "all") != 0) && (strcmp(argv[2], "bank") != 0)) {
497 addr_first = simple_strtoul(argv[2], NULL, 16);
498 addr_last = simple_strtoul(argv[3], NULL, 16);
500 if (addr_dataflash(addr_first) && addr_dataflash(addr_last)) {
501 status = dataflash_real_protect(p,addr_first,addr_last);
502 if (status < 0){
503 puts ("Bad DataFlash sector specification\n");
504 return 1;
506 printf("%sProtect %d DataFlash Sectors\n",
507 p ? "" : "Un-", status);
508 return 0;
511 #endif
513 #ifndef CFG_NO_FLASH
514 if (strcmp(argv[2], "all") == 0) {
515 for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) {
516 info = &flash_info[bank-1];
517 if (info->flash_id == FLASH_UNKNOWN) {
518 continue;
520 printf ("%sProtect Flash Bank # %ld\n",
521 p ? "" : "Un-", bank);
523 for (i=0; i<info->sector_count; ++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 */
532 #if defined(CFG_FLASH_PROTECTION)
533 if (!rcode) puts (" done\n");
534 #endif /* CFG_FLASH_PROTECTION */
536 return rcode;
539 if ((n = abbrev_spec(argv[2], &info, &sect_first, &sect_last)) != 0) {
540 if (n < 0) {
541 puts ("Bad sector specification\n");
542 return 1;
544 printf("%sProtect Flash Sectors %d-%d in Bank # %d\n",
545 p ? "" : "Un-", sect_first, sect_last,
546 (info-flash_info)+1);
547 for (i = sect_first; i <= sect_last; i++) {
548 #if defined(CFG_FLASH_PROTECTION)
549 if (flash_real_protect(info, i, p))
550 rcode = 1;
551 putc ('.');
552 #else
553 info->protect[i] = p;
554 #endif /* CFG_FLASH_PROTECTION */
557 #if defined(CFG_FLASH_PROTECTION)
558 if (!rcode) puts (" done\n");
559 #endif /* CFG_FLASH_PROTECTION */
561 return rcode;
564 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
565 /* protect on/off <part-id> */
566 if ((argc == 3) && (id_parse(argv[2], NULL, &dev_type, &dev_num) == 0)) {
567 mtdparts_init();
568 if (find_dev_and_part(argv[2], &dev, &pnum, &part) == 0) {
569 if (dev->id->type == MTD_DEV_TYPE_NOR) {
570 bank = dev->id->num;
571 info = &flash_info[bank];
572 addr_first = part->offset + info->start[0];
573 addr_last = addr_first + part->size - 1;
575 printf ("%sProtect Flash Parition %s, "
576 "bank %d, 0x%08lx - 0x%08lx\n",
577 p ? "" : "Un", argv[1],
578 bank, addr_first, addr_last);
580 rcode = flash_sect_protect (p, addr_first, addr_last);
581 return rcode;
584 printf("cannot %sprotect, not a NOR device\n",
585 p ? "" : "un");
586 return 1;
589 #endif
591 if (argc != 4) {
592 printf ("Usage:\n%s\n", cmdtp->usage);
593 return 1;
596 if (strcmp(argv[2], "bank") == 0) {
597 bank = simple_strtoul(argv[3], NULL, 16);
598 if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
599 printf ("Only FLASH Banks # 1 ... # %d supported\n",
600 CFG_MAX_FLASH_BANKS);
601 return 1;
603 printf ("%sProtect Flash Bank # %ld\n",
604 p ? "" : "Un-", bank);
605 info = &flash_info[bank-1];
607 if (info->flash_id == FLASH_UNKNOWN) {
608 puts ("missing or unknown FLASH type\n");
609 return 1;
611 for (i=0; i<info->sector_count; ++i) {
612 #if defined(CFG_FLASH_PROTECTION)
613 if (flash_real_protect(info, i, p))
614 rcode = 1;
615 putc ('.');
616 #else
617 info->protect[i] = p;
618 #endif /* CFG_FLASH_PROTECTION */
621 #if defined(CFG_FLASH_PROTECTION)
622 if (!rcode) puts (" done\n");
623 #endif /* CFG_FLASH_PROTECTION */
625 return rcode;
628 if (addr_spec(argv[2], argv[3], &addr_first, &addr_last) < 0){
629 printf("Bad address format\n");
630 return 1;
633 if (addr_first >= addr_last) {
634 printf ("Usage:\n%s\n", cmdtp->usage);
635 return 1;
637 rcode = flash_sect_protect (p, addr_first, addr_last);
638 #endif /* CFG_NO_FLASH */
639 return rcode;
642 #ifndef CFG_NO_FLASH
643 int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
645 flash_info_t *info;
646 ulong bank;
647 #ifdef CFG_MAX_FLASH_BANKS_DETECT
648 int s_first[CFG_MAX_FLASH_BANKS_DETECT], s_last[CFG_MAX_FLASH_BANKS_DETECT];
649 #else
650 int s_first[CFG_MAX_FLASH_BANKS], s_last[CFG_MAX_FLASH_BANKS];
651 #endif
652 int protected, i;
653 int planned;
654 int rcode;
656 rcode = flash_fill_sect_ranges( addr_first, addr_last, s_first, s_last, &planned );
658 protected = 0;
660 if (planned && (rcode == 0)) {
661 for (bank=0,info=&flash_info[0]; bank < CFG_MAX_FLASH_BANKS; ++bank, ++info) {
662 if (info->flash_id == FLASH_UNKNOWN) {
663 continue;
666 if (s_first[bank]>=0 && s_first[bank]<=s_last[bank]) {
667 debug ("%sProtecting sectors %d..%d in bank %ld\n",
668 p ? "" : "Un-",
669 s_first[bank], s_last[bank], bank+1);
670 protected += s_last[bank] - s_first[bank] + 1;
671 for (i=s_first[bank]; i<=s_last[bank]; ++i) {
672 #if defined(CFG_FLASH_PROTECTION)
673 if (flash_real_protect(info, i, p))
674 rcode = 1;
675 putc ('.');
676 #else
677 info->protect[i] = p;
678 #endif /* CFG_FLASH_PROTECTION */
682 #if defined(CFG_FLASH_PROTECTION)
683 puts (" done\n");
684 #endif /* CFG_FLASH_PROTECTION */
686 printf ("%sProtected %d sectors\n",
687 p ? "" : "Un-", protected);
688 } else if (rcode == 0) {
689 puts ("Error: start and/or end address"
690 " not on sector boundary\n");
691 rcode = 1;
693 return rcode;
695 #endif /* CFG_NO_FLASH */
698 /**************************************************/
699 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
700 # define TMP_ERASE "erase <part-id>\n - erase partition\n"
701 # define TMP_PROT_ON "protect on <part-id>\n - protect partition\n"
702 # define TMP_PROT_OFF "protect off <part-id>\n - make partition writable\n"
703 #else
704 # define TMP_ERASE /* empty */
705 # define TMP_PROT_ON /* empty */
706 # define TMP_PROT_OFF /* empty */
707 #endif
709 U_BOOT_CMD(
710 flinit, 1, 1, do_flinit,
711 "flinit - Initialize/probe NOR flash memory\n",
714 U_BOOT_CMD(
715 flinfo, 2, 1, do_flinfo,
716 "flinfo - print FLASH memory information\n",
717 "\n - print information for all FLASH memory banks\n"
718 "flinfo N\n - print information for FLASH memory bank # N\n"
721 U_BOOT_CMD(
722 erase, 3, 0, do_flerase,
723 "erase - erase FLASH memory\n",
724 "start end\n"
725 " - erase FLASH from addr 'start' to addr 'end'\n"
726 "erase start +len\n"
727 " - erase FLASH from addr 'start' to the end of sect "
728 "w/addr 'start'+'len'-1\n"
729 "erase N:SF[-SL]\n - erase sectors SF-SL in FLASH bank # N\n"
730 "erase bank N\n - erase FLASH bank # N\n"
731 TMP_ERASE
732 "erase all\n - erase all FLASH banks\n"
735 U_BOOT_CMD(
736 protect, 4, 0, do_protect,
737 "protect - enable or disable FLASH write protection\n",
738 "on start end\n"
739 " - protect FLASH from addr 'start' to addr 'end'\n"
740 "protect on start +len\n"
741 " - protect FLASH from addr 'start' to end of sect "
742 "w/addr 'start'+'len'-1\n"
743 "protect on N:SF[-SL]\n"
744 " - protect sectors SF-SL in FLASH bank # N\n"
745 "protect on bank N\n - protect FLASH bank # N\n"
746 TMP_PROT_ON
747 "protect on all\n - protect all FLASH banks\n"
748 "protect off start end\n"
749 " - make FLASH from addr 'start' to addr 'end' writable\n"
750 "protect off start +len\n"
751 " - make FLASH from addr 'start' to end of sect "
752 "w/addr 'start'+'len'-1 wrtable\n"
753 "protect off N:SF[-SL]\n"
754 " - make sectors SF-SL writable in FLASH bank # N\n"
755 "protect off bank N\n - make FLASH bank # N writable\n"
756 TMP_PROT_OFF
757 "protect off all\n - make all FLASH banks writable\n"
760 #undef TMP_ERASE
761 #undef TMP_PROT_ON
762 #undef TMP_PROT_OFF