bcm_sf2_regs.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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. /* Register set relative to 'INTRL2_0' and 'INTRL2_1' */
  58. #define INTRL2_CPU_STATUS 0x00
  59. #define INTRL2_CPU_SET 0x04
  60. #define INTRL2_CPU_CLEAR 0x08
  61. #define INTRL2_CPU_MASK_STATUS 0x0c
  62. #define INTRL2_CPU_MASK_SET 0x10
  63. #define INTRL2_CPU_MASK_CLEAR 0x14
  64. /* Shared INTRL2_0 and INTRL2_ interrupt sources macros */
  65. #define P_LINK_UP_IRQ(x) (1 << (0 + (x)))
  66. #define P_LINK_DOWN_IRQ(x) (1 << (1 + (x)))
  67. #define P_ENERGY_ON_IRQ(x) (1 << (2 + (x)))
  68. #define P_ENERGY_OFF_IRQ(x) (1 << (3 + (x)))
  69. #define P_GPHY_IRQ(x) (1 << (4 + (x)))
  70. #define P_NUM_IRQ 5
  71. #define P_IRQ_MASK(x) (P_LINK_UP_IRQ((x)) | \
  72. P_LINK_DOWN_IRQ((x)) | \
  73. P_ENERGY_ON_IRQ((x)) | \
  74. P_ENERGY_OFF_IRQ((x)) | \
  75. P_GPHY_IRQ((x)))
  76. /* INTRL2_0 interrupt sources */
  77. #define P0_IRQ_OFF 0
  78. #define MEM_DOUBLE_IRQ (1 << 5)
  79. #define EEE_LPI_IRQ (1 << 6)
  80. #define P5_CPU_WAKE_IRQ (1 << 7)
  81. #define P8_CPU_WAKE_IRQ (1 << 8)
  82. #define P7_CPU_WAKE_IRQ (1 << 9)
  83. #define IEEE1588_IRQ (1 << 10)
  84. #define MDIO_ERR_IRQ (1 << 11)
  85. #define MDIO_DONE_IRQ (1 << 12)
  86. #define GISB_ERR_IRQ (1 << 13)
  87. #define UBUS_ERR_IRQ (1 << 14)
  88. #define FAILOVER_ON_IRQ (1 << 15)
  89. #define FAILOVER_OFF_IRQ (1 << 16)
  90. #define TCAM_SOFT_ERR_IRQ (1 << 17)
  91. /* INTRL2_1 interrupt sources */
  92. #define P7_IRQ_OFF 0
  93. #define P_IRQ_OFF(x) ((6 - (x)) * P_NUM_IRQ)
  94. /* Register set relative to 'CORE' */
  95. #define CORE_G_PCTL_PORT0 0x00000
  96. #define CORE_G_PCTL_PORT(x) (CORE_G_PCTL_PORT0 + (x * 0x4))
  97. #define CORE_IMP_CTL 0x00020
  98. #define RX_DIS (1 << 0)
  99. #define TX_DIS (1 << 1)
  100. #define RX_BCST_EN (1 << 2)
  101. #define RX_MCST_EN (1 << 3)
  102. #define RX_UCST_EN (1 << 4)
  103. #define G_MISTP_STATE_SHIFT 5
  104. #define G_MISTP_NO_STP (0 << G_MISTP_STATE_SHIFT)
  105. #define G_MISTP_DIS_STATE (1 << G_MISTP_STATE_SHIFT)
  106. #define G_MISTP_BLOCK_STATE (2 << G_MISTP_STATE_SHIFT)
  107. #define G_MISTP_LISTEN_STATE (3 << G_MISTP_STATE_SHIFT)
  108. #define G_MISTP_LEARN_STATE (4 << G_MISTP_STATE_SHIFT)
  109. #define G_MISTP_FWD_STATE (5 << G_MISTP_STATE_SHIFT)
  110. #define G_MISTP_STATE_MASK 0x7
  111. #define CORE_SWMODE 0x0002c
  112. #define SW_FWDG_MODE (1 << 0)
  113. #define SW_FWDG_EN (1 << 1)
  114. #define RTRY_LMT_DIS (1 << 2)
  115. #define CORE_STS_OVERRIDE_IMP 0x00038
  116. #define GMII_SPEED_UP_2G (1 << 6)
  117. #define MII_SW_OR (1 << 7)
  118. #define CORE_NEW_CTRL 0x00084
  119. #define IP_MC (1 << 0)
  120. #define OUTRANGEERR_DISCARD (1 << 1)
  121. #define INRANGEERR_DISCARD (1 << 2)
  122. #define CABLE_DIAG_LEN (1 << 3)
  123. #define OVERRIDE_AUTO_PD_WAR (1 << 4)
  124. #define EN_AUTO_PD_WAR (1 << 5)
  125. #define UC_FWD_EN (1 << 6)
  126. #define MC_FWD_EN (1 << 7)
  127. #define CORE_SWITCH_CTRL 0x00088
  128. #define MII_DUMB_FWDG_EN (1 << 6)
  129. #define CORE_SFT_LRN_CTRL 0x000f8
  130. #define SW_LEARN_CNTL(x) (1 << (x))
  131. #define CORE_STS_OVERRIDE_GMIIP_PORT(x) (0x160 + (x) * 4)
  132. #define LINK_STS (1 << 0)
  133. #define DUPLX_MODE (1 << 1)
  134. #define SPEED_SHIFT 2
  135. #define SPEED_MASK 0x3
  136. #define RXFLOW_CNTL (1 << 4)
  137. #define TXFLOW_CNTL (1 << 5)
  138. #define SW_OVERRIDE (1 << 6)
  139. #define CORE_WATCHDOG_CTRL 0x001e4
  140. #define SOFTWARE_RESET (1 << 7)
  141. #define EN_CHIP_RST (1 << 6)
  142. #define EN_SW_RESET (1 << 4)
  143. #define CORE_LNKSTS 0x00400
  144. #define LNK_STS_MASK 0x1ff
  145. #define CORE_SPDSTS 0x00410
  146. #define SPDSTS_10 0
  147. #define SPDSTS_100 1
  148. #define SPDSTS_1000 2
  149. #define SPDSTS_SHIFT 2
  150. #define SPDSTS_MASK 0x3
  151. #define CORE_DUPSTS 0x00420
  152. #define CORE_DUPSTS_MASK 0x1ff
  153. #define CORE_PAUSESTS 0x00428
  154. #define PAUSESTS_TX_PAUSE_SHIFT 9
  155. #define CORE_GMNCFGCFG 0x0800
  156. #define RST_MIB_CNT (1 << 0)
  157. #define RXBPDU_EN (1 << 1)
  158. #define CORE_IMP0_PRT_ID 0x0804
  159. #define CORE_BRCM_HDR_CTRL 0x0080c
  160. #define BRCM_HDR_EN_P8 (1 << 0)
  161. #define BRCM_HDR_EN_P5 (1 << 1)
  162. #define BRCM_HDR_EN_P7 (1 << 2)
  163. #define CORE_BRCM_HDR_CTRL2 0x0828
  164. #define CORE_HL_PRTC_CTRL 0x0940
  165. #define ARP_EN (1 << 0)
  166. #define RARP_EN (1 << 1)
  167. #define DHCP_EN (1 << 2)
  168. #define ICMPV4_EN (1 << 3)
  169. #define ICMPV6_EN (1 << 4)
  170. #define ICMPV6_FWD_MODE (1 << 5)
  171. #define IGMP_DIP_EN (1 << 8)
  172. #define IGMP_RPTLVE_EN (1 << 9)
  173. #define IGMP_RTPLVE_FWD_MODE (1 << 10)
  174. #define IGMP_QRY_EN (1 << 11)
  175. #define IGMP_QRY_FWD_MODE (1 << 12)
  176. #define IGMP_UKN_EN (1 << 13)
  177. #define IGMP_UKN_FWD_MODE (1 << 14)
  178. #define MLD_RPTDONE_EN (1 << 15)
  179. #define MLD_RPTDONE_FWD_MODE (1 << 16)
  180. #define MLD_QRY_EN (1 << 17)
  181. #define MLD_QRY_FWD_MODE (1 << 18)
  182. #define CORE_RST_MIB_CNT_EN 0x0950
  183. #define CORE_BRCM_HDR_RX_DIS 0x0980
  184. #define CORE_BRCM_HDR_TX_DIS 0x0988
  185. #define CORE_MEM_PSM_VDD_CTRL 0x2380
  186. #define P_TXQ_PSM_VDD_SHIFT 2
  187. #define P_TXQ_PSM_VDD_MASK 0x3
  188. #define P_TXQ_PSM_VDD(x) (P_TXQ_PSM_VDD_MASK << \
  189. ((x) * P_TXQ_PSM_VDD_SHIFT))
  190. #define CORE_P0_MIB_OFFSET 0x8000
  191. #define P_MIB_SIZE 0x400
  192. #define CORE_P_MIB_OFFSET(x) (CORE_P0_MIB_OFFSET + (x) * P_MIB_SIZE)
  193. #define CORE_PORT_VLAN_CTL_PORT(x) (0xc400 + ((x) * 0x8))
  194. #define PORT_VLAN_CTRL_MASK 0x1ff
  195. #define CORE_EEE_EN_CTRL 0x24800
  196. #define CORE_EEE_LPI_INDICATE 0x24810
  197. #endif /* __BCM_SF2_REGS_H */