
Right. But it will be an improvement to the current implementation, where a random command is written as RESET command. And also an improvement to the fixed AMD/Intel RESET command. So I vote for trying this solution. I'll test on a few of mine platforms too.
Michael, could please you provide a patch?
Okay - sorry, I did not have time for as much testing as I planned.
From a short test, it looks like AMD-style flash roms treat *any* unknown
command write as a reset, at least when in CFI Query mode, so issuing the Intel reset command to AMD-style flashs seems safe (from the small sample I have), plus the 3-cycle magic sequence should kick the state machine into the right state even without a reset command. Since the AMD-style flashs require the unlock sequence for real operation, I chose to try the AMD reset command first, so that Intel flashs do no see an invalid command prior to the CFI query.
I have tested the patch on AM29LV320-style flashs from Fujitsu and Macronix, plus Intel StrataFlash.
cu Michael
From c18599658f8470898dc12ac99528d03b3a8d570c Mon Sep 17 00:00:00 2001
From: Michael Schwingen michael@schwingen.org Date: Mon, 18 Feb 2008 23:04:17 +0100 Subject: [PATCH] do not use uninitialized cmd_reset; issue both AMD and Intel reset commands instead
Signed-off-by: Michael Schwingen michael@schwingen.org --- drivers/mtd/cfi_flash.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index eb509f5..439c950 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1538,7 +1538,12 @@ static int __flash_detect_cfi (flash_info_t * info, struct cfi_qry *qry) { int cfi_offset;
- flash_write_cmd (info, 0, 0, info->cmd_reset); + /* We do not yet know what kind of commandset to use, so we issue + the reset command in both Intel and AMD variants, in the hope + that AMD flash roms ignore the Intel command. */ + flash_write_cmd (info, 0, 0, AMD_CMD_RESET); + flash_write_cmd (info, 0, 0, FLASH_CMD_RESET); + for (cfi_offset=0; cfi_offset < sizeof(flash_offset_cfi) / sizeof(uint); cfi_offset++) {