xref: /linux/drivers/net/dsa/bcm_sf2_regs.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
12874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2246d7f77SFlorian Fainelli /*
3246d7f77SFlorian Fainelli  * Broadcom Starfighter 2 switch register defines
4246d7f77SFlorian Fainelli  *
5246d7f77SFlorian Fainelli  * Copyright (C) 2014, Broadcom Corporation
6246d7f77SFlorian Fainelli  */
7246d7f77SFlorian Fainelli #ifndef __BCM_SF2_REGS_H
8246d7f77SFlorian Fainelli #define __BCM_SF2_REGS_H
9246d7f77SFlorian Fainelli 
10246d7f77SFlorian Fainelli /* Register set relative to 'REG' */
11a78e86edSFlorian Fainelli 
12a78e86edSFlorian Fainelli enum bcm_sf2_reg_offs {
13a78e86edSFlorian Fainelli 	REG_SWITCH_CNTRL = 0,
14a78e86edSFlorian Fainelli 	REG_SWITCH_STATUS,
15a78e86edSFlorian Fainelli 	REG_DIR_DATA_WRITE,
16a78e86edSFlorian Fainelli 	REG_DIR_DATA_READ,
17a78e86edSFlorian Fainelli 	REG_SWITCH_REVISION,
18a78e86edSFlorian Fainelli 	REG_PHY_REVISION,
19a78e86edSFlorian Fainelli 	REG_SPHY_CNTRL,
2073b7a604SRafał Miłecki 	REG_CROSSBAR,
21a78e86edSFlorian Fainelli 	REG_RGMII_0_CNTRL,
22a78e86edSFlorian Fainelli 	REG_RGMII_1_CNTRL,
23a78e86edSFlorian Fainelli 	REG_RGMII_2_CNTRL,
246859d915SRafał Miłecki 	REG_RGMII_11_CNTRL,
25a78e86edSFlorian Fainelli 	REG_LED_0_CNTRL,
26a78e86edSFlorian Fainelli 	REG_LED_1_CNTRL,
27a78e86edSFlorian Fainelli 	REG_LED_2_CNTRL,
28*af30f8eaSRafał Miłecki 	REG_LED_3_CNTRL,
29*af30f8eaSRafał Miłecki 	REG_LED_4_CNTRL,
30*af30f8eaSRafał Miłecki 	REG_LED_5_CNTRL,
31*af30f8eaSRafał Miłecki 	REG_LED_AGGREGATE_CTRL,
32a78e86edSFlorian Fainelli 	REG_SWITCH_REG_MAX,
33a78e86edSFlorian Fainelli };
34a78e86edSFlorian Fainelli 
35a78e86edSFlorian Fainelli /* Relative to REG_SWITCH_CNTRL */
36246d7f77SFlorian Fainelli #define  MDIO_MASTER_SEL		(1 << 0)
37246d7f77SFlorian Fainelli 
38a78e86edSFlorian Fainelli /* Relative to REG_SWITCH_REVISION */
39246d7f77SFlorian Fainelli #define  SF2_REV_MASK			0xffff
40246d7f77SFlorian Fainelli #define  SWITCH_TOP_REV_SHIFT		16
41246d7f77SFlorian Fainelli #define  SWITCH_TOP_REV_MASK		0xffff
42246d7f77SFlorian Fainelli 
43a78e86edSFlorian Fainelli /* Relative to REG_PHY_REVISION */
44aa9aef77SFlorian Fainelli #define  PHY_REVISION_MASK		0xffff
45246d7f77SFlorian Fainelli 
46a78e86edSFlorian Fainelli /* Relative to REG_SPHY_CNTRL */
47246d7f77SFlorian Fainelli #define  IDDQ_BIAS			(1 << 0)
48246d7f77SFlorian Fainelli #define  EXT_PWR_DOWN			(1 << 1)
49246d7f77SFlorian Fainelli #define  FORCE_DLL_EN			(1 << 2)
50246d7f77SFlorian Fainelli #define  IDDQ_GLOBAL_PWR		(1 << 3)
51246d7f77SFlorian Fainelli #define  CK25_DIS			(1 << 4)
52246d7f77SFlorian Fainelli #define  PHY_RESET			(1 << 5)
53246d7f77SFlorian Fainelli #define  PHY_PHYAD_SHIFT		8
54246d7f77SFlorian Fainelli #define  PHY_PHYAD_MASK			0x1F
55246d7f77SFlorian Fainelli 
56a9349f08SRafał Miłecki /* Relative to REG_CROSSBAR */
57a9349f08SRafał Miłecki #define CROSSBAR_BCM4908_INT_P7		0
58a9349f08SRafał Miłecki #define CROSSBAR_BCM4908_INT_RUNNER	1
59a9349f08SRafał Miłecki #define CROSSBAR_BCM4908_EXT_SERDES	0
60a9349f08SRafał Miłecki #define CROSSBAR_BCM4908_EXT_GPHY4	1
61a9349f08SRafał Miłecki #define CROSSBAR_BCM4908_EXT_RGMII	2
62a9349f08SRafał Miłecki 
63*af30f8eaSRafał Miłecki /* Relative to REG_LED_*_CNTRL (BCM7278, BCM7445) */
64*af30f8eaSRafał Miłecki #define  LED_CNTRL_NO_LINK_ENCODE_SHIFT		0
65*af30f8eaSRafał Miłecki #define  LED_CNTRL_M10_ENCODE_SHIFT		2
66*af30f8eaSRafał Miłecki #define  LED_CNTRL_M100_ENCODE_SHIFT		4
67*af30f8eaSRafał Miłecki #define  LED_CNTRL_M1000_ENCODE_SHIFT		6
68*af30f8eaSRafał Miłecki #define  LED_CNTRL_SEL_NO_LINK_ENCODE_SHIFT	8
69*af30f8eaSRafał Miłecki #define  LED_CNTRL_SEL_10M_ENCODE_SHIFT		10
70*af30f8eaSRafał Miłecki #define  LED_CNTRL_SEL_100M_ENCODE_SHIFT	12
71*af30f8eaSRafał Miłecki #define  LED_CNTRL_SEL_1000M_ENCODE_SHIFT	14
72*af30f8eaSRafał Miłecki #define  LED_CNTRL_RX_DV_EN			(1 << 16)
73*af30f8eaSRafał Miłecki #define  LED_CNTRL_TX_EN_EN			(1 << 17)
74*af30f8eaSRafał Miłecki #define  LED_CNTRL_SPDLNK_LED0_ACT_SEL_SHIFT	18
75*af30f8eaSRafał Miłecki #define  LED_CNTRL_SPDLNK_LED1_ACT_SEL_SHIFT	20
76*af30f8eaSRafał Miłecki #define  LED_CNTRL_ACT_LED_ACT_SEL_SHIFT	22
77*af30f8eaSRafał Miłecki #define  LED_CNTRL_SPDLNK_SRC_SEL		(1 << 24)
78*af30f8eaSRafał Miłecki #define  LED_CNTRL_SPDLNK_LED0_ACT_POL_SEL	(1 << 25)
79*af30f8eaSRafał Miłecki #define  LED_CNTRL_SPDLNK_LED1_ACT_POL_SEL	(1 << 26)
80*af30f8eaSRafał Miłecki #define  LED_CNTRL_ACT_LED_POL_SEL		(1 << 27)
81*af30f8eaSRafał Miłecki #define  LED_CNTRL_MASK				0x3
82*af30f8eaSRafał Miłecki 
83*af30f8eaSRafał Miłecki /* Register relative to REG_LED_*_CNTRL (BCM4908) */
84*af30f8eaSRafał Miłecki #define REG_LED_CTRL				0x0
85*af30f8eaSRafał Miłecki #define  LED_CTRL_RX_ACT_EN			0x00000001
86*af30f8eaSRafał Miłecki #define  LED_CTRL_TX_ACT_EN			0x00000002
87*af30f8eaSRafał Miłecki #define  LED_CTRL_SPDLNK_LED0_ACT_SEL		0x00000004
88*af30f8eaSRafał Miłecki #define  LED_CTRL_SPDLNK_LED1_ACT_SEL		0x00000008
89*af30f8eaSRafał Miłecki #define  LED_CTRL_SPDLNK_LED2_ACT_SEL		0x00000010
90*af30f8eaSRafał Miłecki #define  LED_CTRL_ACT_LED_ACT_SEL		0x00000020
91*af30f8eaSRafał Miłecki #define  LED_CTRL_SPDLNK_LED0_ACT_POL_SEL	0x00000040
92*af30f8eaSRafał Miłecki #define  LED_CTRL_SPDLNK_LED1_ACT_POL_SEL	0x00000080
93*af30f8eaSRafał Miłecki #define  LED_CTRL_SPDLNK_LED2_ACT_POL_SEL	0x00000100
94*af30f8eaSRafał Miłecki #define  LED_CTRL_ACT_LED_POL_SEL		0x00000200
95*af30f8eaSRafał Miłecki #define  LED_CTRL_LED_SPD_OVRD			0x00001c00
96*af30f8eaSRafał Miłecki #define  LED_CTRL_LNK_STATUS_OVRD		0x00002000
97*af30f8eaSRafał Miłecki #define  LED_CTRL_SPD_OVRD_EN			0x00004000
98*af30f8eaSRafał Miłecki #define  LED_CTRL_LNK_OVRD_EN			0x00008000
99*af30f8eaSRafał Miłecki 
100*af30f8eaSRafał Miłecki /* Register relative to REG_LED_*_CNTRL (BCM4908) */
101*af30f8eaSRafał Miłecki #define REG_LED_LINK_SPEED_ENC_SEL		0x4
102*af30f8eaSRafał Miłecki #define  LED_LINK_SPEED_ENC_SEL_NO_LINK_SHIFT	0
103*af30f8eaSRafał Miłecki #define  LED_LINK_SPEED_ENC_SEL_10M_SHIFT	3
104*af30f8eaSRafał Miłecki #define  LED_LINK_SPEED_ENC_SEL_100M_SHIFT	6
105*af30f8eaSRafał Miłecki #define  LED_LINK_SPEED_ENC_SEL_1000M_SHIFT	9
106*af30f8eaSRafał Miłecki #define  LED_LINK_SPEED_ENC_SEL_2500M_SHIFT	12
107*af30f8eaSRafał Miłecki #define  LED_LINK_SPEED_ENC_SEL_10G_SHIFT	15
108*af30f8eaSRafał Miłecki #define  LED_LINK_SPEED_ENC_SEL_MASK		0x7
109*af30f8eaSRafał Miłecki 
110*af30f8eaSRafał Miłecki /* Register relative to REG_LED_*_CNTRL (BCM4908) */
111*af30f8eaSRafał Miłecki #define REG_LED_LINK_SPEED_ENC			0x8
112*af30f8eaSRafał Miłecki #define  LED_LINK_SPEED_ENC_NO_LINK_SHIFT	0
113*af30f8eaSRafał Miłecki #define  LED_LINK_SPEED_ENC_M10_SHIFT		3
114*af30f8eaSRafał Miłecki #define  LED_LINK_SPEED_ENC_M100_SHIFT		6
115*af30f8eaSRafał Miłecki #define  LED_LINK_SPEED_ENC_M1000_SHIFT		9
116*af30f8eaSRafał Miłecki #define  LED_LINK_SPEED_ENC_M2500_SHIFT		12
117*af30f8eaSRafał Miłecki #define  LED_LINK_SPEED_ENC_M10G_SHIFT		15
118*af30f8eaSRafał Miłecki #define  LED_LINK_SPEED_ENC_MASK		0x7
119*af30f8eaSRafał Miłecki 
120246d7f77SFlorian Fainelli /* Relative to REG_RGMII_CNTRL */
121246d7f77SFlorian Fainelli #define  RGMII_MODE_EN			(1 << 0)
122246d7f77SFlorian Fainelli #define  ID_MODE_DIS			(1 << 1)
123246d7f77SFlorian Fainelli #define  PORT_MODE_SHIFT		2
124246d7f77SFlorian Fainelli #define  INT_EPHY			(0 << PORT_MODE_SHIFT)
125246d7f77SFlorian Fainelli #define  INT_GPHY			(1 << PORT_MODE_SHIFT)
126246d7f77SFlorian Fainelli #define  EXT_EPHY			(2 << PORT_MODE_SHIFT)
127246d7f77SFlorian Fainelli #define  EXT_GPHY			(3 << PORT_MODE_SHIFT)
128246d7f77SFlorian Fainelli #define  EXT_REVMII			(4 << PORT_MODE_SHIFT)
129246d7f77SFlorian Fainelli #define  PORT_MODE_MASK			0x7
130246d7f77SFlorian Fainelli #define  RVMII_REF_SEL			(1 << 5)
131246d7f77SFlorian Fainelli #define  RX_PAUSE_EN			(1 << 6)
132246d7f77SFlorian Fainelli #define  TX_PAUSE_EN			(1 << 7)
133246d7f77SFlorian Fainelli #define  TX_CLK_STOP_EN			(1 << 8)
134246d7f77SFlorian Fainelli #define  LPI_COUNT_SHIFT		9
135246d7f77SFlorian Fainelli #define  LPI_COUNT_MASK			0x3F
136246d7f77SFlorian Fainelli 
137246d7f77SFlorian Fainelli /* Register set relative to 'INTRL2_0' and 'INTRL2_1' */
138246d7f77SFlorian Fainelli #define INTRL2_CPU_STATUS		0x00
139246d7f77SFlorian Fainelli #define INTRL2_CPU_SET			0x04
140246d7f77SFlorian Fainelli #define INTRL2_CPU_CLEAR		0x08
141246d7f77SFlorian Fainelli #define INTRL2_CPU_MASK_STATUS		0x0c
142246d7f77SFlorian Fainelli #define INTRL2_CPU_MASK_SET		0x10
143246d7f77SFlorian Fainelli #define INTRL2_CPU_MASK_CLEAR		0x14
144246d7f77SFlorian Fainelli 
145246d7f77SFlorian Fainelli /* Shared INTRL2_0 and INTRL2_ interrupt sources macros */
146246d7f77SFlorian Fainelli #define P_LINK_UP_IRQ(x)		(1 << (0 + (x)))
147246d7f77SFlorian Fainelli #define P_LINK_DOWN_IRQ(x)		(1 << (1 + (x)))
148246d7f77SFlorian Fainelli #define P_ENERGY_ON_IRQ(x)		(1 << (2 + (x)))
149246d7f77SFlorian Fainelli #define P_ENERGY_OFF_IRQ(x)		(1 << (3 + (x)))
150246d7f77SFlorian Fainelli #define P_GPHY_IRQ(x)			(1 << (4 + (x)))
151246d7f77SFlorian Fainelli #define P_NUM_IRQ			5
152246d7f77SFlorian Fainelli #define P_IRQ_MASK(x)			(P_LINK_UP_IRQ((x)) | \
153246d7f77SFlorian Fainelli 					 P_LINK_DOWN_IRQ((x)) | \
154246d7f77SFlorian Fainelli 					 P_ENERGY_ON_IRQ((x)) | \
155246d7f77SFlorian Fainelli 					 P_ENERGY_OFF_IRQ((x)) | \
156246d7f77SFlorian Fainelli 					 P_GPHY_IRQ((x)))
157246d7f77SFlorian Fainelli 
158246d7f77SFlorian Fainelli /* INTRL2_0 interrupt sources */
159246d7f77SFlorian Fainelli #define P0_IRQ_OFF			0
160246d7f77SFlorian Fainelli #define MEM_DOUBLE_IRQ			(1 << 5)
161246d7f77SFlorian Fainelli #define EEE_LPI_IRQ			(1 << 6)
162246d7f77SFlorian Fainelli #define P5_CPU_WAKE_IRQ			(1 << 7)
163246d7f77SFlorian Fainelli #define P8_CPU_WAKE_IRQ			(1 << 8)
164246d7f77SFlorian Fainelli #define P7_CPU_WAKE_IRQ			(1 << 9)
165246d7f77SFlorian Fainelli #define IEEE1588_IRQ			(1 << 10)
166246d7f77SFlorian Fainelli #define MDIO_ERR_IRQ			(1 << 11)
167246d7f77SFlorian Fainelli #define MDIO_DONE_IRQ			(1 << 12)
168246d7f77SFlorian Fainelli #define GISB_ERR_IRQ			(1 << 13)
169246d7f77SFlorian Fainelli #define UBUS_ERR_IRQ			(1 << 14)
170246d7f77SFlorian Fainelli #define FAILOVER_ON_IRQ			(1 << 15)
171246d7f77SFlorian Fainelli #define FAILOVER_OFF_IRQ		(1 << 16)
172246d7f77SFlorian Fainelli #define TCAM_SOFT_ERR_IRQ		(1 << 17)
173246d7f77SFlorian Fainelli 
174246d7f77SFlorian Fainelli /* INTRL2_1 interrupt sources */
175246d7f77SFlorian Fainelli #define P7_IRQ_OFF			0
176246d7f77SFlorian Fainelli #define P_IRQ_OFF(x)			((6 - (x)) * P_NUM_IRQ)
177246d7f77SFlorian Fainelli 
17832e47ff0SFlorian Fainelli /* Register set relative to 'ACB' */
17932e47ff0SFlorian Fainelli #define ACB_CONTROL			0x00
18032e47ff0SFlorian Fainelli #define  ACB_EN				(1 << 0)
18132e47ff0SFlorian Fainelli #define  ACB_ALGORITHM			(1 << 1)
18232e47ff0SFlorian Fainelli #define  ACB_FLUSH_SHIFT		2
18332e47ff0SFlorian Fainelli #define  ACB_FLUSH_MASK			0x3
18432e47ff0SFlorian Fainelli 
18532e47ff0SFlorian Fainelli #define ACB_QUEUE_0_CFG			0x08
18632e47ff0SFlorian Fainelli #define  XOFF_THRESHOLD_MASK		0x7ff
18732e47ff0SFlorian Fainelli #define  XON_EN				(1 << 11)
18832e47ff0SFlorian Fainelli #define  TOTAL_XOFF_THRESHOLD_SHIFT	12
18932e47ff0SFlorian Fainelli #define  TOTAL_XOFF_THRESHOLD_MASK	0x7ff
19032e47ff0SFlorian Fainelli #define  TOTAL_XOFF_EN			(1 << 23)
19132e47ff0SFlorian Fainelli #define  TOTAL_XON_EN			(1 << 24)
19232e47ff0SFlorian Fainelli #define  PKTLEN_SHIFT			25
19332e47ff0SFlorian Fainelli #define  PKTLEN_MASK			0x3f
19432e47ff0SFlorian Fainelli #define ACB_QUEUE_CFG(x)		(ACB_QUEUE_0_CFG + ((x) * 0x4))
19532e47ff0SFlorian Fainelli 
196246d7f77SFlorian Fainelli /* Register set relative to 'CORE' */
197246d7f77SFlorian Fainelli #define CORE_G_PCTL_PORT0		0x00000
198246d7f77SFlorian Fainelli #define CORE_G_PCTL_PORT(x)		(CORE_G_PCTL_PORT0 + (x * 0x4))
199246d7f77SFlorian Fainelli #define CORE_IMP_CTL			0x00020
200246d7f77SFlorian Fainelli #define  RX_DIS				(1 << 0)
201246d7f77SFlorian Fainelli #define  TX_DIS				(1 << 1)
202246d7f77SFlorian Fainelli #define  RX_BCST_EN			(1 << 2)
203246d7f77SFlorian Fainelli #define  RX_MCST_EN			(1 << 3)
204246d7f77SFlorian Fainelli #define  RX_UCST_EN			(1 << 4)
205246d7f77SFlorian Fainelli 
206246d7f77SFlorian Fainelli #define CORE_SWMODE			0x0002c
207246d7f77SFlorian Fainelli #define  SW_FWDG_MODE			(1 << 0)
208246d7f77SFlorian Fainelli #define  SW_FWDG_EN			(1 << 1)
209246d7f77SFlorian Fainelli #define  RTRY_LMT_DIS			(1 << 2)
210246d7f77SFlorian Fainelli 
211246d7f77SFlorian Fainelli #define CORE_STS_OVERRIDE_IMP		0x00038
212246d7f77SFlorian Fainelli #define  GMII_SPEED_UP_2G		(1 << 6)
213246d7f77SFlorian Fainelli #define  MII_SW_OR			(1 << 7)
214246d7f77SFlorian Fainelli 
2150fe99338SFlorian Fainelli /* Alternate layout for e.g: 7278 */
2160fe99338SFlorian Fainelli #define CORE_STS_OVERRIDE_IMP2		0x39040
2170fe99338SFlorian Fainelli 
218246d7f77SFlorian Fainelli #define CORE_NEW_CTRL			0x00084
219246d7f77SFlorian Fainelli #define  IP_MC				(1 << 0)
220246d7f77SFlorian Fainelli #define  OUTRANGEERR_DISCARD		(1 << 1)
221246d7f77SFlorian Fainelli #define  INRANGEERR_DISCARD		(1 << 2)
222246d7f77SFlorian Fainelli #define  CABLE_DIAG_LEN			(1 << 3)
223246d7f77SFlorian Fainelli #define  OVERRIDE_AUTO_PD_WAR		(1 << 4)
224246d7f77SFlorian Fainelli #define  EN_AUTO_PD_WAR			(1 << 5)
225246d7f77SFlorian Fainelli #define  UC_FWD_EN			(1 << 6)
226246d7f77SFlorian Fainelli #define  MC_FWD_EN			(1 << 7)
227246d7f77SFlorian Fainelli 
228246d7f77SFlorian Fainelli #define CORE_SWITCH_CTRL		0x00088
229246d7f77SFlorian Fainelli #define  MII_DUMB_FWDG_EN		(1 << 6)
230246d7f77SFlorian Fainelli 
231c0e6820bSFlorian Fainelli #define CORE_DIS_LEARN			0x000f0
232c0e6820bSFlorian Fainelli 
233246d7f77SFlorian Fainelli #define CORE_SFT_LRN_CTRL		0x000f8
234246d7f77SFlorian Fainelli #define  SW_LEARN_CNTL(x)		(1 << (x))
235246d7f77SFlorian Fainelli 
236246d7f77SFlorian Fainelli #define CORE_STS_OVERRIDE_GMIIP_PORT(x)	(0x160 + (x) * 4)
2370fe99338SFlorian Fainelli #define CORE_STS_OVERRIDE_GMIIP2_PORT(x) (0x39000 + (x) * 8)
238246d7f77SFlorian Fainelli #define  LINK_STS			(1 << 0)
239246d7f77SFlorian Fainelli #define  DUPLX_MODE			(1 << 1)
240246d7f77SFlorian Fainelli #define  SPEED_SHIFT			2
241246d7f77SFlorian Fainelli #define  SPEED_MASK			0x3
242246d7f77SFlorian Fainelli #define  RXFLOW_CNTL			(1 << 4)
243246d7f77SFlorian Fainelli #define  TXFLOW_CNTL			(1 << 5)
244246d7f77SFlorian Fainelli #define  SW_OVERRIDE			(1 << 6)
245246d7f77SFlorian Fainelli 
246246d7f77SFlorian Fainelli #define CORE_WATCHDOG_CTRL		0x001e4
247246d7f77SFlorian Fainelli #define  SOFTWARE_RESET			(1 << 7)
248246d7f77SFlorian Fainelli #define  EN_CHIP_RST			(1 << 6)
249246d7f77SFlorian Fainelli #define  EN_SW_RESET			(1 << 4)
250246d7f77SFlorian Fainelli 
25112f460f2SFlorian Fainelli #define CORE_FAST_AGE_CTRL		0x00220
25212f460f2SFlorian Fainelli #define  EN_FAST_AGE_STATIC		(1 << 0)
25312f460f2SFlorian Fainelli #define  EN_AGE_DYNAMIC			(1 << 1)
25412f460f2SFlorian Fainelli #define  EN_AGE_PORT			(1 << 2)
25512f460f2SFlorian Fainelli #define  EN_AGE_VLAN			(1 << 3)
25612f460f2SFlorian Fainelli #define  EN_AGE_SPT			(1 << 4)
25712f460f2SFlorian Fainelli #define  EN_AGE_MCAST			(1 << 5)
25812f460f2SFlorian Fainelli #define  FAST_AGE_STR_DONE		(1 << 7)
25912f460f2SFlorian Fainelli 
26012f460f2SFlorian Fainelli #define CORE_FAST_AGE_PORT		0x00224
26112f460f2SFlorian Fainelli #define  AGE_PORT_MASK			0xf
26212f460f2SFlorian Fainelli 
26312f460f2SFlorian Fainelli #define CORE_FAST_AGE_VID		0x00228
26412f460f2SFlorian Fainelli #define  AGE_VID_MASK			0x3fff
26512f460f2SFlorian Fainelli 
266246d7f77SFlorian Fainelli #define CORE_LNKSTS			0x00400
267246d7f77SFlorian Fainelli #define  LNK_STS_MASK			0x1ff
268246d7f77SFlorian Fainelli 
269246d7f77SFlorian Fainelli #define CORE_SPDSTS			0x00410
270246d7f77SFlorian Fainelli #define  SPDSTS_10			0
271246d7f77SFlorian Fainelli #define  SPDSTS_100			1
272246d7f77SFlorian Fainelli #define  SPDSTS_1000			2
273246d7f77SFlorian Fainelli #define  SPDSTS_SHIFT			2
274246d7f77SFlorian Fainelli #define  SPDSTS_MASK			0x3
275246d7f77SFlorian Fainelli 
276246d7f77SFlorian Fainelli #define CORE_DUPSTS			0x00420
277246d7f77SFlorian Fainelli #define  CORE_DUPSTS_MASK		0x1ff
278246d7f77SFlorian Fainelli 
279246d7f77SFlorian Fainelli #define CORE_PAUSESTS			0x00428
280246d7f77SFlorian Fainelli #define  PAUSESTS_TX_PAUSE_SHIFT	9
281246d7f77SFlorian Fainelli 
282246d7f77SFlorian Fainelli #define CORE_GMNCFGCFG			0x0800
283246d7f77SFlorian Fainelli #define  RST_MIB_CNT			(1 << 0)
284246d7f77SFlorian Fainelli #define  RXBPDU_EN			(1 << 1)
285246d7f77SFlorian Fainelli 
286246d7f77SFlorian Fainelli #define CORE_IMP0_PRT_ID		0x0804
287246d7f77SFlorian Fainelli 
288246d7f77SFlorian Fainelli #define CORE_RST_MIB_CNT_EN		0x0950
289246d7f77SFlorian Fainelli 
290064523ffSFlorian Fainelli #define CORE_ARLA_VTBL_RWCTRL		0x1600
291064523ffSFlorian Fainelli #define  ARLA_VTBL_CMD_WRITE		0
292064523ffSFlorian Fainelli #define  ARLA_VTBL_CMD_READ		1
293064523ffSFlorian Fainelli #define  ARLA_VTBL_CMD_CLEAR		2
294064523ffSFlorian Fainelli #define  ARLA_VTBL_STDN			(1 << 7)
295064523ffSFlorian Fainelli 
296064523ffSFlorian Fainelli #define CORE_ARLA_VTBL_ADDR		0x1604
297064523ffSFlorian Fainelli #define  VTBL_ADDR_INDEX_MASK		0xfff
298064523ffSFlorian Fainelli 
299064523ffSFlorian Fainelli #define CORE_ARLA_VTBL_ENTRY		0x160c
300064523ffSFlorian Fainelli #define  FWD_MAP_MASK			0x1ff
301064523ffSFlorian Fainelli #define  UNTAG_MAP_MASK			0x1ff
302064523ffSFlorian Fainelli #define  UNTAG_MAP_SHIFT		9
303064523ffSFlorian Fainelli #define  MSTP_INDEX_MASK		0x7
304064523ffSFlorian Fainelli #define  MSTP_INDEX_SHIFT		18
305064523ffSFlorian Fainelli #define  FWD_MODE			(1 << 21)
306064523ffSFlorian Fainelli 
307246d7f77SFlorian Fainelli #define CORE_MEM_PSM_VDD_CTRL		0x2380
308246d7f77SFlorian Fainelli #define  P_TXQ_PSM_VDD_SHIFT		2
309246d7f77SFlorian Fainelli #define  P_TXQ_PSM_VDD_MASK		0x3
310246d7f77SFlorian Fainelli #define  P_TXQ_PSM_VDD(x)		(P_TXQ_PSM_VDD_MASK << \
311246d7f77SFlorian Fainelli 					((x) * P_TXQ_PSM_VDD_SHIFT))
312246d7f77SFlorian Fainelli 
313e1b9147cSFlorian Fainelli #define CORE_PORT_TC2_QOS_MAP_PORT(x)	(0xc1c0 + ((x) * 0x10))
314e1b9147cSFlorian Fainelli #define  PRT_TO_QID_MASK		0x3
315e1b9147cSFlorian Fainelli #define  PRT_TO_QID_SHIFT		3
316e1b9147cSFlorian Fainelli 
317246d7f77SFlorian Fainelli #define CORE_PORT_VLAN_CTL_PORT(x)	(0xc400 + ((x) * 0x8))
318246d7f77SFlorian Fainelli #define  PORT_VLAN_CTRL_MASK		0x1ff
319246d7f77SFlorian Fainelli 
32032e47ff0SFlorian Fainelli #define CORE_TXQ_THD_PAUSE_QN_PORT_0	0x2c80
32132e47ff0SFlorian Fainelli #define  TXQ_PAUSE_THD_MASK		0x7ff
32232e47ff0SFlorian Fainelli #define CORE_TXQ_THD_PAUSE_QN_PORT(x)	(CORE_TXQ_THD_PAUSE_QN_PORT_0 + \
32332e47ff0SFlorian Fainelli 					(x) * 0x8)
32432e47ff0SFlorian Fainelli 
325064523ffSFlorian Fainelli #define CORE_DEFAULT_1Q_TAG_P(x)	(0xd040 + ((x) * 8))
326064523ffSFlorian Fainelli #define  CFI_SHIFT			12
327064523ffSFlorian Fainelli #define  PRI_SHIFT			13
328064523ffSFlorian Fainelli #define  PRI_MASK			0x7
329064523ffSFlorian Fainelli 
330064523ffSFlorian Fainelli #define CORE_JOIN_ALL_VLAN_EN		0xd140
331064523ffSFlorian Fainelli 
33285345808SFlorian Fainelli #define CORE_CFP_ACC			0x28000
33385345808SFlorian Fainelli #define  OP_STR_DONE			(1 << 0)
33485345808SFlorian Fainelli #define  OP_SEL_SHIFT			1
33585345808SFlorian Fainelli #define  OP_SEL_READ			(1 << OP_SEL_SHIFT)
33685345808SFlorian Fainelli #define  OP_SEL_WRITE			(2 << OP_SEL_SHIFT)
33785345808SFlorian Fainelli #define  OP_SEL_SEARCH			(4 << OP_SEL_SHIFT)
33885345808SFlorian Fainelli #define  OP_SEL_MASK			(7 << OP_SEL_SHIFT)
33985345808SFlorian Fainelli #define  CFP_RAM_CLEAR			(1 << 4)
34085345808SFlorian Fainelli #define  RAM_SEL_SHIFT			10
34185345808SFlorian Fainelli #define  TCAM_SEL			(1 << RAM_SEL_SHIFT)
34285345808SFlorian Fainelli #define  ACT_POL_RAM			(2 << RAM_SEL_SHIFT)
34385345808SFlorian Fainelli #define  RATE_METER_RAM			(4 << RAM_SEL_SHIFT)
34485345808SFlorian Fainelli #define  GREEN_STAT_RAM			(8 << RAM_SEL_SHIFT)
34585345808SFlorian Fainelli #define  YELLOW_STAT_RAM		(16 << RAM_SEL_SHIFT)
34685345808SFlorian Fainelli #define  RED_STAT_RAM			(24 << RAM_SEL_SHIFT)
34785345808SFlorian Fainelli #define  RAM_SEL_MASK			(0x1f << RAM_SEL_SHIFT)
34885345808SFlorian Fainelli #define  TCAM_RESET			(1 << 15)
34985345808SFlorian Fainelli #define  XCESS_ADDR_SHIFT		16
35085345808SFlorian Fainelli #define  XCESS_ADDR_MASK		0xff
35185345808SFlorian Fainelli #define  SEARCH_STS			(1 << 27)
35285345808SFlorian Fainelli #define  RD_STS_SHIFT			28
35385345808SFlorian Fainelli #define  RD_STS_TCAM			(1 << RD_STS_SHIFT)
35485345808SFlorian Fainelli #define  RD_STS_ACT_POL_RAM		(2 << RD_STS_SHIFT)
35585345808SFlorian Fainelli #define  RD_STS_RATE_METER_RAM		(4 << RD_STS_SHIFT)
35685345808SFlorian Fainelli #define  RD_STS_STAT_RAM		(8 << RD_STS_SHIFT)
35785345808SFlorian Fainelli 
35885345808SFlorian Fainelli #define CORE_CFP_RATE_METER_GLOBAL_CTL	0x28010
35985345808SFlorian Fainelli 
36085345808SFlorian Fainelli #define CORE_CFP_DATA_PORT_0		0x28040
36185345808SFlorian Fainelli #define CORE_CFP_DATA_PORT(x)		(CORE_CFP_DATA_PORT_0 + \
36285345808SFlorian Fainelli 					(x) * 0x10)
36385345808SFlorian Fainelli 
36485345808SFlorian Fainelli /* UDF_DATA7 */
36585345808SFlorian Fainelli #define L3_FRAMING_SHIFT		24
36685345808SFlorian Fainelli #define L3_FRAMING_MASK			(0x3 << L3_FRAMING_SHIFT)
36739cdd349SFlorian Fainelli #define IPTOS_SHIFT			16
36839cdd349SFlorian Fainelli #define IPTOS_MASK			0xff
36985345808SFlorian Fainelli #define IPPROTO_SHIFT			8
37085345808SFlorian Fainelli #define IPPROTO_MASK			(0xff << IPPROTO_SHIFT)
37139cdd349SFlorian Fainelli #define IP_FRAG_SHIFT			7
37239cdd349SFlorian Fainelli #define IP_FRAG				(1 << IP_FRAG_SHIFT)
37385345808SFlorian Fainelli 
37485345808SFlorian Fainelli /* UDF_DATA0 */
37585345808SFlorian Fainelli #define  SLICE_VALID			3
37685345808SFlorian Fainelli #define  SLICE_NUM_SHIFT		2
37785345808SFlorian Fainelli #define  SLICE_NUM(x)			((x) << SLICE_NUM_SHIFT)
378bc3fc44cSFlorian Fainelli #define  SLICE_NUM_MASK			0x3
37985345808SFlorian Fainelli 
38085345808SFlorian Fainelli #define CORE_CFP_MASK_PORT_0		0x280c0
38185345808SFlorian Fainelli 
38285345808SFlorian Fainelli #define CORE_CFP_MASK_PORT(x)		(CORE_CFP_MASK_PORT_0 + \
38385345808SFlorian Fainelli 					(x) * 0x10)
38485345808SFlorian Fainelli 
38585345808SFlorian Fainelli #define CORE_ACT_POL_DATA0		0x28140
38685345808SFlorian Fainelli #define  VLAN_BYP			(1 << 0)
38785345808SFlorian Fainelli #define  EAP_BYP			(1 << 1)
38885345808SFlorian Fainelli #define  STP_BYP			(1 << 2)
38985345808SFlorian Fainelli #define  REASON_CODE_SHIFT		3
39085345808SFlorian Fainelli #define  REASON_CODE_MASK		0x3f
39185345808SFlorian Fainelli #define  LOOP_BK_EN			(1 << 9)
39285345808SFlorian Fainelli #define  NEW_TC_SHIFT			10
39385345808SFlorian Fainelli #define  NEW_TC_MASK			0x7
39485345808SFlorian Fainelli #define  CHANGE_TC			(1 << 13)
39585345808SFlorian Fainelli #define  DST_MAP_IB_SHIFT		14
39685345808SFlorian Fainelli #define  DST_MAP_IB_MASK		0x1ff
39785345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_IB_SHIFT	24
39885345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_IB_MASK	0x3
39985345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_IB_NO_DEST	(0 << CHANGE_FWRD_MAP_IB_SHIFT)
40085345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_IB_REM_ARL	(1 << CHANGE_FWRD_MAP_IB_SHIFT)
40185345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_IB_REP_ARL	(2 << CHANGE_FWRD_MAP_IB_SHIFT)
40285345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_IB_ADD_DST	(3 << CHANGE_FWRD_MAP_IB_SHIFT)
40385345808SFlorian Fainelli #define  NEW_DSCP_IB_SHIFT		26
40485345808SFlorian Fainelli #define  NEW_DSCP_IB_MASK		0x3f
40585345808SFlorian Fainelli 
40685345808SFlorian Fainelli #define CORE_ACT_POL_DATA1		0x28150
40785345808SFlorian Fainelli #define  CHANGE_DSCP_IB			(1 << 0)
40885345808SFlorian Fainelli #define  DST_MAP_OB_SHIFT		1
40985345808SFlorian Fainelli #define  DST_MAP_OB_MASK		0x3ff
41085345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_OB_SHIT	11
41185345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_OB_MASK	0x3
41285345808SFlorian Fainelli #define  NEW_DSCP_OB_SHIFT		13
41385345808SFlorian Fainelli #define  NEW_DSCP_OB_MASK		0x3f
41485345808SFlorian Fainelli #define  CHANGE_DSCP_OB			(1 << 19)
41585345808SFlorian Fainelli #define  CHAIN_ID_SHIFT			20
41685345808SFlorian Fainelli #define  CHAIN_ID_MASK			0xff
41785345808SFlorian Fainelli #define  CHANGE_COLOR			(1 << 28)
41885345808SFlorian Fainelli #define  NEW_COLOR_SHIFT		29
41985345808SFlorian Fainelli #define  NEW_COLOR_MASK			0x3
42085345808SFlorian Fainelli #define  NEW_COLOR_GREEN		(0 << NEW_COLOR_SHIFT)
42185345808SFlorian Fainelli #define  NEW_COLOR_YELLOW		(1 << NEW_COLOR_SHIFT)
42285345808SFlorian Fainelli #define  NEW_COLOR_RED			(2 << NEW_COLOR_SHIFT)
42385345808SFlorian Fainelli #define  RED_DEFAULT			(1 << 31)
42485345808SFlorian Fainelli 
42585345808SFlorian Fainelli #define CORE_ACT_POL_DATA2		0x28160
42685345808SFlorian Fainelli #define  MAC_LIMIT_BYPASS		(1 << 0)
42785345808SFlorian Fainelli #define  CHANGE_TC_O			(1 << 1)
42885345808SFlorian Fainelli #define  NEW_TC_O_SHIFT			2
42985345808SFlorian Fainelli #define  NEW_TC_O_MASK			0x7
43085345808SFlorian Fainelli #define  SPCP_RMK_DISABLE		(1 << 5)
43185345808SFlorian Fainelli #define  CPCP_RMK_DISABLE		(1 << 6)
43285345808SFlorian Fainelli #define  DEI_RMK_DISABLE		(1 << 7)
43385345808SFlorian Fainelli 
43485345808SFlorian Fainelli #define CORE_RATE_METER0		0x28180
43585345808SFlorian Fainelli #define  COLOR_MODE			(1 << 0)
43685345808SFlorian Fainelli #define  POLICER_ACTION			(1 << 1)
43785345808SFlorian Fainelli #define  COUPLING_FLAG			(1 << 2)
43885345808SFlorian Fainelli #define  POLICER_MODE_SHIFT		3
43985345808SFlorian Fainelli #define  POLICER_MODE_MASK		0x3
44085345808SFlorian Fainelli #define  POLICER_MODE_RFC2698		(0 << POLICER_MODE_SHIFT)
44185345808SFlorian Fainelli #define  POLICER_MODE_RFC4115		(1 << POLICER_MODE_SHIFT)
44285345808SFlorian Fainelli #define  POLICER_MODE_MEF		(2 << POLICER_MODE_SHIFT)
44385345808SFlorian Fainelli #define  POLICER_MODE_DISABLE		(3 << POLICER_MODE_SHIFT)
44485345808SFlorian Fainelli 
44585345808SFlorian Fainelli #define CORE_RATE_METER1		0x28190
44685345808SFlorian Fainelli #define  EIR_TK_BKT_MASK		0x7fffff
44785345808SFlorian Fainelli 
44885345808SFlorian Fainelli #define CORE_RATE_METER2		0x281a0
44985345808SFlorian Fainelli #define  EIR_BKT_SIZE_MASK		0xfffff
45085345808SFlorian Fainelli 
45185345808SFlorian Fainelli #define CORE_RATE_METER3		0x281b0
45285345808SFlorian Fainelli #define  EIR_REF_CNT_MASK		0x7ffff
45385345808SFlorian Fainelli 
45485345808SFlorian Fainelli #define CORE_RATE_METER4		0x281c0
45585345808SFlorian Fainelli #define  CIR_TK_BKT_MASK		0x7fffff
45685345808SFlorian Fainelli 
45785345808SFlorian Fainelli #define CORE_RATE_METER5		0x281d0
45885345808SFlorian Fainelli #define  CIR_BKT_SIZE_MASK		0xfffff
45985345808SFlorian Fainelli 
46085345808SFlorian Fainelli #define CORE_RATE_METER6		0x281e0
46185345808SFlorian Fainelli #define  CIR_REF_CNT_MASK		0x7ffff
46285345808SFlorian Fainelli 
463f4ae9c08SFlorian Fainelli #define CORE_STAT_GREEN_CNTR		0x28200
464f4ae9c08SFlorian Fainelli #define CORE_STAT_YELLOW_CNTR		0x28210
465f4ae9c08SFlorian Fainelli #define CORE_STAT_RED_CNTR		0x28220
466f4ae9c08SFlorian Fainelli 
46785345808SFlorian Fainelli #define CORE_CFP_CTL_REG		0x28400
46885345808SFlorian Fainelli #define  CFP_EN_MAP_MASK		0x1ff
46985345808SFlorian Fainelli 
47085345808SFlorian Fainelli /* IPv4 slices, 3 of them */
47185345808SFlorian Fainelli #define CORE_UDF_0_A_0_8_PORT_0		0x28440
47285345808SFlorian Fainelli #define  CFG_UDF_OFFSET_MASK		0x1f
47385345808SFlorian Fainelli #define  CFG_UDF_OFFSET_BASE_SHIFT	5
47485345808SFlorian Fainelli #define  CFG_UDF_SOF			(0 << CFG_UDF_OFFSET_BASE_SHIFT)
47585345808SFlorian Fainelli #define  CFG_UDF_EOL2			(2 << CFG_UDF_OFFSET_BASE_SHIFT)
47685345808SFlorian Fainelli #define  CFG_UDF_EOL3			(3 << CFG_UDF_OFFSET_BASE_SHIFT)
47785345808SFlorian Fainelli 
478ba0696c2SFlorian Fainelli /* IPv6 slices */
479ba0696c2SFlorian Fainelli #define CORE_UDF_0_B_0_8_PORT_0		0x28500
480ba0696c2SFlorian Fainelli 
481ba0696c2SFlorian Fainelli /* IPv6 chained slices */
482ba0696c2SFlorian Fainelli #define CORE_UDF_0_D_0_11_PORT_0	0x28680
483ba0696c2SFlorian Fainelli 
48485345808SFlorian Fainelli /* Number of slices for IPv4, IPv6 and non-IP */
4855d80bcbbSFlorian Fainelli #define UDF_NUM_SLICES			4
4865d80bcbbSFlorian Fainelli #define UDFS_PER_SLICE			9
48785345808SFlorian Fainelli 
48885345808SFlorian Fainelli /* Spacing between different slices */
48985345808SFlorian Fainelli #define UDF_SLICE_OFFSET		0x40
49085345808SFlorian Fainelli 
49185345808SFlorian Fainelli #define CFP_NUM_RULES			256
49285345808SFlorian Fainelli 
49318118377SFlorian Fainelli /* Number of egress queues per port */
49418118377SFlorian Fainelli #define SF2_NUM_EGRESS_QUEUES		8
49518118377SFlorian Fainelli 
496246d7f77SFlorian Fainelli #endif /* __BCM_SF2_REGS_H */
497