xref: /linux/drivers/net/dsa/b53/b53_regs.h (revision 151da0171e12607b987d9a028a046104358b7f0d)
1967dd82fSFlorian Fainelli /*
2967dd82fSFlorian Fainelli  * B53 register definitions
3967dd82fSFlorian Fainelli  *
4967dd82fSFlorian Fainelli  * Copyright (C) 2004 Broadcom Corporation
5967dd82fSFlorian Fainelli  * Copyright (C) 2011-2013 Jonas Gorski <jogo@openwrt.org>
6967dd82fSFlorian Fainelli  *
7967dd82fSFlorian Fainelli  * Permission to use, copy, modify, and/or distribute this software for any
8967dd82fSFlorian Fainelli  * purpose with or without fee is hereby granted, provided that the above
9967dd82fSFlorian Fainelli  * copyright notice and this permission notice appear in all copies.
10967dd82fSFlorian Fainelli  *
11967dd82fSFlorian Fainelli  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12967dd82fSFlorian Fainelli  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13967dd82fSFlorian Fainelli  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14967dd82fSFlorian Fainelli  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15967dd82fSFlorian Fainelli  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16967dd82fSFlorian Fainelli  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17967dd82fSFlorian Fainelli  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18967dd82fSFlorian Fainelli  */
19967dd82fSFlorian Fainelli 
20967dd82fSFlorian Fainelli #ifndef __B53_REGS_H
21967dd82fSFlorian Fainelli #define __B53_REGS_H
22967dd82fSFlorian Fainelli 
23967dd82fSFlorian Fainelli /* Management Port (SMP) Page offsets */
24967dd82fSFlorian Fainelli #define B53_CTRL_PAGE			0x00 /* Control */
25967dd82fSFlorian Fainelli #define B53_STAT_PAGE			0x01 /* Status */
26967dd82fSFlorian Fainelli #define B53_MGMT_PAGE			0x02 /* Management Mode */
27967dd82fSFlorian Fainelli #define B53_MIB_AC_PAGE			0x03 /* MIB Autocast */
28967dd82fSFlorian Fainelli #define B53_ARLCTRL_PAGE		0x04 /* ARL Control */
29967dd82fSFlorian Fainelli #define B53_ARLIO_PAGE			0x05 /* ARL Access */
30967dd82fSFlorian Fainelli #define B53_FRAMEBUF_PAGE		0x06 /* Management frame access */
31967dd82fSFlorian Fainelli #define B53_MEM_ACCESS_PAGE		0x08 /* Memory access */
32967dd82fSFlorian Fainelli 
33967dd82fSFlorian Fainelli /* PHY Registers */
34967dd82fSFlorian Fainelli #define B53_PORT_MII_PAGE(i)		(0x10 + (i)) /* Port i MII Registers */
35967dd82fSFlorian Fainelli #define B53_IM_PORT_PAGE		0x18 /* Inverse MII Port (to EMAC) */
36967dd82fSFlorian Fainelli #define B53_ALL_PORT_PAGE		0x19 /* All ports MII (broadcast) */
37967dd82fSFlorian Fainelli 
38967dd82fSFlorian Fainelli /* MIB registers */
39967dd82fSFlorian Fainelli #define B53_MIB_PAGE(i)			(0x20 + (i))
40967dd82fSFlorian Fainelli 
41967dd82fSFlorian Fainelli /* Quality of Service (QoS) Registers */
42967dd82fSFlorian Fainelli #define B53_QOS_PAGE			0x30
43967dd82fSFlorian Fainelli 
44967dd82fSFlorian Fainelli /* Port VLAN Page */
45967dd82fSFlorian Fainelli #define B53_PVLAN_PAGE			0x31
46967dd82fSFlorian Fainelli 
47967dd82fSFlorian Fainelli /* VLAN Registers */
48967dd82fSFlorian Fainelli #define B53_VLAN_PAGE			0x34
49967dd82fSFlorian Fainelli 
50967dd82fSFlorian Fainelli /* Jumbo Frame Registers */
51967dd82fSFlorian Fainelli #define B53_JUMBO_PAGE			0x40
52967dd82fSFlorian Fainelli 
53967dd82fSFlorian Fainelli /* CFP Configuration Registers Page */
54967dd82fSFlorian Fainelli #define B53_CFP_PAGE			0xa1
55967dd82fSFlorian Fainelli 
56967dd82fSFlorian Fainelli /*************************************************************************
57967dd82fSFlorian Fainelli  * Control Page registers
58967dd82fSFlorian Fainelli  *************************************************************************/
59967dd82fSFlorian Fainelli 
60967dd82fSFlorian Fainelli /* Port Control Register (8 bit) */
61967dd82fSFlorian Fainelli #define B53_PORT_CTRL(i)		(0x00 + (i))
62967dd82fSFlorian Fainelli #define   PORT_CTRL_RX_DISABLE		BIT(0)
63967dd82fSFlorian Fainelli #define   PORT_CTRL_TX_DISABLE		BIT(1)
64967dd82fSFlorian Fainelli #define   PORT_CTRL_RX_BCST_EN		BIT(2) /* Broadcast RX (P8 only) */
65967dd82fSFlorian Fainelli #define   PORT_CTRL_RX_MCST_EN		BIT(3) /* Multicast RX (P8 only) */
66967dd82fSFlorian Fainelli #define   PORT_CTRL_RX_UCST_EN		BIT(4) /* Unicast RX (P8 only) */
67967dd82fSFlorian Fainelli #define	  PORT_CTRL_STP_STATE_S		5
68ff39c2d6SFlorian Fainelli #define   PORT_CTRL_NO_STP		(0 << PORT_CTRL_STP_STATE_S)
69ff39c2d6SFlorian Fainelli #define   PORT_CTRL_DIS_STATE		(1 << PORT_CTRL_STP_STATE_S)
70ff39c2d6SFlorian Fainelli #define   PORT_CTRL_BLOCK_STATE		(2 << PORT_CTRL_STP_STATE_S)
71ff39c2d6SFlorian Fainelli #define   PORT_CTRL_LISTEN_STATE	(3 << PORT_CTRL_STP_STATE_S)
72ff39c2d6SFlorian Fainelli #define   PORT_CTRL_LEARN_STATE		(4 << PORT_CTRL_STP_STATE_S)
73ff39c2d6SFlorian Fainelli #define   PORT_CTRL_FWD_STATE		(5 << PORT_CTRL_STP_STATE_S)
74967dd82fSFlorian Fainelli #define   PORT_CTRL_STP_STATE_MASK	(0x7 << PORT_CTRL_STP_STATE_S)
75967dd82fSFlorian Fainelli 
76967dd82fSFlorian Fainelli /* SMP Control Register (8 bit) */
77967dd82fSFlorian Fainelli #define B53_SMP_CTRL			0x0a
78967dd82fSFlorian Fainelli 
79967dd82fSFlorian Fainelli /* Switch Mode Control Register (8 bit) */
80967dd82fSFlorian Fainelli #define B53_SWITCH_MODE			0x0b
81967dd82fSFlorian Fainelli #define   SM_SW_FWD_MODE		BIT(0)	/* 1 = Managed Mode */
82967dd82fSFlorian Fainelli #define   SM_SW_FWD_EN			BIT(1)	/* Forwarding Enable */
83967dd82fSFlorian Fainelli 
84967dd82fSFlorian Fainelli /* IMP Port state override register (8 bit) */
85967dd82fSFlorian Fainelli #define B53_PORT_OVERRIDE_CTRL		0x0e
86967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_LINK		BIT(0)
87967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_FULL_DUPLEX	BIT(1) /* 0 = Half Duplex */
88967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_SPEED_S		2
89967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_SPEED_10M	(0 << PORT_OVERRIDE_SPEED_S)
90967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_SPEED_100M	(1 << PORT_OVERRIDE_SPEED_S)
91967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_SPEED_1000M	(2 << PORT_OVERRIDE_SPEED_S)
92967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_RV_MII_25	BIT(4) /* BCM5325 only */
93967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_RX_FLOW		BIT(4)
94967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_TX_FLOW		BIT(5)
95967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_SPEED_2000M	BIT(6) /* BCM5301X only, requires setting 1000M */
96967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_EN		BIT(7) /* Use the register contents */
97967dd82fSFlorian Fainelli 
98967dd82fSFlorian Fainelli /* Power-down mode control */
99967dd82fSFlorian Fainelli #define B53_PD_MODE_CTRL_25		0x0f
100967dd82fSFlorian Fainelli 
101967dd82fSFlorian Fainelli /* IP Multicast control (8 bit) */
102967dd82fSFlorian Fainelli #define B53_IP_MULTICAST_CTRL		0x21
103967dd82fSFlorian Fainelli #define  B53_IPMC_FWD_EN		BIT(1)
104967dd82fSFlorian Fainelli #define  B53_UC_FWD_EN			BIT(6)
105967dd82fSFlorian Fainelli #define  B53_MC_FWD_EN			BIT(7)
106967dd82fSFlorian Fainelli 
107967dd82fSFlorian Fainelli /* (16 bit) */
108967dd82fSFlorian Fainelli #define B53_UC_FLOOD_MASK		0x32
109967dd82fSFlorian Fainelli #define B53_MC_FLOOD_MASK		0x34
110967dd82fSFlorian Fainelli #define B53_IPMC_FLOOD_MASK		0x36
111967dd82fSFlorian Fainelli 
112967dd82fSFlorian Fainelli /*
113967dd82fSFlorian Fainelli  * Override Ports 0-7 State on devices with xMII interfaces (8 bit)
114967dd82fSFlorian Fainelli  *
115967dd82fSFlorian Fainelli  * For port 8 still use B53_PORT_OVERRIDE_CTRL
116967dd82fSFlorian Fainelli  * Please note that not all ports are available on every hardware, e.g. BCM5301X
117967dd82fSFlorian Fainelli  * don't include overriding port 6, BCM63xx also have some limitations.
118967dd82fSFlorian Fainelli  */
119967dd82fSFlorian Fainelli #define B53_GMII_PORT_OVERRIDE_CTRL(i)	(0x58 + (i))
120967dd82fSFlorian Fainelli #define   GMII_PO_LINK			BIT(0)
121967dd82fSFlorian Fainelli #define   GMII_PO_FULL_DUPLEX		BIT(1) /* 0 = Half Duplex */
122967dd82fSFlorian Fainelli #define   GMII_PO_SPEED_S		2
123967dd82fSFlorian Fainelli #define   GMII_PO_SPEED_10M		(0 << GMII_PO_SPEED_S)
124967dd82fSFlorian Fainelli #define   GMII_PO_SPEED_100M		(1 << GMII_PO_SPEED_S)
125967dd82fSFlorian Fainelli #define   GMII_PO_SPEED_1000M		(2 << GMII_PO_SPEED_S)
126967dd82fSFlorian Fainelli #define   GMII_PO_RX_FLOW		BIT(4)
127967dd82fSFlorian Fainelli #define   GMII_PO_TX_FLOW		BIT(5)
128967dd82fSFlorian Fainelli #define   GMII_PO_EN			BIT(6) /* Use the register contents */
129967dd82fSFlorian Fainelli #define   GMII_PO_SPEED_2000M		BIT(7) /* BCM5301X only, requires setting 1000M */
130967dd82fSFlorian Fainelli 
131967dd82fSFlorian Fainelli #define B53_RGMII_CTRL_IMP		0x60
132967dd82fSFlorian Fainelli #define   RGMII_CTRL_ENABLE_GMII	BIT(7)
133967dd82fSFlorian Fainelli #define   RGMII_CTRL_TIMING_SEL		BIT(2)
134967dd82fSFlorian Fainelli #define   RGMII_CTRL_DLL_RXC		BIT(1)
135967dd82fSFlorian Fainelli #define   RGMII_CTRL_DLL_TXC		BIT(0)
136967dd82fSFlorian Fainelli 
137967dd82fSFlorian Fainelli #define B53_RGMII_CTRL_P(i)		(B53_RGMII_CTRL_IMP + (i))
138967dd82fSFlorian Fainelli 
139967dd82fSFlorian Fainelli /* Software reset register (8 bit) */
140967dd82fSFlorian Fainelli #define B53_SOFTRESET			0x79
141967dd82fSFlorian Fainelli #define   SW_RST			BIT(7)
142967dd82fSFlorian Fainelli #define   EN_SW_RST			BIT(4)
143967dd82fSFlorian Fainelli 
144967dd82fSFlorian Fainelli /* Fast Aging Control register (8 bit) */
145967dd82fSFlorian Fainelli #define B53_FAST_AGE_CTRL		0x88
146967dd82fSFlorian Fainelli #define   FAST_AGE_STATIC		BIT(0)
147967dd82fSFlorian Fainelli #define   FAST_AGE_DYNAMIC		BIT(1)
148967dd82fSFlorian Fainelli #define   FAST_AGE_PORT			BIT(2)
149967dd82fSFlorian Fainelli #define   FAST_AGE_VLAN			BIT(3)
150967dd82fSFlorian Fainelli #define   FAST_AGE_STP			BIT(4)
151967dd82fSFlorian Fainelli #define   FAST_AGE_MC			BIT(5)
152967dd82fSFlorian Fainelli #define   FAST_AGE_DONE			BIT(7)
153967dd82fSFlorian Fainelli 
154ff39c2d6SFlorian Fainelli /* Fast Aging Port Control register (8 bit) */
155ff39c2d6SFlorian Fainelli #define B53_FAST_AGE_PORT_CTRL		0x89
156ff39c2d6SFlorian Fainelli 
157ff39c2d6SFlorian Fainelli /* Fast Aging VID Control register (16 bit) */
158ff39c2d6SFlorian Fainelli #define B53_FAST_AGE_VID_CTRL		0x8a
159ff39c2d6SFlorian Fainelli 
160967dd82fSFlorian Fainelli /*************************************************************************
161967dd82fSFlorian Fainelli  * Status Page registers
162967dd82fSFlorian Fainelli  *************************************************************************/
163967dd82fSFlorian Fainelli 
164967dd82fSFlorian Fainelli /* Link Status Summary Register (16bit) */
165967dd82fSFlorian Fainelli #define B53_LINK_STAT			0x00
166967dd82fSFlorian Fainelli 
167967dd82fSFlorian Fainelli /* Link Status Change Register (16 bit) */
168967dd82fSFlorian Fainelli #define B53_LINK_STAT_CHANGE		0x02
169967dd82fSFlorian Fainelli 
170967dd82fSFlorian Fainelli /* Port Speed Summary Register (16 bit for FE, 32 bit for GE) */
171967dd82fSFlorian Fainelli #define B53_SPEED_STAT			0x04
172967dd82fSFlorian Fainelli #define  SPEED_PORT_FE(reg, port)	(((reg) >> (port)) & 1)
173967dd82fSFlorian Fainelli #define  SPEED_PORT_GE(reg, port)	(((reg) >> 2 * (port)) & 3)
174967dd82fSFlorian Fainelli #define  SPEED_STAT_10M			0
175967dd82fSFlorian Fainelli #define  SPEED_STAT_100M		1
176967dd82fSFlorian Fainelli #define  SPEED_STAT_1000M		2
177967dd82fSFlorian Fainelli 
178967dd82fSFlorian Fainelli /* Duplex Status Summary (16 bit) */
179967dd82fSFlorian Fainelli #define B53_DUPLEX_STAT_FE		0x06
180967dd82fSFlorian Fainelli #define B53_DUPLEX_STAT_GE		0x08
181967dd82fSFlorian Fainelli #define B53_DUPLEX_STAT_63XX		0x0c
182967dd82fSFlorian Fainelli 
183967dd82fSFlorian Fainelli /* Revision ID register for BCM5325 */
184967dd82fSFlorian Fainelli #define B53_REV_ID_25			0x50
185967dd82fSFlorian Fainelli 
186967dd82fSFlorian Fainelli /* Strap Value (48 bit) */
187967dd82fSFlorian Fainelli #define B53_STRAP_VALUE			0x70
188967dd82fSFlorian Fainelli #define   SV_GMII_CTRL_115		BIT(27)
189967dd82fSFlorian Fainelli 
190967dd82fSFlorian Fainelli /*************************************************************************
191967dd82fSFlorian Fainelli  * Management Mode Page Registers
192967dd82fSFlorian Fainelli  *************************************************************************/
193967dd82fSFlorian Fainelli 
194967dd82fSFlorian Fainelli /* Global Management Config Register (8 bit) */
195967dd82fSFlorian Fainelli #define B53_GLOBAL_CONFIG		0x00
196967dd82fSFlorian Fainelli #define   GC_RESET_MIB			0x01
197967dd82fSFlorian Fainelli #define   GC_RX_BPDU_EN			0x02
198967dd82fSFlorian Fainelli #define   GC_MIB_AC_HDR_EN		0x10
199967dd82fSFlorian Fainelli #define   GC_MIB_AC_EN			0x20
200967dd82fSFlorian Fainelli #define   GC_FRM_MGMT_PORT_M		0xC0
201967dd82fSFlorian Fainelli #define   GC_FRM_MGMT_PORT_04		0x00
202967dd82fSFlorian Fainelli #define   GC_FRM_MGMT_PORT_MII		0x80
203967dd82fSFlorian Fainelli 
204967dd82fSFlorian Fainelli /* Broadcom Header control register (8 bit) */
205967dd82fSFlorian Fainelli #define B53_BRCM_HDR			0x03
206967dd82fSFlorian Fainelli #define   BRCM_HDR_P8_EN		BIT(0) /* Enable tagging on port 8 */
207967dd82fSFlorian Fainelli #define   BRCM_HDR_P5_EN		BIT(1) /* Enable tagging on port 5 */
208967dd82fSFlorian Fainelli 
209*151da017SFlorian Fainelli /* Mirror capture control register (16 bit) */
210*151da017SFlorian Fainelli #define B53_MIR_CAP_CTL			0x10
211*151da017SFlorian Fainelli #define  CAP_PORT_MASK			0xf
212*151da017SFlorian Fainelli #define  BLK_NOT_MIR			BIT(14)
213*151da017SFlorian Fainelli #define  MIRROR_EN			BIT(15)
214*151da017SFlorian Fainelli 
215*151da017SFlorian Fainelli /* Ingress mirror control register (16 bit) */
216*151da017SFlorian Fainelli #define B53_IG_MIR_CTL			0x12
217*151da017SFlorian Fainelli #define  MIRROR_MASK			0x1ff
218*151da017SFlorian Fainelli #define  DIV_EN				BIT(13)
219*151da017SFlorian Fainelli #define  MIRROR_FILTER_MASK		0x3
220*151da017SFlorian Fainelli #define  MIRROR_FILTER_SHIFT		14
221*151da017SFlorian Fainelli #define  MIRROR_ALL			0
222*151da017SFlorian Fainelli #define  MIRROR_DA			1
223*151da017SFlorian Fainelli #define  MIRROR_SA			2
224*151da017SFlorian Fainelli 
225*151da017SFlorian Fainelli /* Ingress mirror divider register (16 bit) */
226*151da017SFlorian Fainelli #define B53_IG_MIR_DIV			0x14
227*151da017SFlorian Fainelli #define  IN_MIRROR_DIV_MASK		0x3ff
228*151da017SFlorian Fainelli 
229*151da017SFlorian Fainelli /* Ingress mirror MAC address register (48 bit) */
230*151da017SFlorian Fainelli #define B53_IG_MIR_MAC			0x16
231*151da017SFlorian Fainelli 
232*151da017SFlorian Fainelli /* Egress mirror control register (16 bit) */
233*151da017SFlorian Fainelli #define B53_EG_MIR_CTL			0x1C
234*151da017SFlorian Fainelli 
235*151da017SFlorian Fainelli /* Egress mirror divider register (16 bit) */
236*151da017SFlorian Fainelli #define B53_EG_MIR_DIV			0x1E
237*151da017SFlorian Fainelli 
238*151da017SFlorian Fainelli /* Egress mirror MAC address register (48 bit) */
239*151da017SFlorian Fainelli #define B53_EG_MIR_MAC			0x20
240*151da017SFlorian Fainelli 
241967dd82fSFlorian Fainelli /* Device ID register (8 or 32 bit) */
242967dd82fSFlorian Fainelli #define B53_DEVICE_ID			0x30
243967dd82fSFlorian Fainelli 
244967dd82fSFlorian Fainelli /* Revision ID register (8 bit) */
245967dd82fSFlorian Fainelli #define B53_REV_ID			0x40
246967dd82fSFlorian Fainelli 
247967dd82fSFlorian Fainelli /*************************************************************************
248967dd82fSFlorian Fainelli  * ARL Access Page Registers
249967dd82fSFlorian Fainelli  *************************************************************************/
250967dd82fSFlorian Fainelli 
251967dd82fSFlorian Fainelli /* VLAN Table Access Register (8 bit) */
252967dd82fSFlorian Fainelli #define B53_VT_ACCESS			0x80
253967dd82fSFlorian Fainelli #define B53_VT_ACCESS_9798		0x60 /* for BCM5397/BCM5398 */
254967dd82fSFlorian Fainelli #define B53_VT_ACCESS_63XX		0x60 /* for BCM6328/62/68 */
255967dd82fSFlorian Fainelli #define   VTA_CMD_WRITE			0
256967dd82fSFlorian Fainelli #define   VTA_CMD_READ			1
257967dd82fSFlorian Fainelli #define   VTA_CMD_CLEAR			2
258967dd82fSFlorian Fainelli #define   VTA_START_CMD			BIT(7)
259967dd82fSFlorian Fainelli 
260967dd82fSFlorian Fainelli /* VLAN Table Index Register (16 bit) */
261967dd82fSFlorian Fainelli #define B53_VT_INDEX			0x81
262967dd82fSFlorian Fainelli #define B53_VT_INDEX_9798		0x61
263967dd82fSFlorian Fainelli #define B53_VT_INDEX_63XX		0x62
264967dd82fSFlorian Fainelli 
265967dd82fSFlorian Fainelli /* VLAN Table Entry Register (32 bit) */
266967dd82fSFlorian Fainelli #define B53_VT_ENTRY			0x83
267967dd82fSFlorian Fainelli #define B53_VT_ENTRY_9798		0x63
268967dd82fSFlorian Fainelli #define B53_VT_ENTRY_63XX		0x64
269967dd82fSFlorian Fainelli #define   VTE_MEMBERS			0x1ff
270967dd82fSFlorian Fainelli #define   VTE_UNTAG_S			9
271967dd82fSFlorian Fainelli #define   VTE_UNTAG			(0x1ff << 9)
272967dd82fSFlorian Fainelli 
273967dd82fSFlorian Fainelli /*************************************************************************
2741da6df85SFlorian Fainelli  * ARL I/O Registers
2751da6df85SFlorian Fainelli  *************************************************************************/
2761da6df85SFlorian Fainelli 
2771da6df85SFlorian Fainelli /* ARL Table Read/Write Register (8 bit) */
2781da6df85SFlorian Fainelli #define B53_ARLTBL_RW_CTRL		0x00
2791da6df85SFlorian Fainelli #define    ARLTBL_RW			BIT(0)
2801da6df85SFlorian Fainelli #define    ARLTBL_START_DONE		BIT(7)
2811da6df85SFlorian Fainelli 
2821da6df85SFlorian Fainelli /* MAC Address Index Register (48 bit) */
2831da6df85SFlorian Fainelli #define B53_MAC_ADDR_IDX		0x02
2841da6df85SFlorian Fainelli 
2851da6df85SFlorian Fainelli /* VLAN ID Index Register (16 bit) */
2861da6df85SFlorian Fainelli #define B53_VLAN_ID_IDX			0x08
2871da6df85SFlorian Fainelli 
2881da6df85SFlorian Fainelli /* ARL Table MAC/VID Entry N Registers (64 bit)
2891da6df85SFlorian Fainelli  *
2901da6df85SFlorian Fainelli  * BCM5325 and BCM5365 share most definitions below
2911da6df85SFlorian Fainelli  */
2921da6df85SFlorian Fainelli #define B53_ARLTBL_MAC_VID_ENTRY(n)	(0x10 * (n))
2935e3b724eSGeert Uytterhoeven #define   ARLTBL_MAC_MASK		0xffffffffffffULL
2941da6df85SFlorian Fainelli #define   ARLTBL_VID_S			48
2951da6df85SFlorian Fainelli #define   ARLTBL_VID_MASK_25		0xff
2961da6df85SFlorian Fainelli #define   ARLTBL_VID_MASK		0xfff
2971da6df85SFlorian Fainelli #define   ARLTBL_DATA_PORT_ID_S_25	48
2981da6df85SFlorian Fainelli #define   ARLTBL_DATA_PORT_ID_MASK_25	0xf
2991da6df85SFlorian Fainelli #define   ARLTBL_AGE_25			BIT(61)
3001da6df85SFlorian Fainelli #define   ARLTBL_STATIC_25		BIT(62)
3011da6df85SFlorian Fainelli #define   ARLTBL_VALID_25		BIT(63)
3021da6df85SFlorian Fainelli 
3031da6df85SFlorian Fainelli /* ARL Table Data Entry N Registers (32 bit) */
3041da6df85SFlorian Fainelli #define B53_ARLTBL_DATA_ENTRY(n)	((0x10 * (n)) + 0x08)
3051da6df85SFlorian Fainelli #define   ARLTBL_DATA_PORT_ID_MASK	0x1ff
3061da6df85SFlorian Fainelli #define   ARLTBL_TC(tc)			((3 & tc) << 11)
3071da6df85SFlorian Fainelli #define   ARLTBL_AGE			BIT(14)
3081da6df85SFlorian Fainelli #define   ARLTBL_STATIC			BIT(15)
3091da6df85SFlorian Fainelli #define   ARLTBL_VALID			BIT(16)
3101da6df85SFlorian Fainelli 
3111da6df85SFlorian Fainelli /* ARL Search Control Register (8 bit) */
3121da6df85SFlorian Fainelli #define B53_ARL_SRCH_CTL		0x50
3131da6df85SFlorian Fainelli #define B53_ARL_SRCH_CTL_25		0x20
3141da6df85SFlorian Fainelli #define   ARL_SRCH_VLID			BIT(0)
3151da6df85SFlorian Fainelli #define   ARL_SRCH_STDN			BIT(7)
3161da6df85SFlorian Fainelli 
3171da6df85SFlorian Fainelli /* ARL Search Address Register (16 bit) */
3181da6df85SFlorian Fainelli #define B53_ARL_SRCH_ADDR		0x51
3191da6df85SFlorian Fainelli #define B53_ARL_SRCH_ADDR_25		0x22
3201da6df85SFlorian Fainelli #define B53_ARL_SRCH_ADDR_65		0x24
3211da6df85SFlorian Fainelli #define  ARL_ADDR_MASK			GENMASK(14, 0)
3221da6df85SFlorian Fainelli 
3231da6df85SFlorian Fainelli /* ARL Search MAC/VID Result (64 bit) */
3241da6df85SFlorian Fainelli #define B53_ARL_SRCH_RSTL_0_MACVID	0x60
3251da6df85SFlorian Fainelli 
3261da6df85SFlorian Fainelli /* Single register search result on 5325 */
3271da6df85SFlorian Fainelli #define B53_ARL_SRCH_RSTL_0_MACVID_25	0x24
3281da6df85SFlorian Fainelli /* Single register search result on 5365 */
3291da6df85SFlorian Fainelli #define B53_ARL_SRCH_RSTL_0_MACVID_65	0x30
3301da6df85SFlorian Fainelli 
3311da6df85SFlorian Fainelli /* ARL Search Data Result (32 bit) */
3321da6df85SFlorian Fainelli #define B53_ARL_SRCH_RSTL_0		0x68
3331da6df85SFlorian Fainelli 
3341da6df85SFlorian Fainelli #define B53_ARL_SRCH_RSTL_MACVID(x)	(B53_ARL_SRCH_RSTL_0_MACVID + ((x) * 0x10))
3351da6df85SFlorian Fainelli #define B53_ARL_SRCH_RSTL(x)		(B53_ARL_SRCH_RSTL_0 + ((x) * 0x10))
3361da6df85SFlorian Fainelli 
3371da6df85SFlorian Fainelli /*************************************************************************
338967dd82fSFlorian Fainelli  * Port VLAN Registers
339967dd82fSFlorian Fainelli  *************************************************************************/
340967dd82fSFlorian Fainelli 
341967dd82fSFlorian Fainelli /* Port VLAN mask (16 bit) IMP port is always 8, also on 5325 & co */
342967dd82fSFlorian Fainelli #define B53_PVLAN_PORT_MASK(i)		((i) * 2)
343967dd82fSFlorian Fainelli 
34448aea33aSFlorian Fainelli /* Join all VLANs register (16 bit) */
34548aea33aSFlorian Fainelli #define B53_JOIN_ALL_VLAN_EN		0x50
34648aea33aSFlorian Fainelli 
347967dd82fSFlorian Fainelli /*************************************************************************
348967dd82fSFlorian Fainelli  * 802.1Q Page Registers
349967dd82fSFlorian Fainelli  *************************************************************************/
350967dd82fSFlorian Fainelli 
351967dd82fSFlorian Fainelli /* Global QoS Control (8 bit) */
352967dd82fSFlorian Fainelli #define B53_QOS_GLOBAL_CTL		0x00
353967dd82fSFlorian Fainelli 
354967dd82fSFlorian Fainelli /* Enable 802.1Q for individual Ports (16 bit) */
355967dd82fSFlorian Fainelli #define B53_802_1P_EN			0x04
356967dd82fSFlorian Fainelli 
357967dd82fSFlorian Fainelli /*************************************************************************
358967dd82fSFlorian Fainelli  * VLAN Page Registers
359967dd82fSFlorian Fainelli  *************************************************************************/
360967dd82fSFlorian Fainelli 
361967dd82fSFlorian Fainelli /* VLAN Control 0 (8 bit) */
362967dd82fSFlorian Fainelli #define B53_VLAN_CTRL0			0x00
363967dd82fSFlorian Fainelli #define   VC0_8021PF_CTRL_MASK		0x3
364967dd82fSFlorian Fainelli #define   VC0_8021PF_CTRL_NONE		0x0
365967dd82fSFlorian Fainelli #define   VC0_8021PF_CTRL_CHANGE_PRI	0x1
366967dd82fSFlorian Fainelli #define   VC0_8021PF_CTRL_CHANGE_VID	0x2
367967dd82fSFlorian Fainelli #define   VC0_8021PF_CTRL_CHANGE_BOTH	0x3
368967dd82fSFlorian Fainelli #define   VC0_8021QF_CTRL_MASK		0xc
369967dd82fSFlorian Fainelli #define   VC0_8021QF_CTRL_CHANGE_PRI	0x1
370967dd82fSFlorian Fainelli #define   VC0_8021QF_CTRL_CHANGE_VID	0x2
371967dd82fSFlorian Fainelli #define   VC0_8021QF_CTRL_CHANGE_BOTH	0x3
372967dd82fSFlorian Fainelli #define   VC0_RESERVED_1		BIT(1)
373967dd82fSFlorian Fainelli #define   VC0_DROP_VID_MISS		BIT(4)
374967dd82fSFlorian Fainelli #define   VC0_VID_HASH_VID		BIT(5)
375967dd82fSFlorian Fainelli #define   VC0_VID_CHK_EN		BIT(6)	/* Use VID,DA or VID,SA */
376967dd82fSFlorian Fainelli #define   VC0_VLAN_EN			BIT(7)	/* 802.1Q VLAN Enabled */
377967dd82fSFlorian Fainelli 
378967dd82fSFlorian Fainelli /* VLAN Control 1 (8 bit) */
379967dd82fSFlorian Fainelli #define B53_VLAN_CTRL1			0x01
380967dd82fSFlorian Fainelli #define   VC1_RX_MCST_TAG_EN		BIT(1)
381967dd82fSFlorian Fainelli #define   VC1_RX_MCST_FWD_EN		BIT(2)
382967dd82fSFlorian Fainelli #define   VC1_RX_MCST_UNTAG_EN		BIT(3)
383967dd82fSFlorian Fainelli 
384967dd82fSFlorian Fainelli /* VLAN Control 2 (8 bit) */
385967dd82fSFlorian Fainelli #define B53_VLAN_CTRL2			0x02
386967dd82fSFlorian Fainelli 
387967dd82fSFlorian Fainelli /* VLAN Control 3 (8 bit when BCM5325, 16 bit else) */
388967dd82fSFlorian Fainelli #define B53_VLAN_CTRL3			0x03
389967dd82fSFlorian Fainelli #define B53_VLAN_CTRL3_63XX		0x04
390967dd82fSFlorian Fainelli #define   VC3_MAXSIZE_1532		BIT(6) /* 5325 only */
391967dd82fSFlorian Fainelli #define   VC3_HIGH_8BIT_EN		BIT(7) /* 5325 only */
392967dd82fSFlorian Fainelli 
393967dd82fSFlorian Fainelli /* VLAN Control 4 (8 bit) */
394967dd82fSFlorian Fainelli #define B53_VLAN_CTRL4			0x05
395967dd82fSFlorian Fainelli #define B53_VLAN_CTRL4_25		0x04
396967dd82fSFlorian Fainelli #define B53_VLAN_CTRL4_63XX		0x06
397967dd82fSFlorian Fainelli #define   VC4_ING_VID_CHECK_S		6
398967dd82fSFlorian Fainelli #define   VC4_ING_VID_CHECK_MASK	(0x3 << VC4_ING_VID_CHECK_S)
399967dd82fSFlorian Fainelli #define   VC4_ING_VID_VIO_FWD		0 /* forward, but do not learn */
400967dd82fSFlorian Fainelli #define   VC4_ING_VID_VIO_DROP		1 /* drop VID violations */
401967dd82fSFlorian Fainelli #define   VC4_NO_ING_VID_CHK		2 /* do not check */
402967dd82fSFlorian Fainelli #define   VC4_ING_VID_VIO_TO_IMP	3 /* redirect to MII port */
403967dd82fSFlorian Fainelli 
404967dd82fSFlorian Fainelli /* VLAN Control 5 (8 bit) */
405967dd82fSFlorian Fainelli #define B53_VLAN_CTRL5			0x06
406967dd82fSFlorian Fainelli #define B53_VLAN_CTRL5_25		0x05
407967dd82fSFlorian Fainelli #define B53_VLAN_CTRL5_63XX		0x07
408967dd82fSFlorian Fainelli #define   VC5_VID_FFF_EN		BIT(2)
409967dd82fSFlorian Fainelli #define   VC5_DROP_VTABLE_MISS		BIT(3)
410967dd82fSFlorian Fainelli 
411967dd82fSFlorian Fainelli /* VLAN Control 6 (8 bit) */
412967dd82fSFlorian Fainelli #define B53_VLAN_CTRL6			0x07
413967dd82fSFlorian Fainelli #define B53_VLAN_CTRL6_63XX		0x08
414967dd82fSFlorian Fainelli 
415967dd82fSFlorian Fainelli /* VLAN Table Access Register (16 bit) */
416967dd82fSFlorian Fainelli #define B53_VLAN_TABLE_ACCESS_25	0x06	/* BCM5325E/5350 */
417967dd82fSFlorian Fainelli #define B53_VLAN_TABLE_ACCESS_65	0x08	/* BCM5365 */
418967dd82fSFlorian Fainelli #define   VTA_VID_LOW_MASK_25		0xf
419967dd82fSFlorian Fainelli #define   VTA_VID_LOW_MASK_65		0xff
420967dd82fSFlorian Fainelli #define   VTA_VID_HIGH_S_25		4
421967dd82fSFlorian Fainelli #define   VTA_VID_HIGH_S_65		8
422967dd82fSFlorian Fainelli #define   VTA_VID_HIGH_MASK_25		(0xff << VTA_VID_HIGH_S_25E)
423967dd82fSFlorian Fainelli #define   VTA_VID_HIGH_MASK_65		(0xf << VTA_VID_HIGH_S_65)
424967dd82fSFlorian Fainelli #define   VTA_RW_STATE			BIT(12)
425967dd82fSFlorian Fainelli #define   VTA_RW_STATE_RD		0
426967dd82fSFlorian Fainelli #define   VTA_RW_STATE_WR		BIT(12)
427967dd82fSFlorian Fainelli #define   VTA_RW_OP_EN			BIT(13)
428967dd82fSFlorian Fainelli 
429967dd82fSFlorian Fainelli /* VLAN Read/Write Registers for (16/32 bit) */
430967dd82fSFlorian Fainelli #define B53_VLAN_WRITE_25		0x08
431967dd82fSFlorian Fainelli #define B53_VLAN_WRITE_65		0x0a
432967dd82fSFlorian Fainelli #define B53_VLAN_READ			0x0c
433967dd82fSFlorian Fainelli #define   VA_MEMBER_MASK		0x3f
434967dd82fSFlorian Fainelli #define   VA_UNTAG_S_25			6
435967dd82fSFlorian Fainelli #define   VA_UNTAG_MASK_25		0x3f
436967dd82fSFlorian Fainelli #define   VA_UNTAG_S_65			7
437967dd82fSFlorian Fainelli #define   VA_UNTAG_MASK_65		0x1f
438967dd82fSFlorian Fainelli #define   VA_VID_HIGH_S			12
439967dd82fSFlorian Fainelli #define   VA_VID_HIGH_MASK		(0xffff << VA_VID_HIGH_S)
440967dd82fSFlorian Fainelli #define   VA_VALID_25			BIT(20)
441967dd82fSFlorian Fainelli #define   VA_VALID_25_R4		BIT(24)
442967dd82fSFlorian Fainelli #define   VA_VALID_65			BIT(14)
443967dd82fSFlorian Fainelli 
444967dd82fSFlorian Fainelli /* VLAN Port Default Tag (16 bit) */
445967dd82fSFlorian Fainelli #define B53_VLAN_PORT_DEF_TAG(i)	(0x10 + 2 * (i))
446967dd82fSFlorian Fainelli 
447967dd82fSFlorian Fainelli /*************************************************************************
448967dd82fSFlorian Fainelli  * Jumbo Frame Page Registers
449967dd82fSFlorian Fainelli  *************************************************************************/
450967dd82fSFlorian Fainelli 
451967dd82fSFlorian Fainelli /* Jumbo Enable Port Mask (bit i == port i enabled) (32 bit) */
452967dd82fSFlorian Fainelli #define B53_JUMBO_PORT_MASK		0x01
453967dd82fSFlorian Fainelli #define B53_JUMBO_PORT_MASK_63XX	0x04
454967dd82fSFlorian Fainelli #define   JPM_10_100_JUMBO_EN		BIT(24) /* GigE always enabled */
455967dd82fSFlorian Fainelli 
456967dd82fSFlorian Fainelli /* Good Frame Max Size without 802.1Q TAG (16 bit) */
457967dd82fSFlorian Fainelli #define B53_JUMBO_MAX_SIZE		0x05
458967dd82fSFlorian Fainelli #define B53_JUMBO_MAX_SIZE_63XX		0x08
459967dd82fSFlorian Fainelli #define   JMS_MIN_SIZE			1518
460967dd82fSFlorian Fainelli #define   JMS_MAX_SIZE			9724
461967dd82fSFlorian Fainelli 
462967dd82fSFlorian Fainelli /*************************************************************************
463967dd82fSFlorian Fainelli  * CFP Configuration Page Registers
464967dd82fSFlorian Fainelli  *************************************************************************/
465967dd82fSFlorian Fainelli 
466967dd82fSFlorian Fainelli /* CFP Control Register with ports map (8 bit) */
467967dd82fSFlorian Fainelli #define B53_CFP_CTRL			0x00
468967dd82fSFlorian Fainelli 
469967dd82fSFlorian Fainelli #endif /* !__B53_REGS_H */
470