Commit c6e1111b authored by Maciej Pijanka's avatar Maciej Pijanka Committed by Carl-Daniel Hailfinger
Browse files

Add probe_timing information (int uS value)


This eliminates the conflicting delay requirements for old and new chips
with the same probing sequence.

Corresponding to flashrom svn r569.
Signed-off-by: default avatarMaciej Pijanka <maciej.pijanka@gmail.com>
Acked-by: default avatarCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
parent 48f34c66
......@@ -155,6 +155,9 @@ struct flashchip {
uint32_t tested;
int (*probe) (struct flashchip *flash);
/* Delay after "enter/exit ID mode" commands in microseconds. */
int probe_timing;
int (*erase) (struct flashchip *flash);
int (*write) (struct flashchip *flash, uint8_t *buf);
int (*read) (struct flashchip *flash, uint8_t *buf);
......@@ -182,6 +185,16 @@ struct flashchip {
#define TEST_BAD_PREW (TEST_BAD_PROBE | TEST_BAD_READ | TEST_BAD_ERASE | TEST_BAD_WRITE)
#define TEST_BAD_MASK 0xf0
/* Timing used in probe routines. ZERO is -2 to differentiate between an unset
* field and zero delay.
*
* SPI devices will always have zero delay and ignore this field.
*/
#define TIMING_FIXME -1
/* this is intentionally same value as fixme */
#define TIMING_IGNORED -1
#define TIMING_ZERO -2
extern struct flashchip flashchips[];
struct penable {
......
This diff is collapsed.
......@@ -91,6 +91,22 @@ int probe_jedec(struct flashchip *flash)
uint8_t id1, id2;
uint32_t largeid1, largeid2;
uint32_t flashcontent1, flashcontent2;
int probe_timing_enter, probe_timing_exit;
if (flash->probe_timing > 0)
probe_timing_enter = probe_timing_exit = flash->probe_timing;
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\n");
probe_timing_enter = 10000;
probe_timing_exit = 40;
} else {
printf("Chip has negative value in probe_timing, failing "
"without chip access\n");
return 0;
}
/* Issue JEDEC Product ID Entry command */
chip_writeb(0xAA, bios + 0x5555);
......@@ -101,7 +117,7 @@ int probe_jedec(struct flashchip *flash)
/* Older chips may need up to 100 us to respond. The ATMEL 29C020
* needs 10 ms according to the data sheet.
*/
myusec_delay(10000);
myusec_delay(probe_timing_enter);
/* Read product ID */
id1 = chip_readb(bios);
......@@ -127,7 +143,7 @@ int probe_jedec(struct flashchip *flash)
chip_writeb(0x55, bios + 0x2AAA);
myusec_delay(10);
chip_writeb(0xF0, bios + 0x5555);
myusec_delay(40);
myusec_delay(probe_timing_exit);
printf_debug("%s: id1 0x%02x, id2 0x%02x", __FUNCTION__, largeid1, largeid2);
if (!oddparity(id1))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment