ocelot_qsys.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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_QSYS_H_
  8. #define _MSCC_OCELOT_QSYS_H_
  9. #define QSYS_PORT_MODE_RSZ 0x4
  10. #define QSYS_PORT_MODE_DEQUEUE_DIS BIT(1)
  11. #define QSYS_PORT_MODE_DEQUEUE_LATE BIT(0)
  12. #define QSYS_SWITCH_PORT_MODE_RSZ 0x4
  13. #define QSYS_SWITCH_PORT_MODE_PORT_ENA BIT(14)
  14. #define QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG(x) (((x) << 11) & GENMASK(13, 11))
  15. #define QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG_M GENMASK(13, 11)
  16. #define QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG_X(x) (((x) & GENMASK(13, 11)) >> 11)
  17. #define QSYS_SWITCH_PORT_MODE_YEL_RSRVD BIT(10)
  18. #define QSYS_SWITCH_PORT_MODE_INGRESS_DROP_MODE BIT(9)
  19. #define QSYS_SWITCH_PORT_MODE_TX_PFC_ENA(x) (((x) << 1) & GENMASK(8, 1))
  20. #define QSYS_SWITCH_PORT_MODE_TX_PFC_ENA_M GENMASK(8, 1)
  21. #define QSYS_SWITCH_PORT_MODE_TX_PFC_ENA_X(x) (((x) & GENMASK(8, 1)) >> 1)
  22. #define QSYS_SWITCH_PORT_MODE_TX_PFC_MODE BIT(0)
  23. #define QSYS_STAT_CNT_CFG_TX_GREEN_CNT_MODE BIT(5)
  24. #define QSYS_STAT_CNT_CFG_TX_YELLOW_CNT_MODE BIT(4)
  25. #define QSYS_STAT_CNT_CFG_DROP_GREEN_CNT_MODE BIT(3)
  26. #define QSYS_STAT_CNT_CFG_DROP_YELLOW_CNT_MODE BIT(2)
  27. #define QSYS_STAT_CNT_CFG_DROP_COUNT_ONCE BIT(1)
  28. #define QSYS_STAT_CNT_CFG_DROP_COUNT_EGRESS BIT(0)
  29. #define QSYS_EEE_CFG_RSZ 0x4
  30. #define QSYS_EEE_THRES_EEE_HIGH_BYTES(x) (((x) << 8) & GENMASK(15, 8))
  31. #define QSYS_EEE_THRES_EEE_HIGH_BYTES_M GENMASK(15, 8)
  32. #define QSYS_EEE_THRES_EEE_HIGH_BYTES_X(x) (((x) & GENMASK(15, 8)) >> 8)
  33. #define QSYS_EEE_THRES_EEE_HIGH_FRAMES(x) ((x) & GENMASK(7, 0))
  34. #define QSYS_EEE_THRES_EEE_HIGH_FRAMES_M GENMASK(7, 0)
  35. #define QSYS_SW_STATUS_RSZ 0x4
  36. #define QSYS_EXT_CPU_CFG_EXT_CPU_PORT(x) (((x) << 8) & GENMASK(12, 8))
  37. #define QSYS_EXT_CPU_CFG_EXT_CPU_PORT_M GENMASK(12, 8)
  38. #define QSYS_EXT_CPU_CFG_EXT_CPU_PORT_X(x) (((x) & GENMASK(12, 8)) >> 8)
  39. #define QSYS_EXT_CPU_CFG_EXT_CPUQ_MSK(x) ((x) & GENMASK(7, 0))
  40. #define QSYS_EXT_CPU_CFG_EXT_CPUQ_MSK_M GENMASK(7, 0)
  41. #define QSYS_QMAP_GSZ 0x4
  42. #define QSYS_QMAP_SE_BASE(x) (((x) << 5) & GENMASK(12, 5))
  43. #define QSYS_QMAP_SE_BASE_M GENMASK(12, 5)
  44. #define QSYS_QMAP_SE_BASE_X(x) (((x) & GENMASK(12, 5)) >> 5)
  45. #define QSYS_QMAP_SE_IDX_SEL(x) (((x) << 2) & GENMASK(4, 2))
  46. #define QSYS_QMAP_SE_IDX_SEL_M GENMASK(4, 2)
  47. #define QSYS_QMAP_SE_IDX_SEL_X(x) (((x) & GENMASK(4, 2)) >> 2)
  48. #define QSYS_QMAP_SE_INP_SEL(x) ((x) & GENMASK(1, 0))
  49. #define QSYS_QMAP_SE_INP_SEL_M GENMASK(1, 0)
  50. #define QSYS_ISDX_SGRP_GSZ 0x4
  51. #define QSYS_TIMED_FRAME_ENTRY_GSZ 0x4
  52. #define QSYS_TFRM_MISC_TIMED_CANCEL_SLOT(x) (((x) << 9) & GENMASK(18, 9))
  53. #define QSYS_TFRM_MISC_TIMED_CANCEL_SLOT_M GENMASK(18, 9)
  54. #define QSYS_TFRM_MISC_TIMED_CANCEL_SLOT_X(x) (((x) & GENMASK(18, 9)) >> 9)
  55. #define QSYS_TFRM_MISC_TIMED_CANCEL_1SHOT BIT(8)
  56. #define QSYS_TFRM_MISC_TIMED_SLOT_MODE_MC BIT(7)
  57. #define QSYS_TFRM_MISC_TIMED_ENTRY_FAST_CNT(x) ((x) & GENMASK(6, 0))
  58. #define QSYS_TFRM_MISC_TIMED_ENTRY_FAST_CNT_M GENMASK(6, 0)
  59. #define QSYS_RED_PROFILE_RSZ 0x4
  60. #define QSYS_RED_PROFILE_WM_RED_LOW(x) (((x) << 8) & GENMASK(15, 8))
  61. #define QSYS_RED_PROFILE_WM_RED_LOW_M GENMASK(15, 8)
  62. #define QSYS_RED_PROFILE_WM_RED_LOW_X(x) (((x) & GENMASK(15, 8)) >> 8)
  63. #define QSYS_RED_PROFILE_WM_RED_HIGH(x) ((x) & GENMASK(7, 0))
  64. #define QSYS_RED_PROFILE_WM_RED_HIGH_M GENMASK(7, 0)
  65. #define QSYS_RES_CFG_GSZ 0x8
  66. #define QSYS_RES_STAT_GSZ 0x8
  67. #define QSYS_RES_STAT_INUSE(x) (((x) << 12) & GENMASK(23, 12))
  68. #define QSYS_RES_STAT_INUSE_M GENMASK(23, 12)
  69. #define QSYS_RES_STAT_INUSE_X(x) (((x) & GENMASK(23, 12)) >> 12)
  70. #define QSYS_RES_STAT_MAXUSE(x) ((x) & GENMASK(11, 0))
  71. #define QSYS_RES_STAT_MAXUSE_M GENMASK(11, 0)
  72. #define QSYS_EVENTS_CORE_EV_FDC(x) (((x) << 2) & GENMASK(4, 2))
  73. #define QSYS_EVENTS_CORE_EV_FDC_M GENMASK(4, 2)
  74. #define QSYS_EVENTS_CORE_EV_FDC_X(x) (((x) & GENMASK(4, 2)) >> 2)
  75. #define QSYS_EVENTS_CORE_EV_FRD(x) ((x) & GENMASK(1, 0))
  76. #define QSYS_EVENTS_CORE_EV_FRD_M GENMASK(1, 0)
  77. #define QSYS_QMAXSDU_CFG_0_RSZ 0x4
  78. #define QSYS_QMAXSDU_CFG_1_RSZ 0x4
  79. #define QSYS_QMAXSDU_CFG_2_RSZ 0x4
  80. #define QSYS_QMAXSDU_CFG_3_RSZ 0x4
  81. #define QSYS_QMAXSDU_CFG_4_RSZ 0x4
  82. #define QSYS_QMAXSDU_CFG_5_RSZ 0x4
  83. #define QSYS_QMAXSDU_CFG_6_RSZ 0x4
  84. #define QSYS_QMAXSDU_CFG_7_RSZ 0x4
  85. #define QSYS_PREEMPTION_CFG_RSZ 0x4
  86. #define QSYS_PREEMPTION_CFG_P_QUEUES(x) ((x) & GENMASK(7, 0))
  87. #define QSYS_PREEMPTION_CFG_P_QUEUES_M GENMASK(7, 0)
  88. #define QSYS_PREEMPTION_CFG_MM_ADD_FRAG_SIZE(x) (((x) << 8) & GENMASK(9, 8))
  89. #define QSYS_PREEMPTION_CFG_MM_ADD_FRAG_SIZE_M GENMASK(9, 8)
  90. #define QSYS_PREEMPTION_CFG_MM_ADD_FRAG_SIZE_X(x) (((x) & GENMASK(9, 8)) >> 8)
  91. #define QSYS_PREEMPTION_CFG_STRICT_IPG(x) (((x) << 12) & GENMASK(13, 12))
  92. #define QSYS_PREEMPTION_CFG_STRICT_IPG_M GENMASK(13, 12)
  93. #define QSYS_PREEMPTION_CFG_STRICT_IPG_X(x) (((x) & GENMASK(13, 12)) >> 12)
  94. #define QSYS_PREEMPTION_CFG_HOLD_ADVANCE(x) (((x) << 16) & GENMASK(31, 16))
  95. #define QSYS_PREEMPTION_CFG_HOLD_ADVANCE_M GENMASK(31, 16)
  96. #define QSYS_PREEMPTION_CFG_HOLD_ADVANCE_X(x) (((x) & GENMASK(31, 16)) >> 16)
  97. #define QSYS_CIR_CFG_GSZ 0x80
  98. #define QSYS_CIR_CFG_CIR_RATE(x) (((x) << 6) & GENMASK(20, 6))
  99. #define QSYS_CIR_CFG_CIR_RATE_M GENMASK(20, 6)
  100. #define QSYS_CIR_CFG_CIR_RATE_X(x) (((x) & GENMASK(20, 6)) >> 6)
  101. #define QSYS_CIR_CFG_CIR_BURST(x) ((x) & GENMASK(5, 0))
  102. #define QSYS_CIR_CFG_CIR_BURST_M GENMASK(5, 0)
  103. #define QSYS_EIR_CFG_GSZ 0x80
  104. #define QSYS_EIR_CFG_EIR_RATE(x) (((x) << 7) & GENMASK(21, 7))
  105. #define QSYS_EIR_CFG_EIR_RATE_M GENMASK(21, 7)
  106. #define QSYS_EIR_CFG_EIR_RATE_X(x) (((x) & GENMASK(21, 7)) >> 7)
  107. #define QSYS_EIR_CFG_EIR_BURST(x) (((x) << 1) & GENMASK(6, 1))
  108. #define QSYS_EIR_CFG_EIR_BURST_M GENMASK(6, 1)
  109. #define QSYS_EIR_CFG_EIR_BURST_X(x) (((x) & GENMASK(6, 1)) >> 1)
  110. #define QSYS_EIR_CFG_EIR_MARK_ENA BIT(0)
  111. #define QSYS_SE_CFG_GSZ 0x80
  112. #define QSYS_SE_CFG_SE_DWRR_CNT(x) (((x) << 6) & GENMASK(9, 6))
  113. #define QSYS_SE_CFG_SE_DWRR_CNT_M GENMASK(9, 6)
  114. #define QSYS_SE_CFG_SE_DWRR_CNT_X(x) (((x) & GENMASK(9, 6)) >> 6)
  115. #define QSYS_SE_CFG_SE_RR_ENA BIT(5)
  116. #define QSYS_SE_CFG_SE_AVB_ENA BIT(4)
  117. #define QSYS_SE_CFG_SE_FRM_MODE(x) (((x) << 2) & GENMASK(3, 2))
  118. #define QSYS_SE_CFG_SE_FRM_MODE_M GENMASK(3, 2)
  119. #define QSYS_SE_CFG_SE_FRM_MODE_X(x) (((x) & GENMASK(3, 2)) >> 2)
  120. #define QSYS_SE_CFG_SE_EXC_ENA BIT(1)
  121. #define QSYS_SE_CFG_SE_EXC_FWD BIT(0)
  122. #define QSYS_SE_DWRR_CFG_GSZ 0x80
  123. #define QSYS_SE_DWRR_CFG_RSZ 0x4
  124. #define QSYS_SE_CONNECT_GSZ 0x80
  125. #define QSYS_SE_CONNECT_SE_OUTP_IDX(x) (((x) << 17) & GENMASK(24, 17))
  126. #define QSYS_SE_CONNECT_SE_OUTP_IDX_M GENMASK(24, 17)
  127. #define QSYS_SE_CONNECT_SE_OUTP_IDX_X(x) (((x) & GENMASK(24, 17)) >> 17)
  128. #define QSYS_SE_CONNECT_SE_INP_IDX(x) (((x) << 9) & GENMASK(16, 9))
  129. #define QSYS_SE_CONNECT_SE_INP_IDX_M GENMASK(16, 9)
  130. #define QSYS_SE_CONNECT_SE_INP_IDX_X(x) (((x) & GENMASK(16, 9)) >> 9)
  131. #define QSYS_SE_CONNECT_SE_OUTP_CON(x) (((x) << 5) & GENMASK(8, 5))
  132. #define QSYS_SE_CONNECT_SE_OUTP_CON_M GENMASK(8, 5)
  133. #define QSYS_SE_CONNECT_SE_OUTP_CON_X(x) (((x) & GENMASK(8, 5)) >> 5)
  134. #define QSYS_SE_CONNECT_SE_INP_CNT(x) (((x) << 1) & GENMASK(4, 1))
  135. #define QSYS_SE_CONNECT_SE_INP_CNT_M GENMASK(4, 1)
  136. #define QSYS_SE_CONNECT_SE_INP_CNT_X(x) (((x) & GENMASK(4, 1)) >> 1)
  137. #define QSYS_SE_CONNECT_SE_TERMINAL BIT(0)
  138. #define QSYS_SE_DLB_SENSE_GSZ 0x80
  139. #define QSYS_SE_DLB_SENSE_SE_DLB_PRIO(x) (((x) << 11) & GENMASK(13, 11))
  140. #define QSYS_SE_DLB_SENSE_SE_DLB_PRIO_M GENMASK(13, 11)
  141. #define QSYS_SE_DLB_SENSE_SE_DLB_PRIO_X(x) (((x) & GENMASK(13, 11)) >> 11)
  142. #define QSYS_SE_DLB_SENSE_SE_DLB_SPORT(x) (((x) << 7) & GENMASK(10, 7))
  143. #define QSYS_SE_DLB_SENSE_SE_DLB_SPORT_M GENMASK(10, 7)
  144. #define QSYS_SE_DLB_SENSE_SE_DLB_SPORT_X(x) (((x) & GENMASK(10, 7)) >> 7)
  145. #define QSYS_SE_DLB_SENSE_SE_DLB_DPORT(x) (((x) << 3) & GENMASK(6, 3))
  146. #define QSYS_SE_DLB_SENSE_SE_DLB_DPORT_M GENMASK(6, 3)
  147. #define QSYS_SE_DLB_SENSE_SE_DLB_DPORT_X(x) (((x) & GENMASK(6, 3)) >> 3)
  148. #define QSYS_SE_DLB_SENSE_SE_DLB_PRIO_ENA BIT(2)
  149. #define QSYS_SE_DLB_SENSE_SE_DLB_SPORT_ENA BIT(1)
  150. #define QSYS_SE_DLB_SENSE_SE_DLB_DPORT_ENA BIT(0)
  151. #define QSYS_CIR_STATE_GSZ 0x80
  152. #define QSYS_CIR_STATE_CIR_LVL(x) (((x) << 4) & GENMASK(25, 4))
  153. #define QSYS_CIR_STATE_CIR_LVL_M GENMASK(25, 4)
  154. #define QSYS_CIR_STATE_CIR_LVL_X(x) (((x) & GENMASK(25, 4)) >> 4)
  155. #define QSYS_CIR_STATE_SHP_TIME(x) ((x) & GENMASK(3, 0))
  156. #define QSYS_CIR_STATE_SHP_TIME_M GENMASK(3, 0)
  157. #define QSYS_EIR_STATE_GSZ 0x80
  158. #define QSYS_SE_STATE_GSZ 0x80
  159. #define QSYS_SE_STATE_SE_OUTP_LVL(x) (((x) << 1) & GENMASK(2, 1))
  160. #define QSYS_SE_STATE_SE_OUTP_LVL_M GENMASK(2, 1)
  161. #define QSYS_SE_STATE_SE_OUTP_LVL_X(x) (((x) & GENMASK(2, 1)) >> 1)
  162. #define QSYS_SE_STATE_SE_WAS_YEL BIT(0)
  163. #define QSYS_HSCH_MISC_CFG_SE_CONNECT_VLD BIT(8)
  164. #define QSYS_HSCH_MISC_CFG_FRM_ADJ(x) (((x) << 3) & GENMASK(7, 3))
  165. #define QSYS_HSCH_MISC_CFG_FRM_ADJ_M GENMASK(7, 3)
  166. #define QSYS_HSCH_MISC_CFG_FRM_ADJ_X(x) (((x) & GENMASK(7, 3)) >> 3)
  167. #define QSYS_HSCH_MISC_CFG_LEAK_DIS BIT(2)
  168. #define QSYS_HSCH_MISC_CFG_QSHP_EXC_ENA BIT(1)
  169. #define QSYS_HSCH_MISC_CFG_PFC_BYP_UPD BIT(0)
  170. #define QSYS_TAG_CONFIG_RSZ 0x4
  171. #define QSYS_TAG_CONFIG_ENABLE BIT(0)
  172. #define QSYS_TAG_CONFIG_LINK_SPEED(x) (((x) << 4) & GENMASK(5, 4))
  173. #define QSYS_TAG_CONFIG_LINK_SPEED_M GENMASK(5, 4)
  174. #define QSYS_TAG_CONFIG_LINK_SPEED_X(x) (((x) & GENMASK(5, 4)) >> 4)
  175. #define QSYS_TAG_CONFIG_INIT_GATE_STATE(x) (((x) << 8) & GENMASK(15, 8))
  176. #define QSYS_TAG_CONFIG_INIT_GATE_STATE_M GENMASK(15, 8)
  177. #define QSYS_TAG_CONFIG_INIT_GATE_STATE_X(x) (((x) & GENMASK(15, 8)) >> 8)
  178. #define QSYS_TAG_CONFIG_SCH_TRAFFIC_QUEUES(x) (((x) << 16) & GENMASK(23, 16))
  179. #define QSYS_TAG_CONFIG_SCH_TRAFFIC_QUEUES_M GENMASK(23, 16)
  180. #define QSYS_TAG_CONFIG_SCH_TRAFFIC_QUEUES_X(x) (((x) & GENMASK(23, 16)) >> 16)
  181. #define QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM(x) ((x) & GENMASK(7, 0))
  182. #define QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM_M GENMASK(7, 0)
  183. #define QSYS_TAS_PARAM_CFG_CTRL_ALWAYS_GUARD_BAND_SCH_Q BIT(8)
  184. #define QSYS_TAS_PARAM_CFG_CTRL_CONFIG_CHANGE BIT(16)
  185. #define QSYS_PORT_MAX_SDU_RSZ 0x4
  186. #define QSYS_PARAM_CFG_REG_3_BASE_TIME_SEC_MSB(x) ((x) & GENMASK(15, 0))
  187. #define QSYS_PARAM_CFG_REG_3_BASE_TIME_SEC_MSB_M GENMASK(15, 0)
  188. #define QSYS_PARAM_CFG_REG_3_LIST_LENGTH(x) (((x) << 16) & GENMASK(31, 16))
  189. #define QSYS_PARAM_CFG_REG_3_LIST_LENGTH_M GENMASK(31, 16)
  190. #define QSYS_PARAM_CFG_REG_3_LIST_LENGTH_X(x) (((x) & GENMASK(31, 16)) >> 16)
  191. #define QSYS_GCL_CFG_REG_1_GCL_ENTRY_NUM(x) ((x) & GENMASK(5, 0))
  192. #define QSYS_GCL_CFG_REG_1_GCL_ENTRY_NUM_M GENMASK(5, 0)
  193. #define QSYS_GCL_CFG_REG_1_GATE_STATE(x) (((x) << 8) & GENMASK(15, 8))
  194. #define QSYS_GCL_CFG_REG_1_GATE_STATE_M GENMASK(15, 8)
  195. #define QSYS_GCL_CFG_REG_1_GATE_STATE_X(x) (((x) & GENMASK(15, 8)) >> 8)
  196. #define QSYS_PARAM_STATUS_REG_3_BASE_TIME_SEC_MSB(x) ((x) & GENMASK(15, 0))
  197. #define QSYS_PARAM_STATUS_REG_3_BASE_TIME_SEC_MSB_M GENMASK(15, 0)
  198. #define QSYS_PARAM_STATUS_REG_3_LIST_LENGTH(x) (((x) << 16) & GENMASK(31, 16))
  199. #define QSYS_PARAM_STATUS_REG_3_LIST_LENGTH_M GENMASK(31, 16)
  200. #define QSYS_PARAM_STATUS_REG_3_LIST_LENGTH_X(x) (((x) & GENMASK(31, 16)) >> 16)
  201. #define QSYS_PARAM_STATUS_REG_8_CFG_CHG_TIME_SEC_MSB(x) ((x) & GENMASK(15, 0))
  202. #define QSYS_PARAM_STATUS_REG_8_CFG_CHG_TIME_SEC_MSB_M GENMASK(15, 0)
  203. #define QSYS_PARAM_STATUS_REG_8_OPER_GATE_STATE(x) (((x) << 16) & GENMASK(23, 16))
  204. #define QSYS_PARAM_STATUS_REG_8_OPER_GATE_STATE_M GENMASK(23, 16)
  205. #define QSYS_PARAM_STATUS_REG_8_OPER_GATE_STATE_X(x) (((x) & GENMASK(23, 16)) >> 16)
  206. #define QSYS_PARAM_STATUS_REG_8_CONFIG_PENDING BIT(24)
  207. #define QSYS_GCL_STATUS_REG_1_GCL_ENTRY_NUM(x) ((x) & GENMASK(5, 0))
  208. #define QSYS_GCL_STATUS_REG_1_GCL_ENTRY_NUM_M GENMASK(5, 0)
  209. #define QSYS_GCL_STATUS_REG_1_GATE_STATE(x) (((x) << 8) & GENMASK(15, 8))
  210. #define QSYS_GCL_STATUS_REG_1_GATE_STATE_M GENMASK(15, 8)
  211. #define QSYS_GCL_STATUS_REG_1_GATE_STATE_X(x) (((x) & GENMASK(15, 8)) >> 8)
  212. #endif