3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/processor.h>
12 #if defined(CONFIG_CAM5200) && defined(CONFIG_CAM5200_NIOSFLASH)
15 #define DEBUGF(x...) printf(x)
20 #define swap16(x) __swab16(x)
22 flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */
25 * CAM5200 is a TQM5200B based board. Additionally it also features
26 * a NIOS cpu. The NIOS CPU peripherals are accessible through MPC5xxx
27 * Local Bus on CS5. This includes 32 bit wide RAM and SRAM as well as
28 * 16 bit wide flash device. Big Endian order on a 32 bit CS5 makes
29 * access to flash chip slightly more complicated as additional byte
30 * swapping is necessary within each 16 bit wide flash 'word'.
32 * This driver's task is to handle both flash devices: 32 bit TQM5200B
33 * flash chip and 16 bit NIOS cpu flash chip. In the below
34 * flash_addr_table table we use least significant address bit to mark
35 * 16 bit flash bank and two sets of routines *_32 and *_16 to handle
36 * specifics of both flashes.
38 static unsigned long flash_addr_table[][CONFIG_SYS_MAX_FLASH_BANKS] = {
39 {CONFIG_SYS_BOOTCS_START, CONFIG_SYS_CS5_START | 1}
42 /*-----------------------------------------------------------------------
45 static int write_word(flash_info_t * info, ulong dest, ulong data);
46 #ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV
47 static int write_word_32(flash_info_t * info, ulong dest, ulong data);
48 static int write_word_16(flash_info_t * info, ulong dest, ulong data);
49 static int flash_erase_32(flash_info_t * info, int s_first, int s_last);
50 static int flash_erase_16(flash_info_t * info, int s_first, int s_last);
51 static ulong flash_get_size_32(vu_long * addr, flash_info_t * info);
52 static ulong flash_get_size_16(vu_long * addr, flash_info_t * info);
55 void flash_print_info(flash_info_t * info)
59 volatile unsigned long *flash;
61 if (info->flash_id == FLASH_UNKNOWN) {
62 printf("missing or unknown FLASH type\n");
66 switch (info->flash_id & FLASH_VENDMASK) {
74 printf("Unknown Vendor ");
78 switch (info->flash_id & FLASH_TYPEMASK) {
80 printf ("S29GL128N (256 Mbit, uniform sector size)\n");
83 printf ("29LV320B (32 Mbit, bottom boot sect)\n");
86 printf ("29LV320T (32 Mbit, top boot sect)\n");
89 printf("Unknown Chip Type\n");
93 printf(" Size: %ld KB in %d Sectors\n",
94 info->size >> 10, info->sector_count);
96 printf(" Sector Start Addresses:");
97 for (i = 0; i < info->sector_count; ++i) {
99 * Check if whole sector is erased
101 if (i != (info->sector_count - 1))
102 size = info->start[i + 1] - info->start[i];
104 size = info->start[0] + info->size - info->start[i];
107 flash = (volatile unsigned long *)info->start[i];
108 size = size >> 2; /* divide by 4 for longword access */
110 for (k = 0; k < size; k++) {
111 if (*flash++ != 0xffffffff) {
120 printf(" %08lX%s%s", info->start[i],
122 info->protect[i] ? "RO " : " ");
130 * The following code cannot be run from FLASH!
132 #ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV
133 static ulong flash_get_size(vu_long * addr, flash_info_t * info)
136 DEBUGF("get_size: FLASH ADDR %08lx\n", addr);
138 /* bit 0 used for big flash marking */
139 if ((ulong)addr & 0x1)
140 return flash_get_size_16((vu_long *)((ulong)addr & 0xfffffffe), info);
142 return flash_get_size_32(addr, info);
145 static ulong flash_get_size_32(vu_long * addr, flash_info_t * info)
147 static ulong flash_get_size(vu_long * addr, flash_info_t * info)
151 CONFIG_SYS_FLASH_WORD_SIZE value;
152 ulong base = (ulong) addr;
153 volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) addr;
155 DEBUGF("get_size32: FLASH ADDR: %08x\n", (unsigned)addr);
157 /* Write auto select command: read Manufacturer ID */
158 addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA;
159 addr2[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055;
160 addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00900090;
164 DEBUGF("FLASH MANUFACT: %x\n", value);
167 case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_MANUFACT:
168 info->flash_id = FLASH_MAN_AMD;
171 info->flash_id = FLASH_UNKNOWN;
172 info->sector_count = 0;
174 return (0); /* no or unknown flash */
177 value = addr2[1]; /* device ID */
178 DEBUGF("\nFLASH DEVICEID: %x\n", value);
182 DEBUGF("Mirror Bit flash: addr[14] = %08lX addr[15] = %08lX\n",
185 case AMD_ID_GL128N_2:
186 if (addr[15] != AMD_ID_GL128N_3) {
187 DEBUGF("Chip: S29GL128N -> unknown\n");
188 info->flash_id = FLASH_UNKNOWN;
190 DEBUGF("Chip: S29GL128N\n");
191 info->flash_id += FLASH_S29GL128N;
192 info->sector_count = 128;
193 info->size = 0x02000000;
197 info->flash_id = FLASH_UNKNOWN;
203 info->flash_id = FLASH_UNKNOWN;
204 return (0); /* => no or unknown flash */
207 /* set up sector start address table */
208 for (i = 0; i < info->sector_count; i++)
209 info->start[i] = base + (i * 0x00040000);
211 /* check for protected sectors */
212 for (i = 0; i < info->sector_count; i++) {
213 /* read sector protection at sector address, (A7 .. A0) = 0x02 */
214 /* D0 = 1 if protected */
215 addr2 = (volatile CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[i]);
217 info->protect[i] = addr2[2] & 1;
220 /* issue bank reset to return to read mode */
221 addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00F000F0;
226 static int wait_for_DQ7_32(flash_info_t * info, int sect)
228 ulong start, now, last;
229 volatile CONFIG_SYS_FLASH_WORD_SIZE *addr =
230 (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]);
232 start = get_timer(0);
234 while ((addr[0] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080) !=
235 (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080) {
236 if ((now = get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
240 /* show that we're waiting */
241 if ((now - last) > 1000) { /* every second */
249 #ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV
250 int flash_erase(flash_info_t * info, int s_first, int s_last)
252 if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320B) {
253 return flash_erase_16(info, s_first, s_last);
255 return flash_erase_32(info, s_first, s_last);
259 static int flash_erase_32(flash_info_t * info, int s_first, int s_last)
261 int flash_erase(flash_info_t * info, int s_first, int s_last)
264 volatile CONFIG_SYS_FLASH_WORD_SIZE *addr = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]);
265 volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2;
266 int flag, prot, sect;
268 if ((s_first < 0) || (s_first > s_last)) {
269 if (info->flash_id == FLASH_UNKNOWN)
270 printf("- missing\n");
272 printf("- no sectors to erase\n");
276 if (info->flash_id == FLASH_UNKNOWN) {
277 printf("Can't erase unknown flash type - aborted\n");
282 for (sect = s_first; sect <= s_last; ++sect) {
283 if (info->protect[sect])
288 printf("- Warning: %d protected sectors will not be erased!", prot);
292 /* Disable interrupts which might cause a timeout here */
293 flag = disable_interrupts();
295 /* Start erase on unprotected sectors */
296 for (sect = s_first; sect <= s_last; sect++) {
297 if (info->protect[sect] == 0) { /* not protected */
298 addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]);
300 addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA;
301 addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055;
302 addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080;
303 addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA;
304 addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055;
305 addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00300030; /* sector erase */
308 * Wait for each sector to complete, it's more
309 * reliable. According to AMD Spec, you must
310 * issue all erase commands within a specified
311 * timeout. This has been seen to fail, especially
312 * if printf()s are included (for debug)!!
314 wait_for_DQ7_32(info, sect);
318 /* re-enable interrupts if necessary */
322 /* wait at least 80us - let's wait 1 ms */
325 /* reset to read mode */
326 addr = (CONFIG_SYS_FLASH_WORD_SIZE *) info->start[0];
327 addr[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00F000F0; /* reset bank */
333 /*-----------------------------------------------------------------------
334 * Copy memory to flash, returns:
337 * 2 - Flash not erased
339 int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt)
344 wp = (addr & ~3); /* get lower word aligned address */
347 * handle unaligned start bytes
349 if ((l = addr - wp) != 0) {
351 for (i = 0, cp = wp; i < l; ++i, ++cp)
352 data = (data << 8) | (*(uchar *) cp);
354 for (; i < 4 && cnt > 0; ++i) {
355 data = (data << 8) | *src++;
360 for (; cnt == 0 && i < 4; ++i, ++cp)
361 data = (data << 8) | (*(uchar *) cp);
363 if ((rc = write_word(info, wp, data)) != 0)
370 * handle word aligned part
374 for (i = 0; i < 4; ++i)
375 data = (data << 8) | *src++;
377 if ((rc = write_word(info, wp, data)) != 0)
388 * handle unaligned tail bytes
391 for (i = 0, cp = wp; i < 4 && cnt > 0; ++i, ++cp) {
392 data = (data << 8) | *src++;
395 for (; i < 4; ++i, ++cp)
396 data = (data << 8) | (*(uchar *) cp);
398 return (write_word(info, wp, data));
401 /*-----------------------------------------------------------------------
402 * Copy memory to flash, returns:
405 * 2 - Flash not erased
407 #ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV
408 static int write_word(flash_info_t * info, ulong dest, ulong data)
410 if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320B) {
411 return write_word_16(info, dest, data);
413 return write_word_32(info, dest, data);
417 static int write_word_32(flash_info_t * info, ulong dest, ulong data)
419 static int write_word(flash_info_t * info, ulong dest, ulong data)
422 volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]);
423 volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *) dest;
424 ulong *datap = &data;
425 volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 =
426 (volatile CONFIG_SYS_FLASH_WORD_SIZE *)datap;
430 /* Check if Flash is (sufficiently) erased */
431 if ((*((vu_long *)dest) & data) != data)
434 for (i = 0; i < 4 / sizeof(CONFIG_SYS_FLASH_WORD_SIZE); i++) {
435 /* Disable interrupts which might cause a timeout here */
436 flag = disable_interrupts();
438 addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA;
439 addr2[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055;
440 addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00A000A0;
444 /* re-enable interrupts if necessary */
448 /* data polling for D7 */
449 start = get_timer(0);
450 while ((dest2[i] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080) !=
451 (data2[i] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080)) {
453 if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT)
461 #ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV
463 #undef CONFIG_SYS_FLASH_WORD_SIZE
464 #define CONFIG_SYS_FLASH_WORD_SIZE unsigned short
467 * The following code cannot be run from FLASH!
469 static ulong flash_get_size_16(vu_long * addr, flash_info_t * info)
472 CONFIG_SYS_FLASH_WORD_SIZE value;
473 ulong base = (ulong) addr;
474 volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) addr;
476 DEBUGF("get_size16: FLASH ADDR: %08x\n", (unsigned)addr);
478 /* issue bank reset to return to read mode */
479 addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xF000F000;
481 /* Write auto select command: read Manufacturer ID */
482 addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xAA00AA00;
483 addr2[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x55005500;
484 addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x90009000;
487 value = swap16(addr2[0]);
488 DEBUGF("FLASH MANUFACT: %x\n", value);
491 case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_MANUFACT:
492 info->flash_id = FLASH_MAN_AMD;
494 case (CONFIG_SYS_FLASH_WORD_SIZE) FUJ_MANUFACT:
495 info->flash_id = FLASH_MAN_FUJ;
498 info->flash_id = FLASH_UNKNOWN;
499 info->sector_count = 0;
501 return (0); /* no or unknown flash */
504 value = swap16(addr2[1]); /* device ID */
505 DEBUGF("\nFLASH DEVICEID: %x\n", value);
508 case (CONFIG_SYS_FLASH_WORD_SIZE)AMD_ID_LV320B:
509 info->flash_id += FLASH_AM320B;
510 info->sector_count = 71;
511 info->size = 0x00400000;
513 case (CONFIG_SYS_FLASH_WORD_SIZE)AMD_ID_LV320T:
514 info->flash_id += FLASH_AM320T;
515 info->sector_count = 71;
516 info->size = 0x00400000;
519 info->flash_id = FLASH_UNKNOWN;
520 return (0); /* => no or unknown flash */
523 if (info->flash_id & FLASH_BTYPE) {
524 /* set sector offsets for bottom boot block type */
525 info->start[0] = base + 0x00000000;
526 info->start[1] = base + 0x00002000;
527 info->start[2] = base + 0x00004000;
528 info->start[3] = base + 0x00006000;
529 info->start[4] = base + 0x00008000;
530 info->start[5] = base + 0x0000a000;
531 info->start[6] = base + 0x0000c000;
532 info->start[7] = base + 0x0000e000;
534 for (i = 8; i < info->sector_count; i++)
535 info->start[i] = base + (i * 0x00010000) - 0x00070000;
537 /* set sector offsets for top boot block type */
538 i = info->sector_count - 1;
539 info->start[i--] = base + info->size - 0x00002000;
540 info->start[i--] = base + info->size - 0x00004000;
541 info->start[i--] = base + info->size - 0x00006000;
542 info->start[i--] = base + info->size - 0x00008000;
543 info->start[i--] = base + info->size - 0x0000a000;
544 info->start[i--] = base + info->size - 0x0000c000;
545 info->start[i--] = base + info->size - 0x0000e000;
548 info->start[i] = base + i * 0x00010000;
551 /* check for protected sectors */
552 for (i = 0; i < info->sector_count; i++) {
553 /* read sector protection at sector address, (A7 .. A0) = 0x02 */
554 /* D0 = 1 if protected */
555 addr2 = (volatile CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[i]);
557 info->protect[i] = addr2[2] & 1;
560 /* issue bank reset to return to read mode */
561 addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xF000F000;
566 static int wait_for_DQ7_16(flash_info_t * info, int sect)
568 ulong start, now, last;
569 volatile CONFIG_SYS_FLASH_WORD_SIZE *addr =
570 (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]);
572 start = get_timer(0);
574 while ((addr[0] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x80008000) !=
575 (CONFIG_SYS_FLASH_WORD_SIZE) 0x80008000) {
576 if ((now = get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
580 /* show that we're waiting */
581 if ((now - last) > 1000) { /* every second */
589 static int flash_erase_16(flash_info_t * info, int s_first, int s_last)
591 volatile CONFIG_SYS_FLASH_WORD_SIZE *addr = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]);
592 volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2;
593 int flag, prot, sect;
595 if ((s_first < 0) || (s_first > s_last)) {
596 if (info->flash_id == FLASH_UNKNOWN)
597 printf("- missing\n");
599 printf("- no sectors to erase\n");
603 if (info->flash_id == FLASH_UNKNOWN) {
604 printf("Can't erase unknown flash type - aborted\n");
609 for (sect = s_first; sect <= s_last; ++sect) {
610 if (info->protect[sect])
615 printf("- Warning: %d protected sectors will not be erased!", prot);
619 /* Disable interrupts which might cause a timeout here */
620 flag = disable_interrupts();
622 /* Start erase on unprotected sectors */
623 for (sect = s_first; sect <= s_last; sect++) {
624 if (info->protect[sect] == 0) { /* not protected */
625 addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]);
627 addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xAA00AA00;
628 addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x55005500;
629 addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x80008000;
630 addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xAA00AA00;
631 addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x55005500;
632 addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x30003000; /* sector erase */
635 * Wait for each sector to complete, it's more
636 * reliable. According to AMD Spec, you must
637 * issue all erase commands within a specified
638 * timeout. This has been seen to fail, especially
639 * if printf()s are included (for debug)!!
641 wait_for_DQ7_16(info, sect);
645 /* re-enable interrupts if necessary */
649 /* wait at least 80us - let's wait 1 ms */
652 /* reset to read mode */
653 addr = (CONFIG_SYS_FLASH_WORD_SIZE *) info->start[0];
654 addr[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xF000F000; /* reset bank */
660 static int write_word_16(flash_info_t * info, ulong dest, ulong data)
662 volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]);
663 volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *) dest;
664 ulong *datap = &data;
665 volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 =
666 (volatile CONFIG_SYS_FLASH_WORD_SIZE *)datap;
670 /* Check if Flash is (sufficiently) erased */
671 for (i = 0; i < 4 / sizeof(CONFIG_SYS_FLASH_WORD_SIZE); i++) {
672 if ((dest2[i] & swap16(data2[i])) != swap16(data2[i]))
676 for (i = 0; i < 4 / sizeof(CONFIG_SYS_FLASH_WORD_SIZE); i++) {
679 /* Disable interrupts which might cause a timeout here */
680 flag = disable_interrupts();
682 addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xAA00AA00;
683 addr2[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x55005500;
684 addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xA000A000;
686 dest2[i] = swap16(data2[i]);
688 /* re-enable interrupts if necessary */
692 /* data polling for D7 */
693 start = get_timer(0);
694 while ((dest2[i] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x80008000) !=
695 (swap16(data2[i]) & (CONFIG_SYS_FLASH_WORD_SIZE) 0x80008000)) {
697 if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
705 #endif /* CONFIG_SYS_FLASH_2ND_16BIT_DEV */
707 /*-----------------------------------------------------------------------
710 static ulong flash_get_size(vu_long * addr, flash_info_t * info);
711 static int write_word(flash_info_t * info, ulong dest, ulong data);
713 /*-----------------------------------------------------------------------
716 unsigned long flash_init(void)
718 unsigned long total_b = 0;
719 unsigned long size_b[CONFIG_SYS_MAX_FLASH_BANKS];
720 unsigned short index = 0;
724 DEBUGF("FLASH: Index: %d\n", index);
726 /* Init: no FLASHes known */
727 for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; ++i) {
728 flash_info[i].flash_id = FLASH_UNKNOWN;
729 flash_info[i].sector_count = -1;
730 flash_info[i].size = 0;
732 /* check whether the address is 0 */
733 if (flash_addr_table[index][i] == 0)
736 /* call flash_get_size() to initialize sector address */
737 size_b[i] = flash_get_size((vu_long *) flash_addr_table[index][i],
740 flash_info[i].size = size_b[i];
742 if (flash_info[i].flash_id == FLASH_UNKNOWN) {
743 printf("## Unknown FLASH on Bank %d - Size = 0x%08lx = %ld MB\n",
744 i+1, size_b[i], size_b[i] << 20);
745 flash_info[i].sector_count = -1;
746 flash_info[i].size = 0;
749 /* Monitor protection ON by default */
750 (void)flash_protect(FLAG_PROTECT_SET, CONFIG_SYS_MONITOR_BASE,
751 CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN - 1,
753 #if defined(CONFIG_ENV_IS_IN_FLASH)
754 (void)flash_protect(FLAG_PROTECT_SET, CONFIG_ENV_ADDR,
755 CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1,
757 #if defined(CONFIG_ENV_ADDR_REDUND)
758 (void)flash_protect(FLAG_PROTECT_SET, CONFIG_ENV_ADDR_REDUND,
759 CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1,
763 total_b += flash_info[i].size;
768 #endif /* if defined(CONFIG_CAM5200) && defined(CONFIG_CAM5200_NIOSFLASH) */