]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[MTD] [NOR] AT49BV6416 has swapped erase regions
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Tue, 30 Sep 2008 11:55:33 +0000 (13:55 +0200)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 18 Oct 2008 11:53:15 +0000 (12:53 +0100)
The CFI information read from AT49BV6416 lists the erase regions in the
wrong order, causing problems when trying to erase or update the first
or last 64KiB block.

Work around this by inverting the "top boot" flag, which will
effectively reverse the order of the erase regions.

This chip is obsolete, but it's used in some existing designs.

Signed-off-by: HÃ¥vard Skinnemoen <haavard.skinnemoen@atmel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/chips/cfi_cmdset_0002.c

index db16b7b0723fc8b23e10f4623fe2ba02d18ebe35..3e6f5d8609e8e513b38e5110bc7719a3fce5c1d0 100644 (file)
@@ -213,10 +213,18 @@ static void fixup_convert_atmel_pri(struct mtd_info *mtd, void *param)
        if (atmel_pri.Features & 0x02)
                extp->EraseSuspend = 2;
 
-       if (atmel_pri.BottomBoot)
-               extp->TopBottom = 2;
-       else
-               extp->TopBottom = 3;
+       /* Some chips got it backwards... */
+       if (cfi->id == AT49BV6416) {
+               if (atmel_pri.BottomBoot)
+                       extp->TopBottom = 3;
+               else
+                       extp->TopBottom = 2;
+       } else {
+               if (atmel_pri.BottomBoot)
+                       extp->TopBottom = 2;
+               else
+                       extp->TopBottom = 3;
+       }
 
        /* burst write mode not supported */
        cfi->cfiq->BufWriteTimeoutTyp = 0;