diff --git a/jedec.c b/jedec.c index 055e910..af1d300 100644 --- a/jedec.c +++ b/jedec.c @@ -112,26 +112,40 @@ int probe_jedec_common(struct flashchip *flash, unsigned int mask) else if (flash->probe_timing == TIMING_ZERO) { /* No delay. */ probe_timing_enter = probe_timing_exit = 0; } else if (flash->probe_timing == TIMING_FIXME) { /* == _IGNORED */ printf_debug("Chip lacks correct probe timing information, " "using default 10mS/40uS. "); probe_timing_enter = 10000; probe_timing_exit = 40; } else { printf("Chip has negative value in probe_timing, failing " "without chip access\n"); return 0; } + /* Reset chip to a clean slate */ + if ((flash->feature_bits & FEATURE_SHORT_RESET) == FEATURE_LONG_RESET) + { + chip_writeb(0xAA, bios + (0x5555 & mask)); + if (probe_timing_exit) + programmer_delay(10); + chip_writeb(0x55, bios + (0x2AAA & mask)); + if (probe_timing_exit) + programmer_delay(10); + } + chip_writeb(0xF0, bios + (0x5555 & mask)); + if (probe_timing_exit) + programmer_delay(probe_timing_exit); + /* Issue JEDEC Product ID Entry command */ chip_writeb(0xAA, bios + (0x5555 & mask)); if (probe_timing_enter) programmer_delay(10); chip_writeb(0x55, bios + (0x2AAA & mask)); if (probe_timing_enter) programmer_delay(10); chip_writeb(0x90, bios + (0x5555 & mask)); if (probe_timing_enter) programmer_delay(probe_timing_enter); /* Read product ID */ id1 = chip_readb(bios);