bcm_sf2_regs.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /*
  2. * Broadcom Starfighter 2 switch register defines
  3. *
  4. * Copyright (C) 2014, Broadcom Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #ifndef __BCM_SF2_REGS_H
  12. #define __BCM_SF2_REGS_H
  13. /* Register set relative to 'REG' */
  14. #define REG_SWITCH_CNTRL 0x00
  15. #define MDIO_MASTER_SEL (1 << 0)
  16. #define REG_SWITCH_STATUS 0x04
  17. #define REG_DIR_DATA_WRITE 0x08
  18. #define REG_DIR_DATA_READ 0x0C
  19. #define REG_SWITCH_REVISION 0x18
  20. #define SF2_REV_MASK 0xffff
  21. #define SWITCH_TOP_REV_SHIFT 16
  22. #define SWITCH_TOP_REV_MASK 0xffff
  23. #define REG_PHY_REVISION 0x1C
  24. #define PHY_REVISION_MASK 0xffff
  25. #define REG_SPHY_CNTRL 0x2C
  26. #define IDDQ_BIAS (1 << 0)
  27. #define EXT_PWR_DOWN (1 << 1)
  28. #define FORCE_DLL_EN (1 << 2)
  29. #define IDDQ_GLOBAL_PWR (1 << 3)
  30. #define CK25_DIS (1 << 4)
  31. #define PHY_RESET (1 << 5)
  32. #define PHY_PHYAD_SHIFT 8
  33. #define PHY_PHYAD_MASK 0x1F
  34. #define REG_RGMII_0_BASE 0x34
  35. #define REG_RGMII_CNTRL 0x00
  36. #define REG_RGMII_IB_STATUS 0x04
  37. #define REG_RGMII_RX_CLOCK_DELAY_CNTRL 0x08
  38. #define REG_RGMII_CNTRL_SIZE 0x0C
  39. #define REG_RGMII_CNTRL_P(x) (REG_RGMII_0_BASE + \
  40. ((x) * REG_RGMII_CNTRL_SIZE))
  41. /* Relative to REG_RGMII_CNTRL */
  42. #define RGMII_MODE_EN (1 << 0)
  43. #define ID_MODE_DIS (1 << 1)
  44. #define PORT_MODE_SHIFT 2
  45. #define INT_EPHY (0 << PORT_MODE_SHIFT)
  46. #define INT_GPHY (1 << PORT_MODE_SHIFT)
  47. #define EXT_EPHY (2 << PORT_MODE_SHIFT)
  48. #define EXT_GPHY (3 << PORT_MODE_SHIFT)
  49. #define EXT_REVMII (4 << PORT_MODE_SHIFT)
  50. #define PORT_MODE_MASK 0x7
  51. #define RVMII_REF_SEL (1 << 5)
  52. #define RX_PAUSE_EN (1 << 6)
  53. #define TX_PAUSE_EN (1 << 7)
  54. #define TX_CLK_STOP_EN (1 << 8)
  55. #define LPI_COUNT_SHIFT 9
  56. #define LPI_COUNT_MASK 0x3F
  57. #define REG_LED_CNTRL_BASE 0x90
  58. #define REG_LED_CNTRL(x) (REG_LED_CNTRL_BASE + (x) * 4)
  59. #define SPDLNK_SRC_SEL (1 << 24)
  60. /* Register set relative to 'INTRL2_0' and 'INTRL2_1' */
  61. #define INTRL2_CPU_STATUS 0x00
  62. #define INTRL2_CPU_SET 0x04
  63. #define INTRL2_CPU_CLEAR 0x08
  64. #define INTRL2_CPU_MASK_STATUS 0x0c
  65. #define INTRL2_CPU_MASK_SET 0x10
  66. #define INTRL2_CPU_MASK_CLEAR 0x14
  67. /* Shared INTRL2_0 and INTRL2_ interrupt sources macros */
  68. #define P_LINK_UP_IRQ(x) (1 << (0 + (x)))
  69. #define P_LINK_DOWN_IRQ(x) (1 << (1 + (x)))
  70. #define P_ENERGY_ON_IRQ(x) (1 << (2 + (x)))
  71. #define P_ENERGY_OFF_IRQ(x) (1 << (3 + (x)))
  72. #define P_GPHY_IRQ(x) (1 << (4 + (x)))
  73. #define P_NUM_IRQ 5
  74. #define P_IRQ_MASK(x) (P_LINK_UP_IRQ((x)) | \
  75. P_LINK_DOWN_IRQ((x)) | \
  76. P_ENERGY_ON_IRQ((x)) | \
  77. P_ENERGY_OFF_IRQ((x)) | \
  78. P_GPHY_IRQ((x)))
  79. /* INTRL2_0 interrupt sources */
  80. #define P0_IRQ_OFF 0
  81. #define MEM_DOUBLE_IRQ (1 << 5)
  82. #define EEE_LPI_IRQ (1 << 6)
  83. #define P5_CPU_WAKE_IRQ (1 << 7)
  84. #define P8_CPU_WAKE_IRQ (1 << 8)
  85. #define P7_CPU_WAKE_IRQ (1 << 9)
  86. #define IEEE1588_IRQ (1 << 10)
  87. #define MDIO_ERR_IRQ (1 << 11)
  88. #define MDIO_DONE_IRQ (1 << 12)
  89. #define GISB_ERR_IRQ (1 << 13)
  90. #define UBUS_ERR_IRQ (1 << 14)
  91. #define FAILOVER_ON_IRQ (1 << 15)
  92. #define FAILOVER_OFF_IRQ (1 << 16)
  93. #define TCAM_SOFT_ERR_IRQ (1 << 17)
  94. /* INTRL2_1 interrupt sources */
  95. #define P7_IRQ_OFF 0
  96. #define P_IRQ_OFF(x) ((6 - (x)) * P_NUM_IRQ)
  97. /* Register set relative to 'CORE' */
  98. #define CORE_G_PCTL_PORT0 0x00000
  99. #define CORE_G_PCTL_PORT(x) (CORE_G_PCTL_PORT0 + (x * 0x4))
  100. #define CORE_IMP_CTL 0x00020
  101. #define RX_DIS (1 << 0)
  102. #define TX_DIS (1 << 1)
  103. #define RX_BCST_EN (1 << 2)
  104. #define RX_MCST_EN (1 << 3)
  105. #define RX_UCST_EN (1 << 4)
  106. #define CORE_SWMODE 0x0002c
  107. #define SW_FWDG_MODE (1 << 0)
  108. #define SW_FWDG_EN (1 << 1)
  109. #define RTRY_LMT_DIS (1 << 2)
  110. #define CORE_STS_OVERRIDE_IMP 0x00038
  111. #define GMII_SPEED_UP_2G (1 << 6)
  112. #define MII_SW_OR (1 << 7)
  113. #define CORE_NEW_CTRL 0x00084
  114. #define IP_MC (1 << 0)
  115. #define OUTRANGEERR_DISCARD (1 << 1)
  116. #define INRANGEERR_DISCARD (1 << 2)
  117. #define CABLE_DIAG_LEN (1 << 3)
  118. #define OVERRIDE_AUTO_PD_WAR (1 << 4)
  119. #define EN_AUTO_PD_WAR (1 << 5)
  120. #define UC_FWD_EN (1 << 6)
  121. #define MC_FWD_EN (1 << 7)
  122. #define CORE_SWITCH_CTRL 0x00088
  123. #define MII_DUMB_FWDG_EN (1 << 6)
  124. #define CORE_SFT_LRN_CTRL 0x000f8
  125. #define SW_LEARN_CNTL(x) (1 << (x))
  126. #define CORE_STS_OVERRIDE_GMIIP_PORT(x) (0x160 + (x) * 4)
  127. #define LINK_STS (1 << 0)
  128. #define DUPLX_MODE (1 << 1)
  129. #define SPEED_SHIFT 2
  130. #define SPEED_MASK 0x3
  131. #define RXFLOW_CNTL (1 << 4)
  132. #define TXFLOW_CNTL (1 << 5)
  133. #define SW_OVERRIDE (1 << 6)
  134. #define CORE_WATCHDOG_CTRL 0x001e4
  135. #define SOFTWARE_RESET (1 << 7)
  136. #define EN_CHIP_RST (1 << 6)
  137. #define EN_SW_RESET (1 << 4)
  138. #define CORE_FAST_AGE_CTRL 0x00220
  139. #define EN_FAST_AGE_STATIC (1 << 0)
  140. #define EN_AGE_DYNAMIC (1 << 1)
  141. #define EN_AGE_PORT (1 << 2)
  142. #define EN_AGE_VLAN (1 << 3)
  143. #define EN_AGE_SPT (1 << 4)
  144. #define EN_AGE_MCAST (1 << 5)
  145. #define FAST_AGE_STR_DONE (1 << 7)
  146. #define CORE_FAST_AGE_PORT 0x00224
  147. #define AGE_PORT_MASK 0xf
  148. #define CORE_FAST_AGE_VID 0x00228
  149. #define AGE_VID_MASK 0x3fff
  150. #define CORE_LNKSTS 0x00400
  151. #define LNK_STS_MASK 0x1ff
  152. #define CORE_SPDSTS 0x00410
  153. #define SPDSTS_10 0
  154. #define SPDSTS_100 1
  155. #define SPDSTS_1000 2
  156. #define SPDSTS_SHIFT 2
  157. #define SPDSTS_MASK 0x3
  158. #define CORE_DUPSTS 0x00420
  159. #define CORE_DUPSTS_MASK 0x1ff
  160. #define CORE_PAUSESTS 0x00428
  161. #define PAUSESTS_TX_PAUSE_SHIFT 9
  162. #define CORE_GMNCFGCFG 0x0800
  163. #define RST_MIB_CNT (1 << 0)
  164. #define RXBPDU_EN (1 << 1)
  165. #define CORE_IMP0_PRT_ID 0x0804
  166. #define CORE_BRCM_HDR_CTRL 0x0080c
  167. #define BRCM_HDR_EN_P8 (1 << 0)
  168. #define BRCM_HDR_EN_P5 (1 << 1)
  169. #define BRCM_HDR_EN_P7 (1 << 2)
  170. #define CORE_RST_MIB_CNT_EN 0x0950
  171. #define CORE_BRCM_HDR_RX_DIS 0x0980
  172. #define CORE_BRCM_HDR_TX_DIS 0x0988
  173. #define CORE_ARLA_VTBL_RWCTRL 0x1600
  174. #define ARLA_VTBL_CMD_WRITE 0
  175. #define ARLA_VTBL_CMD_READ 1
  176. #define ARLA_VTBL_CMD_CLEAR 2
  177. #define ARLA_VTBL_STDN (1 << 7)
  178. #define CORE_ARLA_VTBL_ADDR 0x1604
  179. #define VTBL_ADDR_INDEX_MASK 0xfff
  180. #define CORE_ARLA_VTBL_ENTRY 0x160c
  181. #define FWD_MAP_MASK 0x1ff
  182. #define UNTAG_MAP_MASK 0x1ff
  183. #define UNTAG_MAP_SHIFT 9
  184. #define MSTP_INDEX_MASK 0x7
  185. #define MSTP_INDEX_SHIFT 18
  186. #define FWD_MODE (1 << 21)
  187. #define CORE_MEM_PSM_VDD_CTRL 0x2380
  188. #define P_TXQ_PSM_VDD_SHIFT 2
  189. #define P_TXQ_PSM_VDD_MASK 0x3
  190. #define P_TXQ_PSM_VDD(x) (P_TXQ_PSM_VDD_MASK << \
  191. ((x) * P_TXQ_PSM_VDD_SHIFT))
  192. #define CORE_PORT_VLAN_CTL_PORT(x) (0xc400 + ((x) * 0x8))
  193. #define PORT_VLAN_CTRL_MASK 0x1ff
  194. #define CORE_DEFAULT_1Q_TAG_P(x) (0xd040 + ((x) * 8))
  195. #define CFI_SHIFT 12
  196. #define PRI_SHIFT 13
  197. #define PRI_MASK 0x7
  198. #define CORE_JOIN_ALL_VLAN_EN 0xd140
  199. #define CORE_EEE_EN_CTRL 0x24800
  200. #define CORE_EEE_LPI_INDICATE 0x24810
  201. #endif /* __BCM_SF2_REGS_H */