fpga.h 2.5 KB

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