From 4e00acded2e6a8d663e12690a0f0f08f5bec5a58 Mon Sep 17 00:00:00 2001 From: TsiChung Liew Date: Tue, 19 Aug 2008 16:53:39 +0000 Subject: CFI: Fix AMD Legacy sector protect New implement sector lock and unlock or softlock commands do not exist in AMD legacy flash. Thus, causing issue when erasing AMD legacy flash (such as lv040) Signed-off-by: TsiChung Liew Signed-off-by: Stefan Roese --- drivers/mtd/cfi_flash.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 58295fe0487..a41293871e2 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1369,9 +1369,6 @@ int flash_real_protect (flash_info_t * info, long sector, int prot) 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) { @@ -1392,6 +1389,15 @@ int flash_real_protect (flash_info_t * info, long sector, int prot) } } break; +#ifdef CONFIG_FLASH_CFI_LEGACY + case CFI_CMDSET_AMD_LEGACY: + 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); +#endif }; if ((retcode = -- cgit v1.2.3 From 9e8e63cce69556aef10b58bcbc56d324f570ec3a Mon Sep 17 00:00:00 2001 From: Nick Spence Date: Tue, 19 Aug 2008 22:21:16 -0700 Subject: CFI: Add CFI_CMDSET_INTEL_EXTENDED to fix flash_real_protect() This patch fixes a missing vendor code in the flash_real_protect() function. Signed-off-by: Nick Spence Signed-off-by: Stefan Roese --- drivers/mtd/cfi_flash.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index a41293871e2..03ea2d040d7 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1357,6 +1357,7 @@ 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); -- cgit v1.2.3