diff options
author | Todd Poynor <tpoynor@mvista.com> | 2005-11-15 18:28:20 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-11-29 13:27:24 -0500 |
commit | 987d24018dc83d27e491674c50ff2272f51eb719 (patch) | |
tree | 3cef69b2a161db4a194cec81b9f3bd28b009dc0c /include/linux/mtd/cfi.h | |
parent | 3eb8ceac486ed9b6eceed098423f1ca6b180ec9d (diff) |
[MTD] CFI: Use 16-bit access to autoselect/read device id data
Recent models of Intel/Sharp and Spansion CFI flash now have significant
bits in the upper byte of device ID codes, read via what Spansion calls
"autoselect" and Intel calls "read device identifier". Currently these
values are truncated to the low 8 bits in the mtd data structures, as
all CFI read query info has previously been read one byte at a time.
Add a new method for reading 16-bit info, currently just manufacturer
and device codes; datasheets hint at future uses for upper bytes in
other fields.
Signed-off-by: Todd Poynor <tpoynor@mvista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/mtd/cfi.h')
-rw-r--r-- | include/linux/mtd/cfi.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index 3c9ea4b7adda..23a568910341 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
@@ -1,7 +1,7 @@ | |||
1 | 1 | ||
2 | /* Common Flash Interface structures | 2 | /* Common Flash Interface structures |
3 | * See http://support.intel.com/design/flash/technote/index.htm | 3 | * See http://support.intel.com/design/flash/technote/index.htm |
4 | * $Id: cfi.h,v 1.56 2005/11/07 11:14:54 gleixner Exp $ | 4 | * $Id: cfi.h,v 1.57 2005/11/15 23:28:17 tpoynor Exp $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __MTD_CFI_H__ | 7 | #ifndef __MTD_CFI_H__ |
@@ -426,6 +426,22 @@ static inline uint8_t cfi_read_query(struct map_info *map, uint32_t addr) | |||
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | static inline uint16_t cfi_read_query16(struct map_info *map, uint32_t addr) | ||
430 | { | ||
431 | map_word val = map_read(map, addr); | ||
432 | |||
433 | if (map_bankwidth_is_1(map)) { | ||
434 | return val.x[0] & 0xff; | ||
435 | } else if (map_bankwidth_is_2(map)) { | ||
436 | return cfi16_to_cpu(val.x[0]); | ||
437 | } else { | ||
438 | /* No point in a 64-bit byteswap since that would just be | ||
439 | swapping the responses from different chips, and we are | ||
440 | only interested in one chip (a representative sample) */ | ||
441 | return cfi32_to_cpu(val.x[0]); | ||
442 | } | ||
443 | } | ||
444 | |||
429 | static inline void cfi_udelay(int us) | 445 | static inline void cfi_udelay(int us) |
430 | { | 446 | { |
431 | if (us >= 1000) { | 447 | if (us >= 1000) { |