Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #include <asm/byteorder.h> |
| 2 | |
| 3 | #ifndef CONFIG_MTD_CFI_ADV_OPTIONS |
| 4 | |
| 5 | #define CFI_HOST_ENDIAN |
| 6 | |
| 7 | #else |
| 8 | |
| 9 | #ifdef CONFIG_MTD_CFI_NOSWAP |
| 10 | #define CFI_HOST_ENDIAN |
| 11 | #endif |
| 12 | |
| 13 | #ifdef CONFIG_MTD_CFI_LE_BYTE_SWAP |
| 14 | #define CFI_LITTLE_ENDIAN |
| 15 | #endif |
| 16 | |
| 17 | #ifdef CONFIG_MTD_CFI_BE_BYTE_SWAP |
| 18 | #define CFI_BIG_ENDIAN |
| 19 | #endif |
| 20 | |
| 21 | #endif |
| 22 | |
| 23 | #if defined(CFI_LITTLE_ENDIAN) |
| 24 | #define cpu_to_cfi8(x) (x) |
| 25 | #define cfi8_to_cpu(x) (x) |
| 26 | #define cpu_to_cfi16(x) cpu_to_le16(x) |
| 27 | #define cpu_to_cfi32(x) cpu_to_le32(x) |
| 28 | #define cpu_to_cfi64(x) cpu_to_le64(x) |
| 29 | #define cfi16_to_cpu(x) le16_to_cpu(x) |
| 30 | #define cfi32_to_cpu(x) le32_to_cpu(x) |
| 31 | #define cfi64_to_cpu(x) le64_to_cpu(x) |
| 32 | #elif defined (CFI_BIG_ENDIAN) |
| 33 | #define cpu_to_cfi8(x) (x) |
| 34 | #define cfi8_to_cpu(x) (x) |
| 35 | #define cpu_to_cfi16(x) cpu_to_be16(x) |
| 36 | #define cpu_to_cfi32(x) cpu_to_be32(x) |
| 37 | #define cpu_to_cfi64(x) cpu_to_be64(x) |
| 38 | #define cfi16_to_cpu(x) be16_to_cpu(x) |
| 39 | #define cfi32_to_cpu(x) be32_to_cpu(x) |
| 40 | #define cfi64_to_cpu(x) be64_to_cpu(x) |
| 41 | #elif defined (CFI_HOST_ENDIAN) |
| 42 | #define cpu_to_cfi8(x) (x) |
| 43 | #define cfi8_to_cpu(x) (x) |
| 44 | #define cpu_to_cfi16(x) (x) |
| 45 | #define cpu_to_cfi32(x) (x) |
| 46 | #define cpu_to_cfi64(x) (x) |
| 47 | #define cfi16_to_cpu(x) (x) |
| 48 | #define cfi32_to_cpu(x) (x) |
| 49 | #define cfi64_to_cpu(x) (x) |
| 50 | #else |
| 51 | #error No CFI endianness defined |
| 52 | #endif |