On 04.02.2010 07:13, Sean Nelson wrote:
I'd like Uwe, Stepan, or Carl-Daniel to test this and send an ack/nack.
On 1/31/10 8:07 AM, Anders Juel Jensen wrote:
On Sunday 31 January 2010 06:33:12 Sean Nelson wrote:
Add a reset to probe_jedec before we read the Chip's IDs. Signed-off-by: Sean Nelson audiohacked@gmail.com
Acked-by: Anders Juel Jensen andersjjensen@gmail.com
Sorry for the long delay. We absolutely want this patch, and I'm happy with it except for two minor issues: - Previous probes might have had too short delays for entering ID mode, so the chip may still be in the process of entering the ID mode. Due to that, an additional delay before the reset makes sense. - We needed FEATURE_RESET_MASK to deal cleanly with those feature bits.
Maciej Pijanka tested the patch and it fixes probing for him with some old Atmel chips.
Signed-off-by: Sean Nelson audiohacked@gmail.com Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net Acked-by: Anders Juel Jensen andersjjensen@gmail.com
Index: flashrom-reset_before_probe/flash.h =================================================================== --- flashrom-reset_before_probe/flash.h (Revision 1172) +++ flashrom-reset_before_probe/flash.h (Arbeitskopie) @@ -78,6 +78,7 @@ #define FEATURE_LONG_RESET (0 << 4) #define FEATURE_SHORT_RESET (1 << 4) #define FEATURE_EITHER_RESET FEATURE_LONG_RESET +#define FEATURE_RESET_MASK (FEATURE_LONG_RESET | FEATURE_SHORT_RESET) #define FEATURE_ADDR_FULL (0 << 2) #define FEATURE_ADDR_MASK (3 << 2) #define FEATURE_ADDR_2AA (1 << 2) Index: flashrom-reset_before_probe/jedec.c =================================================================== --- flashrom-reset_before_probe/jedec.c (Revision 1172) +++ flashrom-reset_before_probe/jedec.c (Arbeitskopie) @@ -123,6 +123,26 @@ return 0; }
+ /* Earlier probes might have been too fast for the chip to enter ID + * mode completely. Allow the chip to finish this before seeing a + * reset command. + */ + if (probe_timing_enter) + programmer_delay(probe_timing_enter); + /* Reset chip to a clean slate */ + if ((flash->feature_bits & FEATURE_RESET_MASK) == 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) @@ -153,7 +173,7 @@ }
/* Issue JEDEC Product ID Exit command */ - if ((flash->feature_bits & FEATURE_SHORT_RESET) == FEATURE_LONG_RESET) + if ((flash->feature_bits & FEATURE_RESET_MASK) == FEATURE_LONG_RESET) { chip_writeb(0xAA, bios + (0x5555 & mask)); if (probe_timing_exit)