1 #include <asm/byteorder.h>
3 #ifndef CONFIG_MTD_CFI_ADV_OPTIONS
5 #define CFI_HOST_ENDIAN
9 #ifdef CONFIG_MTD_CFI_NOSWAP
10 #define CFI_HOST_ENDIAN
13 #ifdef CONFIG_MTD_CFI_LE_BYTE_SWAP
14 #define CFI_LITTLE_ENDIAN
17 #ifdef CONFIG_MTD_CFI_BE_BYTE_SWAP
18 #define CFI_BIG_ENDIAN
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)
51 #error No CFI endianness defined