xref: /linux/drivers/net/dsa/b53/b53_regs.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
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 
53909d812aSFlorian Fainelli /* EEE Control Registers Page */
54909d812aSFlorian Fainelli #define B53_EEE_PAGE			0x92
55909d812aSFlorian Fainelli 
56967dd82fSFlorian Fainelli /* CFP Configuration Registers Page */
57967dd82fSFlorian Fainelli #define B53_CFP_PAGE			0xa1
58967dd82fSFlorian Fainelli 
59967dd82fSFlorian Fainelli /*************************************************************************
60967dd82fSFlorian Fainelli  * Control Page registers
61967dd82fSFlorian Fainelli  *************************************************************************/
62967dd82fSFlorian Fainelli 
63967dd82fSFlorian Fainelli /* Port Control Register (8 bit) */
64967dd82fSFlorian Fainelli #define B53_PORT_CTRL(i)		(0x00 + (i))
65967dd82fSFlorian Fainelli #define   PORT_CTRL_RX_DISABLE		BIT(0)
66967dd82fSFlorian Fainelli #define   PORT_CTRL_TX_DISABLE		BIT(1)
67967dd82fSFlorian Fainelli #define   PORT_CTRL_RX_BCST_EN		BIT(2) /* Broadcast RX (P8 only) */
68967dd82fSFlorian Fainelli #define   PORT_CTRL_RX_MCST_EN		BIT(3) /* Multicast RX (P8 only) */
69967dd82fSFlorian Fainelli #define   PORT_CTRL_RX_UCST_EN		BIT(4) /* Unicast RX (P8 only) */
70967dd82fSFlorian Fainelli #define	  PORT_CTRL_STP_STATE_S		5
71ff39c2d6SFlorian Fainelli #define   PORT_CTRL_NO_STP		(0 << PORT_CTRL_STP_STATE_S)
72ff39c2d6SFlorian Fainelli #define   PORT_CTRL_DIS_STATE		(1 << PORT_CTRL_STP_STATE_S)
73ff39c2d6SFlorian Fainelli #define   PORT_CTRL_BLOCK_STATE		(2 << PORT_CTRL_STP_STATE_S)
74ff39c2d6SFlorian Fainelli #define   PORT_CTRL_LISTEN_STATE	(3 << PORT_CTRL_STP_STATE_S)
75ff39c2d6SFlorian Fainelli #define   PORT_CTRL_LEARN_STATE		(4 << PORT_CTRL_STP_STATE_S)
76ff39c2d6SFlorian Fainelli #define   PORT_CTRL_FWD_STATE		(5 << PORT_CTRL_STP_STATE_S)
77967dd82fSFlorian Fainelli #define   PORT_CTRL_STP_STATE_MASK	(0x7 << PORT_CTRL_STP_STATE_S)
78967dd82fSFlorian Fainelli 
79967dd82fSFlorian Fainelli /* SMP Control Register (8 bit) */
80967dd82fSFlorian Fainelli #define B53_SMP_CTRL			0x0a
81967dd82fSFlorian Fainelli 
82967dd82fSFlorian Fainelli /* Switch Mode Control Register (8 bit) */
83967dd82fSFlorian Fainelli #define B53_SWITCH_MODE			0x0b
84967dd82fSFlorian Fainelli #define   SM_SW_FWD_MODE		BIT(0)	/* 1 = Managed Mode */
85967dd82fSFlorian Fainelli #define   SM_SW_FWD_EN			BIT(1)	/* Forwarding Enable */
86967dd82fSFlorian Fainelli 
87967dd82fSFlorian Fainelli /* IMP Port state override register (8 bit) */
88967dd82fSFlorian Fainelli #define B53_PORT_OVERRIDE_CTRL		0x0e
89967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_LINK		BIT(0)
90967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_FULL_DUPLEX	BIT(1) /* 0 = Half Duplex */
91967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_SPEED_S		2
92967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_SPEED_10M	(0 << PORT_OVERRIDE_SPEED_S)
93967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_SPEED_100M	(1 << PORT_OVERRIDE_SPEED_S)
94967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_SPEED_1000M	(2 << PORT_OVERRIDE_SPEED_S)
95967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_RV_MII_25	BIT(4) /* BCM5325 only */
96967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_RX_FLOW		BIT(4)
97967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_TX_FLOW		BIT(5)
98967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_SPEED_2000M	BIT(6) /* BCM5301X only, requires setting 1000M */
99967dd82fSFlorian Fainelli #define   PORT_OVERRIDE_EN		BIT(7) /* Use the register contents */
100967dd82fSFlorian Fainelli 
101967dd82fSFlorian Fainelli /* Power-down mode control */
102967dd82fSFlorian Fainelli #define B53_PD_MODE_CTRL_25		0x0f
103967dd82fSFlorian Fainelli 
104967dd82fSFlorian Fainelli /* IP Multicast control (8 bit) */
105967dd82fSFlorian Fainelli #define B53_IP_MULTICAST_CTRL		0x21
106967dd82fSFlorian Fainelli #define  B53_IPMC_FWD_EN		BIT(1)
107967dd82fSFlorian Fainelli #define  B53_UC_FWD_EN			BIT(6)
108967dd82fSFlorian Fainelli #define  B53_MC_FWD_EN			BIT(7)
109967dd82fSFlorian Fainelli 
110a424f0deSFlorian Fainelli /* Switch control (8 bit) */
111a424f0deSFlorian Fainelli #define B53_SWITCH_CTRL			0x22
112a424f0deSFlorian Fainelli #define  B53_MII_DUMB_FWDG_EN		BIT(6)
113a424f0deSFlorian Fainelli 
114967dd82fSFlorian Fainelli /* (16 bit) */
115967dd82fSFlorian Fainelli #define B53_UC_FLOOD_MASK		0x32
116967dd82fSFlorian Fainelli #define B53_MC_FLOOD_MASK		0x34
117967dd82fSFlorian Fainelli #define B53_IPMC_FLOOD_MASK		0x36
118f9b3827eSFlorian Fainelli #define B53_DIS_LEARNING		0x3c
119967dd82fSFlorian Fainelli 
120967dd82fSFlorian Fainelli /*
121967dd82fSFlorian Fainelli  * Override Ports 0-7 State on devices with xMII interfaces (8 bit)
122967dd82fSFlorian Fainelli  *
123967dd82fSFlorian Fainelli  * For port 8 still use B53_PORT_OVERRIDE_CTRL
124967dd82fSFlorian Fainelli  * Please note that not all ports are available on every hardware, e.g. BCM5301X
125967dd82fSFlorian Fainelli  * don't include overriding port 6, BCM63xx also have some limitations.
126967dd82fSFlorian Fainelli  */
127967dd82fSFlorian Fainelli #define B53_GMII_PORT_OVERRIDE_CTRL(i)	(0x58 + (i))
128967dd82fSFlorian Fainelli #define   GMII_PO_LINK			BIT(0)
129967dd82fSFlorian Fainelli #define   GMII_PO_FULL_DUPLEX		BIT(1) /* 0 = Half Duplex */
130967dd82fSFlorian Fainelli #define   GMII_PO_SPEED_S		2
131967dd82fSFlorian Fainelli #define   GMII_PO_SPEED_10M		(0 << GMII_PO_SPEED_S)
132967dd82fSFlorian Fainelli #define   GMII_PO_SPEED_100M		(1 << GMII_PO_SPEED_S)
133967dd82fSFlorian Fainelli #define   GMII_PO_SPEED_1000M		(2 << GMII_PO_SPEED_S)
134967dd82fSFlorian Fainelli #define   GMII_PO_RX_FLOW		BIT(4)
135967dd82fSFlorian Fainelli #define   GMII_PO_TX_FLOW		BIT(5)
136967dd82fSFlorian Fainelli #define   GMII_PO_EN			BIT(6) /* Use the register contents */
137967dd82fSFlorian Fainelli #define   GMII_PO_SPEED_2000M		BIT(7) /* BCM5301X only, requires setting 1000M */
138967dd82fSFlorian Fainelli 
139967dd82fSFlorian Fainelli #define B53_RGMII_CTRL_IMP		0x60
140967dd82fSFlorian Fainelli #define   RGMII_CTRL_ENABLE_GMII	BIT(7)
141*594c6c2eSÁlvaro Fernández Rojas #define   RGMII_CTRL_MII_OVERRIDE	BIT(6)
142967dd82fSFlorian Fainelli #define   RGMII_CTRL_TIMING_SEL		BIT(2)
143967dd82fSFlorian Fainelli #define   RGMII_CTRL_DLL_RXC		BIT(1)
144967dd82fSFlorian Fainelli #define   RGMII_CTRL_DLL_TXC		BIT(0)
145967dd82fSFlorian Fainelli 
146967dd82fSFlorian Fainelli #define B53_RGMII_CTRL_P(i)		(B53_RGMII_CTRL_IMP + (i))
147967dd82fSFlorian Fainelli 
148967dd82fSFlorian Fainelli /* Software reset register (8 bit) */
149967dd82fSFlorian Fainelli #define B53_SOFTRESET			0x79
150967dd82fSFlorian Fainelli #define   SW_RST			BIT(7)
1513fb22b05SFlorian Fainelli #define   EN_CH_RST			BIT(6)
152967dd82fSFlorian Fainelli #define   EN_SW_RST			BIT(4)
153967dd82fSFlorian Fainelli 
154967dd82fSFlorian Fainelli /* Fast Aging Control register (8 bit) */
155967dd82fSFlorian Fainelli #define B53_FAST_AGE_CTRL		0x88
156967dd82fSFlorian Fainelli #define   FAST_AGE_STATIC		BIT(0)
157967dd82fSFlorian Fainelli #define   FAST_AGE_DYNAMIC		BIT(1)
158967dd82fSFlorian Fainelli #define   FAST_AGE_PORT			BIT(2)
159967dd82fSFlorian Fainelli #define   FAST_AGE_VLAN			BIT(3)
160967dd82fSFlorian Fainelli #define   FAST_AGE_STP			BIT(4)
161967dd82fSFlorian Fainelli #define   FAST_AGE_MC			BIT(5)
162967dd82fSFlorian Fainelli #define   FAST_AGE_DONE			BIT(7)
163967dd82fSFlorian Fainelli 
164ff39c2d6SFlorian Fainelli /* Fast Aging Port Control register (8 bit) */
165ff39c2d6SFlorian Fainelli #define B53_FAST_AGE_PORT_CTRL		0x89
166ff39c2d6SFlorian Fainelli 
167ff39c2d6SFlorian Fainelli /* Fast Aging VID Control register (16 bit) */
168ff39c2d6SFlorian Fainelli #define B53_FAST_AGE_VID_CTRL		0x8a
169ff39c2d6SFlorian Fainelli 
170967dd82fSFlorian Fainelli /*************************************************************************
171967dd82fSFlorian Fainelli  * Status Page registers
172967dd82fSFlorian Fainelli  *************************************************************************/
173967dd82fSFlorian Fainelli 
174967dd82fSFlorian Fainelli /* Link Status Summary Register (16bit) */
175967dd82fSFlorian Fainelli #define B53_LINK_STAT			0x00
176967dd82fSFlorian Fainelli 
177967dd82fSFlorian Fainelli /* Link Status Change Register (16 bit) */
178967dd82fSFlorian Fainelli #define B53_LINK_STAT_CHANGE		0x02
179967dd82fSFlorian Fainelli 
180967dd82fSFlorian Fainelli /* Port Speed Summary Register (16 bit for FE, 32 bit for GE) */
181967dd82fSFlorian Fainelli #define B53_SPEED_STAT			0x04
182967dd82fSFlorian Fainelli #define  SPEED_PORT_FE(reg, port)	(((reg) >> (port)) & 1)
183967dd82fSFlorian Fainelli #define  SPEED_PORT_GE(reg, port)	(((reg) >> 2 * (port)) & 3)
184967dd82fSFlorian Fainelli #define  SPEED_STAT_10M			0
185967dd82fSFlorian Fainelli #define  SPEED_STAT_100M		1
186967dd82fSFlorian Fainelli #define  SPEED_STAT_1000M		2
187967dd82fSFlorian Fainelli 
188967dd82fSFlorian Fainelli /* Duplex Status Summary (16 bit) */
189967dd82fSFlorian Fainelli #define B53_DUPLEX_STAT_FE		0x06
190967dd82fSFlorian Fainelli #define B53_DUPLEX_STAT_GE		0x08
191967dd82fSFlorian Fainelli #define B53_DUPLEX_STAT_63XX		0x0c
192967dd82fSFlorian Fainelli 
193967dd82fSFlorian Fainelli /* Revision ID register for BCM5325 */
194967dd82fSFlorian Fainelli #define B53_REV_ID_25			0x50
195967dd82fSFlorian Fainelli 
196967dd82fSFlorian Fainelli /* Strap Value (48 bit) */
197967dd82fSFlorian Fainelli #define B53_STRAP_VALUE			0x70
198967dd82fSFlorian Fainelli #define   SV_GMII_CTRL_115		BIT(27)
199967dd82fSFlorian Fainelli 
200967dd82fSFlorian Fainelli /*************************************************************************
201967dd82fSFlorian Fainelli  * Management Mode Page Registers
202967dd82fSFlorian Fainelli  *************************************************************************/
203967dd82fSFlorian Fainelli 
204967dd82fSFlorian Fainelli /* Global Management Config Register (8 bit) */
205967dd82fSFlorian Fainelli #define B53_GLOBAL_CONFIG		0x00
206967dd82fSFlorian Fainelli #define   GC_RESET_MIB			0x01
207967dd82fSFlorian Fainelli #define   GC_RX_BPDU_EN			0x02
208967dd82fSFlorian Fainelli #define   GC_MIB_AC_HDR_EN		0x10
209967dd82fSFlorian Fainelli #define   GC_MIB_AC_EN			0x20
210967dd82fSFlorian Fainelli #define   GC_FRM_MGMT_PORT_M		0xC0
211967dd82fSFlorian Fainelli #define   GC_FRM_MGMT_PORT_04		0x00
212967dd82fSFlorian Fainelli #define   GC_FRM_MGMT_PORT_MII		0x80
213967dd82fSFlorian Fainelli 
214967dd82fSFlorian Fainelli /* Broadcom Header control register (8 bit) */
215967dd82fSFlorian Fainelli #define B53_BRCM_HDR			0x03
216967dd82fSFlorian Fainelli #define   BRCM_HDR_P8_EN		BIT(0) /* Enable tagging on port 8 */
217967dd82fSFlorian Fainelli #define   BRCM_HDR_P5_EN		BIT(1) /* Enable tagging on port 5 */
218b409a9efSFlorian Fainelli #define   BRCM_HDR_P7_EN		BIT(2) /* Enable tagging on port 7 */
219967dd82fSFlorian Fainelli 
220151da017SFlorian Fainelli /* Mirror capture control register (16 bit) */
221151da017SFlorian Fainelli #define B53_MIR_CAP_CTL			0x10
222151da017SFlorian Fainelli #define  CAP_PORT_MASK			0xf
223151da017SFlorian Fainelli #define  BLK_NOT_MIR			BIT(14)
224151da017SFlorian Fainelli #define  MIRROR_EN			BIT(15)
225151da017SFlorian Fainelli 
226151da017SFlorian Fainelli /* Ingress mirror control register (16 bit) */
227151da017SFlorian Fainelli #define B53_IG_MIR_CTL			0x12
228151da017SFlorian Fainelli #define  MIRROR_MASK			0x1ff
229151da017SFlorian Fainelli #define  DIV_EN				BIT(13)
230151da017SFlorian Fainelli #define  MIRROR_FILTER_MASK		0x3
231151da017SFlorian Fainelli #define  MIRROR_FILTER_SHIFT		14
232151da017SFlorian Fainelli #define  MIRROR_ALL			0
233151da017SFlorian Fainelli #define  MIRROR_DA			1
234151da017SFlorian Fainelli #define  MIRROR_SA			2
235151da017SFlorian Fainelli 
236151da017SFlorian Fainelli /* Ingress mirror divider register (16 bit) */
237151da017SFlorian Fainelli #define B53_IG_MIR_DIV			0x14
238151da017SFlorian Fainelli #define  IN_MIRROR_DIV_MASK		0x3ff
239151da017SFlorian Fainelli 
240151da017SFlorian Fainelli /* Ingress mirror MAC address register (48 bit) */
241151da017SFlorian Fainelli #define B53_IG_MIR_MAC			0x16
242151da017SFlorian Fainelli 
243151da017SFlorian Fainelli /* Egress mirror control register (16 bit) */
244151da017SFlorian Fainelli #define B53_EG_MIR_CTL			0x1C
245151da017SFlorian Fainelli 
246151da017SFlorian Fainelli /* Egress mirror divider register (16 bit) */
247151da017SFlorian Fainelli #define B53_EG_MIR_DIV			0x1E
248151da017SFlorian Fainelli 
249151da017SFlorian Fainelli /* Egress mirror MAC address register (48 bit) */
250151da017SFlorian Fainelli #define B53_EG_MIR_MAC			0x20
251151da017SFlorian Fainelli 
252967dd82fSFlorian Fainelli /* Device ID register (8 or 32 bit) */
253967dd82fSFlorian Fainelli #define B53_DEVICE_ID			0x30
254967dd82fSFlorian Fainelli 
255967dd82fSFlorian Fainelli /* Revision ID register (8 bit) */
256967dd82fSFlorian Fainelli #define B53_REV_ID			0x40
257967dd82fSFlorian Fainelli 
258b409a9efSFlorian Fainelli /* Broadcom header RX control (16 bit) */
259b409a9efSFlorian Fainelli #define B53_BRCM_HDR_RX_DIS		0x60
260b409a9efSFlorian Fainelli 
261b409a9efSFlorian Fainelli /* Broadcom header TX control (16 bit)	*/
262b409a9efSFlorian Fainelli #define B53_BRCM_HDR_TX_DIS		0x62
263b409a9efSFlorian Fainelli 
264967dd82fSFlorian Fainelli /*************************************************************************
265967dd82fSFlorian Fainelli  * ARL Access Page Registers
266967dd82fSFlorian Fainelli  *************************************************************************/
267967dd82fSFlorian Fainelli 
268967dd82fSFlorian Fainelli /* VLAN Table Access Register (8 bit) */
269967dd82fSFlorian Fainelli #define B53_VT_ACCESS			0x80
270967dd82fSFlorian Fainelli #define B53_VT_ACCESS_9798		0x60 /* for BCM5397/BCM5398 */
271967dd82fSFlorian Fainelli #define B53_VT_ACCESS_63XX		0x60 /* for BCM6328/62/68 */
272967dd82fSFlorian Fainelli #define   VTA_CMD_WRITE			0
273967dd82fSFlorian Fainelli #define   VTA_CMD_READ			1
274967dd82fSFlorian Fainelli #define   VTA_CMD_CLEAR			2
275967dd82fSFlorian Fainelli #define   VTA_START_CMD			BIT(7)
276967dd82fSFlorian Fainelli 
277967dd82fSFlorian Fainelli /* VLAN Table Index Register (16 bit) */
278967dd82fSFlorian Fainelli #define B53_VT_INDEX			0x81
279967dd82fSFlorian Fainelli #define B53_VT_INDEX_9798		0x61
280967dd82fSFlorian Fainelli #define B53_VT_INDEX_63XX		0x62
281967dd82fSFlorian Fainelli 
282967dd82fSFlorian Fainelli /* VLAN Table Entry Register (32 bit) */
283967dd82fSFlorian Fainelli #define B53_VT_ENTRY			0x83
284967dd82fSFlorian Fainelli #define B53_VT_ENTRY_9798		0x63
285967dd82fSFlorian Fainelli #define B53_VT_ENTRY_63XX		0x64
286967dd82fSFlorian Fainelli #define   VTE_MEMBERS			0x1ff
287967dd82fSFlorian Fainelli #define   VTE_UNTAG_S			9
288967dd82fSFlorian Fainelli #define   VTE_UNTAG			(0x1ff << 9)
289967dd82fSFlorian Fainelli 
290967dd82fSFlorian Fainelli /*************************************************************************
2911da6df85SFlorian Fainelli  * ARL I/O Registers
2921da6df85SFlorian Fainelli  *************************************************************************/
2931da6df85SFlorian Fainelli 
2941da6df85SFlorian Fainelli /* ARL Table Read/Write Register (8 bit) */
2951da6df85SFlorian Fainelli #define B53_ARLTBL_RW_CTRL		0x00
2961da6df85SFlorian Fainelli #define    ARLTBL_RW			BIT(0)
29764fec949SFlorian Fainelli #define    ARLTBL_IVL_SVL_SELECT	BIT(6)
2981da6df85SFlorian Fainelli #define    ARLTBL_START_DONE		BIT(7)
2991da6df85SFlorian Fainelli 
3001da6df85SFlorian Fainelli /* MAC Address Index Register (48 bit) */
3011da6df85SFlorian Fainelli #define B53_MAC_ADDR_IDX		0x02
3021da6df85SFlorian Fainelli 
3031da6df85SFlorian Fainelli /* VLAN ID Index Register (16 bit) */
3041da6df85SFlorian Fainelli #define B53_VLAN_ID_IDX			0x08
3051da6df85SFlorian Fainelli 
3061da6df85SFlorian Fainelli /* ARL Table MAC/VID Entry N Registers (64 bit)
3071da6df85SFlorian Fainelli  *
3081da6df85SFlorian Fainelli  * BCM5325 and BCM5365 share most definitions below
3091da6df85SFlorian Fainelli  */
310c2e77a18SFlorian Fainelli #define B53_ARLTBL_MAC_VID_ENTRY(n)	((0x10 * (n)) + 0x10)
3115e3b724eSGeert Uytterhoeven #define   ARLTBL_MAC_MASK		0xffffffffffffULL
3121da6df85SFlorian Fainelli #define   ARLTBL_VID_S			48
3131da6df85SFlorian Fainelli #define   ARLTBL_VID_MASK_25		0xff
3141da6df85SFlorian Fainelli #define   ARLTBL_VID_MASK		0xfff
3151da6df85SFlorian Fainelli #define   ARLTBL_DATA_PORT_ID_S_25	48
3161da6df85SFlorian Fainelli #define   ARLTBL_DATA_PORT_ID_MASK_25	0xf
3171da6df85SFlorian Fainelli #define   ARLTBL_AGE_25			BIT(61)
3181da6df85SFlorian Fainelli #define   ARLTBL_STATIC_25		BIT(62)
3191da6df85SFlorian Fainelli #define   ARLTBL_VALID_25		BIT(63)
3201da6df85SFlorian Fainelli 
3211da6df85SFlorian Fainelli /* ARL Table Data Entry N Registers (32 bit) */
322c2e77a18SFlorian Fainelli #define B53_ARLTBL_DATA_ENTRY(n)	((0x10 * (n)) + 0x18)
3231da6df85SFlorian Fainelli #define   ARLTBL_DATA_PORT_ID_MASK	0x1ff
3241da6df85SFlorian Fainelli #define   ARLTBL_TC(tc)			((3 & tc) << 11)
3251da6df85SFlorian Fainelli #define   ARLTBL_AGE			BIT(14)
3261da6df85SFlorian Fainelli #define   ARLTBL_STATIC			BIT(15)
3271da6df85SFlorian Fainelli #define   ARLTBL_VALID			BIT(16)
3281da6df85SFlorian Fainelli 
3296344dbdeSFlorian Fainelli /* Maximum number of bin entries in the ARL for all switches */
3306344dbdeSFlorian Fainelli #define B53_ARLTBL_MAX_BIN_ENTRIES	4
3316344dbdeSFlorian Fainelli 
3321da6df85SFlorian Fainelli /* ARL Search Control Register (8 bit) */
3331da6df85SFlorian Fainelli #define B53_ARL_SRCH_CTL		0x50
3341da6df85SFlorian Fainelli #define B53_ARL_SRCH_CTL_25		0x20
3351da6df85SFlorian Fainelli #define   ARL_SRCH_VLID			BIT(0)
3361da6df85SFlorian Fainelli #define   ARL_SRCH_STDN			BIT(7)
3371da6df85SFlorian Fainelli 
3381da6df85SFlorian Fainelli /* ARL Search Address Register (16 bit) */
3391da6df85SFlorian Fainelli #define B53_ARL_SRCH_ADDR		0x51
3401da6df85SFlorian Fainelli #define B53_ARL_SRCH_ADDR_25		0x22
3411da6df85SFlorian Fainelli #define B53_ARL_SRCH_ADDR_65		0x24
3421da6df85SFlorian Fainelli #define  ARL_ADDR_MASK			GENMASK(14, 0)
3431da6df85SFlorian Fainelli 
3441da6df85SFlorian Fainelli /* ARL Search MAC/VID Result (64 bit) */
3451da6df85SFlorian Fainelli #define B53_ARL_SRCH_RSTL_0_MACVID	0x60
3461da6df85SFlorian Fainelli 
3471da6df85SFlorian Fainelli /* Single register search result on 5325 */
3481da6df85SFlorian Fainelli #define B53_ARL_SRCH_RSTL_0_MACVID_25	0x24
3491da6df85SFlorian Fainelli /* Single register search result on 5365 */
3501da6df85SFlorian Fainelli #define B53_ARL_SRCH_RSTL_0_MACVID_65	0x30
3511da6df85SFlorian Fainelli 
3521da6df85SFlorian Fainelli /* ARL Search Data Result (32 bit) */
3531da6df85SFlorian Fainelli #define B53_ARL_SRCH_RSTL_0		0x68
3541da6df85SFlorian Fainelli 
3551da6df85SFlorian Fainelli #define B53_ARL_SRCH_RSTL_MACVID(x)	(B53_ARL_SRCH_RSTL_0_MACVID + ((x) * 0x10))
3561da6df85SFlorian Fainelli #define B53_ARL_SRCH_RSTL(x)		(B53_ARL_SRCH_RSTL_0 + ((x) * 0x10))
3571da6df85SFlorian Fainelli 
3581da6df85SFlorian Fainelli /*************************************************************************
359967dd82fSFlorian Fainelli  * Port VLAN Registers
360967dd82fSFlorian Fainelli  *************************************************************************/
361967dd82fSFlorian Fainelli 
362967dd82fSFlorian Fainelli /* Port VLAN mask (16 bit) IMP port is always 8, also on 5325 & co */
363967dd82fSFlorian Fainelli #define B53_PVLAN_PORT_MASK(i)		((i) * 2)
364967dd82fSFlorian Fainelli 
36548aea33aSFlorian Fainelli /* Join all VLANs register (16 bit) */
36648aea33aSFlorian Fainelli #define B53_JOIN_ALL_VLAN_EN		0x50
36748aea33aSFlorian Fainelli 
368967dd82fSFlorian Fainelli /*************************************************************************
369967dd82fSFlorian Fainelli  * 802.1Q Page Registers
370967dd82fSFlorian Fainelli  *************************************************************************/
371967dd82fSFlorian Fainelli 
372967dd82fSFlorian Fainelli /* Global QoS Control (8 bit) */
373967dd82fSFlorian Fainelli #define B53_QOS_GLOBAL_CTL		0x00
374967dd82fSFlorian Fainelli 
375967dd82fSFlorian Fainelli /* Enable 802.1Q for individual Ports (16 bit) */
376967dd82fSFlorian Fainelli #define B53_802_1P_EN			0x04
377967dd82fSFlorian Fainelli 
378967dd82fSFlorian Fainelli /*************************************************************************
379967dd82fSFlorian Fainelli  * VLAN Page Registers
380967dd82fSFlorian Fainelli  *************************************************************************/
381967dd82fSFlorian Fainelli 
382967dd82fSFlorian Fainelli /* VLAN Control 0 (8 bit) */
383967dd82fSFlorian Fainelli #define B53_VLAN_CTRL0			0x00
384967dd82fSFlorian Fainelli #define   VC0_8021PF_CTRL_MASK		0x3
385967dd82fSFlorian Fainelli #define   VC0_8021PF_CTRL_NONE		0x0
386967dd82fSFlorian Fainelli #define   VC0_8021PF_CTRL_CHANGE_PRI	0x1
387967dd82fSFlorian Fainelli #define   VC0_8021PF_CTRL_CHANGE_VID	0x2
388967dd82fSFlorian Fainelli #define   VC0_8021PF_CTRL_CHANGE_BOTH	0x3
389967dd82fSFlorian Fainelli #define   VC0_8021QF_CTRL_MASK		0xc
390967dd82fSFlorian Fainelli #define   VC0_8021QF_CTRL_CHANGE_PRI	0x1
391967dd82fSFlorian Fainelli #define   VC0_8021QF_CTRL_CHANGE_VID	0x2
392967dd82fSFlorian Fainelli #define   VC0_8021QF_CTRL_CHANGE_BOTH	0x3
393967dd82fSFlorian Fainelli #define   VC0_RESERVED_1		BIT(1)
394967dd82fSFlorian Fainelli #define   VC0_DROP_VID_MISS		BIT(4)
395967dd82fSFlorian Fainelli #define   VC0_VID_HASH_VID		BIT(5)
396967dd82fSFlorian Fainelli #define   VC0_VID_CHK_EN		BIT(6)	/* Use VID,DA or VID,SA */
397967dd82fSFlorian Fainelli #define   VC0_VLAN_EN			BIT(7)	/* 802.1Q VLAN Enabled */
398967dd82fSFlorian Fainelli 
399967dd82fSFlorian Fainelli /* VLAN Control 1 (8 bit) */
400967dd82fSFlorian Fainelli #define B53_VLAN_CTRL1			0x01
401967dd82fSFlorian Fainelli #define   VC1_RX_MCST_TAG_EN		BIT(1)
402967dd82fSFlorian Fainelli #define   VC1_RX_MCST_FWD_EN		BIT(2)
403967dd82fSFlorian Fainelli #define   VC1_RX_MCST_UNTAG_EN		BIT(3)
404967dd82fSFlorian Fainelli 
405967dd82fSFlorian Fainelli /* VLAN Control 2 (8 bit) */
406967dd82fSFlorian Fainelli #define B53_VLAN_CTRL2			0x02
407967dd82fSFlorian Fainelli 
408967dd82fSFlorian Fainelli /* VLAN Control 3 (8 bit when BCM5325, 16 bit else) */
409967dd82fSFlorian Fainelli #define B53_VLAN_CTRL3			0x03
410967dd82fSFlorian Fainelli #define B53_VLAN_CTRL3_63XX		0x04
411967dd82fSFlorian Fainelli #define   VC3_MAXSIZE_1532		BIT(6) /* 5325 only */
412967dd82fSFlorian Fainelli #define   VC3_HIGH_8BIT_EN		BIT(7) /* 5325 only */
413967dd82fSFlorian Fainelli 
414967dd82fSFlorian Fainelli /* VLAN Control 4 (8 bit) */
415967dd82fSFlorian Fainelli #define B53_VLAN_CTRL4			0x05
416967dd82fSFlorian Fainelli #define B53_VLAN_CTRL4_25		0x04
417967dd82fSFlorian Fainelli #define B53_VLAN_CTRL4_63XX		0x06
418967dd82fSFlorian Fainelli #define   VC4_ING_VID_CHECK_S		6
419967dd82fSFlorian Fainelli #define   VC4_ING_VID_CHECK_MASK	(0x3 << VC4_ING_VID_CHECK_S)
420967dd82fSFlorian Fainelli #define   VC4_ING_VID_VIO_FWD		0 /* forward, but do not learn */
421967dd82fSFlorian Fainelli #define   VC4_ING_VID_VIO_DROP		1 /* drop VID violations */
422967dd82fSFlorian Fainelli #define   VC4_NO_ING_VID_CHK		2 /* do not check */
423967dd82fSFlorian Fainelli #define   VC4_ING_VID_VIO_TO_IMP	3 /* redirect to MII port */
424967dd82fSFlorian Fainelli 
425967dd82fSFlorian Fainelli /* VLAN Control 5 (8 bit) */
426967dd82fSFlorian Fainelli #define B53_VLAN_CTRL5			0x06
427967dd82fSFlorian Fainelli #define B53_VLAN_CTRL5_25		0x05
428967dd82fSFlorian Fainelli #define B53_VLAN_CTRL5_63XX		0x07
429967dd82fSFlorian Fainelli #define   VC5_VID_FFF_EN		BIT(2)
430967dd82fSFlorian Fainelli #define   VC5_DROP_VTABLE_MISS		BIT(3)
431967dd82fSFlorian Fainelli 
432967dd82fSFlorian Fainelli /* VLAN Control 6 (8 bit) */
433967dd82fSFlorian Fainelli #define B53_VLAN_CTRL6			0x07
434967dd82fSFlorian Fainelli #define B53_VLAN_CTRL6_63XX		0x08
435967dd82fSFlorian Fainelli 
436967dd82fSFlorian Fainelli /* VLAN Table Access Register (16 bit) */
437967dd82fSFlorian Fainelli #define B53_VLAN_TABLE_ACCESS_25	0x06	/* BCM5325E/5350 */
438967dd82fSFlorian Fainelli #define B53_VLAN_TABLE_ACCESS_65	0x08	/* BCM5365 */
439967dd82fSFlorian Fainelli #define   VTA_VID_LOW_MASK_25		0xf
440967dd82fSFlorian Fainelli #define   VTA_VID_LOW_MASK_65		0xff
441967dd82fSFlorian Fainelli #define   VTA_VID_HIGH_S_25		4
442967dd82fSFlorian Fainelli #define   VTA_VID_HIGH_S_65		8
443967dd82fSFlorian Fainelli #define   VTA_VID_HIGH_MASK_25		(0xff << VTA_VID_HIGH_S_25E)
444967dd82fSFlorian Fainelli #define   VTA_VID_HIGH_MASK_65		(0xf << VTA_VID_HIGH_S_65)
445967dd82fSFlorian Fainelli #define   VTA_RW_STATE			BIT(12)
446967dd82fSFlorian Fainelli #define   VTA_RW_STATE_RD		0
447967dd82fSFlorian Fainelli #define   VTA_RW_STATE_WR		BIT(12)
448967dd82fSFlorian Fainelli #define   VTA_RW_OP_EN			BIT(13)
449967dd82fSFlorian Fainelli 
450967dd82fSFlorian Fainelli /* VLAN Read/Write Registers for (16/32 bit) */
451967dd82fSFlorian Fainelli #define B53_VLAN_WRITE_25		0x08
452967dd82fSFlorian Fainelli #define B53_VLAN_WRITE_65		0x0a
453967dd82fSFlorian Fainelli #define B53_VLAN_READ			0x0c
454967dd82fSFlorian Fainelli #define   VA_MEMBER_MASK		0x3f
455967dd82fSFlorian Fainelli #define   VA_UNTAG_S_25			6
456967dd82fSFlorian Fainelli #define   VA_UNTAG_MASK_25		0x3f
457967dd82fSFlorian Fainelli #define   VA_UNTAG_S_65			7
458967dd82fSFlorian Fainelli #define   VA_UNTAG_MASK_65		0x1f
459967dd82fSFlorian Fainelli #define   VA_VID_HIGH_S			12
460967dd82fSFlorian Fainelli #define   VA_VID_HIGH_MASK		(0xffff << VA_VID_HIGH_S)
461967dd82fSFlorian Fainelli #define   VA_VALID_25			BIT(20)
462967dd82fSFlorian Fainelli #define   VA_VALID_25_R4		BIT(24)
463967dd82fSFlorian Fainelli #define   VA_VALID_65			BIT(14)
464967dd82fSFlorian Fainelli 
465967dd82fSFlorian Fainelli /* VLAN Port Default Tag (16 bit) */
466967dd82fSFlorian Fainelli #define B53_VLAN_PORT_DEF_TAG(i)	(0x10 + 2 * (i))
467967dd82fSFlorian Fainelli 
468967dd82fSFlorian Fainelli /*************************************************************************
469967dd82fSFlorian Fainelli  * Jumbo Frame Page Registers
470967dd82fSFlorian Fainelli  *************************************************************************/
471967dd82fSFlorian Fainelli 
472967dd82fSFlorian Fainelli /* Jumbo Enable Port Mask (bit i == port i enabled) (32 bit) */
473967dd82fSFlorian Fainelli #define B53_JUMBO_PORT_MASK		0x01
474967dd82fSFlorian Fainelli #define B53_JUMBO_PORT_MASK_63XX	0x04
475967dd82fSFlorian Fainelli #define   JPM_10_100_JUMBO_EN		BIT(24) /* GigE always enabled */
476967dd82fSFlorian Fainelli 
477967dd82fSFlorian Fainelli /* Good Frame Max Size without 802.1Q TAG (16 bit) */
478967dd82fSFlorian Fainelli #define B53_JUMBO_MAX_SIZE		0x05
479967dd82fSFlorian Fainelli #define B53_JUMBO_MAX_SIZE_63XX		0x08
480967dd82fSFlorian Fainelli #define   JMS_MIN_SIZE			1518
481967dd82fSFlorian Fainelli #define   JMS_MAX_SIZE			9724
482967dd82fSFlorian Fainelli 
483967dd82fSFlorian Fainelli /*************************************************************************
484909d812aSFlorian Fainelli  * EEE Configuration Page Registers
485909d812aSFlorian Fainelli  *************************************************************************/
486909d812aSFlorian Fainelli 
487909d812aSFlorian Fainelli /* EEE Enable control register (16 bit) */
488909d812aSFlorian Fainelli #define B53_EEE_EN_CTRL			0x00
489909d812aSFlorian Fainelli 
490909d812aSFlorian Fainelli /* EEE LPI assert status register (16 bit) */
491909d812aSFlorian Fainelli #define B53_EEE_LPI_ASSERT_STS		0x02
492909d812aSFlorian Fainelli 
493909d812aSFlorian Fainelli /* EEE LPI indicate status register (16 bit) */
494909d812aSFlorian Fainelli #define B53_EEE_LPI_INDICATE		0x4
495909d812aSFlorian Fainelli 
496909d812aSFlorian Fainelli /* EEE Receiving idle symbols status register (16 bit) */
497909d812aSFlorian Fainelli #define B53_EEE_RX_IDLE_SYM_STS		0x6
498909d812aSFlorian Fainelli 
499909d812aSFlorian Fainelli /* EEE Pipeline timer register (32 bit) */
500909d812aSFlorian Fainelli #define B53_EEE_PIP_TIMER		0xC
501909d812aSFlorian Fainelli 
502909d812aSFlorian Fainelli /* EEE Sleep timer Gig register (32 bit) */
503909d812aSFlorian Fainelli #define B53_EEE_SLEEP_TIMER_GIG(i)	(0x10 + 4 * (i))
504909d812aSFlorian Fainelli 
505909d812aSFlorian Fainelli /* EEE Sleep timer FE register (32 bit) */
506909d812aSFlorian Fainelli #define B53_EEE_SLEEP_TIMER_FE(i)	(0x34 + 4 * (i))
507909d812aSFlorian Fainelli 
508909d812aSFlorian Fainelli /* EEE Minimum LP timer Gig register (32 bit) */
509909d812aSFlorian Fainelli #define B53_EEE_MIN_LP_TIMER_GIG(i)	(0x58 + 4 * (i))
510909d812aSFlorian Fainelli 
511909d812aSFlorian Fainelli /* EEE Minimum LP timer FE register (32 bit) */
512909d812aSFlorian Fainelli #define B53_EEE_MIN_LP_TIMER_FE(i)	(0x7c + 4 * (i))
513909d812aSFlorian Fainelli 
514909d812aSFlorian Fainelli /* EEE Wake timer Gig register (16 bit) */
515909d812aSFlorian Fainelli #define B53_EEE_WAKE_TIMER_GIG(i)	(0xa0 + 2 * (i))
516909d812aSFlorian Fainelli 
517909d812aSFlorian Fainelli /* EEE Wake timer FE register (16 bit) */
518909d812aSFlorian Fainelli #define B53_EEE_WAKE_TIMER_FE(i)	(0xb2 + 2 * (i))
519909d812aSFlorian Fainelli 
520909d812aSFlorian Fainelli 
521909d812aSFlorian Fainelli /*************************************************************************
522967dd82fSFlorian Fainelli  * CFP Configuration Page Registers
523967dd82fSFlorian Fainelli  *************************************************************************/
524967dd82fSFlorian Fainelli 
525967dd82fSFlorian Fainelli /* CFP Control Register with ports map (8 bit) */
526967dd82fSFlorian Fainelli #define B53_CFP_CTRL			0x00
527967dd82fSFlorian Fainelli 
528967dd82fSFlorian Fainelli #endif /* !__B53_REGS_H */
529