aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor
diff options
context:
space:
mode:
authorAndreas Bießmann <andreas.devel@googlemail.com>2011-07-12 12:38:22 +0200
committerØyvind Harboe <oyvind.harboe@zylin.com>2011-08-09 20:19:37 +0200
commit6e5c37be29cdefc0ea2de6d06866811bc7e44cbd (patch)
treed414a8c628819fd90bdb8bd15280ae466d84d078 /src/flash/nor
parent7d2bf8805df5ec9f108758188e85f2d355f720c4 (diff)
flash/nor/cfi: fix TopBottom for atmel chips
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>
Diffstat (limited to 'src/flash/nor')
-rw-r--r--src/flash/nor/cfi.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c
index 3f1fbabe..f854dd63 100644
--- a/src/flash/nor/cfi.c
+++ b/src/flash/nor/cfi.c
@@ -42,6 +42,10 @@
/* 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;