Patchworkβ Reset before reading Chip ID

login
register
about
Submitter Sean Nelson
Date 2010-01-31 05:33:12
Message ID <4B651618.90307@gmail.com>
Download mbox | patch
Permalink /patch/857/
State Superseded
Headers show

Comments

Sean Nelson - 2010-01-31 05:33:12
Add a reset to probe_jedec before we read the Chip's IDs.
Signed-off-by: Sean Nelson <audiohacked@gmail.com>
Anders Juel Jensen - 2010-01-31 16:07:19
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>
Sean Nelson - 2010-02-04 06:13:40
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>
>
> _______________________________________________
> flashrom mailing list
> flashrom@flashrom.org
> http://www.flashrom.org/mailman/listinfo/flashrom
>

Patch

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);