diff options
author | Stefan Roese <sr@denx.de> | 2012-12-06 15:44:10 +0100 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2013-01-10 14:39:48 +0100 |
commit | 03deff433ee8768947d3f232725d64806acd79bc (patch) | |
tree | 5cfb433fd6d4161352331b043c2a02fa2c44dc25 /drivers | |
parent | 20043a4c3cfbe0df8b452ef137ad6149f68c4ada (diff) | |
download | u-boot-imx-03deff433ee8768947d3f232725d64806acd79bc.zip u-boot-imx-03deff433ee8768947d3f232725d64806acd79bc.tar.gz u-boot-imx-03deff433ee8768947d3f232725d64806acd79bc.tar.bz2 |
cfi_flash: Read PPB sector protection from device for AMD/Spansion chips
Patch 66863b05 [cfi_flash: add support for Spansion flash PPB sector
protection] introduced the PPB (Persistent Protection Bit) locking for
Spansion chips. But right now the sector protection status (locked vs
unlocked) is set to unlocked for all sectors upon bootup. The real
sector protection status is ignored.
This patch now reads the current sector protection status and uses
it for these AMD/Spansion flash chips.
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Holger Brunck <holger.brunck@keymile.com>
Tested-by: Holger Brunck <holger.brunck@keymile.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/cfi_flash.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 9a44109..2ca73f9 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -2183,6 +2183,27 @@ ulong flash_get_size (phys_addr_t base, int banknum) FLASH_OFFSET_PROTECT, FLASH_STATUS_PROTECT); break; + case CFI_CMDSET_AMD_EXTENDED: + case CFI_CMDSET_AMD_STANDARD: + if (!manufact_match(info, AMD_MANUFACT)) { + /* default: not protected */ + info->protect[sect_cnt] = 0; + break; + } + + /* Read protection (PPB) from sector */ + flash_write_cmd(info, 0, 0, + info->cmd_reset); + flash_unlock_seq(info, 0); + flash_write_cmd(info, 0, + info->addr_unlock1, + FLASH_CMD_READ_ID); + info->protect[sect_cnt] = + flash_isset( + info, sect_cnt, + FLASH_OFFSET_PROTECT, + FLASH_STATUS_PROTECT); + break; default: /* default: not protected */ info->protect[sect_cnt] = 0; |