[MTD] [NOR] Fix incorrect interface code for x16/x32 chips
authorBartlomiej Sieka <tur@semihalf.com>
Mon, 26 Nov 2007 17:55:18 +0000 (18:55 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Thu, 10 Jan 2008 22:07:12 +0000 (22:07 +0000)
According to "Common Flash Memory Interface Publication 100" dated December 1,
2001, the interface code for x16/x32 chips is 0x0005, and not 0x0004 used so
far.

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
drivers/mtd/chips/cfi_cmdset_0002.c
drivers/mtd/chips/cfi_probe.c
drivers/mtd/maps/scb2_flash.c
include/linux/mtd/cfi.h

index 571226eefeb8b7fa31599f6f1b36250e261d7ca5..796bfeadea21e85622d98ce6345843a97e33f39d 100644 (file)
@@ -342,10 +342,12 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
                /* Modify the unlock address if we are in compatibility mode */
                if (    /* x16 in x8 mode */
                        ((cfi->device_type == CFI_DEVICETYPE_X8) &&
-                               (cfi->cfiq->InterfaceDesc == 2)) ||
+                               (cfi->cfiq->InterfaceDesc ==
+                                       CFI_INTERFACE_X8_BY_X16_ASYNC)) ||
                        /* x32 in x16 mode */
                        ((cfi->device_type == CFI_DEVICETYPE_X16) &&
-                               (cfi->cfiq->InterfaceDesc == 4)))
+                               (cfi->cfiq->InterfaceDesc ==
+                                       CFI_INTERFACE_X16_BY_X32_ASYNC)))
                {
                        cfi->addr_unlock1 = 0xaaa;
                        cfi->addr_unlock2 = 0x555;
index 60e11a0ada97b4d6ae9b1792eec64a45e6865da8..f651b6ef1c5d6c44805b066fab343eb965f952d0 100644 (file)
@@ -370,27 +370,27 @@ static void print_cfi_ident(struct cfi_ident *cfip)
        printk("Device size: 0x%X bytes (%d MiB)\n", 1 << cfip->DevSize, 1<< (cfip->DevSize - 20));
        printk("Flash Device Interface description: 0x%4.4X\n", cfip->InterfaceDesc);
        switch(cfip->InterfaceDesc) {
-       case 0:
+       case CFI_INTERFACE_X8_ASYNC:
                printk("  - x8-only asynchronous interface\n");
                break;
 
-       case 1:
+       case CFI_INTERFACE_X16_ASYNC:
                printk("  - x16-only asynchronous interface\n");
                break;
 
-       case 2:
+       case CFI_INTERFACE_X8_BY_X16_ASYNC:
                printk("  - supports x8 and x16 via BYTE# with asynchronous interface\n");
                break;
 
-       case 3:
+       case CFI_INTERFACE_X32_ASYNC:
                printk("  - x32-only asynchronous interface\n");
                break;
 
-       case 4:
+       case CFI_INTERFACE_X16_BY_X32_ASYNC:
                printk("  - supports x16 and x32 via Word# with asynchronous interface\n");
                break;
 
-       case 65535:
+       case CFI_INTERFACE_NOT_ALLOWED:
                printk("  - Not Allowed / Reserved\n");
                break;
 
index dcfb85840d1e4c5d5fd355dc783b7f55aef75464..0fc5584324e3d38488dd62627867787c2201e5d1 100644 (file)
@@ -79,7 +79,7 @@ scb2_fixup_mtd(struct mtd_info *mtd)
        struct cfi_private *cfi = map->fldrv_priv;
 
        /* barf if this doesn't look right */
-       if (cfi->cfiq->InterfaceDesc != 1) {
+       if (cfi->cfiq->InterfaceDesc != CFI_INTERFACE_X16_ASYNC) {
                printk(KERN_ERR MODNAME ": unsupported InterfaceDesc: %#x\n",
                    cfi->cfiq->InterfaceDesc);
                return -1;
index e17c5343cf517e6938c93551e6878400b6a11046..b0ddf4b25862392d90443a8ad88a9d6c7ad68b95 100644 (file)
@@ -98,6 +98,18 @@ static inline int cfi_interleave_supported(int i)
 #define CFI_DEVICETYPE_X32 (32 / 8)
 #define CFI_DEVICETYPE_X64 (64 / 8)
 
+
+/* Device Interface Code Assignments from the "Common Flash Memory Interface
+ * Publication 100" dated December 1, 2001.
+ */
+#define CFI_INTERFACE_X8_ASYNC         0x0000
+#define CFI_INTERFACE_X16_ASYNC                0x0001
+#define CFI_INTERFACE_X8_BY_X16_ASYNC  0x0002
+#define CFI_INTERFACE_X32_ASYNC                0x0003
+#define CFI_INTERFACE_X16_BY_X32_ASYNC 0x0005
+#define CFI_INTERFACE_NOT_ALLOWED      0xffff
+
+
 /* NB: We keep these structures in memory in HOST byteorder, except
  * where individually noted.
  */