flash/nor/cfi: fix TopBottom for atmel chips
authorAndreas Bießmann <andreas.devel@googlemail.com>
Tue, 12 Jul 2011 10:38:22 +0000 (12:38 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 9 Aug 2011 18:19:37 +0000 (20:19 +0200)
There are some older atmel nor chips which have negated logic for
TopBottom detection. This patch adds a special handling for the old
chips. This is the same mechanism as implemented in linux kernel.

Signed-off-by: Andreas Bießmann <andreas.devel@gmail.com>
src/flash/nor/cfi.c

index 3f1fbabe95577f997b70c41a5078ecc1d08723f4..f854dd632b459595134f7a024ac645b3bdfc130c 100644 (file)
 /* defines internal maximum size for code fragment in cfi_intel_write_block() */
 #define CFI_MAX_INTEL_CODESIZE 256
 
+/* some id-types with specific handling */
+#define AT49BV6416     0x00d6
+#define AT49BV6416T    0x00d2
+
 static struct cfi_unlock_addresses cfi_unlock_addresses[] =
 {
        [CFI_UNLOCK_555_2AA] = { .unlock1 = 0x555, .unlock2 = 0x2aa },
@@ -700,10 +704,19 @@ static int cfi_read_atmel_pri_ext(struct flash_bank *bank)
        if (atmel_pri_ext.features & 0x02)
                pri_ext->EraseSuspend = 2;
 
-       if (atmel_pri_ext.bottom_boot)
-               pri_ext->TopBottom = 2;
-       else
-               pri_ext->TopBottom = 3;
+       /* some chips got it backwards... */
+       if (cfi_info->device_id == AT49BV6416 ||
+           cfi_info->device_id == AT49BV6416T) {
+               if (atmel_pri_ext.bottom_boot)
+                       pri_ext->TopBottom = 3;
+               else
+                       pri_ext->TopBottom = 2;
+       } else {
+               if (atmel_pri_ext.bottom_boot)
+                       pri_ext->TopBottom = 2;
+               else
+                       pri_ext->TopBottom = 3;
+       }
 
        pri_ext->_unlock1 = cfi_unlock_addresses[CFI_UNLOCK_555_2AA].unlock1;
        pri_ext->_unlock2 = cfi_unlock_addresses[CFI_UNLOCK_555_2AA].unlock2;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)