ocelot_dev.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. /* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
  2. /*
  3. * Microsemi Ocelot Switch driver
  4. *
  5. * Copyright (c) 2017 Microsemi Corporation
  6. */
  7. #ifndef _MSCC_OCELOT_DEV_H_
  8. #define _MSCC_OCELOT_DEV_H_
  9. #define DEV_CLOCK_CFG 0x0
  10. #define DEV_CLOCK_CFG_MAC_TX_RST BIT(7)
  11. #define DEV_CLOCK_CFG_MAC_RX_RST BIT(6)
  12. #define DEV_CLOCK_CFG_PCS_TX_RST BIT(5)
  13. #define DEV_CLOCK_CFG_PCS_RX_RST BIT(4)
  14. #define DEV_CLOCK_CFG_PORT_RST BIT(3)
  15. #define DEV_CLOCK_CFG_PHY_RST BIT(2)
  16. #define DEV_CLOCK_CFG_LINK_SPEED(x) ((x) & GENMASK(1, 0))
  17. #define DEV_CLOCK_CFG_LINK_SPEED_M GENMASK(1, 0)
  18. #define DEV_PORT_MISC 0x4
  19. #define DEV_PORT_MISC_FWD_ERROR_ENA BIT(4)
  20. #define DEV_PORT_MISC_FWD_PAUSE_ENA BIT(3)
  21. #define DEV_PORT_MISC_FWD_CTRL_ENA BIT(2)
  22. #define DEV_PORT_MISC_DEV_LOOP_ENA BIT(1)
  23. #define DEV_PORT_MISC_HDX_FAST_DIS BIT(0)
  24. #define DEV_EVENTS 0x8
  25. #define DEV_EEE_CFG 0xc
  26. #define DEV_EEE_CFG_EEE_ENA BIT(22)
  27. #define DEV_EEE_CFG_EEE_TIMER_AGE(x) (((x) << 15) & GENMASK(21, 15))
  28. #define DEV_EEE_CFG_EEE_TIMER_AGE_M GENMASK(21, 15)
  29. #define DEV_EEE_CFG_EEE_TIMER_AGE_X(x) (((x) & GENMASK(21, 15)) >> 15)
  30. #define DEV_EEE_CFG_EEE_TIMER_WAKEUP(x) (((x) << 8) & GENMASK(14, 8))
  31. #define DEV_EEE_CFG_EEE_TIMER_WAKEUP_M GENMASK(14, 8)
  32. #define DEV_EEE_CFG_EEE_TIMER_WAKEUP_X(x) (((x) & GENMASK(14, 8)) >> 8)
  33. #define DEV_EEE_CFG_EEE_TIMER_HOLDOFF(x) (((x) << 1) & GENMASK(7, 1))
  34. #define DEV_EEE_CFG_EEE_TIMER_HOLDOFF_M GENMASK(7, 1)
  35. #define DEV_EEE_CFG_EEE_TIMER_HOLDOFF_X(x) (((x) & GENMASK(7, 1)) >> 1)
  36. #define DEV_EEE_CFG_PORT_LPI BIT(0)
  37. #define DEV_RX_PATH_DELAY 0x10
  38. #define DEV_TX_PATH_DELAY 0x14
  39. #define DEV_PTP_PREDICT_CFG 0x18
  40. #define DEV_PTP_PREDICT_CFG_PTP_PHY_PREDICT_CFG(x) (((x) << 4) & GENMASK(11, 4))
  41. #define DEV_PTP_PREDICT_CFG_PTP_PHY_PREDICT_CFG_M GENMASK(11, 4)
  42. #define DEV_PTP_PREDICT_CFG_PTP_PHY_PREDICT_CFG_X(x) (((x) & GENMASK(11, 4)) >> 4)
  43. #define DEV_PTP_PREDICT_CFG_PTP_PHASE_PREDICT_CFG(x) ((x) & GENMASK(3, 0))
  44. #define DEV_PTP_PREDICT_CFG_PTP_PHASE_PREDICT_CFG_M GENMASK(3, 0)
  45. #define DEV_MAC_ENA_CFG 0x1c
  46. #define DEV_MAC_ENA_CFG_RX_ENA BIT(4)
  47. #define DEV_MAC_ENA_CFG_TX_ENA BIT(0)
  48. #define DEV_MAC_MODE_CFG 0x20
  49. #define DEV_MAC_MODE_CFG_FC_WORD_SYNC_ENA BIT(8)
  50. #define DEV_MAC_MODE_CFG_GIGA_MODE_ENA BIT(4)
  51. #define DEV_MAC_MODE_CFG_FDX_ENA BIT(0)
  52. #define DEV_MAC_MAXLEN_CFG 0x24
  53. #define DEV_MAC_TAGS_CFG 0x28
  54. #define DEV_MAC_TAGS_CFG_TAG_ID(x) (((x) << 16) & GENMASK(31, 16))
  55. #define DEV_MAC_TAGS_CFG_TAG_ID_M GENMASK(31, 16)
  56. #define DEV_MAC_TAGS_CFG_TAG_ID_X(x) (((x) & GENMASK(31, 16)) >> 16)
  57. #define DEV_MAC_TAGS_CFG_VLAN_LEN_AWR_ENA BIT(2)
  58. #define DEV_MAC_TAGS_CFG_PB_ENA BIT(1)
  59. #define DEV_MAC_TAGS_CFG_VLAN_AWR_ENA BIT(0)
  60. #define DEV_MAC_ADV_CHK_CFG 0x2c
  61. #define DEV_MAC_ADV_CHK_CFG_LEN_DROP_ENA BIT(0)
  62. #define DEV_MAC_IFG_CFG 0x30
  63. #define DEV_MAC_IFG_CFG_RESTORE_OLD_IPG_CHECK BIT(17)
  64. #define DEV_MAC_IFG_CFG_REDUCED_TX_IFG BIT(16)
  65. #define DEV_MAC_IFG_CFG_TX_IFG(x) (((x) << 8) & GENMASK(12, 8))
  66. #define DEV_MAC_IFG_CFG_TX_IFG_M GENMASK(12, 8)
  67. #define DEV_MAC_IFG_CFG_TX_IFG_X(x) (((x) & GENMASK(12, 8)) >> 8)
  68. #define DEV_MAC_IFG_CFG_RX_IFG2(x) (((x) << 4) & GENMASK(7, 4))
  69. #define DEV_MAC_IFG_CFG_RX_IFG2_M GENMASK(7, 4)
  70. #define DEV_MAC_IFG_CFG_RX_IFG2_X(x) (((x) & GENMASK(7, 4)) >> 4)
  71. #define DEV_MAC_IFG_CFG_RX_IFG1(x) ((x) & GENMASK(3, 0))
  72. #define DEV_MAC_IFG_CFG_RX_IFG1_M GENMASK(3, 0)
  73. #define DEV_MAC_HDX_CFG 0x34
  74. #define DEV_MAC_HDX_CFG_BYPASS_COL_SYNC BIT(26)
  75. #define DEV_MAC_HDX_CFG_OB_ENA BIT(25)
  76. #define DEV_MAC_HDX_CFG_WEXC_DIS BIT(24)
  77. #define DEV_MAC_HDX_CFG_SEED(x) (((x) << 16) & GENMASK(23, 16))
  78. #define DEV_MAC_HDX_CFG_SEED_M GENMASK(23, 16)
  79. #define DEV_MAC_HDX_CFG_SEED_X(x) (((x) & GENMASK(23, 16)) >> 16)
  80. #define DEV_MAC_HDX_CFG_SEED_LOAD BIT(12)
  81. #define DEV_MAC_HDX_CFG_RETRY_AFTER_EXC_COL_ENA BIT(8)
  82. #define DEV_MAC_HDX_CFG_LATE_COL_POS(x) ((x) & GENMASK(6, 0))
  83. #define DEV_MAC_HDX_CFG_LATE_COL_POS_M GENMASK(6, 0)
  84. #define DEV_MAC_DBG_CFG 0x38
  85. #define DEV_MAC_DBG_CFG_TBI_MODE BIT(4)
  86. #define DEV_MAC_DBG_CFG_IFG_CRS_EXT_CHK_ENA BIT(0)
  87. #define DEV_MAC_FC_MAC_LOW_CFG 0x3c
  88. #define DEV_MAC_FC_MAC_HIGH_CFG 0x40
  89. #define DEV_MAC_STICKY 0x44
  90. #define DEV_MAC_STICKY_RX_IPG_SHRINK_STICKY BIT(9)
  91. #define DEV_MAC_STICKY_RX_PREAM_SHRINK_STICKY BIT(8)
  92. #define DEV_MAC_STICKY_RX_CARRIER_EXT_STICKY BIT(7)
  93. #define DEV_MAC_STICKY_RX_CARRIER_EXT_ERR_STICKY BIT(6)
  94. #define DEV_MAC_STICKY_RX_JUNK_STICKY BIT(5)
  95. #define DEV_MAC_STICKY_TX_RETRANSMIT_STICKY BIT(4)
  96. #define DEV_MAC_STICKY_TX_JAM_STICKY BIT(3)
  97. #define DEV_MAC_STICKY_TX_FIFO_OFLW_STICKY BIT(2)
  98. #define DEV_MAC_STICKY_TX_FRM_LEN_OVR_STICKY BIT(1)
  99. #define DEV_MAC_STICKY_TX_ABORT_STICKY BIT(0)
  100. #define PCS1G_CFG 0x48
  101. #define PCS1G_CFG_LINK_STATUS_TYPE BIT(4)
  102. #define PCS1G_CFG_AN_LINK_CTRL_ENA BIT(1)
  103. #define PCS1G_CFG_PCS_ENA BIT(0)
  104. #define PCS1G_MODE_CFG 0x4c
  105. #define PCS1G_MODE_CFG_UNIDIR_MODE_ENA BIT(4)
  106. #define PCS1G_MODE_CFG_SGMII_MODE_ENA BIT(0)
  107. #define PCS1G_SD_CFG 0x50
  108. #define PCS1G_SD_CFG_SD_SEL BIT(8)
  109. #define PCS1G_SD_CFG_SD_POL BIT(4)
  110. #define PCS1G_SD_CFG_SD_ENA BIT(0)
  111. #define PCS1G_ANEG_CFG 0x54
  112. #define PCS1G_ANEG_CFG_ADV_ABILITY(x) (((x) << 16) & GENMASK(31, 16))
  113. #define PCS1G_ANEG_CFG_ADV_ABILITY_M GENMASK(31, 16)
  114. #define PCS1G_ANEG_CFG_ADV_ABILITY_X(x) (((x) & GENMASK(31, 16)) >> 16)
  115. #define PCS1G_ANEG_CFG_SW_RESOLVE_ENA BIT(8)
  116. #define PCS1G_ANEG_CFG_ANEG_RESTART_ONE_SHOT BIT(1)
  117. #define PCS1G_ANEG_CFG_ANEG_ENA BIT(0)
  118. #define PCS1G_ANEG_NP_CFG 0x58
  119. #define PCS1G_ANEG_NP_CFG_NP_TX(x) (((x) << 16) & GENMASK(31, 16))
  120. #define PCS1G_ANEG_NP_CFG_NP_TX_M GENMASK(31, 16)
  121. #define PCS1G_ANEG_NP_CFG_NP_TX_X(x) (((x) & GENMASK(31, 16)) >> 16)
  122. #define PCS1G_ANEG_NP_CFG_NP_LOADED_ONE_SHOT BIT(0)
  123. #define PCS1G_LB_CFG 0x5c
  124. #define PCS1G_LB_CFG_RA_ENA BIT(4)
  125. #define PCS1G_LB_CFG_GMII_PHY_LB_ENA BIT(1)
  126. #define PCS1G_LB_CFG_TBI_HOST_LB_ENA BIT(0)
  127. #define PCS1G_DBG_CFG 0x60
  128. #define PCS1G_DBG_CFG_UDLT BIT(0)
  129. #define PCS1G_CDET_CFG 0x64
  130. #define PCS1G_CDET_CFG_CDET_ENA BIT(0)
  131. #define PCS1G_ANEG_STATUS 0x68
  132. #define PCS1G_ANEG_STATUS_LP_ADV_ABILITY(x) (((x) << 16) & GENMASK(31, 16))
  133. #define PCS1G_ANEG_STATUS_LP_ADV_ABILITY_M GENMASK(31, 16)
  134. #define PCS1G_ANEG_STATUS_LP_ADV_ABILITY_X(x) (((x) & GENMASK(31, 16)) >> 16)
  135. #define PCS1G_ANEG_STATUS_PR BIT(4)
  136. #define PCS1G_ANEG_STATUS_PAGE_RX_STICKY BIT(3)
  137. #define PCS1G_ANEG_STATUS_ANEG_COMPLETE BIT(0)
  138. #define PCS1G_ANEG_NP_STATUS 0x6c
  139. #define PCS1G_LINK_STATUS 0x70
  140. #define PCS1G_LINK_STATUS_DELAY_VAR(x) (((x) << 12) & GENMASK(15, 12))
  141. #define PCS1G_LINK_STATUS_DELAY_VAR_M GENMASK(15, 12)
  142. #define PCS1G_LINK_STATUS_DELAY_VAR_X(x) (((x) & GENMASK(15, 12)) >> 12)
  143. #define PCS1G_LINK_STATUS_SIGNAL_DETECT BIT(8)
  144. #define PCS1G_LINK_STATUS_LINK_STATUS BIT(4)
  145. #define PCS1G_LINK_STATUS_SYNC_STATUS BIT(0)
  146. #define PCS1G_LINK_DOWN_CNT 0x74
  147. #define PCS1G_STICKY 0x78
  148. #define PCS1G_STICKY_LINK_DOWN_STICKY BIT(4)
  149. #define PCS1G_STICKY_OUT_OF_SYNC_STICKY BIT(0)
  150. #define PCS1G_DEBUG_STATUS 0x7c
  151. #define PCS1G_LPI_CFG 0x80
  152. #define PCS1G_LPI_CFG_QSGMII_MS_SEL BIT(20)
  153. #define PCS1G_LPI_CFG_RX_LPI_OUT_DIS BIT(17)
  154. #define PCS1G_LPI_CFG_LPI_TESTMODE BIT(16)
  155. #define PCS1G_LPI_CFG_LPI_RX_WTIM(x) (((x) << 4) & GENMASK(5, 4))
  156. #define PCS1G_LPI_CFG_LPI_RX_WTIM_M GENMASK(5, 4)
  157. #define PCS1G_LPI_CFG_LPI_RX_WTIM_X(x) (((x) & GENMASK(5, 4)) >> 4)
  158. #define PCS1G_LPI_CFG_TX_ASSERT_LPIDLE BIT(0)
  159. #define PCS1G_LPI_WAKE_ERROR_CNT 0x84
  160. #define PCS1G_LPI_STATUS 0x88
  161. #define PCS1G_LPI_STATUS_RX_LPI_FAIL BIT(16)
  162. #define PCS1G_LPI_STATUS_RX_LPI_EVENT_STICKY BIT(12)
  163. #define PCS1G_LPI_STATUS_RX_QUIET BIT(9)
  164. #define PCS1G_LPI_STATUS_RX_LPI_MODE BIT(8)
  165. #define PCS1G_LPI_STATUS_TX_LPI_EVENT_STICKY BIT(4)
  166. #define PCS1G_LPI_STATUS_TX_QUIET BIT(1)
  167. #define PCS1G_LPI_STATUS_TX_LPI_MODE BIT(0)
  168. #define PCS1G_TSTPAT_MODE_CFG 0x8c
  169. #define PCS1G_TSTPAT_STATUS 0x90
  170. #define PCS1G_TSTPAT_STATUS_JTP_ERR_CNT(x) (((x) << 8) & GENMASK(15, 8))
  171. #define PCS1G_TSTPAT_STATUS_JTP_ERR_CNT_M GENMASK(15, 8)
  172. #define PCS1G_TSTPAT_STATUS_JTP_ERR_CNT_X(x) (((x) & GENMASK(15, 8)) >> 8)
  173. #define PCS1G_TSTPAT_STATUS_JTP_ERR BIT(4)
  174. #define PCS1G_TSTPAT_STATUS_JTP_LOCK BIT(0)
  175. #define DEV_PCS_FX100_CFG 0x94
  176. #define DEV_PCS_FX100_CFG_SD_SEL BIT(26)
  177. #define DEV_PCS_FX100_CFG_SD_POL BIT(25)
  178. #define DEV_PCS_FX100_CFG_SD_ENA BIT(24)
  179. #define DEV_PCS_FX100_CFG_LOOPBACK_ENA BIT(20)
  180. #define DEV_PCS_FX100_CFG_SWAP_MII_ENA BIT(16)
  181. #define DEV_PCS_FX100_CFG_RXBITSEL(x) (((x) << 12) & GENMASK(15, 12))
  182. #define DEV_PCS_FX100_CFG_RXBITSEL_M GENMASK(15, 12)
  183. #define DEV_PCS_FX100_CFG_RXBITSEL_X(x) (((x) & GENMASK(15, 12)) >> 12)
  184. #define DEV_PCS_FX100_CFG_SIGDET_CFG(x) (((x) << 9) & GENMASK(10, 9))
  185. #define DEV_PCS_FX100_CFG_SIGDET_CFG_M GENMASK(10, 9)
  186. #define DEV_PCS_FX100_CFG_SIGDET_CFG_X(x) (((x) & GENMASK(10, 9)) >> 9)
  187. #define DEV_PCS_FX100_CFG_LINKHYST_TM_ENA BIT(8)
  188. #define DEV_PCS_FX100_CFG_LINKHYSTTIMER(x) (((x) << 4) & GENMASK(7, 4))
  189. #define DEV_PCS_FX100_CFG_LINKHYSTTIMER_M GENMASK(7, 4)
  190. #define DEV_PCS_FX100_CFG_LINKHYSTTIMER_X(x) (((x) & GENMASK(7, 4)) >> 4)
  191. #define DEV_PCS_FX100_CFG_UNIDIR_MODE_ENA BIT(3)
  192. #define DEV_PCS_FX100_CFG_FEFCHK_ENA BIT(2)
  193. #define DEV_PCS_FX100_CFG_FEFGEN_ENA BIT(1)
  194. #define DEV_PCS_FX100_CFG_PCS_ENA BIT(0)
  195. #define DEV_PCS_FX100_STATUS 0x98
  196. #define DEV_PCS_FX100_STATUS_EDGE_POS_PTP(x) (((x) << 8) & GENMASK(11, 8))
  197. #define DEV_PCS_FX100_STATUS_EDGE_POS_PTP_M GENMASK(11, 8)
  198. #define DEV_PCS_FX100_STATUS_EDGE_POS_PTP_X(x) (((x) & GENMASK(11, 8)) >> 8)
  199. #define DEV_PCS_FX100_STATUS_PCS_ERROR_STICKY BIT(7)
  200. #define DEV_PCS_FX100_STATUS_FEF_FOUND_STICKY BIT(6)
  201. #define DEV_PCS_FX100_STATUS_SSD_ERROR_STICKY BIT(5)
  202. #define DEV_PCS_FX100_STATUS_SYNC_LOST_STICKY BIT(4)
  203. #define DEV_PCS_FX100_STATUS_FEF_STATUS BIT(2)
  204. #define DEV_PCS_FX100_STATUS_SIGNAL_DETECT BIT(1)
  205. #define DEV_PCS_FX100_STATUS_SYNC_STATUS BIT(0)
  206. #endif