]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
CFI: Fix AMD Legacy sector protect
authorTsiChung Liew <Tsi-Chung.Liew@freescale.com>
Tue, 19 Aug 2008 16:53:39 +0000 (16:53 +0000)
committerStefan Roese <sr@denx.de>
Wed, 20 Aug 2008 12:21:46 +0000 (14:21 +0200)
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 <Tsi-Chung.Liew@freescale.com>
Signed-off-by: Stefan Roese <sr@denx.de>
drivers/mtd/cfi_flash.c

index 58295fe0487c6ca4888e28a2467b4e96b8d20be9..a41293871e236ec284ce4e0ccbe21007184cf2e8 100644 (file)
@@ -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 =