mtd: nand: support alternate BB marker locations on MLC
[safe/jmp/linux-2.6] / drivers / mtd / chips / cfi_probe.c
index f657d16..b2acd32 100644 (file)
@@ -158,6 +158,7 @@ static int __xipram cfi_chip_setup(struct map_info *map,
        __u32 base = 0;
        int num_erase_regions = cfi_read_query(map, base + (0x10 + 28)*ofs_factor);
        int i;
+       int addr_unlock1 = 0x555, addr_unlock2 = 0x2AA;
 
        xip_enable(base, map, cfi);
 #ifdef DEBUG_CFI
@@ -205,6 +206,11 @@ static int __xipram cfi_chip_setup(struct map_info *map,
 #endif
        }
 
+       if (cfi->cfiq->P_ID == P_ID_SST_OLD) {
+               addr_unlock1 = 0x5555;
+               addr_unlock2 = 0x2AAA;
+       }
+
        /*
         * Note we put the device back into Read Mode BEFORE going into Auto
         * Select Mode, as some devices support nesting of modes, others
@@ -214,9 +220,9 @@ static int __xipram cfi_chip_setup(struct map_info *map,
         * back into Read Mode, which is a nop in this case).
         */
        cfi_send_gen_cmd(0xf0,     0, base, map, cfi, cfi->device_type, NULL);
-       cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL);
-       cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL);
-       cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL);
+       cfi_send_gen_cmd(0xaa, addr_unlock1, base, map, cfi, cfi->device_type, NULL);
+       cfi_send_gen_cmd(0x55, addr_unlock2, base, map, cfi, cfi->device_type, NULL);
+       cfi_send_gen_cmd(0x90, addr_unlock1, base, map, cfi, cfi->device_type, NULL);
        cfi->mfr = cfi_read_query16(map, base);
        cfi->id = cfi_read_query16(map, base + ofs_factor);
 
@@ -270,6 +276,9 @@ static char *vendorname(__u16 vendor)
        case P_ID_SST_PAGE:
                return "SST Page Write";
 
+       case P_ID_SST_OLD:
+               return "SST 39VF160x/39VF320x";
+
        case P_ID_INTEL_PERFORMANCE:
                return "Intel Performance Code";