From patchwork Sun Jan 31 05:33:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Reset before reading Chip ID Date: Sun, 31 Jan 2010 04:33:12 -0000 From: Sean Nelson X-Patchwork-Id: 857 Message-Id: <4B651618.90307@gmail.com> To: flashrom Add a reset to probe_jedec before we read the Chip's IDs. Signed-off-by: Sean Nelson Acked-by: Anders Juel Jensen 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);