ixp4xx: New patch to support FSG-3 buttons
[openwrt.git] / target / linux / adm5120 / patches-2.6.23 / 101-cfi_fixup_macronix_bootloc.patch
1 Index: linux-2.6.23/drivers/mtd/chips/cfi_cmdset_0002.c
2 ===================================================================
3 --- linux-2.6.23.orig/drivers/mtd/chips/cfi_cmdset_0002.c
4 +++ linux-2.6.23/drivers/mtd/chips/cfi_cmdset_0002.c
5 @@ -47,12 +47,19 @@
6 #define MANUFACTURER_AMD 0x0001
7 #define MANUFACTURER_ATMEL 0x001F
8 #define MANUFACTURER_SST 0x00BF
9 +#define MANUFACTURER_MACRONIX 0x00C2
10 #define SST49LF004B 0x0060
11 #define SST49LF040B 0x0050
12 #define SST49LF008A 0x005a
13 #define AT49BV6416 0x00d6
14 #define MANUFACTURER_SAMSUNG 0x00ec
15
16 +/* Macronix */
17 +#define MX29LV160B 0x2249 /* MX29LV160 Bottom-boot chip */
18 +#define MX29LV160T 0x22C4 /* MX29LV160 Top-boot chip */
19 +#define MX29LV320B 0x22A8 /* MX29LV320 Bottom-boot chip */
20 +#define MX29LV320T 0x22A7 /* MX29LV320 Top-boot chip */
21 +
22 static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
23 static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
24 static int cfi_amdstd_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
25 @@ -217,6 +224,41 @@ static void fixup_use_atmel_lock(struct
26 mtd->flags |= MTD_STUPID_LOCK;
27 }
28
29 +#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC
30 +/*
31 + * Some Macronix chips has no/bad bootblock information in the CFI table
32 + */
33 +static void fixup_macronix_bootloc(struct mtd_info *mtd, void* param)
34 +{
35 + struct map_info *map = mtd->priv;
36 + struct cfi_private *cfi = map->fldrv_priv;
37 + struct cfi_pri_amdstd *extp = cfi->cmdset_priv;
38 + __u8 t;
39 +
40 + switch (cfi->id) {
41 + /* TODO: put affected chip ids here */
42 + case MX29LV160B:
43 + case MX29LV320B:
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 + }
53 +
54 + if (extp->TopBottom == t)
55 + /* boot location detected by the CFI layer is correct */
56 + return;
57 +
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");
61 +}
62 +#endif /* CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC */
63 +
64 static struct cfi_fixup cfi_fixup_table[] = {
65 #ifdef AMD_BOOTLOC_BUG
66 { CFI_MFR_AMD, CFI_ID_ANY, fixup_amd_bootblock, NULL },
67 @@ -231,6 +273,9 @@ static struct cfi_fixup cfi_fixup_table[
68 { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_write_buffers, NULL, },
69 #endif
70 { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
71 +#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC
72 + { MANUFACTURER_MACRONIX, CFI_ID_ANY, fixup_macronix_bootloc, NULL, },
73 +#endif
74 { 0, 0, NULL, NULL }
75 };
76 static struct cfi_fixup jedec_fixup_table[] = {
77 Index: linux-2.6.23/drivers/mtd/chips/Kconfig
78 ===================================================================
79 --- linux-2.6.23.orig/drivers/mtd/chips/Kconfig
80 +++ linux-2.6.23/drivers/mtd/chips/Kconfig
81 @@ -196,6 +196,14 @@ config MTD_CFI_AMDSTD
82 provides support for one of those command sets, used on chips
83 including the AMD Am29LV320.
84
85 +config MTD_CFI_FIXUP_MACRONIX_BOOTLOC
86 + bool "Fix boot-block location for Macronix flash chips"
87 + depends on MTD_CFI_AMDSTD
88 + help
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
91 + this if your board has such chip.
92 +
93 config MTD_CFI_STAA
94 tristate "Support for ST (Advanced Architecture) flash chips"
95 depends on MTD_GEN_PROBE
This page took 0.049582 seconds and 5 git commands to generate.