]> git.sur5r.net Git - openocd/commitdiff
Fix non cfi x16 nor flash connected to x8 bus. The ids in the table should be masked...
authorAlexandre Pereira da Silva <aletes.xgr@gmail.com>
Tue, 12 Apr 2011 15:56:28 +0000 (12:56 -0300)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 19 Apr 2011 10:53:05 +0000 (12:53 +0200)
src/flash/nor/non_cfi.c

index b6739043ce969704199e2a1a9fdd4252f2a0efbc..795f60da188a75487fbf6cdc169f43d6c3aa57e9 100644 (file)
@@ -454,13 +454,19 @@ static struct non_cfi non_cfi_flashes[] = {
 
 void cfi_fixup_non_cfi(struct flash_bank *bank)
 {
+       unsigned int mask;
        struct cfi_flash_bank *cfi_info = bank->driver_priv;
        struct non_cfi *non_cfi = non_cfi_flashes;
 
+       if(cfi_info->x16_as_x8)
+               mask = 0xFF;
+       else
+               mask = 0xFFFF;
+
        for (non_cfi = non_cfi_flashes; non_cfi->mfr; non_cfi++)
        {
                if ((cfi_info->manufacturer == non_cfi->mfr)
-                       && (cfi_info->device_id == non_cfi->id))
+                       && (cfi_info->device_id == (non_cfi->id & mask)))
                {
                        break;
                }