Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2004-2005 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
| 5 | * (C) Copyright 2002 Jun Gu <jung@artesyncp.com> |
| 6 | * Add support for Am29F016D and dynamic switch setting. |
| 7 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame^] | 8 | * SPDX-License-Identifier: GPL-2.0+ |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | /* |
| 12 | * Modified 4/5/2001 |
| 13 | * Wait for completion of each sector erase command issued |
| 14 | * 4/5/2001 |
| 15 | * Chris Hallinan - DS4.COM, Inc. - clh@net1plus.com |
| 16 | */ |
| 17 | |
| 18 | #include <common.h> |
Stefan Roese | b36df56 | 2010-09-09 19:18:00 +0200 | [diff] [blame] | 19 | #include <asm/ppc4xx.h> |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 20 | #include <asm/processor.h> |
| 21 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 22 | flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */ |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 23 | |
| 24 | /*----------------------------------------------------------------------- |
| 25 | * Functions |
| 26 | */ |
| 27 | static int write_word(flash_info_t * info, ulong dest, ulong data); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 28 | #ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 29 | static int write_word_1(flash_info_t * info, ulong dest, ulong data); |
| 30 | static int write_word_2(flash_info_t * info, ulong dest, ulong data); |
| 31 | static int flash_erase_1(flash_info_t * info, int s_first, int s_last); |
| 32 | static int flash_erase_2(flash_info_t * info, int s_first, int s_last); |
| 33 | static ulong flash_get_size_1(vu_long * addr, flash_info_t * info); |
| 34 | static ulong flash_get_size_2(vu_long * addr, flash_info_t * info); |
| 35 | #endif |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 36 | |
| 37 | void flash_print_info(flash_info_t * info) |
| 38 | { |
| 39 | int i; |
| 40 | int k; |
| 41 | int size; |
| 42 | int erased; |
| 43 | volatile unsigned long *flash; |
| 44 | |
| 45 | if (info->flash_id == FLASH_UNKNOWN) { |
| 46 | printf("missing or unknown FLASH type\n"); |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | switch (info->flash_id & FLASH_VENDMASK) { |
| 51 | case FLASH_MAN_AMD: |
| 52 | printf("AMD "); |
| 53 | break; |
| 54 | case FLASH_MAN_STM: |
| 55 | printf("STM "); |
| 56 | break; |
| 57 | case FLASH_MAN_FUJ: |
| 58 | printf("FUJITSU "); |
| 59 | break; |
| 60 | case FLASH_MAN_SST: |
| 61 | printf("SST "); |
| 62 | break; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 63 | case FLASH_MAN_MX: |
Stefan Roese | 9ede3cc | 2006-08-07 14:31:21 +0200 | [diff] [blame] | 64 | printf ("MACRONIX "); |
| 65 | break; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 66 | default: |
| 67 | printf("Unknown Vendor "); |
| 68 | break; |
| 69 | } |
| 70 | |
| 71 | switch (info->flash_id & FLASH_TYPEMASK) { |
| 72 | case FLASH_AM040: |
| 73 | printf("AM29F040 (512 Kbit, uniform sector size)\n"); |
| 74 | break; |
| 75 | case FLASH_AM400B: |
| 76 | printf("AM29LV400B (4 Mbit, bottom boot sect)\n"); |
| 77 | break; |
| 78 | case FLASH_AM400T: |
| 79 | printf("AM29LV400T (4 Mbit, top boot sector)\n"); |
| 80 | break; |
| 81 | case FLASH_AM800B: |
| 82 | printf("AM29LV800B (8 Mbit, bottom boot sect)\n"); |
| 83 | break; |
| 84 | case FLASH_AM800T: |
| 85 | printf("AM29LV800T (8 Mbit, top boot sector)\n"); |
| 86 | break; |
| 87 | case FLASH_AMD016: |
| 88 | printf("AM29F016D (16 Mbit, uniform sector size)\n"); |
| 89 | break; |
| 90 | case FLASH_AM160B: |
| 91 | printf("AM29LV160B (16 Mbit, bottom boot sect)\n"); |
| 92 | break; |
| 93 | case FLASH_AM160T: |
| 94 | printf("AM29LV160T (16 Mbit, top boot sector)\n"); |
| 95 | break; |
| 96 | case FLASH_AM320B: |
| 97 | printf("AM29LV320B (32 Mbit, bottom boot sect)\n"); |
| 98 | break; |
| 99 | case FLASH_AM320T: |
| 100 | printf("AM29LV320T (32 Mbit, top boot sector)\n"); |
| 101 | break; |
| 102 | case FLASH_AM033C: |
| 103 | printf("AM29LV033C (32 Mbit, top boot sector)\n"); |
| 104 | break; |
| 105 | case FLASH_SST800A: |
| 106 | printf("SST39LF/VF800 (8 Mbit, uniform sector size)\n"); |
| 107 | break; |
| 108 | case FLASH_SST160A: |
| 109 | printf("SST39LF/VF160 (16 Mbit, uniform sector size)\n"); |
| 110 | break; |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 111 | case FLASH_STMW320DT: |
| 112 | printf ("M29W320DT (32 M, top sector)\n"); |
| 113 | break; |
Stefan Roese | 9ede3cc | 2006-08-07 14:31:21 +0200 | [diff] [blame] | 114 | case FLASH_MXLV320T: |
| 115 | printf ("MXLV320T (32 Mbit, top sector)\n"); |
| 116 | break; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 117 | default: |
| 118 | printf("Unknown Chip Type\n"); |
| 119 | break; |
| 120 | } |
| 121 | |
| 122 | printf(" Size: %ld KB in %d Sectors\n", |
| 123 | info->size >> 10, info->sector_count); |
| 124 | |
| 125 | printf(" Sector Start Addresses:"); |
| 126 | for (i = 0; i < info->sector_count; ++i) { |
| 127 | /* |
| 128 | * Check if whole sector is erased |
| 129 | */ |
| 130 | if (i != (info->sector_count - 1)) |
| 131 | size = info->start[i + 1] - info->start[i]; |
| 132 | else |
| 133 | size = info->start[0] + info->size - info->start[i]; |
| 134 | erased = 1; |
| 135 | flash = (volatile unsigned long *)info->start[i]; |
| 136 | size = size >> 2; /* divide by 4 for longword access */ |
| 137 | for (k = 0; k < size; k++) { |
| 138 | if (*flash++ != 0xffffffff) { |
| 139 | erased = 0; |
| 140 | break; |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | if ((i % 5) == 0) |
| 145 | printf("\n "); |
| 146 | printf(" %08lX%s%s", |
| 147 | info->start[i], |
| 148 | erased ? " E" : " ", info->protect[i] ? "RO " : " "); |
| 149 | } |
| 150 | printf("\n"); |
| 151 | return; |
| 152 | } |
| 153 | |
| 154 | |
| 155 | /* |
| 156 | * The following code cannot be run from FLASH! |
| 157 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 158 | #ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 159 | static ulong flash_get_size(vu_long * addr, flash_info_t * info) |
| 160 | { |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 161 | /* bit 0 used for big flash marking */ |
| 162 | if ((ulong)addr & 0x1) { |
| 163 | return flash_get_size_2((vu_long *)((ulong)addr & 0xfffffffe), info); |
| 164 | } else { |
| 165 | return flash_get_size_1(addr, info); |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | static ulong flash_get_size_1(vu_long * addr, flash_info_t * info) |
| 170 | #else |
| 171 | static ulong flash_get_size(vu_long * addr, flash_info_t * info) |
| 172 | #endif |
| 173 | { |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 174 | short i; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 175 | CONFIG_SYS_FLASH_WORD_SIZE value; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 176 | ulong base = (ulong) addr; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 177 | volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) addr; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 178 | |
| 179 | DEBUGF("FLASH ADDR: %08x\n", (unsigned)addr); |
| 180 | |
| 181 | /* Write auto select command: read Manufacturer ID */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 182 | addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA; |
| 183 | addr2[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055; |
| 184 | addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00900090; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 185 | udelay(1000); |
| 186 | |
| 187 | value = addr2[0]; |
| 188 | DEBUGF("FLASH MANUFACT: %x\n", value); |
| 189 | |
| 190 | switch (value) { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 191 | case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_MANUFACT: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 192 | info->flash_id = FLASH_MAN_AMD; |
| 193 | break; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 194 | case (CONFIG_SYS_FLASH_WORD_SIZE) FUJ_MANUFACT: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 195 | info->flash_id = FLASH_MAN_FUJ; |
| 196 | break; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 197 | case (CONFIG_SYS_FLASH_WORD_SIZE) SST_MANUFACT: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 198 | info->flash_id = FLASH_MAN_SST; |
| 199 | break; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 200 | case (CONFIG_SYS_FLASH_WORD_SIZE) STM_MANUFACT: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 201 | info->flash_id = FLASH_MAN_STM; |
| 202 | break; |
| 203 | default: |
| 204 | info->flash_id = FLASH_UNKNOWN; |
| 205 | info->sector_count = 0; |
| 206 | info->size = 0; |
| 207 | return (0); /* no or unknown flash */ |
| 208 | } |
| 209 | |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 210 | value = addr2[1]; /* device ID */ |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 211 | DEBUGF("\nFLASH DEVICEID: %x\n", value); |
| 212 | |
| 213 | switch (value) { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 214 | case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_ID_LV040B: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 215 | info->flash_id += FLASH_AM040; |
| 216 | info->sector_count = 8; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 217 | info->size = 0x0080000; /* => 512 KiB */ |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 218 | break; |
| 219 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 220 | case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_ID_F040B: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 221 | info->flash_id += FLASH_AM040; |
| 222 | info->sector_count = 8; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 223 | info->size = 0x0080000; /* => 512 KiB */ |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 224 | break; |
| 225 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 226 | case (CONFIG_SYS_FLASH_WORD_SIZE) STM_ID_M29W040B: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 227 | info->flash_id += FLASH_AM040; |
| 228 | info->sector_count = 8; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 229 | info->size = 0x0080000; /* => 512 KiB */ |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 230 | break; |
| 231 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 232 | case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_ID_F016D: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 233 | info->flash_id += FLASH_AMD016; |
| 234 | info->sector_count = 32; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 235 | info->size = 0x00200000; /* => 2 MiB */ |
| 236 | break; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 237 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 238 | case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_ID_LV033C: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 239 | info->flash_id += FLASH_AMDLV033C; |
| 240 | info->sector_count = 64; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 241 | info->size = 0x00400000; /* => 4 MiB */ |
| 242 | break; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 243 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 244 | case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_ID_LV400T: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 245 | info->flash_id += FLASH_AM400T; |
| 246 | info->sector_count = 11; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 247 | info->size = 0x00080000; /* => 512 KiB */ |
| 248 | break; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 249 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 250 | case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_ID_LV400B: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 251 | info->flash_id += FLASH_AM400B; |
| 252 | info->sector_count = 11; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 253 | info->size = 0x00080000; /* => 512 KiB */ |
| 254 | break; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 255 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 256 | case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_ID_LV800T: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 257 | info->flash_id += FLASH_AM800T; |
| 258 | info->sector_count = 19; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 259 | info->size = 0x00100000; /* => 1 MiB */ |
| 260 | break; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 261 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 262 | case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_ID_LV800B: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 263 | info->flash_id += FLASH_AM800B; |
| 264 | info->sector_count = 19; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 265 | info->size = 0x00100000; /* => 1 MiB */ |
| 266 | break; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 267 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 268 | case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_ID_LV160T: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 269 | info->flash_id += FLASH_AM160T; |
| 270 | info->sector_count = 35; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 271 | info->size = 0x00200000; /* => 2 MiB */ |
| 272 | break; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 273 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 274 | case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_ID_LV160B: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 275 | info->flash_id += FLASH_AM160B; |
| 276 | info->sector_count = 35; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 277 | info->size = 0x00200000; /* => 2 MiB */ |
| 278 | break; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 279 | |
| 280 | default: |
| 281 | info->flash_id = FLASH_UNKNOWN; |
| 282 | return (0); /* => no or unknown flash */ |
| 283 | } |
| 284 | |
| 285 | /* set up sector start address table */ |
| 286 | if (((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) || |
| 287 | ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM040) || |
| 288 | ((info->flash_id & FLASH_TYPEMASK) == FLASH_AMD016)) { |
| 289 | for (i = 0; i < info->sector_count; i++) |
| 290 | info->start[i] = base + (i * 0x00010000); |
| 291 | } else { |
| 292 | if (info->flash_id & FLASH_BTYPE) { |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 293 | /* set sector offsets for bottom boot block type */ |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 294 | info->start[0] = base + 0x00000000; |
| 295 | info->start[1] = base + 0x00004000; |
| 296 | info->start[2] = base + 0x00006000; |
| 297 | info->start[3] = base + 0x00008000; |
| 298 | for (i = 4; i < info->sector_count; i++) { |
| 299 | info->start[i] = |
| 300 | base + (i * 0x00010000) - 0x00030000; |
| 301 | } |
| 302 | } else { |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 303 | /* set sector offsets for top boot block type */ |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 304 | i = info->sector_count - 1; |
| 305 | info->start[i--] = base + info->size - 0x00004000; |
| 306 | info->start[i--] = base + info->size - 0x00006000; |
| 307 | info->start[i--] = base + info->size - 0x00008000; |
| 308 | for (; i >= 0; i--) { |
| 309 | info->start[i] = base + i * 0x00010000; |
| 310 | } |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | /* check for protected sectors */ |
| 315 | for (i = 0; i < info->sector_count; i++) { |
| 316 | /* read sector protection at sector address, (A7 .. A0) = 0x02 */ |
| 317 | /* D0 = 1 if protected */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 318 | addr2 = (volatile CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[i]); |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 319 | |
| 320 | /* For AMD29033C flash we need to resend the command of * |
| 321 | * reading flash protection for upper 8 Mb of flash */ |
| 322 | if (i == 32) { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 323 | addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xAAAAAAAA; |
| 324 | addr2[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x55555555; |
| 325 | addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x90909090; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 326 | } |
| 327 | |
| 328 | if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) |
| 329 | info->protect[i] = 0; |
| 330 | else |
| 331 | info->protect[i] = addr2[2] & 1; |
| 332 | } |
| 333 | |
| 334 | /* issue bank reset to return to read mode */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 335 | addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00F000F0; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 336 | |
| 337 | return (info->size); |
| 338 | } |
| 339 | |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 340 | static int wait_for_DQ7_1(flash_info_t * info, int sect) |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 341 | { |
| 342 | ulong start, now, last; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 343 | volatile CONFIG_SYS_FLASH_WORD_SIZE *addr = |
| 344 | (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]); |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 345 | |
| 346 | start = get_timer(0); |
| 347 | last = start; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 348 | while ((addr[0] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080) != |
| 349 | (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080) { |
| 350 | if ((now = get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) { |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 351 | printf("Timeout\n"); |
| 352 | return -1; |
| 353 | } |
| 354 | /* show that we're waiting */ |
| 355 | if ((now - last) > 1000) { /* every second */ |
| 356 | putc('.'); |
| 357 | last = now; |
| 358 | } |
| 359 | } |
| 360 | return 0; |
| 361 | } |
| 362 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 363 | #ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 364 | int flash_erase(flash_info_t * info, int s_first, int s_last) |
| 365 | { |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 366 | if (((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320B) || |
| 367 | ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320T) || |
Stefan Roese | 9ede3cc | 2006-08-07 14:31:21 +0200 | [diff] [blame] | 368 | ((info->flash_id & FLASH_TYPEMASK) == FLASH_MXLV320T) || |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 369 | ((info->flash_id & FLASH_TYPEMASK) == FLASH_STMW320DT)) { |
| 370 | return flash_erase_2(info, s_first, s_last); |
| 371 | } else { |
| 372 | return flash_erase_1(info, s_first, s_last); |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | static int flash_erase_1(flash_info_t * info, int s_first, int s_last) |
| 377 | #else |
| 378 | int flash_erase(flash_info_t * info, int s_first, int s_last) |
| 379 | #endif |
| 380 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 381 | volatile CONFIG_SYS_FLASH_WORD_SIZE *addr = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]); |
| 382 | volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2; |
Wolfgang Denk | 9879d57 | 2011-11-17 09:49:59 +0000 | [diff] [blame] | 383 | int flag, prot, sect; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 384 | int i; |
| 385 | |
| 386 | if ((s_first < 0) || (s_first > s_last)) { |
| 387 | if (info->flash_id == FLASH_UNKNOWN) { |
| 388 | printf("- missing\n"); |
| 389 | } else { |
| 390 | printf("- no sectors to erase\n"); |
| 391 | } |
| 392 | return 1; |
| 393 | } |
| 394 | |
| 395 | if (info->flash_id == FLASH_UNKNOWN) { |
| 396 | printf("Can't erase unknown flash type - aborted\n"); |
| 397 | return 1; |
| 398 | } |
| 399 | |
| 400 | prot = 0; |
| 401 | for (sect = s_first; sect <= s_last; ++sect) { |
| 402 | if (info->protect[sect]) { |
| 403 | prot++; |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | if (prot) { |
| 408 | printf("- Warning: %d protected sectors will not be erased!\n", |
| 409 | prot); |
| 410 | } else { |
| 411 | printf("\n"); |
| 412 | } |
| 413 | |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 414 | /* Disable interrupts which might cause a timeout here */ |
| 415 | flag = disable_interrupts(); |
| 416 | |
| 417 | /* Start erase on unprotected sectors */ |
| 418 | for (sect = s_first; sect <= s_last; sect++) { |
| 419 | if (info->protect[sect] == 0) { /* not protected */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 420 | addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]); |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 421 | |
| 422 | if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 423 | addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA; |
| 424 | addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055; |
| 425 | addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080; |
| 426 | addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA; |
| 427 | addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055; |
| 428 | addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00500050; /* block erase */ |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 429 | for (i = 0; i < 50; i++) |
| 430 | udelay(1000); /* wait 1 ms */ |
| 431 | } else { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 432 | addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA; |
| 433 | addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055; |
| 434 | addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080; |
| 435 | addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA; |
| 436 | addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055; |
| 437 | addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00300030; /* sector erase */ |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 438 | } |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 439 | /* |
| 440 | * Wait for each sector to complete, it's more |
| 441 | * reliable. According to AMD Spec, you must |
| 442 | * issue all erase commands within a specified |
| 443 | * timeout. This has been seen to fail, especially |
| 444 | * if printf()s are included (for debug)!! |
| 445 | */ |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 446 | wait_for_DQ7_1(info, sect); |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 447 | } |
| 448 | } |
| 449 | |
| 450 | /* re-enable interrupts if necessary */ |
| 451 | if (flag) |
| 452 | enable_interrupts(); |
| 453 | |
| 454 | /* wait at least 80us - let's wait 1 ms */ |
| 455 | udelay(1000); |
| 456 | |
| 457 | /* reset to read mode */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 458 | addr = (CONFIG_SYS_FLASH_WORD_SIZE *) info->start[0]; |
| 459 | addr[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00F000F0; /* reset bank */ |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 460 | |
| 461 | printf(" done\n"); |
| 462 | return 0; |
| 463 | } |
| 464 | |
| 465 | /*----------------------------------------------------------------------- |
| 466 | * Copy memory to flash, returns: |
| 467 | * 0 - OK |
| 468 | * 1 - write timeout |
| 469 | * 2 - Flash not erased |
| 470 | */ |
| 471 | int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt) |
| 472 | { |
| 473 | ulong cp, wp, data; |
| 474 | int i, l, rc; |
| 475 | |
| 476 | wp = (addr & ~3); /* get lower word aligned address */ |
| 477 | |
| 478 | /* |
| 479 | * handle unaligned start bytes |
| 480 | */ |
| 481 | if ((l = addr - wp) != 0) { |
| 482 | data = 0; |
| 483 | for (i = 0, cp = wp; i < l; ++i, ++cp) { |
| 484 | data = (data << 8) | (*(uchar *) cp); |
| 485 | } |
| 486 | for (; i < 4 && cnt > 0; ++i) { |
| 487 | data = (data << 8) | *src++; |
| 488 | --cnt; |
| 489 | ++cp; |
| 490 | } |
| 491 | for (; cnt == 0 && i < 4; ++i, ++cp) { |
| 492 | data = (data << 8) | (*(uchar *) cp); |
| 493 | } |
| 494 | |
| 495 | if ((rc = write_word(info, wp, data)) != 0) { |
| 496 | return (rc); |
| 497 | } |
| 498 | wp += 4; |
| 499 | } |
| 500 | |
| 501 | /* |
| 502 | * handle word aligned part |
| 503 | */ |
| 504 | while (cnt >= 4) { |
| 505 | data = 0; |
| 506 | for (i = 0; i < 4; ++i) { |
| 507 | data = (data << 8) | *src++; |
| 508 | } |
| 509 | if ((rc = write_word(info, wp, data)) != 0) { |
| 510 | return (rc); |
| 511 | } |
| 512 | wp += 4; |
| 513 | cnt -= 4; |
| 514 | } |
| 515 | |
| 516 | if (cnt == 0) { |
| 517 | return (0); |
| 518 | } |
| 519 | |
| 520 | /* |
| 521 | * handle unaligned tail bytes |
| 522 | */ |
| 523 | data = 0; |
| 524 | for (i = 0, cp = wp; i < 4 && cnt > 0; ++i, ++cp) { |
| 525 | data = (data << 8) | *src++; |
| 526 | --cnt; |
| 527 | } |
| 528 | for (; i < 4; ++i, ++cp) { |
| 529 | data = (data << 8) | (*(uchar *) cp); |
| 530 | } |
| 531 | |
| 532 | return (write_word(info, wp, data)); |
| 533 | } |
| 534 | |
| 535 | /*----------------------------------------------------------------------- |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 536 | * Copy memory to flash, returns: |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 537 | * 0 - OK |
| 538 | * 1 - write timeout |
| 539 | * 2 - Flash not erased |
| 540 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 541 | #ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 542 | static int write_word(flash_info_t * info, ulong dest, ulong data) |
| 543 | { |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 544 | if (((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320B) || |
| 545 | ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320T) || |
Stefan Roese | 9ede3cc | 2006-08-07 14:31:21 +0200 | [diff] [blame] | 546 | ((info->flash_id & FLASH_TYPEMASK) == FLASH_MXLV320T) || |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 547 | ((info->flash_id & FLASH_TYPEMASK) == FLASH_STMW320DT)) { |
| 548 | return write_word_2(info, dest, data); |
| 549 | } else { |
| 550 | return write_word_1(info, dest, data); |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | static int write_word_1(flash_info_t * info, ulong dest, ulong data) |
| 555 | #else |
| 556 | static int write_word(flash_info_t * info, ulong dest, ulong data) |
| 557 | #endif |
| 558 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 559 | volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]); |
| 560 | volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *) dest; |
| 561 | volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *) & data; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 562 | ulong start; |
| 563 | int i; |
| 564 | |
| 565 | /* Check if Flash is (sufficiently) erased */ |
| 566 | if ((*((vu_long *)dest) & data) != data) { |
| 567 | return (2); |
| 568 | } |
| 569 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 570 | for (i = 0; i < 4 / sizeof(CONFIG_SYS_FLASH_WORD_SIZE); i++) { |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 571 | int flag; |
| 572 | |
| 573 | /* Disable interrupts which might cause a timeout here */ |
| 574 | flag = disable_interrupts(); |
| 575 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 576 | addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA; |
| 577 | addr2[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055; |
| 578 | addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00A000A0; |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 579 | |
| 580 | dest2[i] = data2[i]; |
| 581 | |
| 582 | /* re-enable interrupts if necessary */ |
| 583 | if (flag) |
| 584 | enable_interrupts(); |
| 585 | |
| 586 | /* data polling for D7 */ |
| 587 | start = get_timer(0); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 588 | while ((dest2[i] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080) != |
| 589 | (data2[i] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080)) { |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 590 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 591 | if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) { |
Stefan Roese | 8a316c9 | 2005-08-01 16:49:12 +0200 | [diff] [blame] | 592 | return (1); |
| 593 | } |
| 594 | } |
| 595 | } |
| 596 | |
| 597 | return (0); |
| 598 | } |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 599 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 600 | #ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 601 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 602 | #undef CONFIG_SYS_FLASH_WORD_SIZE |
| 603 | #define CONFIG_SYS_FLASH_WORD_SIZE unsigned short |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 604 | |
| 605 | /* |
| 606 | * The following code cannot be run from FLASH! |
| 607 | */ |
| 608 | static ulong flash_get_size_2(vu_long * addr, flash_info_t * info) |
| 609 | { |
| 610 | short i; |
| 611 | int n; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 612 | CONFIG_SYS_FLASH_WORD_SIZE value; |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 613 | ulong base = (ulong) addr; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 614 | volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) addr; |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 615 | |
| 616 | DEBUGF("FLASH ADDR: %08x\n", (unsigned)addr); |
| 617 | |
| 618 | /* Write auto select command: read Manufacturer ID */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 619 | addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA; |
| 620 | addr2[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055; |
| 621 | addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00900090; |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 622 | udelay(1000); |
| 623 | |
| 624 | value = addr2[0]; |
| 625 | DEBUGF("FLASH MANUFACT: %x\n", value); |
| 626 | |
| 627 | switch (value) { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 628 | case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_MANUFACT: |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 629 | info->flash_id = FLASH_MAN_AMD; |
| 630 | break; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 631 | case (CONFIG_SYS_FLASH_WORD_SIZE) FUJ_MANUFACT: |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 632 | info->flash_id = FLASH_MAN_FUJ; |
| 633 | break; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 634 | case (CONFIG_SYS_FLASH_WORD_SIZE) SST_MANUFACT: |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 635 | info->flash_id = FLASH_MAN_SST; |
| 636 | break; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 637 | case (CONFIG_SYS_FLASH_WORD_SIZE) STM_MANUFACT: |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 638 | info->flash_id = FLASH_MAN_STM; |
| 639 | break; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 640 | case (CONFIG_SYS_FLASH_WORD_SIZE) MX_MANUFACT: |
Stefan Roese | 9ede3cc | 2006-08-07 14:31:21 +0200 | [diff] [blame] | 641 | info->flash_id = FLASH_MAN_MX; |
| 642 | break; |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 643 | default: |
| 644 | info->flash_id = FLASH_UNKNOWN; |
| 645 | info->sector_count = 0; |
| 646 | info->size = 0; |
| 647 | return (0); /* no or unknown flash */ |
| 648 | } |
| 649 | |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 650 | value = addr2[1]; /* device ID */ |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 651 | |
| 652 | DEBUGF("\nFLASH DEVICEID: %x\n", value); |
| 653 | |
| 654 | switch (value) { |
| 655 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 656 | case (CONFIG_SYS_FLASH_WORD_SIZE)AMD_ID_LV320T: |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 657 | info->flash_id += FLASH_AM320T; |
| 658 | info->sector_count = 71; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 659 | info->size = 0x00400000; break; /* => 4 MiB */ |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 660 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 661 | case (CONFIG_SYS_FLASH_WORD_SIZE)AMD_ID_LV320B: |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 662 | info->flash_id += FLASH_AM320B; |
| 663 | info->sector_count = 71; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 664 | info->size = 0x00400000; break; /* => 4 MiB */ |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 665 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 666 | case (CONFIG_SYS_FLASH_WORD_SIZE)STM_ID_29W320DT: |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 667 | info->flash_id += FLASH_STMW320DT; |
| 668 | info->sector_count = 67; |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 669 | info->size = 0x00400000; break; /* => 4 MiB */ |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 670 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 671 | case (CONFIG_SYS_FLASH_WORD_SIZE)MX_ID_LV320T: |
Stefan Roese | 9ede3cc | 2006-08-07 14:31:21 +0200 | [diff] [blame] | 672 | info->flash_id += FLASH_MXLV320T; |
| 673 | info->sector_count = 71; |
| 674 | info->size = 0x00400000; |
| 675 | break; /* => 4 MB */ |
| 676 | |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 677 | default: |
| 678 | info->flash_id = FLASH_UNKNOWN; |
| 679 | return (0); /* => no or unknown flash */ |
| 680 | } |
| 681 | |
| 682 | /* set up sector start address table */ |
| 683 | if (((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) || |
| 684 | ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM040) || |
| 685 | ((info->flash_id & FLASH_TYPEMASK) == FLASH_AMD016)) { |
| 686 | for (i = 0; i < info->sector_count; i++) |
| 687 | info->start[i] = base + (i * 0x00010000); |
| 688 | } else if ((info->flash_id & FLASH_TYPEMASK) == FLASH_STMW320DT) { |
| 689 | /* set sector offsets for top boot block type */ |
| 690 | base += info->size; |
| 691 | i = info->sector_count; |
| 692 | /* 1 x 16k boot sector */ |
| 693 | base -= 16 << 10; |
| 694 | --i; |
| 695 | info->start[i] = base; |
| 696 | /* 2 x 8k boot sectors */ |
| 697 | for (n=0; n<2; ++n) { |
| 698 | base -= 8 << 10; |
| 699 | --i; |
| 700 | info->start[i] = base; |
| 701 | } |
| 702 | /* 1 x 32k boot sector */ |
| 703 | base -= 32 << 10; |
| 704 | --i; |
| 705 | info->start[i] = base; |
| 706 | |
| 707 | while (i > 0) { /* 64k regular sectors */ |
| 708 | base -= 64 << 10; |
| 709 | --i; |
| 710 | info->start[i] = base; |
| 711 | } |
Stefan Roese | 9ede3cc | 2006-08-07 14:31:21 +0200 | [diff] [blame] | 712 | } else if ((info->flash_id & FLASH_TYPEMASK) == FLASH_MXLV320T) { |
| 713 | i = info->sector_count - 1; |
| 714 | info->start[i--] = base + info->size - 0x00002000; |
| 715 | info->start[i--] = base + info->size - 0x00004000; |
| 716 | info->start[i--] = base + info->size - 0x00006000; |
| 717 | info->start[i--] = base + info->size - 0x00008000; |
| 718 | info->start[i--] = base + info->size - 0x0000a000; |
| 719 | info->start[i--] = base + info->size - 0x0000c000; |
| 720 | info->start[i--] = base + info->size - 0x0000e000; |
| 721 | info->start[i--] = base + info->size - 0x00010000; |
| 722 | |
| 723 | for (; i >= 0; i--) |
| 724 | info->start[i] = base + i * 0x00010000; |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 725 | } else { |
| 726 | if (info->flash_id & FLASH_BTYPE) { |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 727 | /* set sector offsets for bottom boot block type */ |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 728 | info->start[0] = base + 0x00000000; |
Eugene OBrien | d2f6800 | 2007-07-31 10:24:56 +0200 | [diff] [blame] | 729 | info->start[1] = base + 0x00002000; |
| 730 | info->start[2] = base + 0x00004000; |
| 731 | info->start[3] = base + 0x00006000; |
| 732 | info->start[4] = base + 0x00008000; |
| 733 | info->start[5] = base + 0x0000a000; |
| 734 | info->start[6] = base + 0x0000c000; |
| 735 | info->start[7] = base + 0x0000e000; |
| 736 | for (i = 8; i < info->sector_count; i++) { |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 737 | info->start[i] = |
Eugene OBrien | d2f6800 | 2007-07-31 10:24:56 +0200 | [diff] [blame] | 738 | base + ((i-7) * 0x00010000); |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 739 | } |
| 740 | } else { |
Wolfgang Denk | 1685091 | 2006-08-27 18:10:01 +0200 | [diff] [blame] | 741 | /* set sector offsets for top boot block type */ |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 742 | i = info->sector_count - 1; |
Eugene OBrien | d2f6800 | 2007-07-31 10:24:56 +0200 | [diff] [blame] | 743 | info->start[i--] = base + info->size - 0x00002000; |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 744 | info->start[i--] = base + info->size - 0x00004000; |
| 745 | info->start[i--] = base + info->size - 0x00006000; |
| 746 | info->start[i--] = base + info->size - 0x00008000; |
Eugene OBrien | d2f6800 | 2007-07-31 10:24:56 +0200 | [diff] [blame] | 747 | info->start[i--] = base + info->size - 0x0000a000; |
| 748 | info->start[i--] = base + info->size - 0x0000c000; |
| 749 | info->start[i--] = base + info->size - 0x0000e000; |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 750 | for (; i >= 0; i--) { |
| 751 | info->start[i] = base + i * 0x00010000; |
| 752 | } |
| 753 | } |
| 754 | } |
| 755 | |
| 756 | /* check for protected sectors */ |
| 757 | for (i = 0; i < info->sector_count; i++) { |
| 758 | /* read sector protection at sector address, (A7 .. A0) = 0x02 */ |
| 759 | /* D0 = 1 if protected */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 760 | addr2 = (volatile CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[i]); |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 761 | |
| 762 | /* For AMD29033C flash we need to resend the command of * |
| 763 | * reading flash protection for upper 8 Mb of flash */ |
| 764 | if (i == 32) { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 765 | addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xAAAAAAAA; |
| 766 | addr2[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x55555555; |
| 767 | addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x90909090; |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 768 | } |
| 769 | |
| 770 | if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) |
| 771 | info->protect[i] = 0; |
| 772 | else |
| 773 | info->protect[i] = addr2[2] & 1; |
| 774 | } |
| 775 | |
| 776 | /* issue bank reset to return to read mode */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 777 | addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00F000F0; |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 778 | |
| 779 | return (info->size); |
| 780 | } |
| 781 | |
| 782 | static int wait_for_DQ7_2(flash_info_t * info, int sect) |
| 783 | { |
| 784 | ulong start, now, last; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 785 | volatile CONFIG_SYS_FLASH_WORD_SIZE *addr = |
| 786 | (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]); |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 787 | |
| 788 | start = get_timer(0); |
| 789 | last = start; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 790 | while ((addr[0] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080) != |
| 791 | (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080) { |
| 792 | if ((now = get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) { |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 793 | printf("Timeout\n"); |
| 794 | return -1; |
| 795 | } |
| 796 | /* show that we're waiting */ |
| 797 | if ((now - last) > 1000) { /* every second */ |
| 798 | putc('.'); |
| 799 | last = now; |
| 800 | } |
| 801 | } |
| 802 | return 0; |
| 803 | } |
| 804 | |
| 805 | static int flash_erase_2(flash_info_t * info, int s_first, int s_last) |
| 806 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 807 | volatile CONFIG_SYS_FLASH_WORD_SIZE *addr = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]); |
| 808 | volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2; |
Wolfgang Denk | 9879d57 | 2011-11-17 09:49:59 +0000 | [diff] [blame] | 809 | int flag, prot, sect; |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 810 | int i; |
| 811 | |
| 812 | if ((s_first < 0) || (s_first > s_last)) { |
| 813 | if (info->flash_id == FLASH_UNKNOWN) { |
| 814 | printf("- missing\n"); |
| 815 | } else { |
| 816 | printf("- no sectors to erase\n"); |
| 817 | } |
| 818 | return 1; |
| 819 | } |
| 820 | |
| 821 | if (info->flash_id == FLASH_UNKNOWN) { |
| 822 | printf("Can't erase unknown flash type - aborted\n"); |
| 823 | return 1; |
| 824 | } |
| 825 | |
| 826 | prot = 0; |
| 827 | for (sect = s_first; sect <= s_last; ++sect) { |
| 828 | if (info->protect[sect]) { |
| 829 | prot++; |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | if (prot) { |
| 834 | printf("- Warning: %d protected sectors will not be erased!\n", |
| 835 | prot); |
| 836 | } else { |
| 837 | printf("\n"); |
| 838 | } |
| 839 | |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 840 | /* Disable interrupts which might cause a timeout here */ |
| 841 | flag = disable_interrupts(); |
| 842 | |
| 843 | /* Start erase on unprotected sectors */ |
| 844 | for (sect = s_first; sect <= s_last; sect++) { |
| 845 | if (info->protect[sect] == 0) { /* not protected */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 846 | addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]); |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 847 | |
| 848 | if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 849 | addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA; |
| 850 | addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055; |
| 851 | addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080; |
| 852 | addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA; |
| 853 | addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055; |
| 854 | addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00500050; /* block erase */ |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 855 | for (i = 0; i < 50; i++) |
| 856 | udelay(1000); /* wait 1 ms */ |
| 857 | } else { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 858 | addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA; |
| 859 | addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055; |
| 860 | addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080; |
| 861 | addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA; |
| 862 | addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055; |
| 863 | addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00300030; /* sector erase */ |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 864 | } |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 865 | /* |
| 866 | * Wait for each sector to complete, it's more |
| 867 | * reliable. According to AMD Spec, you must |
| 868 | * issue all erase commands within a specified |
| 869 | * timeout. This has been seen to fail, especially |
| 870 | * if printf()s are included (for debug)!! |
| 871 | */ |
| 872 | wait_for_DQ7_2(info, sect); |
| 873 | } |
| 874 | } |
| 875 | |
| 876 | /* re-enable interrupts if necessary */ |
| 877 | if (flag) |
| 878 | enable_interrupts(); |
| 879 | |
| 880 | /* wait at least 80us - let's wait 1 ms */ |
| 881 | udelay(1000); |
| 882 | |
| 883 | /* reset to read mode */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 884 | addr = (CONFIG_SYS_FLASH_WORD_SIZE *) info->start[0]; |
| 885 | addr[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00F000F0; /* reset bank */ |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 886 | |
| 887 | printf(" done\n"); |
| 888 | return 0; |
| 889 | } |
| 890 | |
| 891 | static int write_word_2(flash_info_t * info, ulong dest, ulong data) |
| 892 | { |
Wolfgang Denk | 6c7bc91 | 2009-09-11 11:30:34 +0200 | [diff] [blame] | 893 | ulong *data_ptr = &data; |
| 894 | volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[0]); |
| 895 | volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *)dest; |
| 896 | volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *)data_ptr; |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 897 | ulong start; |
| 898 | int i; |
| 899 | |
| 900 | /* Check if Flash is (sufficiently) erased */ |
| 901 | if ((*((vu_long *)dest) & data) != data) { |
| 902 | return (2); |
| 903 | } |
| 904 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 905 | for (i = 0; i < 4 / sizeof(CONFIG_SYS_FLASH_WORD_SIZE); i++) { |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 906 | int flag; |
| 907 | |
| 908 | /* Disable interrupts which might cause a timeout here */ |
| 909 | flag = disable_interrupts(); |
| 910 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 911 | addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA; |
| 912 | addr2[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055; |
| 913 | addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00A000A0; |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 914 | |
| 915 | dest2[i] = data2[i]; |
| 916 | |
| 917 | /* re-enable interrupts if necessary */ |
| 918 | if (flag) |
| 919 | enable_interrupts(); |
| 920 | |
| 921 | /* data polling for D7 */ |
| 922 | start = get_timer(0); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 923 | while ((dest2[i] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080) != |
| 924 | (data2[i] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080)) { |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 925 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 926 | if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) { |
Stefan Roese | 17f50f22 | 2005-08-04 17:09:16 +0200 | [diff] [blame] | 927 | return (1); |
| 928 | } |
| 929 | } |
| 930 | } |
| 931 | |
| 932 | return (0); |
| 933 | } |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 934 | #endif /* CONFIG_SYS_FLASH_2ND_16BIT_DEV */ |