Ignore:
Timestamp:
2007-07-03T19:04:46+02:00 (9 years ago)
Author:
juhosg
Message:

[adm5120] more generic handling of Macronix flash chips, fix #2008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/adm5120-2.6/patches-2.6.22/101-cfi-fixup-macronix-bootloc.patch

    r7797 r7863  
    33--- linux-2.6.22-rc6.orig/drivers/mtd/chips/cfi_cmdset_0002.c 
    44+++ linux-2.6.22-rc6/drivers/mtd/chips/cfi_cmdset_0002.c 
    5 @@ -47,12 +47,17 @@ 
     5@@ -47,12 +47,19 @@ 
    66 #define MANUFACTURER_AMD       0x0001 
    77 #define MANUFACTURER_ATMEL     0x001F 
     
    1616+/* Macronix */ 
    1717+#define MX29LV160B     0x2249  /* MX29LV160 Bottom-boot chip */ 
     18+#define MX29LV160T     0x22C4  /* MX29LV160 Top-boot chip */ 
    1819+#define MX29LV320B     0x22A8  /* MX29LV320 Bottom-boot chip */ 
     20+#define MX29LV320T     0x22A7  /* MX29LV320 Top-boot chip */ 
    1921+ 
    2022 static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); 
    2123 static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); 
    2224 static int cfi_amdstd_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); 
    23 @@ -217,6 +222,35 @@ static void fixup_use_atmel_lock(struct  
     25@@ -217,6 +224,41 @@ static void fixup_use_atmel_lock(struct  
    2426        mtd->flags |= MTD_STUPID_LOCK; 
    2527 } 
     
    2729+#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC 
    2830+/* 
    29 + * Some Macronix chips has bad bootblock information in the CFI table 
     31+ * Some Macronix chips has no/bad bootblock information in the CFI table 
    3032+ */ 
    3133+static void fixup_macronix_bootloc(struct mtd_info *mtd, void* param) 
     
    3436+       struct cfi_private *cfi = map->fldrv_priv; 
    3537+       struct cfi_pri_amdstd *extp = cfi->cmdset_priv; 
    36 +       __u8 major = extp->MajorVersion; 
    37 +       __u8 minor = extp->MinorVersion; 
     38+       __u8 t; 
    3839+ 
    3940+       switch (cfi->id) { 
     
    4142+       case MX29LV160B: 
    4243+       case MX29LV320B: 
    43 +               if (((major << 8) | minor) != 0x3131) 
    44 +                       break; 
     44+               t = 2;  /* Bottom boot */ 
     45+               break; 
     46+       case MX29LV160T: 
     47+       case MX29LV320T: 
     48+               t = 3;  /* Top boot */ 
     49+               break; 
     50+       default: 
     51+               return; 
     52+       } 
    4553+ 
    46 +               if (extp->TopBottom == 2) 
    47 +                       break; 
     54+       if (extp->TopBottom == t) 
     55+               /* boot location detected by the CFI layer is correct */ 
     56+               return; 
    4857+ 
    49 +               extp->TopBottom = 2;    /* Bottom boot */ 
    50 +               printk("%s: weird Macronix chip detected, id:0x%04X, boot location " 
    51 +                       "forced to bottom\n", map->name, cfi->id); 
    52 +       } 
     58+       extp->TopBottom = t; 
     59+       printk("%s: Macronix chip detected, id:0x%04X, boot location forced " 
     60+               "to %s\n", map->name, cfi->id, (t == 2) ? "bottom" : "top"); 
    5361+} 
    5462+#endif /* CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC */ 
     
    5765 #ifdef AMD_BOOTLOC_BUG 
    5866        { CFI_MFR_AMD, CFI_ID_ANY, fixup_amd_bootblock, NULL }, 
    59 @@ -231,6 +265,9 @@ static struct cfi_fixup cfi_fixup_table[ 
     67@@ -231,6 +273,9 @@ static struct cfi_fixup cfi_fixup_table[ 
    6068        { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_write_buffers, NULL, }, 
    6169 #endif 
     
    7987+       depends on MTD_CFI_AMDSTD 
    8088+       help 
    81 +         Some Macronix flash chips have wrong boot-block location in the 
    82 +         CFI table, and the driver may detect the type incorrectly. Select  
     89+         Some Macronix flash chips have no/wrong boot-block location in the 
     90+         CFI table, and the driver may detect the type incorrectly. Select 
    8391+         this if your board has such chip. 
    8492+ 
Note: See TracChangeset for help on using the changeset viewer.