public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH CFI flash]: Workaround for Numonyx Axcell P33/P30 256-Mbit 65nm bug
@ 2010-06-23 11:57 Philippe De Muyter
  2010-06-23 12:48 ` Wolfgang Denk
  2010-06-23 13:10 ` [U-Boot] [PATCHv2 " Philippe De Muyter
  0 siblings, 2 replies; 15+ messages in thread
From: Philippe De Muyter @ 2010-06-23 11:57 UTC (permalink / raw)
  To: u-boot

Hello Wolfgang & list,

I have "ported" U-boot to a in house made board with Numonyx Axcell P33/P30
256-Mbit 65nm flash chips.

After some time :( searching for bugs in our board or soft, we have
discovered that those chips have a small but annoying bug, documented in
"Numonyx Axcell P33/P30 256-Mbit Specification Update"

It states :
When customer uses [...] block unlock, the block lock status might be
altered inadvertently. Lock status might be set to either 01h or 03h
unexpectedly (00h as expected data), which leads to program/erase failure
on certain blocks.

A working workaround is given, which I have applied and tested with success.

Signed-off-by: Philippe De Muyter <phdm@macqel.be>

---
 drivers/mtd/cfi_flash.c |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 3267c5d..0931137 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1347,16 +1347,29 @@ int flash_real_protect (flash_info_t * info, long sector, int prot)
 	switch (info->vendor) {
 		case CFI_CMDSET_INTEL_PROG_REGIONS:
 		case CFI_CMDSET_INTEL_STANDARD:
-		case CFI_CMDSET_INTEL_EXTENDED:
-			flash_write_cmd (info, sector, 0,
-					 FLASH_CMD_CLEAR_STATUS);
-			flash_write_cmd (info, sector, 0, FLASH_CMD_PROTECT);
+		case CFI_CMDSET_INTEL_EXTENDED: {
+			unsigned short cmd;
+
 			if (prot)
-				flash_write_cmd (info, sector, 0,
-					FLASH_CMD_PROTECT_SET);
+				cmd = FLASH_CMD_PROTECT_SET;
 			else
+				cmd = FLASH_CMD_PROTECT_CLEAR;
+			/* see errata
+			   "Numonyx Axcell P33/P30 Specification Update" :) */
+			flash_write_cmd (info, sector, 0, FLASH_CMD_READ_ID);
+			if (!flash_isequal (info, sector, FLASH_OFFSET_PROTECT,
+					    prot)) {
+				/* cmd must come before 20us after FLASH_CMD_PROTECT */
+				/* Disable interrupts which might cause a timeout here */
+				int flag = disable_interrupts ();
 				flash_write_cmd (info, sector, 0,
-					FLASH_CMD_PROTECT_CLEAR);
+						  FLASH_CMD_PROTECT);
+				flash_write_cmd (info, sector, 0, cmd);
+				/* re-enable interrupts if necessary */
+				if (flag)
+					enable_interrupts ();
+			}
+			}
 			break;
 		case CFI_CMDSET_AMD_EXTENDED:
 		case CFI_CMDSET_AMD_STANDARD:
-- 
1.6.3.3



-- 
Philippe De Muyter  phdm at macqel dot be  Tel +32 27029044
Macq Electronique SA  rue de l'Aeronef 2  B-1140 Bruxelles  Fax +32 27029077

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2010-08-10 16:12 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-23 11:57 [U-Boot] [PATCH CFI flash]: Workaround for Numonyx Axcell P33/P30 256-Mbit 65nm bug Philippe De Muyter
2010-06-23 12:48 ` Wolfgang Denk
2010-06-23 13:10 ` [U-Boot] [PATCHv2 " Philippe De Muyter
2010-08-06 23:11   ` Wolfgang Denk
2010-08-09  8:32     ` Joakim Tjernlund
2010-08-09 12:57       ` Philippe De Muyter
2010-08-09 15:48         ` Philippe De Muyter
2010-08-09 15:55         ` Joakim Tjernlund
2010-08-09 13:52     ` Stefan Roese
2010-08-09 15:46       ` Philippe De Muyter
2010-08-10 11:20         ` Stefan Roese
2010-08-10 13:31           ` Philippe De Muyter
2010-08-10 13:39             ` Stefan Roese
2010-08-10 15:28         ` Stefan Roese
2010-08-10 16:12           ` [U-Boot] [PATCHv2 CFI flash]: Workaround for Numonyx Axcell?P33/P30 " Philippe De Muyter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox