fpga.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #ifndef __MACH_SDK7786_FPGA_H
  2. #define __MACH_SDK7786_FPGA_H
  3. #include <linux/io.h>
  4. #include <linux/types.h>
  5. #include <linux/bitops.h>
  6. #define SRSTR 0x000
  7. #define SRSTR_MAGIC 0x1971 /* Fixed magical read value */
  8. #define INTASR 0x010
  9. #define INTAMR 0x020
  10. #define MODSWR 0x030
  11. #define INTTESTR 0x040
  12. #define SYSSR 0x050
  13. #define NRGPR 0x060
  14. #define NMISR 0x070
  15. #define NMIMR 0x080
  16. #define NMIMR_MAN_NMIM BIT(0) /* Manual NMI mask */
  17. #define NMIMR_AUX_NMIM BIT(1) /* Auxiliary NMI mask */
  18. #define INTBSR 0x090
  19. #define INTBMR 0x0a0
  20. #define USRLEDR 0x0b0
  21. #define MAPSWR 0x0c0
  22. #define FPGAVR 0x0d0
  23. #define FPGADR 0x0e0
  24. #define PCBRR 0x0f0
  25. #define RSR 0x100
  26. #define EXTASR 0x110
  27. #define SPCAR 0x120
  28. #define INTMSR 0x130
  29. #define PCIECR 0x140
  30. #define FAER 0x150
  31. #define USRGPIR 0x160
  32. /* 0x170 reserved */
  33. #define LCLASR 0x180
  34. #define SBCR 0x190
  35. #define SCBR_I2CMEN BIT(0) /* FPGA I2C master enable */
  36. #define SCBR_I2CCEN BIT(1) /* CPU I2C master enable */
  37. #define PWRCR 0x1a0
  38. #define PWRCR_SCISEL0 BIT(0)
  39. #define PWRCR_SCISEL1 BIT(1)
  40. #define PWRCR_SCIEN BIT(2) /* Serial port enable */
  41. #define PWRCR_PDWNACK BIT(5) /* Power down acknowledge */
  42. #define PWRCR_PDWNREQ BIT(7) /* Power down request */
  43. #define PWRCR_INT2 BIT(11) /* INT2 connection to power manager */
  44. #define PWRCR_BUPINIT BIT(13) /* DDR backup initialize */
  45. #define PWRCR_BKPRST BIT(15) /* Backup power reset */
  46. #define SPCBR 0x1b0
  47. #define SPICR 0x1c0
  48. #define SPIDR 0x1d0
  49. #define I2CCR 0x1e0
  50. #define I2CDR 0x1f0
  51. #define FPGACR 0x200
  52. #define IASELR1 0x210
  53. #define IASELR2 0x220
  54. #define IASELR3 0x230
  55. #define IASELR4 0x240
  56. #define IASELR5 0x250
  57. #define IASELR6 0x260
  58. #define IASELR7 0x270
  59. #define IASELR8 0x280
  60. #define IASELR9 0x290
  61. #define IASELR10 0x2a0
  62. #define IASELR11 0x2b0
  63. #define IASELR12 0x2c0
  64. #define IASELR13 0x2d0
  65. #define IASELR14 0x2e0
  66. #define IASELR15 0x2f0
  67. /* 0x300 reserved */
  68. #define IBSELR1 0x310
  69. #define IBSELR2 0x320
  70. #define IBSELR3 0x330
  71. #define IBSELR4 0x340
  72. #define IBSELR5 0x350
  73. #define IBSELR6 0x360
  74. #define IBSELR7 0x370
  75. #define IBSELR8 0x380
  76. #define IBSELR9 0x390
  77. #define IBSELR10 0x3a0
  78. #define IBSELR11 0x3b0
  79. #define IBSELR12 0x3c0
  80. #define IBSELR13 0x3d0
  81. #define IBSELR14 0x3e0
  82. #define IBSELR15 0x3f0
  83. #define USRACR 0x400
  84. #define BEEPR 0x410
  85. #define USRLCDR 0x420
  86. #define SMBCR 0x430
  87. #define SMBDR 0x440
  88. #define USBCR 0x450
  89. #define AMSR 0x460
  90. #define ACCR 0x470
  91. #define SDIFCR 0x480
  92. /* arch/sh/boards/mach-sdk7786/fpga.c */
  93. extern void __iomem *sdk7786_fpga_base;
  94. extern void sdk7786_fpga_init(void);
  95. #define SDK7786_FPGA_REGADDR(reg) (sdk7786_fpga_base + (reg))
  96. /*
  97. * A convenience wrapper from register offset to internal I2C address,
  98. * when the FPGA is in I2C slave mode.
  99. */
  100. #define SDK7786_FPGA_I2CADDR(reg) ((reg) >> 3)
  101. static inline u16 fpga_read_reg(unsigned int reg)
  102. {
  103. return ioread16(sdk7786_fpga_base + reg);
  104. }
  105. static inline void fpga_write_reg(u16 val, unsigned int reg)
  106. {
  107. iowrite16(val, sdk7786_fpga_base + reg);
  108. }
  109. #endif /* __MACH_SDK7786_FPGA_H */