diff options
author | Wolfgang Denk <wd@denx.de> | 2008-08-14 14:56:40 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-08-14 14:56:40 +0200 |
commit | 855efd04e440754297769849f4d7fb52c7dc6bf4 (patch) | |
tree | cf7fc9b8574668957306905ac690d7bf6ffbad3b | |
parent | 4b0708093e15b412296328bf81325cf9b69fe512 (diff) | |
parent | becbbc7b2a1be44d38779c80ce94fb20e5e13f12 (diff) | |
download | u-boot-imx-855efd04e440754297769849f4d7fb52c7dc6bf4.zip u-boot-imx-855efd04e440754297769849f4d7fb52c7dc6bf4.tar.gz u-boot-imx-855efd04e440754297769849f4d7fb52c7dc6bf4.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-cfi-flash
-rw-r--r-- | drivers/mtd/cfi_flash.c | 49 | ||||
-rw-r--r-- | drivers/mtd/jedec_flash.c | 17 |
2 files changed, 60 insertions, 6 deletions
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 402d835..58295fe 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -102,6 +102,10 @@ #define AMD_STATUS_TOGGLE 0x40 #define AMD_STATUS_ERROR 0x20 +#define ATM_CMD_UNLOCK_SECT 0x70 +#define ATM_CMD_SOFTLOCK_START 0x80 +#define ATM_CMD_LOCK_SECT 0x40 + #define FLASH_OFFSET_MANUFACTURER_ID 0x00 #define FLASH_OFFSET_DEVICE_ID 0x01 #define FLASH_OFFSET_DEVICE_ID2 0x0E @@ -1350,12 +1354,45 @@ int flash_real_protect (flash_info_t * info, long sector, int prot) { int retcode = 0; - 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 - flash_write_cmd (info, sector, 0, FLASH_CMD_PROTECT_CLEAR); + switch (info->vendor) { + case CFI_CMDSET_INTEL_PROG_REGIONS: + case CFI_CMDSET_INTEL_STANDARD: + 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 + flash_write_cmd (info, sector, 0, + FLASH_CMD_PROTECT_CLEAR); + break; + case CFI_CMDSET_AMD_EXTENDED: + case CFI_CMDSET_AMD_STANDARD: +#ifdef CONFIG_FLASH_CFI_LEGACY + case CFI_CMDSET_AMD_LEGACY: +#endif + /* U-Boot only checks the first byte */ + if (info->manufacturer_id == (uchar)ATM_MANUFACT) { + if (prot) { + flash_unlock_seq (info, 0); + flash_write_cmd (info, 0, + info->addr_unlock1, + ATM_CMD_SOFTLOCK_START); + flash_unlock_seq (info, 0); + flash_write_cmd (info, sector, 0, + ATM_CMD_LOCK_SECT); + } else { + flash_write_cmd (info, 0, + info->addr_unlock1, + AMD_CMD_UNLOCK_START); + if (info->device_id == ATM_ID_BV6416) + flash_write_cmd (info, sector, + 0, ATM_CMD_UNLOCK_SECT); + } + } + break; + }; if ((retcode = flash_full_status_check (info, sector, info->erase_blk_tout, diff --git a/drivers/mtd/jedec_flash.c b/drivers/mtd/jedec_flash.c index 9845e93..020647a 100644 --- a/drivers/mtd/jedec_flash.c +++ b/drivers/mtd/jedec_flash.c @@ -234,6 +234,23 @@ static const struct amd_flash_info jedec_table[] = { ERASEINFO(0x10000,7), } }, + { + .mfr_id = MANUFACTURER_AMD, + .dev_id = AM29LV800BB, + .name = "AMD AM29LV800BB", + .uaddr = { + [1] = MTD_UADDR_0x0555_0x02AA /* x16 */ + }, + .DevSize = SIZE_1MiB, + .CmdSet = CFI_CMDSET_AMD_LEGACY, + .NumEraseRegions= 4, + .regions = { + ERASEINFO(0x04000, 1), + ERASEINFO(0x02000, 2), + ERASEINFO(0x08000, 1), + ERASEINFO(0x10000, 15), + } + }, #endif }; |