diff options
author | Bartlomiej Sieka <tur@semihalf.com> | 2007-11-26 12:55:18 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2008-01-10 17:07:12 -0500 |
commit | de7921f01a407e0cb38143363995db89a5f9a5c5 (patch) | |
tree | 425512d0db3500d05d2c4388d227e89ed82bb5d7 | |
parent | 78b65179d08e7e4466ba69d5ede85035a2c96358 (diff) |
[MTD] [NOR] Fix incorrect interface code for x16/x32 chips
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>
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0002.c | 6 | ||||
-rw-r--r-- | drivers/mtd/chips/cfi_probe.c | 12 | ||||
-rw-r--r-- | drivers/mtd/maps/scb2_flash.c | 2 | ||||
-rw-r--r-- | include/linux/mtd/cfi.h | 12 |
4 files changed, 23 insertions, 9 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 571226eefeb8..796bfeadea21 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | |||
@@ -342,10 +342,12 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary) | |||
342 | /* Modify the unlock address if we are in compatibility mode */ | 342 | /* Modify the unlock address if we are in compatibility mode */ |
343 | if ( /* x16 in x8 mode */ | 343 | if ( /* x16 in x8 mode */ |
344 | ((cfi->device_type == CFI_DEVICETYPE_X8) && | 344 | ((cfi->device_type == CFI_DEVICETYPE_X8) && |
345 | (cfi->cfiq->InterfaceDesc == 2)) || | 345 | (cfi->cfiq->InterfaceDesc == |
346 | CFI_INTERFACE_X8_BY_X16_ASYNC)) || | ||
346 | /* x32 in x16 mode */ | 347 | /* x32 in x16 mode */ |
347 | ((cfi->device_type == CFI_DEVICETYPE_X16) && | 348 | ((cfi->device_type == CFI_DEVICETYPE_X16) && |
348 | (cfi->cfiq->InterfaceDesc == 4))) | 349 | (cfi->cfiq->InterfaceDesc == |
350 | CFI_INTERFACE_X16_BY_X32_ASYNC))) | ||
349 | { | 351 | { |
350 | cfi->addr_unlock1 = 0xaaa; | 352 | cfi->addr_unlock1 = 0xaaa; |
351 | cfi->addr_unlock2 = 0x555; | 353 | cfi->addr_unlock2 = 0x555; |
diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c index 60e11a0ada97..f651b6ef1c5d 100644 --- a/drivers/mtd/chips/cfi_probe.c +++ b/drivers/mtd/chips/cfi_probe.c | |||
@@ -370,27 +370,27 @@ static void print_cfi_ident(struct cfi_ident *cfip) | |||
370 | printk("Device size: 0x%X bytes (%d MiB)\n", 1 << cfip->DevSize, 1<< (cfip->DevSize - 20)); | 370 | printk("Device size: 0x%X bytes (%d MiB)\n", 1 << cfip->DevSize, 1<< (cfip->DevSize - 20)); |
371 | printk("Flash Device Interface description: 0x%4.4X\n", cfip->InterfaceDesc); | 371 | printk("Flash Device Interface description: 0x%4.4X\n", cfip->InterfaceDesc); |
372 | switch(cfip->InterfaceDesc) { | 372 | switch(cfip->InterfaceDesc) { |
373 | case 0: | 373 | case CFI_INTERFACE_X8_ASYNC: |
374 | printk(" - x8-only asynchronous interface\n"); | 374 | printk(" - x8-only asynchronous interface\n"); |
375 | break; | 375 | break; |
376 | 376 | ||
377 | case 1: | 377 | case CFI_INTERFACE_X16_ASYNC: |
378 | printk(" - x16-only asynchronous interface\n"); | 378 | printk(" - x16-only asynchronous interface\n"); |
379 | break; | 379 | break; |
380 | 380 | ||
381 | case 2: | 381 | case CFI_INTERFACE_X8_BY_X16_ASYNC: |
382 | printk(" - supports x8 and x16 via BYTE# with asynchronous interface\n"); | 382 | printk(" - supports x8 and x16 via BYTE# with asynchronous interface\n"); |
383 | break; | 383 | break; |
384 | 384 | ||
385 | case 3: | 385 | case CFI_INTERFACE_X32_ASYNC: |
386 | printk(" - x32-only asynchronous interface\n"); | 386 | printk(" - x32-only asynchronous interface\n"); |
387 | break; | 387 | break; |
388 | 388 | ||
389 | case 4: | 389 | case CFI_INTERFACE_X16_BY_X32_ASYNC: |
390 | printk(" - supports x16 and x32 via Word# with asynchronous interface\n"); | 390 | printk(" - supports x16 and x32 via Word# with asynchronous interface\n"); |
391 | break; | 391 | break; |
392 | 392 | ||
393 | case 65535: | 393 | case CFI_INTERFACE_NOT_ALLOWED: |
394 | printk(" - Not Allowed / Reserved\n"); | 394 | printk(" - Not Allowed / Reserved\n"); |
395 | break; | 395 | break; |
396 | 396 | ||
diff --git a/drivers/mtd/maps/scb2_flash.c b/drivers/mtd/maps/scb2_flash.c index dcfb85840d1e..0fc5584324e3 100644 --- a/drivers/mtd/maps/scb2_flash.c +++ b/drivers/mtd/maps/scb2_flash.c | |||
@@ -79,7 +79,7 @@ scb2_fixup_mtd(struct mtd_info *mtd) | |||
79 | struct cfi_private *cfi = map->fldrv_priv; | 79 | struct cfi_private *cfi = map->fldrv_priv; |
80 | 80 | ||
81 | /* barf if this doesn't look right */ | 81 | /* barf if this doesn't look right */ |
82 | if (cfi->cfiq->InterfaceDesc != 1) { | 82 | if (cfi->cfiq->InterfaceDesc != CFI_INTERFACE_X16_ASYNC) { |
83 | printk(KERN_ERR MODNAME ": unsupported InterfaceDesc: %#x\n", | 83 | printk(KERN_ERR MODNAME ": unsupported InterfaceDesc: %#x\n", |
84 | cfi->cfiq->InterfaceDesc); | 84 | cfi->cfiq->InterfaceDesc); |
85 | return -1; | 85 | return -1; |
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index e17c5343cf51..b0ddf4b25862 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
@@ -98,6 +98,18 @@ static inline int cfi_interleave_supported(int i) | |||
98 | #define CFI_DEVICETYPE_X32 (32 / 8) | 98 | #define CFI_DEVICETYPE_X32 (32 / 8) |
99 | #define CFI_DEVICETYPE_X64 (64 / 8) | 99 | #define CFI_DEVICETYPE_X64 (64 / 8) |
100 | 100 | ||
101 | |||
102 | /* Device Interface Code Assignments from the "Common Flash Memory Interface | ||
103 | * Publication 100" dated December 1, 2001. | ||
104 | */ | ||
105 | #define CFI_INTERFACE_X8_ASYNC 0x0000 | ||
106 | #define CFI_INTERFACE_X16_ASYNC 0x0001 | ||
107 | #define CFI_INTERFACE_X8_BY_X16_ASYNC 0x0002 | ||
108 | #define CFI_INTERFACE_X32_ASYNC 0x0003 | ||
109 | #define CFI_INTERFACE_X16_BY_X32_ASYNC 0x0005 | ||
110 | #define CFI_INTERFACE_NOT_ALLOWED 0xffff | ||
111 | |||
112 | |||
101 | /* NB: We keep these structures in memory in HOST byteorder, except | 113 | /* NB: We keep these structures in memory in HOST byteorder, except |
102 | * where individually noted. | 114 | * where individually noted. |
103 | */ | 115 | */ |