fpga_defs.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. /* $Date: 2005/03/07 23:59:05 $ $RCSfile: fpga_defs.h,v $ $Revision: 1.4 $ */
  2. /*
  3. * FPGA specific definitions
  4. */
  5. #ifndef __CHELSIO_FPGA_DEFS_H__
  6. #define __CHELSIO_FPGA_DEFS_H__
  7. #define FPGA_PCIX_ADDR_VERSION 0xA08
  8. #define FPGA_PCIX_ADDR_STAT 0xA0C
  9. /* FPGA master interrupt Cause/Enable bits */
  10. #define FPGA_PCIX_INTERRUPT_SGE_ERROR 0x1
  11. #define FPGA_PCIX_INTERRUPT_SGE_DATA 0x2
  12. #define FPGA_PCIX_INTERRUPT_TP 0x4
  13. #define FPGA_PCIX_INTERRUPT_MC3 0x8
  14. #define FPGA_PCIX_INTERRUPT_GMAC 0x10
  15. #define FPGA_PCIX_INTERRUPT_PCIX 0x20
  16. /* TP interrupt register addresses */
  17. #define FPGA_TP_ADDR_INTERRUPT_ENABLE 0xA10
  18. #define FPGA_TP_ADDR_INTERRUPT_CAUSE 0xA14
  19. #define FPGA_TP_ADDR_VERSION 0xA18
  20. /* TP interrupt Cause/Enable bits */
  21. #define FPGA_TP_INTERRUPT_MC4 0x1
  22. #define FPGA_TP_INTERRUPT_MC5 0x2
  23. /*
  24. * PM interrupt register addresses
  25. */
  26. #define FPGA_MC3_REG_INTRENABLE 0xA20
  27. #define FPGA_MC3_REG_INTRCAUSE 0xA24
  28. #define FPGA_MC3_REG_VERSION 0xA28
  29. /*
  30. * GMAC interrupt register addresses
  31. */
  32. #define FPGA_GMAC_ADDR_INTERRUPT_ENABLE 0xA30
  33. #define FPGA_GMAC_ADDR_INTERRUPT_CAUSE 0xA34
  34. #define FPGA_GMAC_ADDR_VERSION 0xA38
  35. /* GMAC Cause/Enable bits */
  36. #define FPGA_GMAC_INTERRUPT_PORT0 0x1
  37. #define FPGA_GMAC_INTERRUPT_PORT1 0x2
  38. #define FPGA_GMAC_INTERRUPT_PORT2 0x4
  39. #define FPGA_GMAC_INTERRUPT_PORT3 0x8
  40. /* MI0 registers */
  41. #define A_MI0_CLK 0xb00
  42. #define S_MI0_CLK_DIV 0
  43. #define M_MI0_CLK_DIV 0xff
  44. #define V_MI0_CLK_DIV(x) ((x) << S_MI0_CLK_DIV)
  45. #define G_MI0_CLK_DIV(x) (((x) >> S_MI0_CLK_DIV) & M_MI0_CLK_DIV)
  46. #define S_MI0_CLK_CNT 8
  47. #define M_MI0_CLK_CNT 0xff
  48. #define V_MI0_CLK_CNT(x) ((x) << S_MI0_CLK_CNT)
  49. #define G_MI0_CLK_CNT(x) (((x) >> S_MI0_CLK_CNT) & M_MI0_CLK_CNT)
  50. #define A_MI0_CSR 0xb04
  51. #define S_MI0_CSR_POLL 0
  52. #define V_MI0_CSR_POLL(x) ((x) << S_MI0_CSR_POLL)
  53. #define F_MI0_CSR_POLL V_MI0_CSR_POLL(1U)
  54. #define S_MI0_PREAMBLE 1
  55. #define V_MI0_PREAMBLE(x) ((x) << S_MI0_PREAMBLE)
  56. #define F_MI0_PREAMBLE V_MI0_PREAMBLE(1U)
  57. #define S_MI0_INTR_ENABLE 2
  58. #define V_MI0_INTR_ENABLE(x) ((x) << S_MI0_INTR_ENABLE)
  59. #define F_MI0_INTR_ENABLE V_MI0_INTR_ENABLE(1U)
  60. #define S_MI0_BUSY 3
  61. #define V_MI0_BUSY(x) ((x) << S_MI0_BUSY)
  62. #define F_MI0_BUSY V_MI0_BUSY(1U)
  63. #define S_MI0_MDIO 4
  64. #define V_MI0_MDIO(x) ((x) << S_MI0_MDIO)
  65. #define F_MI0_MDIO V_MI0_MDIO(1U)
  66. #define A_MI0_ADDR 0xb08
  67. #define S_MI0_PHY_REG_ADDR 0
  68. #define M_MI0_PHY_REG_ADDR 0x1f
  69. #define V_MI0_PHY_REG_ADDR(x) ((x) << S_MI0_PHY_REG_ADDR)
  70. #define G_MI0_PHY_REG_ADDR(x) (((x) >> S_MI0_PHY_REG_ADDR) & M_MI0_PHY_REG_ADDR)
  71. #define S_MI0_PHY_ADDR 5
  72. #define M_MI0_PHY_ADDR 0x1f
  73. #define V_MI0_PHY_ADDR(x) ((x) << S_MI0_PHY_ADDR)
  74. #define G_MI0_PHY_ADDR(x) (((x) >> S_MI0_PHY_ADDR) & M_MI0_PHY_ADDR)
  75. #define A_MI0_DATA_EXT 0xb0c
  76. #define A_MI0_DATA_INT 0xb10
  77. /* GMAC registers */
  78. #define A_GMAC_MACID_LO 0x28
  79. #define A_GMAC_MACID_HI 0x2c
  80. #define A_GMAC_CSR 0x30
  81. #define S_INTERFACE 0
  82. #define M_INTERFACE 0x3
  83. #define V_INTERFACE(x) ((x) << S_INTERFACE)
  84. #define G_INTERFACE(x) (((x) >> S_INTERFACE) & M_INTERFACE)
  85. #define S_MAC_TX_ENABLE 2
  86. #define V_MAC_TX_ENABLE(x) ((x) << S_MAC_TX_ENABLE)
  87. #define F_MAC_TX_ENABLE V_MAC_TX_ENABLE(1U)
  88. #define S_MAC_RX_ENABLE 3
  89. #define V_MAC_RX_ENABLE(x) ((x) << S_MAC_RX_ENABLE)
  90. #define F_MAC_RX_ENABLE V_MAC_RX_ENABLE(1U)
  91. #define S_MAC_LB_ENABLE 4
  92. #define V_MAC_LB_ENABLE(x) ((x) << S_MAC_LB_ENABLE)
  93. #define F_MAC_LB_ENABLE V_MAC_LB_ENABLE(1U)
  94. #define S_MAC_SPEED 5
  95. #define M_MAC_SPEED 0x3
  96. #define V_MAC_SPEED(x) ((x) << S_MAC_SPEED)
  97. #define G_MAC_SPEED(x) (((x) >> S_MAC_SPEED) & M_MAC_SPEED)
  98. #define S_MAC_HD_FC_ENABLE 7
  99. #define V_MAC_HD_FC_ENABLE(x) ((x) << S_MAC_HD_FC_ENABLE)
  100. #define F_MAC_HD_FC_ENABLE V_MAC_HD_FC_ENABLE(1U)
  101. #define S_MAC_HALF_DUPLEX 8
  102. #define V_MAC_HALF_DUPLEX(x) ((x) << S_MAC_HALF_DUPLEX)
  103. #define F_MAC_HALF_DUPLEX V_MAC_HALF_DUPLEX(1U)
  104. #define S_MAC_PROMISC 9
  105. #define V_MAC_PROMISC(x) ((x) << S_MAC_PROMISC)
  106. #define F_MAC_PROMISC V_MAC_PROMISC(1U)
  107. #define S_MAC_MC_ENABLE 10
  108. #define V_MAC_MC_ENABLE(x) ((x) << S_MAC_MC_ENABLE)
  109. #define F_MAC_MC_ENABLE V_MAC_MC_ENABLE(1U)
  110. #define S_MAC_RESET 11
  111. #define V_MAC_RESET(x) ((x) << S_MAC_RESET)
  112. #define F_MAC_RESET V_MAC_RESET(1U)
  113. #define S_MAC_RX_PAUSE_ENABLE 12
  114. #define V_MAC_RX_PAUSE_ENABLE(x) ((x) << S_MAC_RX_PAUSE_ENABLE)
  115. #define F_MAC_RX_PAUSE_ENABLE V_MAC_RX_PAUSE_ENABLE(1U)
  116. #define S_MAC_TX_PAUSE_ENABLE 13
  117. #define V_MAC_TX_PAUSE_ENABLE(x) ((x) << S_MAC_TX_PAUSE_ENABLE)
  118. #define F_MAC_TX_PAUSE_ENABLE V_MAC_TX_PAUSE_ENABLE(1U)
  119. #define S_MAC_LWM_ENABLE 14
  120. #define V_MAC_LWM_ENABLE(x) ((x) << S_MAC_LWM_ENABLE)
  121. #define F_MAC_LWM_ENABLE V_MAC_LWM_ENABLE(1U)
  122. #define S_MAC_MAGIC_PKT_ENABLE 15
  123. #define V_MAC_MAGIC_PKT_ENABLE(x) ((x) << S_MAC_MAGIC_PKT_ENABLE)
  124. #define F_MAC_MAGIC_PKT_ENABLE V_MAC_MAGIC_PKT_ENABLE(1U)
  125. #define S_MAC_ISL_ENABLE 16
  126. #define V_MAC_ISL_ENABLE(x) ((x) << S_MAC_ISL_ENABLE)
  127. #define F_MAC_ISL_ENABLE V_MAC_ISL_ENABLE(1U)
  128. #define S_MAC_JUMBO_ENABLE 17
  129. #define V_MAC_JUMBO_ENABLE(x) ((x) << S_MAC_JUMBO_ENABLE)
  130. #define F_MAC_JUMBO_ENABLE V_MAC_JUMBO_ENABLE(1U)
  131. #define S_MAC_RX_PAD_ENABLE 18
  132. #define V_MAC_RX_PAD_ENABLE(x) ((x) << S_MAC_RX_PAD_ENABLE)
  133. #define F_MAC_RX_PAD_ENABLE V_MAC_RX_PAD_ENABLE(1U)
  134. #define S_MAC_RX_CRC_ENABLE 19
  135. #define V_MAC_RX_CRC_ENABLE(x) ((x) << S_MAC_RX_CRC_ENABLE)
  136. #define F_MAC_RX_CRC_ENABLE V_MAC_RX_CRC_ENABLE(1U)
  137. #define A_GMAC_IFS 0x34
  138. #define S_MAC_IFS2 0
  139. #define M_MAC_IFS2 0x3f
  140. #define V_MAC_IFS2(x) ((x) << S_MAC_IFS2)
  141. #define G_MAC_IFS2(x) (((x) >> S_MAC_IFS2) & M_MAC_IFS2)
  142. #define S_MAC_IFS1 8
  143. #define M_MAC_IFS1 0x7f
  144. #define V_MAC_IFS1(x) ((x) << S_MAC_IFS1)
  145. #define G_MAC_IFS1(x) (((x) >> S_MAC_IFS1) & M_MAC_IFS1)
  146. #define A_GMAC_JUMBO_FRAME_LEN 0x38
  147. #define A_GMAC_LNK_DLY 0x3c
  148. #define A_GMAC_PAUSETIME 0x40
  149. #define A_GMAC_MCAST_LO 0x44
  150. #define A_GMAC_MCAST_HI 0x48
  151. #define A_GMAC_MCAST_MASK_LO 0x4c
  152. #define A_GMAC_MCAST_MASK_HI 0x50
  153. #define A_GMAC_RMT_CNT 0x54
  154. #define A_GMAC_RMT_DATA 0x58
  155. #define A_GMAC_BACKOFF_SEED 0x5c
  156. #define A_GMAC_TXF_THRES 0x60
  157. #define S_TXF_READ_THRESHOLD 0
  158. #define M_TXF_READ_THRESHOLD 0xff
  159. #define V_TXF_READ_THRESHOLD(x) ((x) << S_TXF_READ_THRESHOLD)
  160. #define G_TXF_READ_THRESHOLD(x) (((x) >> S_TXF_READ_THRESHOLD) & M_TXF_READ_THRESHOLD)
  161. #define S_TXF_WRITE_THRESHOLD 16
  162. #define M_TXF_WRITE_THRESHOLD 0xff
  163. #define V_TXF_WRITE_THRESHOLD(x) ((x) << S_TXF_WRITE_THRESHOLD)
  164. #define G_TXF_WRITE_THRESHOLD(x) (((x) >> S_TXF_WRITE_THRESHOLD) & M_TXF_WRITE_THRESHOLD)
  165. #define MAC_REG_BASE 0x600
  166. #define MAC_REG_ADDR(idx, reg) (MAC_REG_BASE + (idx) * 128 + (reg))
  167. #define MAC_REG_IDLO(idx) MAC_REG_ADDR(idx, A_GMAC_MACID_LO)
  168. #define MAC_REG_IDHI(idx) MAC_REG_ADDR(idx, A_GMAC_MACID_HI)
  169. #define MAC_REG_CSR(idx) MAC_REG_ADDR(idx, A_GMAC_CSR)
  170. #define MAC_REG_IFS(idx) MAC_REG_ADDR(idx, A_GMAC_IFS)
  171. #define MAC_REG_LARGEFRAMELENGTH(idx) MAC_REG_ADDR(idx, A_GMAC_JUMBO_FRAME_LEN)
  172. #define MAC_REG_LINKDLY(idx) MAC_REG_ADDR(idx, A_GMAC_LNK_DLY)
  173. #define MAC_REG_PAUSETIME(idx) MAC_REG_ADDR(idx, A_GMAC_PAUSETIME)
  174. #define MAC_REG_CASTLO(idx) MAC_REG_ADDR(idx, A_GMAC_MCAST_LO)
  175. #define MAC_REG_MCASTHI(idx) MAC_REG_ADDR(idx, A_GMAC_MCAST_HI)
  176. #define MAC_REG_CASTMASKLO(idx) MAC_REG_ADDR(idx, A_GMAC_MCAST_MASK_LO)
  177. #define MAC_REG_MCASTMASKHI(idx) MAC_REG_ADDR(idx, A_GMAC_MCAST_MASK_HI)
  178. #define MAC_REG_RMCNT(idx) MAC_REG_ADDR(idx, A_GMAC_RMT_CNT)
  179. #define MAC_REG_RMDATA(idx) MAC_REG_ADDR(idx, A_GMAC_RMT_DATA)
  180. #define MAC_REG_GMRANDBACKOFFSEED(idx) MAC_REG_ADDR(idx, A_GMAC_BACKOFF_SEED)
  181. #define MAC_REG_TXFTHRESHOLDS(idx) MAC_REG_ADDR(idx, A_GMAC_TXF_THRES)
  182. #endif