cfi_endian.h 1.2 KB

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