diff options
author | Aaron Sierra <asierra@xes-inc.com> | 2011-11-14 19:44:34 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-01-09 13:06:13 -0500 |
commit | 8e987465a137d4824710e02550f06aa891c9b865 (patch) | |
tree | 26edb55e4a9fe8f2f9832ba045286d5b18d3cc40 /include/linux/mtd/cfi.h | |
parent | 342ff28f5a2e5aa3236617bd2bddf6c749677ef2 (diff) |
mtd: cfi: Allow per-mapping CFI device endianness
This patch allows each CFI device map to use its own endianness. The
globally defined CFI endianness (CONFIG_MTD_CFI_NOSWAP,
CONFIG_MTD_CFI_BE_BYTE_SWAP or CONFIG_MTD_CFI_LE_BYTE_SWAP) becomes the
default value which can be overridden by a driver for a particular device.
Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include/linux/mtd/cfi.h')
-rw-r--r-- | include/linux/mtd/cfi.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index d24925492972..d5d2ec6494bb 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
@@ -354,10 +354,10 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf | |||
354 | onecmd = cmd; | 354 | onecmd = cmd; |
355 | break; | 355 | break; |
356 | case 2: | 356 | case 2: |
357 | onecmd = cpu_to_cfi16(cmd); | 357 | onecmd = cpu_to_cfi16(map, cmd); |
358 | break; | 358 | break; |
359 | case 4: | 359 | case 4: |
360 | onecmd = cpu_to_cfi32(cmd); | 360 | onecmd = cpu_to_cfi32(map, cmd); |
361 | break; | 361 | break; |
362 | } | 362 | } |
363 | 363 | ||
@@ -437,10 +437,10 @@ static inline unsigned long cfi_merge_status(map_word val, struct map_info *map, | |||
437 | case 1: | 437 | case 1: |
438 | break; | 438 | break; |
439 | case 2: | 439 | case 2: |
440 | res = cfi16_to_cpu(res); | 440 | res = cfi16_to_cpu(map, res); |
441 | break; | 441 | break; |
442 | case 4: | 442 | case 4: |
443 | res = cfi32_to_cpu(res); | 443 | res = cfi32_to_cpu(map, res); |
444 | break; | 444 | break; |
445 | default: BUG(); | 445 | default: BUG(); |
446 | } | 446 | } |
@@ -480,12 +480,12 @@ static inline uint8_t cfi_read_query(struct map_info *map, uint32_t addr) | |||
480 | if (map_bankwidth_is_1(map)) { | 480 | if (map_bankwidth_is_1(map)) { |
481 | return val.x[0]; | 481 | return val.x[0]; |
482 | } else if (map_bankwidth_is_2(map)) { | 482 | } else if (map_bankwidth_is_2(map)) { |
483 | return cfi16_to_cpu(val.x[0]); | 483 | return cfi16_to_cpu(map, val.x[0]); |
484 | } else { | 484 | } else { |
485 | /* No point in a 64-bit byteswap since that would just be | 485 | /* No point in a 64-bit byteswap since that would just be |
486 | swapping the responses from different chips, and we are | 486 | swapping the responses from different chips, and we are |
487 | only interested in one chip (a representative sample) */ | 487 | only interested in one chip (a representative sample) */ |
488 | return cfi32_to_cpu(val.x[0]); | 488 | return cfi32_to_cpu(map, val.x[0]); |
489 | } | 489 | } |
490 | } | 490 | } |
491 | 491 | ||
@@ -496,12 +496,12 @@ static inline uint16_t cfi_read_query16(struct map_info *map, uint32_t addr) | |||
496 | if (map_bankwidth_is_1(map)) { | 496 | if (map_bankwidth_is_1(map)) { |
497 | return val.x[0] & 0xff; | 497 | return val.x[0] & 0xff; |
498 | } else if (map_bankwidth_is_2(map)) { | 498 | } else if (map_bankwidth_is_2(map)) { |
499 | return cfi16_to_cpu(val.x[0]); | 499 | return cfi16_to_cpu(map, val.x[0]); |
500 | } else { | 500 | } else { |
501 | /* No point in a 64-bit byteswap since that would just be | 501 | /* No point in a 64-bit byteswap since that would just be |
502 | swapping the responses from different chips, and we are | 502 | swapping the responses from different chips, and we are |
503 | only interested in one chip (a representative sample) */ | 503 | only interested in one chip (a representative sample) */ |
504 | return cfi32_to_cpu(val.x[0]); | 504 | return cfi32_to_cpu(map, val.x[0]); |
505 | } | 505 | } |
506 | } | 506 | } |
507 | 507 | ||