summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-09-07 22:19:49 +0200
committerWolfgang Denk <wd@denx.de>2010-09-07 22:19:49 +0200
commitf91506e28387fece392b5dd3bb3aa309e4ce7e4d (patch)
tree3e46227d94b7b379341fba534df5aa3dd3948f68 /drivers/mtd
parent5549d22b656550d36b2cc46743c7220ab0e9dcc4 (diff)
parent2df0e6fc6b71448e1752e4ce1d5577d8977f3e5e (diff)
downloadu-boot-imx-f91506e28387fece392b5dd3bb3aa309e4ce7e4d.zip
u-boot-imx-f91506e28387fece392b5dd3bb3aa309e4ce7e4d.tar.gz
u-boot-imx-f91506e28387fece392b5dd3bb3aa309e4ce7e4d.tar.bz2
Merge branch 'master' of /home/wd/git/u-boot/master
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/cfi_flash.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 1191ef0..44ebb9d 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1355,15 +1355,32 @@ int flash_real_protect (flash_info_t * info, long sector, int prot)
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);
- if (prot)
- flash_write_cmd (info, sector, 0,
- FLASH_CMD_PROTECT_SET);
- else
+ /*
+ * see errata called
+ * "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 FLASH_CMD_PROTECT + 20us
+ * Disable interrupts which might cause a timeout here.
+ */
+ int flag = disable_interrupts ();
+ unsigned short cmd;
+
+ if (prot)
+ cmd = FLASH_CMD_PROTECT_SET;
+ else
+ cmd = FLASH_CMD_PROTECT_CLEAR;
+
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: