[flashrom] [PATCH] WRDI before RDID for AAI chips.

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Thu Oct 4 05:27:47 CEST 2012


Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
---
This is not for merge but just a reminder to not forget about this:
AAI uses a stateful process for writes that will only reset on reception
of WRDI or reset. In this state the chip will not react to other opcodes
than AAI write and WRDI. Now when a chip gets interrupted while in this
state, flashrom is not able to detect and use the chip, because it won't
reply to the probes.

TODO: either add WRDI to the generic RDID command after checking that
this is safe, or add the probe_spi_rdid_wrdi command instead of
probe_spi_rdid to all AAI-capable chips. Thanks to Denis 'GNUtoo' Carikli
for reporting the problem.

 chipdrivers.h |    1 +
 flashchips.c  |    2 +-
 spi25.c       |    6 ++++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/chipdrivers.h b/chipdrivers.h
index 1ef4959..a01e5e7 100644
--- a/chipdrivers.h
+++ b/chipdrivers.h
@@ -34,6 +34,7 @@ int spi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start, int
 
 /* spi25.c */
 int probe_spi_rdid(struct flashctx *flash);
+int probe_spi_rdid_wrdi(struct flashctx *flash);
 int probe_spi_rdid4(struct flashctx *flash);
 int probe_spi_rems(struct flashctx *flash);
 int probe_spi_res1(struct flashctx *flash);
diff --git a/flashchips.c b/flashchips.c
index e290e2f..00df2ac 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -6390,7 +6390,7 @@ const struct flashchip flashchips[] = {
 		.page_size	= 256,
 		.feature_bits	= FEATURE_WRSR_EWSR,
 		.tested		= TEST_OK_PREW,
-		.probe		= probe_spi_rdid,
+		.probe		= probe_spi_rdid_wrdi,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
diff --git a/spi25.c b/spi25.c
index a65f548..38179b6 100644
--- a/spi25.c
+++ b/spi25.c
@@ -173,6 +173,12 @@ int probe_spi_rdid(struct flashctx *flash)
 	return probe_spi_rdid_generic(flash, 3);
 }
 
+int probe_spi_rdid_wrdi(struct flashctx *flash)
+{
+	spi_write_disable(flash);
+	return probe_spi_rdid_generic(flash, 3);
+}
+
 int probe_spi_rdid4(struct flashctx *flash)
 {
 	/* Some SPI controllers do not support commands with writecnt=1 and
-- 
Kind regards, Stefan Tauner





More information about the flashrom mailing list