ts72xx.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * arch/arm/mach-ep93xx/include/mach/ts72xx.h
  4. */
  5. /*
  6. * TS72xx memory map:
  7. *
  8. * virt phys size
  9. * febff000 22000000 4K model number register (bits 0-2)
  10. * febfe000 22400000 4K options register
  11. * febfd000 22800000 4K options register #2
  12. * febfc000 23400000 4K CPLD version register
  13. */
  14. #ifndef __TS72XX_H_
  15. #define __TS72XX_H_
  16. #define TS72XX_MODEL_PHYS_BASE 0x22000000
  17. #define TS72XX_MODEL_VIRT_BASE IOMEM(0xfebff000)
  18. #define TS72XX_MODEL_SIZE 0x00001000
  19. #define TS72XX_MODEL_TS7200 0x00
  20. #define TS72XX_MODEL_TS7250 0x01
  21. #define TS72XX_MODEL_TS7260 0x02
  22. #define TS72XX_MODEL_TS7300 0x03
  23. #define TS72XX_MODEL_TS7400 0x04
  24. #define TS72XX_MODEL_MASK 0x07
  25. #define TS72XX_OPTIONS_PHYS_BASE 0x22400000
  26. #define TS72XX_OPTIONS_VIRT_BASE IOMEM(0xfebfe000)
  27. #define TS72XX_OPTIONS_SIZE 0x00001000
  28. #define TS72XX_OPTIONS_COM2_RS485 0x02
  29. #define TS72XX_OPTIONS_MAX197 0x01
  30. #define TS72XX_OPTIONS2_PHYS_BASE 0x22800000
  31. #define TS72XX_OPTIONS2_VIRT_BASE IOMEM(0xfebfd000)
  32. #define TS72XX_OPTIONS2_SIZE 0x00001000
  33. #define TS72XX_OPTIONS2_TS9420 0x04
  34. #define TS72XX_OPTIONS2_TS9420_BOOT 0x02
  35. #define TS72XX_CPLDVER_PHYS_BASE 0x23400000
  36. #define TS72XX_CPLDVER_VIRT_BASE IOMEM(0xfebfc000)
  37. #define TS72XX_CPLDVER_SIZE 0x00001000
  38. #ifndef __ASSEMBLY__
  39. static inline int ts72xx_model(void)
  40. {
  41. return __raw_readb(TS72XX_MODEL_VIRT_BASE) & TS72XX_MODEL_MASK;
  42. }
  43. static inline int board_is_ts7200(void)
  44. {
  45. return ts72xx_model() == TS72XX_MODEL_TS7200;
  46. }
  47. static inline int board_is_ts7250(void)
  48. {
  49. return ts72xx_model() == TS72XX_MODEL_TS7250;
  50. }
  51. static inline int board_is_ts7260(void)
  52. {
  53. return ts72xx_model() == TS72XX_MODEL_TS7260;
  54. }
  55. static inline int board_is_ts7300(void)
  56. {
  57. return ts72xx_model() == TS72XX_MODEL_TS7300;
  58. }
  59. static inline int board_is_ts7400(void)
  60. {
  61. return ts72xx_model() == TS72XX_MODEL_TS7400;
  62. }
  63. static inline int is_max197_installed(void)
  64. {
  65. return !!(__raw_readb(TS72XX_OPTIONS_VIRT_BASE) &
  66. TS72XX_OPTIONS_MAX197);
  67. }
  68. static inline int is_ts9420_installed(void)
  69. {
  70. return !!(__raw_readb(TS72XX_OPTIONS2_VIRT_BASE) &
  71. TS72XX_OPTIONS2_TS9420);
  72. }
  73. #endif
  74. #endif /* __TS72XX_H_ */