xref: /linux/drivers/net/dsa/bcm_sf2_regs.h (revision a9349f08ec6c1251d41ef167d27a15cc39bc5b97)
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,
24a78e86edSFlorian Fainelli 	REG_LED_0_CNTRL,
25a78e86edSFlorian Fainelli 	REG_LED_1_CNTRL,
26a78e86edSFlorian Fainelli 	REG_LED_2_CNTRL,
27a78e86edSFlorian Fainelli 	REG_SWITCH_REG_MAX,
28a78e86edSFlorian Fainelli };
29a78e86edSFlorian Fainelli 
30a78e86edSFlorian Fainelli /* Relative to REG_SWITCH_CNTRL */
31246d7f77SFlorian Fainelli #define  MDIO_MASTER_SEL		(1 << 0)
32246d7f77SFlorian Fainelli 
33a78e86edSFlorian Fainelli /* Relative to REG_SWITCH_REVISION */
34246d7f77SFlorian Fainelli #define  SF2_REV_MASK			0xffff
35246d7f77SFlorian Fainelli #define  SWITCH_TOP_REV_SHIFT		16
36246d7f77SFlorian Fainelli #define  SWITCH_TOP_REV_MASK		0xffff
37246d7f77SFlorian Fainelli 
38a78e86edSFlorian Fainelli /* Relative to REG_PHY_REVISION */
39aa9aef77SFlorian Fainelli #define  PHY_REVISION_MASK		0xffff
40246d7f77SFlorian Fainelli 
41a78e86edSFlorian Fainelli /* Relative to REG_SPHY_CNTRL */
42246d7f77SFlorian Fainelli #define  IDDQ_BIAS			(1 << 0)
43246d7f77SFlorian Fainelli #define  EXT_PWR_DOWN			(1 << 1)
44246d7f77SFlorian Fainelli #define  FORCE_DLL_EN			(1 << 2)
45246d7f77SFlorian Fainelli #define  IDDQ_GLOBAL_PWR		(1 << 3)
46246d7f77SFlorian Fainelli #define  CK25_DIS			(1 << 4)
47246d7f77SFlorian Fainelli #define  PHY_RESET			(1 << 5)
48246d7f77SFlorian Fainelli #define  PHY_PHYAD_SHIFT		8
49246d7f77SFlorian Fainelli #define  PHY_PHYAD_MASK			0x1F
50246d7f77SFlorian Fainelli 
51*a9349f08SRafał Miłecki /* Relative to REG_CROSSBAR */
52*a9349f08SRafał Miłecki #define CROSSBAR_BCM4908_INT_P7		0
53*a9349f08SRafał Miłecki #define CROSSBAR_BCM4908_INT_RUNNER	1
54*a9349f08SRafał Miłecki #define CROSSBAR_BCM4908_EXT_SERDES	0
55*a9349f08SRafał Miłecki #define CROSSBAR_BCM4908_EXT_GPHY4	1
56*a9349f08SRafał Miłecki #define CROSSBAR_BCM4908_EXT_RGMII	2
57*a9349f08SRafał Miłecki 
58a78e86edSFlorian Fainelli #define REG_RGMII_CNTRL_P(x)		(REG_RGMII_0_CNTRL + (x))
59a78e86edSFlorian Fainelli 
60246d7f77SFlorian Fainelli /* Relative to REG_RGMII_CNTRL */
61246d7f77SFlorian Fainelli #define  RGMII_MODE_EN			(1 << 0)
62246d7f77SFlorian Fainelli #define  ID_MODE_DIS			(1 << 1)
63246d7f77SFlorian Fainelli #define  PORT_MODE_SHIFT		2
64246d7f77SFlorian Fainelli #define  INT_EPHY			(0 << PORT_MODE_SHIFT)
65246d7f77SFlorian Fainelli #define  INT_GPHY			(1 << PORT_MODE_SHIFT)
66246d7f77SFlorian Fainelli #define  EXT_EPHY			(2 << PORT_MODE_SHIFT)
67246d7f77SFlorian Fainelli #define  EXT_GPHY			(3 << PORT_MODE_SHIFT)
68246d7f77SFlorian Fainelli #define  EXT_REVMII			(4 << PORT_MODE_SHIFT)
69246d7f77SFlorian Fainelli #define  PORT_MODE_MASK			0x7
70246d7f77SFlorian Fainelli #define  RVMII_REF_SEL			(1 << 5)
71246d7f77SFlorian Fainelli #define  RX_PAUSE_EN			(1 << 6)
72246d7f77SFlorian Fainelli #define  TX_PAUSE_EN			(1 << 7)
73246d7f77SFlorian Fainelli #define  TX_CLK_STOP_EN			(1 << 8)
74246d7f77SFlorian Fainelli #define  LPI_COUNT_SHIFT		9
75246d7f77SFlorian Fainelli #define  LPI_COUNT_MASK			0x3F
76246d7f77SFlorian Fainelli 
77a78e86edSFlorian Fainelli #define REG_LED_CNTRL(x)		(REG_LED_0_CNTRL + (x))
78a78e86edSFlorian Fainelli 
799af197a8SFlorian Fainelli #define  SPDLNK_SRC_SEL			(1 << 24)
809af197a8SFlorian Fainelli 
81246d7f77SFlorian Fainelli /* Register set relative to 'INTRL2_0' and 'INTRL2_1' */
82246d7f77SFlorian Fainelli #define INTRL2_CPU_STATUS		0x00
83246d7f77SFlorian Fainelli #define INTRL2_CPU_SET			0x04
84246d7f77SFlorian Fainelli #define INTRL2_CPU_CLEAR		0x08
85246d7f77SFlorian Fainelli #define INTRL2_CPU_MASK_STATUS		0x0c
86246d7f77SFlorian Fainelli #define INTRL2_CPU_MASK_SET		0x10
87246d7f77SFlorian Fainelli #define INTRL2_CPU_MASK_CLEAR		0x14
88246d7f77SFlorian Fainelli 
89246d7f77SFlorian Fainelli /* Shared INTRL2_0 and INTRL2_ interrupt sources macros */
90246d7f77SFlorian Fainelli #define P_LINK_UP_IRQ(x)		(1 << (0 + (x)))
91246d7f77SFlorian Fainelli #define P_LINK_DOWN_IRQ(x)		(1 << (1 + (x)))
92246d7f77SFlorian Fainelli #define P_ENERGY_ON_IRQ(x)		(1 << (2 + (x)))
93246d7f77SFlorian Fainelli #define P_ENERGY_OFF_IRQ(x)		(1 << (3 + (x)))
94246d7f77SFlorian Fainelli #define P_GPHY_IRQ(x)			(1 << (4 + (x)))
95246d7f77SFlorian Fainelli #define P_NUM_IRQ			5
96246d7f77SFlorian Fainelli #define P_IRQ_MASK(x)			(P_LINK_UP_IRQ((x)) | \
97246d7f77SFlorian Fainelli 					 P_LINK_DOWN_IRQ((x)) | \
98246d7f77SFlorian Fainelli 					 P_ENERGY_ON_IRQ((x)) | \
99246d7f77SFlorian Fainelli 					 P_ENERGY_OFF_IRQ((x)) | \
100246d7f77SFlorian Fainelli 					 P_GPHY_IRQ((x)))
101246d7f77SFlorian Fainelli 
102246d7f77SFlorian Fainelli /* INTRL2_0 interrupt sources */
103246d7f77SFlorian Fainelli #define P0_IRQ_OFF			0
104246d7f77SFlorian Fainelli #define MEM_DOUBLE_IRQ			(1 << 5)
105246d7f77SFlorian Fainelli #define EEE_LPI_IRQ			(1 << 6)
106246d7f77SFlorian Fainelli #define P5_CPU_WAKE_IRQ			(1 << 7)
107246d7f77SFlorian Fainelli #define P8_CPU_WAKE_IRQ			(1 << 8)
108246d7f77SFlorian Fainelli #define P7_CPU_WAKE_IRQ			(1 << 9)
109246d7f77SFlorian Fainelli #define IEEE1588_IRQ			(1 << 10)
110246d7f77SFlorian Fainelli #define MDIO_ERR_IRQ			(1 << 11)
111246d7f77SFlorian Fainelli #define MDIO_DONE_IRQ			(1 << 12)
112246d7f77SFlorian Fainelli #define GISB_ERR_IRQ			(1 << 13)
113246d7f77SFlorian Fainelli #define UBUS_ERR_IRQ			(1 << 14)
114246d7f77SFlorian Fainelli #define FAILOVER_ON_IRQ			(1 << 15)
115246d7f77SFlorian Fainelli #define FAILOVER_OFF_IRQ		(1 << 16)
116246d7f77SFlorian Fainelli #define TCAM_SOFT_ERR_IRQ		(1 << 17)
117246d7f77SFlorian Fainelli 
118246d7f77SFlorian Fainelli /* INTRL2_1 interrupt sources */
119246d7f77SFlorian Fainelli #define P7_IRQ_OFF			0
120246d7f77SFlorian Fainelli #define P_IRQ_OFF(x)			((6 - (x)) * P_NUM_IRQ)
121246d7f77SFlorian Fainelli 
12232e47ff0SFlorian Fainelli /* Register set relative to 'ACB' */
12332e47ff0SFlorian Fainelli #define ACB_CONTROL			0x00
12432e47ff0SFlorian Fainelli #define  ACB_EN				(1 << 0)
12532e47ff0SFlorian Fainelli #define  ACB_ALGORITHM			(1 << 1)
12632e47ff0SFlorian Fainelli #define  ACB_FLUSH_SHIFT		2
12732e47ff0SFlorian Fainelli #define  ACB_FLUSH_MASK			0x3
12832e47ff0SFlorian Fainelli 
12932e47ff0SFlorian Fainelli #define ACB_QUEUE_0_CFG			0x08
13032e47ff0SFlorian Fainelli #define  XOFF_THRESHOLD_MASK		0x7ff
13132e47ff0SFlorian Fainelli #define  XON_EN				(1 << 11)
13232e47ff0SFlorian Fainelli #define  TOTAL_XOFF_THRESHOLD_SHIFT	12
13332e47ff0SFlorian Fainelli #define  TOTAL_XOFF_THRESHOLD_MASK	0x7ff
13432e47ff0SFlorian Fainelli #define  TOTAL_XOFF_EN			(1 << 23)
13532e47ff0SFlorian Fainelli #define  TOTAL_XON_EN			(1 << 24)
13632e47ff0SFlorian Fainelli #define  PKTLEN_SHIFT			25
13732e47ff0SFlorian Fainelli #define  PKTLEN_MASK			0x3f
13832e47ff0SFlorian Fainelli #define ACB_QUEUE_CFG(x)		(ACB_QUEUE_0_CFG + ((x) * 0x4))
13932e47ff0SFlorian Fainelli 
140246d7f77SFlorian Fainelli /* Register set relative to 'CORE' */
141246d7f77SFlorian Fainelli #define CORE_G_PCTL_PORT0		0x00000
142246d7f77SFlorian Fainelli #define CORE_G_PCTL_PORT(x)		(CORE_G_PCTL_PORT0 + (x * 0x4))
143246d7f77SFlorian Fainelli #define CORE_IMP_CTL			0x00020
144246d7f77SFlorian Fainelli #define  RX_DIS				(1 << 0)
145246d7f77SFlorian Fainelli #define  TX_DIS				(1 << 1)
146246d7f77SFlorian Fainelli #define  RX_BCST_EN			(1 << 2)
147246d7f77SFlorian Fainelli #define  RX_MCST_EN			(1 << 3)
148246d7f77SFlorian Fainelli #define  RX_UCST_EN			(1 << 4)
149246d7f77SFlorian Fainelli 
150246d7f77SFlorian Fainelli #define CORE_SWMODE			0x0002c
151246d7f77SFlorian Fainelli #define  SW_FWDG_MODE			(1 << 0)
152246d7f77SFlorian Fainelli #define  SW_FWDG_EN			(1 << 1)
153246d7f77SFlorian Fainelli #define  RTRY_LMT_DIS			(1 << 2)
154246d7f77SFlorian Fainelli 
155246d7f77SFlorian Fainelli #define CORE_STS_OVERRIDE_IMP		0x00038
156246d7f77SFlorian Fainelli #define  GMII_SPEED_UP_2G		(1 << 6)
157246d7f77SFlorian Fainelli #define  MII_SW_OR			(1 << 7)
158246d7f77SFlorian Fainelli 
1590fe99338SFlorian Fainelli /* Alternate layout for e.g: 7278 */
1600fe99338SFlorian Fainelli #define CORE_STS_OVERRIDE_IMP2		0x39040
1610fe99338SFlorian Fainelli 
162246d7f77SFlorian Fainelli #define CORE_NEW_CTRL			0x00084
163246d7f77SFlorian Fainelli #define  IP_MC				(1 << 0)
164246d7f77SFlorian Fainelli #define  OUTRANGEERR_DISCARD		(1 << 1)
165246d7f77SFlorian Fainelli #define  INRANGEERR_DISCARD		(1 << 2)
166246d7f77SFlorian Fainelli #define  CABLE_DIAG_LEN			(1 << 3)
167246d7f77SFlorian Fainelli #define  OVERRIDE_AUTO_PD_WAR		(1 << 4)
168246d7f77SFlorian Fainelli #define  EN_AUTO_PD_WAR			(1 << 5)
169246d7f77SFlorian Fainelli #define  UC_FWD_EN			(1 << 6)
170246d7f77SFlorian Fainelli #define  MC_FWD_EN			(1 << 7)
171246d7f77SFlorian Fainelli 
172246d7f77SFlorian Fainelli #define CORE_SWITCH_CTRL		0x00088
173246d7f77SFlorian Fainelli #define  MII_DUMB_FWDG_EN		(1 << 6)
174246d7f77SFlorian Fainelli 
175c0e6820bSFlorian Fainelli #define CORE_DIS_LEARN			0x000f0
176c0e6820bSFlorian Fainelli 
177246d7f77SFlorian Fainelli #define CORE_SFT_LRN_CTRL		0x000f8
178246d7f77SFlorian Fainelli #define  SW_LEARN_CNTL(x)		(1 << (x))
179246d7f77SFlorian Fainelli 
180246d7f77SFlorian Fainelli #define CORE_STS_OVERRIDE_GMIIP_PORT(x)	(0x160 + (x) * 4)
1810fe99338SFlorian Fainelli #define CORE_STS_OVERRIDE_GMIIP2_PORT(x) (0x39000 + (x) * 8)
182246d7f77SFlorian Fainelli #define  LINK_STS			(1 << 0)
183246d7f77SFlorian Fainelli #define  DUPLX_MODE			(1 << 1)
184246d7f77SFlorian Fainelli #define  SPEED_SHIFT			2
185246d7f77SFlorian Fainelli #define  SPEED_MASK			0x3
186246d7f77SFlorian Fainelli #define  RXFLOW_CNTL			(1 << 4)
187246d7f77SFlorian Fainelli #define  TXFLOW_CNTL			(1 << 5)
188246d7f77SFlorian Fainelli #define  SW_OVERRIDE			(1 << 6)
189246d7f77SFlorian Fainelli 
190246d7f77SFlorian Fainelli #define CORE_WATCHDOG_CTRL		0x001e4
191246d7f77SFlorian Fainelli #define  SOFTWARE_RESET			(1 << 7)
192246d7f77SFlorian Fainelli #define  EN_CHIP_RST			(1 << 6)
193246d7f77SFlorian Fainelli #define  EN_SW_RESET			(1 << 4)
194246d7f77SFlorian Fainelli 
19512f460f2SFlorian Fainelli #define CORE_FAST_AGE_CTRL		0x00220
19612f460f2SFlorian Fainelli #define  EN_FAST_AGE_STATIC		(1 << 0)
19712f460f2SFlorian Fainelli #define  EN_AGE_DYNAMIC			(1 << 1)
19812f460f2SFlorian Fainelli #define  EN_AGE_PORT			(1 << 2)
19912f460f2SFlorian Fainelli #define  EN_AGE_VLAN			(1 << 3)
20012f460f2SFlorian Fainelli #define  EN_AGE_SPT			(1 << 4)
20112f460f2SFlorian Fainelli #define  EN_AGE_MCAST			(1 << 5)
20212f460f2SFlorian Fainelli #define  FAST_AGE_STR_DONE		(1 << 7)
20312f460f2SFlorian Fainelli 
20412f460f2SFlorian Fainelli #define CORE_FAST_AGE_PORT		0x00224
20512f460f2SFlorian Fainelli #define  AGE_PORT_MASK			0xf
20612f460f2SFlorian Fainelli 
20712f460f2SFlorian Fainelli #define CORE_FAST_AGE_VID		0x00228
20812f460f2SFlorian Fainelli #define  AGE_VID_MASK			0x3fff
20912f460f2SFlorian Fainelli 
210246d7f77SFlorian Fainelli #define CORE_LNKSTS			0x00400
211246d7f77SFlorian Fainelli #define  LNK_STS_MASK			0x1ff
212246d7f77SFlorian Fainelli 
213246d7f77SFlorian Fainelli #define CORE_SPDSTS			0x00410
214246d7f77SFlorian Fainelli #define  SPDSTS_10			0
215246d7f77SFlorian Fainelli #define  SPDSTS_100			1
216246d7f77SFlorian Fainelli #define  SPDSTS_1000			2
217246d7f77SFlorian Fainelli #define  SPDSTS_SHIFT			2
218246d7f77SFlorian Fainelli #define  SPDSTS_MASK			0x3
219246d7f77SFlorian Fainelli 
220246d7f77SFlorian Fainelli #define CORE_DUPSTS			0x00420
221246d7f77SFlorian Fainelli #define  CORE_DUPSTS_MASK		0x1ff
222246d7f77SFlorian Fainelli 
223246d7f77SFlorian Fainelli #define CORE_PAUSESTS			0x00428
224246d7f77SFlorian Fainelli #define  PAUSESTS_TX_PAUSE_SHIFT	9
225246d7f77SFlorian Fainelli 
226246d7f77SFlorian Fainelli #define CORE_GMNCFGCFG			0x0800
227246d7f77SFlorian Fainelli #define  RST_MIB_CNT			(1 << 0)
228246d7f77SFlorian Fainelli #define  RXBPDU_EN			(1 << 1)
229246d7f77SFlorian Fainelli 
230246d7f77SFlorian Fainelli #define CORE_IMP0_PRT_ID		0x0804
231246d7f77SFlorian Fainelli 
232246d7f77SFlorian Fainelli #define CORE_RST_MIB_CNT_EN		0x0950
233246d7f77SFlorian Fainelli 
234064523ffSFlorian Fainelli #define CORE_ARLA_VTBL_RWCTRL		0x1600
235064523ffSFlorian Fainelli #define  ARLA_VTBL_CMD_WRITE		0
236064523ffSFlorian Fainelli #define  ARLA_VTBL_CMD_READ		1
237064523ffSFlorian Fainelli #define  ARLA_VTBL_CMD_CLEAR		2
238064523ffSFlorian Fainelli #define  ARLA_VTBL_STDN			(1 << 7)
239064523ffSFlorian Fainelli 
240064523ffSFlorian Fainelli #define CORE_ARLA_VTBL_ADDR		0x1604
241064523ffSFlorian Fainelli #define  VTBL_ADDR_INDEX_MASK		0xfff
242064523ffSFlorian Fainelli 
243064523ffSFlorian Fainelli #define CORE_ARLA_VTBL_ENTRY		0x160c
244064523ffSFlorian Fainelli #define  FWD_MAP_MASK			0x1ff
245064523ffSFlorian Fainelli #define  UNTAG_MAP_MASK			0x1ff
246064523ffSFlorian Fainelli #define  UNTAG_MAP_SHIFT		9
247064523ffSFlorian Fainelli #define  MSTP_INDEX_MASK		0x7
248064523ffSFlorian Fainelli #define  MSTP_INDEX_SHIFT		18
249064523ffSFlorian Fainelli #define  FWD_MODE			(1 << 21)
250064523ffSFlorian Fainelli 
251246d7f77SFlorian Fainelli #define CORE_MEM_PSM_VDD_CTRL		0x2380
252246d7f77SFlorian Fainelli #define  P_TXQ_PSM_VDD_SHIFT		2
253246d7f77SFlorian Fainelli #define  P_TXQ_PSM_VDD_MASK		0x3
254246d7f77SFlorian Fainelli #define  P_TXQ_PSM_VDD(x)		(P_TXQ_PSM_VDD_MASK << \
255246d7f77SFlorian Fainelli 					((x) * P_TXQ_PSM_VDD_SHIFT))
256246d7f77SFlorian Fainelli 
257e1b9147cSFlorian Fainelli #define CORE_PORT_TC2_QOS_MAP_PORT(x)	(0xc1c0 + ((x) * 0x10))
258e1b9147cSFlorian Fainelli #define  PRT_TO_QID_MASK		0x3
259e1b9147cSFlorian Fainelli #define  PRT_TO_QID_SHIFT		3
260e1b9147cSFlorian Fainelli 
261246d7f77SFlorian Fainelli #define CORE_PORT_VLAN_CTL_PORT(x)	(0xc400 + ((x) * 0x8))
262246d7f77SFlorian Fainelli #define  PORT_VLAN_CTRL_MASK		0x1ff
263246d7f77SFlorian Fainelli 
26432e47ff0SFlorian Fainelli #define CORE_TXQ_THD_PAUSE_QN_PORT_0	0x2c80
26532e47ff0SFlorian Fainelli #define  TXQ_PAUSE_THD_MASK		0x7ff
26632e47ff0SFlorian Fainelli #define CORE_TXQ_THD_PAUSE_QN_PORT(x)	(CORE_TXQ_THD_PAUSE_QN_PORT_0 + \
26732e47ff0SFlorian Fainelli 					(x) * 0x8)
26832e47ff0SFlorian Fainelli 
269064523ffSFlorian Fainelli #define CORE_DEFAULT_1Q_TAG_P(x)	(0xd040 + ((x) * 8))
270064523ffSFlorian Fainelli #define  CFI_SHIFT			12
271064523ffSFlorian Fainelli #define  PRI_SHIFT			13
272064523ffSFlorian Fainelli #define  PRI_MASK			0x7
273064523ffSFlorian Fainelli 
274064523ffSFlorian Fainelli #define CORE_JOIN_ALL_VLAN_EN		0xd140
275064523ffSFlorian Fainelli 
27685345808SFlorian Fainelli #define CORE_CFP_ACC			0x28000
27785345808SFlorian Fainelli #define  OP_STR_DONE			(1 << 0)
27885345808SFlorian Fainelli #define  OP_SEL_SHIFT			1
27985345808SFlorian Fainelli #define  OP_SEL_READ			(1 << OP_SEL_SHIFT)
28085345808SFlorian Fainelli #define  OP_SEL_WRITE			(2 << OP_SEL_SHIFT)
28185345808SFlorian Fainelli #define  OP_SEL_SEARCH			(4 << OP_SEL_SHIFT)
28285345808SFlorian Fainelli #define  OP_SEL_MASK			(7 << OP_SEL_SHIFT)
28385345808SFlorian Fainelli #define  CFP_RAM_CLEAR			(1 << 4)
28485345808SFlorian Fainelli #define  RAM_SEL_SHIFT			10
28585345808SFlorian Fainelli #define  TCAM_SEL			(1 << RAM_SEL_SHIFT)
28685345808SFlorian Fainelli #define  ACT_POL_RAM			(2 << RAM_SEL_SHIFT)
28785345808SFlorian Fainelli #define  RATE_METER_RAM			(4 << RAM_SEL_SHIFT)
28885345808SFlorian Fainelli #define  GREEN_STAT_RAM			(8 << RAM_SEL_SHIFT)
28985345808SFlorian Fainelli #define  YELLOW_STAT_RAM		(16 << RAM_SEL_SHIFT)
29085345808SFlorian Fainelli #define  RED_STAT_RAM			(24 << RAM_SEL_SHIFT)
29185345808SFlorian Fainelli #define  RAM_SEL_MASK			(0x1f << RAM_SEL_SHIFT)
29285345808SFlorian Fainelli #define  TCAM_RESET			(1 << 15)
29385345808SFlorian Fainelli #define  XCESS_ADDR_SHIFT		16
29485345808SFlorian Fainelli #define  XCESS_ADDR_MASK		0xff
29585345808SFlorian Fainelli #define  SEARCH_STS			(1 << 27)
29685345808SFlorian Fainelli #define  RD_STS_SHIFT			28
29785345808SFlorian Fainelli #define  RD_STS_TCAM			(1 << RD_STS_SHIFT)
29885345808SFlorian Fainelli #define  RD_STS_ACT_POL_RAM		(2 << RD_STS_SHIFT)
29985345808SFlorian Fainelli #define  RD_STS_RATE_METER_RAM		(4 << RD_STS_SHIFT)
30085345808SFlorian Fainelli #define  RD_STS_STAT_RAM		(8 << RD_STS_SHIFT)
30185345808SFlorian Fainelli 
30285345808SFlorian Fainelli #define CORE_CFP_RATE_METER_GLOBAL_CTL	0x28010
30385345808SFlorian Fainelli 
30485345808SFlorian Fainelli #define CORE_CFP_DATA_PORT_0		0x28040
30585345808SFlorian Fainelli #define CORE_CFP_DATA_PORT(x)		(CORE_CFP_DATA_PORT_0 + \
30685345808SFlorian Fainelli 					(x) * 0x10)
30785345808SFlorian Fainelli 
30885345808SFlorian Fainelli /* UDF_DATA7 */
30985345808SFlorian Fainelli #define L3_FRAMING_SHIFT		24
31085345808SFlorian Fainelli #define L3_FRAMING_MASK			(0x3 << L3_FRAMING_SHIFT)
31139cdd349SFlorian Fainelli #define IPTOS_SHIFT			16
31239cdd349SFlorian Fainelli #define IPTOS_MASK			0xff
31385345808SFlorian Fainelli #define IPPROTO_SHIFT			8
31485345808SFlorian Fainelli #define IPPROTO_MASK			(0xff << IPPROTO_SHIFT)
31539cdd349SFlorian Fainelli #define IP_FRAG_SHIFT			7
31639cdd349SFlorian Fainelli #define IP_FRAG				(1 << IP_FRAG_SHIFT)
31785345808SFlorian Fainelli 
31885345808SFlorian Fainelli /* UDF_DATA0 */
31985345808SFlorian Fainelli #define  SLICE_VALID			3
32085345808SFlorian Fainelli #define  SLICE_NUM_SHIFT		2
32185345808SFlorian Fainelli #define  SLICE_NUM(x)			((x) << SLICE_NUM_SHIFT)
322bc3fc44cSFlorian Fainelli #define  SLICE_NUM_MASK			0x3
32385345808SFlorian Fainelli 
32485345808SFlorian Fainelli #define CORE_CFP_MASK_PORT_0		0x280c0
32585345808SFlorian Fainelli 
32685345808SFlorian Fainelli #define CORE_CFP_MASK_PORT(x)		(CORE_CFP_MASK_PORT_0 + \
32785345808SFlorian Fainelli 					(x) * 0x10)
32885345808SFlorian Fainelli 
32985345808SFlorian Fainelli #define CORE_ACT_POL_DATA0		0x28140
33085345808SFlorian Fainelli #define  VLAN_BYP			(1 << 0)
33185345808SFlorian Fainelli #define  EAP_BYP			(1 << 1)
33285345808SFlorian Fainelli #define  STP_BYP			(1 << 2)
33385345808SFlorian Fainelli #define  REASON_CODE_SHIFT		3
33485345808SFlorian Fainelli #define  REASON_CODE_MASK		0x3f
33585345808SFlorian Fainelli #define  LOOP_BK_EN			(1 << 9)
33685345808SFlorian Fainelli #define  NEW_TC_SHIFT			10
33785345808SFlorian Fainelli #define  NEW_TC_MASK			0x7
33885345808SFlorian Fainelli #define  CHANGE_TC			(1 << 13)
33985345808SFlorian Fainelli #define  DST_MAP_IB_SHIFT		14
34085345808SFlorian Fainelli #define  DST_MAP_IB_MASK		0x1ff
34185345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_IB_SHIFT	24
34285345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_IB_MASK	0x3
34385345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_IB_NO_DEST	(0 << CHANGE_FWRD_MAP_IB_SHIFT)
34485345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_IB_REM_ARL	(1 << CHANGE_FWRD_MAP_IB_SHIFT)
34585345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_IB_REP_ARL	(2 << CHANGE_FWRD_MAP_IB_SHIFT)
34685345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_IB_ADD_DST	(3 << CHANGE_FWRD_MAP_IB_SHIFT)
34785345808SFlorian Fainelli #define  NEW_DSCP_IB_SHIFT		26
34885345808SFlorian Fainelli #define  NEW_DSCP_IB_MASK		0x3f
34985345808SFlorian Fainelli 
35085345808SFlorian Fainelli #define CORE_ACT_POL_DATA1		0x28150
35185345808SFlorian Fainelli #define  CHANGE_DSCP_IB			(1 << 0)
35285345808SFlorian Fainelli #define  DST_MAP_OB_SHIFT		1
35385345808SFlorian Fainelli #define  DST_MAP_OB_MASK		0x3ff
35485345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_OB_SHIT	11
35585345808SFlorian Fainelli #define  CHANGE_FWRD_MAP_OB_MASK	0x3
35685345808SFlorian Fainelli #define  NEW_DSCP_OB_SHIFT		13
35785345808SFlorian Fainelli #define  NEW_DSCP_OB_MASK		0x3f
35885345808SFlorian Fainelli #define  CHANGE_DSCP_OB			(1 << 19)
35985345808SFlorian Fainelli #define  CHAIN_ID_SHIFT			20
36085345808SFlorian Fainelli #define  CHAIN_ID_MASK			0xff
36185345808SFlorian Fainelli #define  CHANGE_COLOR			(1 << 28)
36285345808SFlorian Fainelli #define  NEW_COLOR_SHIFT		29
36385345808SFlorian Fainelli #define  NEW_COLOR_MASK			0x3
36485345808SFlorian Fainelli #define  NEW_COLOR_GREEN		(0 << NEW_COLOR_SHIFT)
36585345808SFlorian Fainelli #define  NEW_COLOR_YELLOW		(1 << NEW_COLOR_SHIFT)
36685345808SFlorian Fainelli #define  NEW_COLOR_RED			(2 << NEW_COLOR_SHIFT)
36785345808SFlorian Fainelli #define  RED_DEFAULT			(1 << 31)
36885345808SFlorian Fainelli 
36985345808SFlorian Fainelli #define CORE_ACT_POL_DATA2		0x28160
37085345808SFlorian Fainelli #define  MAC_LIMIT_BYPASS		(1 << 0)
37185345808SFlorian Fainelli #define  CHANGE_TC_O			(1 << 1)
37285345808SFlorian Fainelli #define  NEW_TC_O_SHIFT			2
37385345808SFlorian Fainelli #define  NEW_TC_O_MASK			0x7
37485345808SFlorian Fainelli #define  SPCP_RMK_DISABLE		(1 << 5)
37585345808SFlorian Fainelli #define  CPCP_RMK_DISABLE		(1 << 6)
37685345808SFlorian Fainelli #define  DEI_RMK_DISABLE		(1 << 7)
37785345808SFlorian Fainelli 
37885345808SFlorian Fainelli #define CORE_RATE_METER0		0x28180
37985345808SFlorian Fainelli #define  COLOR_MODE			(1 << 0)
38085345808SFlorian Fainelli #define  POLICER_ACTION			(1 << 1)
38185345808SFlorian Fainelli #define  COUPLING_FLAG			(1 << 2)
38285345808SFlorian Fainelli #define  POLICER_MODE_SHIFT		3
38385345808SFlorian Fainelli #define  POLICER_MODE_MASK		0x3
38485345808SFlorian Fainelli #define  POLICER_MODE_RFC2698		(0 << POLICER_MODE_SHIFT)
38585345808SFlorian Fainelli #define  POLICER_MODE_RFC4115		(1 << POLICER_MODE_SHIFT)
38685345808SFlorian Fainelli #define  POLICER_MODE_MEF		(2 << POLICER_MODE_SHIFT)
38785345808SFlorian Fainelli #define  POLICER_MODE_DISABLE		(3 << POLICER_MODE_SHIFT)
38885345808SFlorian Fainelli 
38985345808SFlorian Fainelli #define CORE_RATE_METER1		0x28190
39085345808SFlorian Fainelli #define  EIR_TK_BKT_MASK		0x7fffff
39185345808SFlorian Fainelli 
39285345808SFlorian Fainelli #define CORE_RATE_METER2		0x281a0
39385345808SFlorian Fainelli #define  EIR_BKT_SIZE_MASK		0xfffff
39485345808SFlorian Fainelli 
39585345808SFlorian Fainelli #define CORE_RATE_METER3		0x281b0
39685345808SFlorian Fainelli #define  EIR_REF_CNT_MASK		0x7ffff
39785345808SFlorian Fainelli 
39885345808SFlorian Fainelli #define CORE_RATE_METER4		0x281c0
39985345808SFlorian Fainelli #define  CIR_TK_BKT_MASK		0x7fffff
40085345808SFlorian Fainelli 
40185345808SFlorian Fainelli #define CORE_RATE_METER5		0x281d0
40285345808SFlorian Fainelli #define  CIR_BKT_SIZE_MASK		0xfffff
40385345808SFlorian Fainelli 
40485345808SFlorian Fainelli #define CORE_RATE_METER6		0x281e0
40585345808SFlorian Fainelli #define  CIR_REF_CNT_MASK		0x7ffff
40685345808SFlorian Fainelli 
407f4ae9c08SFlorian Fainelli #define CORE_STAT_GREEN_CNTR		0x28200
408f4ae9c08SFlorian Fainelli #define CORE_STAT_YELLOW_CNTR		0x28210
409f4ae9c08SFlorian Fainelli #define CORE_STAT_RED_CNTR		0x28220
410f4ae9c08SFlorian Fainelli 
41185345808SFlorian Fainelli #define CORE_CFP_CTL_REG		0x28400
41285345808SFlorian Fainelli #define  CFP_EN_MAP_MASK		0x1ff
41385345808SFlorian Fainelli 
41485345808SFlorian Fainelli /* IPv4 slices, 3 of them */
41585345808SFlorian Fainelli #define CORE_UDF_0_A_0_8_PORT_0		0x28440
41685345808SFlorian Fainelli #define  CFG_UDF_OFFSET_MASK		0x1f
41785345808SFlorian Fainelli #define  CFG_UDF_OFFSET_BASE_SHIFT	5
41885345808SFlorian Fainelli #define  CFG_UDF_SOF			(0 << CFG_UDF_OFFSET_BASE_SHIFT)
41985345808SFlorian Fainelli #define  CFG_UDF_EOL2			(2 << CFG_UDF_OFFSET_BASE_SHIFT)
42085345808SFlorian Fainelli #define  CFG_UDF_EOL3			(3 << CFG_UDF_OFFSET_BASE_SHIFT)
42185345808SFlorian Fainelli 
422ba0696c2SFlorian Fainelli /* IPv6 slices */
423ba0696c2SFlorian Fainelli #define CORE_UDF_0_B_0_8_PORT_0		0x28500
424ba0696c2SFlorian Fainelli 
425ba0696c2SFlorian Fainelli /* IPv6 chained slices */
426ba0696c2SFlorian Fainelli #define CORE_UDF_0_D_0_11_PORT_0	0x28680
427ba0696c2SFlorian Fainelli 
42885345808SFlorian Fainelli /* Number of slices for IPv4, IPv6 and non-IP */
4295d80bcbbSFlorian Fainelli #define UDF_NUM_SLICES			4
4305d80bcbbSFlorian Fainelli #define UDFS_PER_SLICE			9
43185345808SFlorian Fainelli 
43285345808SFlorian Fainelli /* Spacing between different slices */
43385345808SFlorian Fainelli #define UDF_SLICE_OFFSET		0x40
43485345808SFlorian Fainelli 
43585345808SFlorian Fainelli #define CFP_NUM_RULES			256
43685345808SFlorian Fainelli 
43718118377SFlorian Fainelli /* Number of egress queues per port */
43818118377SFlorian Fainelli #define SF2_NUM_EGRESS_QUEUES		8
43918118377SFlorian Fainelli 
440246d7f77SFlorian Fainelli #endif /* __BCM_SF2_REGS_H */
441