FreeCalypso > hg > freecalypso-tools
comparison loadtools/flutil.c @ 505:7bf0d909c87e
fc-loadtool flash ID check: change of reset after the check logic
This change only affects those flash configurations that have ID checks
enabled. The logic for resetting the flash after the ID check has been
changed as follows:
1) If the check fails, we return without attempting to reset the flash.
2) If the check is successful, we reset the flash using the configured
method (could be AMD or Intel or Intel W30) instead of always doing an
AMD flash reset as the original code did.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 27 May 2019 19:58:01 +0000 |
parents | e7502631a0f9 |
children | 0dd2c87c1b63 |
comparison
equal
deleted
inserted
replaced
504:d3d22dbe223f | 505:7bf0d909c87e |
---|---|
156 free(geom); | 156 free(geom); |
157 return(-1); | 157 return(-1); |
158 } | 158 } |
159 if (size_check != geom->total_size) { | 159 if (size_check != geom->total_size) { |
160 fprintf(stderr, | 160 fprintf(stderr, |
161 "CFI error: added size of erase regions (%lx) != reported devive size (%lx)\n", | 161 "CFI error: added size of erase regions (%lx) != reported device size (%lx)\n", |
162 (u_long) size_check, (u_long) geom->total_size); | 162 (u_long) size_check, (u_long) geom->total_size); |
163 free(geom); | 163 free(geom); |
164 return(-1); | 164 return(-1); |
165 } | 165 } |
166 /* all checks passed */ | 166 /* all checks passed */ |
334 fail = 1; | 334 fail = 1; |
335 break; | 335 break; |
336 } | 336 } |
337 id++; | 337 id++; |
338 } | 338 } |
339 /* reset flash to read mode */ | |
340 stat = do_w16(bi->base_addr + 0xAAA, 0xF0); | |
341 if (stat) { | |
342 fprintf(stderr, | |
343 "unexpected response to w16 when resetting flash to read mode!\n"); | |
344 return(-1); | |
345 } | |
346 if (fail) | 339 if (fail) |
347 return(-1); | 340 return(-1); |
341 if (bi->ops->reset_cmd(bi) < 0) { | |
342 /* error msg already printed */ | |
343 return(-1); | |
344 } | |
348 bi->idcheck_done = 1; | 345 bi->idcheck_done = 1; |
349 return(0); | 346 return(0); |
350 } | 347 } |