Author: stuge Date: 2007-08-13 06:10:32 +0200 (Mon, 13 Aug 2007) New Revision: 2744
Modified: trunk/util/flashrom/sst28sf040.c Log: Fix bug in probe_28sf040() causing flash corruption on SST49LF160C verify.
The first byte of the flash chip was read at the start of the function and later written back to address 0 if the flash chip was not identified as SST28SF040, which means most of the time. This write caused corruption of flash contents when verifying a SST49LF160C part.
Signed-off-by: Ed Swierk eswierk@arastra.com Acked-by: Peter Stuge peter@stuge.se
Modified: trunk/util/flashrom/sst28sf040.c =================================================================== --- trunk/util/flashrom/sst28sf040.c 2007-08-11 16:59:11 UTC (rev 2743) +++ trunk/util/flashrom/sst28sf040.c 2007-08-13 04:10:32 UTC (rev 2744) @@ -106,11 +106,8 @@ int probe_28sf040(struct flashchip *flash) { volatile uint8_t *bios = flash->virtual_memory; - uint8_t id1, id2, tmp; + uint8_t id1, id2;
- /* save the value at the beginning of the Flash */ - tmp = *bios; - *bios = RESET; myusec_delay(10);
@@ -127,8 +124,6 @@ if (id1 == flash->manufacture_id && id2 == flash->model_id) return 1;
- /* if there is no SST28SF040, restore the original value */ - *bios = tmp; return 0; }