summaryrefslogtreecommitdiff
path: root/drivers/mtd/cfi_flash.c
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2010-10-25 18:31:29 +0200
committerStefan Roese <sr@denx.de>2010-12-17 09:54:03 +0100
commitdf4e813b72bf07d9026b00455f5e7dffd694ae48 (patch)
treeac88addeb444ab1dd34263f36ab07eba597aa2d6 /drivers/mtd/cfi_flash.c
parent97a85b223ab316d11f3a374fecc5d449a1c8a694 (diff)
downloadu-boot-imx-df4e813b72bf07d9026b00455f5e7dffd694ae48.zip
u-boot-imx-df4e813b72bf07d9026b00455f5e7dffd694ae48.tar.gz
u-boot-imx-df4e813b72bf07d9026b00455f5e7dffd694ae48.tar.bz2
cfi_flash: Fix problems with status/id read mode
This patch adds some calls to set the flash chip in the read-status- register- or read-id-mode before the corresponding register is read back. This problem was detected while porting the common CFI driver to support the Xilinx DS617 flash chips. Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/mtd/cfi_flash.c')
-rw-r--r--drivers/mtd/cfi_flash.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 39c235e..643cd87 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1426,6 +1426,11 @@ int flash_real_protect (flash_info_t * info, long sector, int prot)
#endif
};
+ /*
+ * Flash needs to be in status register read mode for
+ * flash_full_status_check() to work correctly
+ */
+ flash_write_cmd(info, sector, 0, FLASH_CMD_READ_STATUS);
if ((retcode =
flash_full_status_check (info, sector, info->erase_blk_tout,
prot ? "protect" : "unprotect")) == 0) {
@@ -1975,6 +1980,13 @@ ulong flash_get_size (phys_addr_t base, int banknum)
case CFI_CMDSET_INTEL_PROG_REGIONS:
case CFI_CMDSET_INTEL_EXTENDED:
case CFI_CMDSET_INTEL_STANDARD:
+ /*
+ * Set flash to read-id mode. Otherwise
+ * reading protected status is not
+ * guaranteed.
+ */
+ flash_write_cmd(info, sect_cnt, 0,
+ FLASH_CMD_READ_ID);
info->protect[sect_cnt] =
flash_isset (info, sect_cnt,
FLASH_OFFSET_PROTECT,