On 11/25/2010 06:13 AM, 韦东山 wrote:
For some flash, such as SST39VF6401B, it needs 3 step to enter CFI mode.

--- src/flash/nor/cfi.c.origin  Thu Nov 11 05:42:00 2010
+++ src/flash/nor/cfi.c Thu Nov 25 12:31:18 2010
@@ -2264,6 +2264,24 @@
        struct cfi_flash_bank *cfi_info = bank->driver_priv;
        int retval;

+       uint32_t unlock1 = 0x555;
+       uint32_t unlock2 = 0x2aa;
+       
+       if (cfi_info->jedec_probe)
+       {
+               unlock1 = 0x5555;
+               unlock2 = 0x2aaa;
+       }
+
+       if ((retval = cfi_send_command(bank, 0xaa, flash_address(bank, 0, 
unlock1))) != ERROR_OK)
+       {
+               return retval;
+       }
+       if ((retval = cfi_send_command(bank, 0x55, flash_address(bank, 0, 
unlock2))) != ERROR_OK)
+       {
+               return retval;
+       }
+
        if ((retval = cfi_send_command(bank, 0x98, flash_address(bank, 0, 
address))) != ERROR_OK)
        {
                return retval;
Please don't apply.

These SST flashes have a broken CFI implementation. If you force them into CFI mode that way, they report bad values in the CFI tables (sectors are reported multiple times, summing up to more than the size of the flash), essentially making them useless.

IMHO, the easiest way to handle those parts is to treat them as non-CFI. The required additional workarounds in the CFI code are worse than the required non-CFI table entries.

cu
Michael

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to