162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * B53 register definitions
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (C) 2004 Broadcom Corporation
562306a36Sopenharmony_ci * Copyright (C) 2011-2013 Jonas Gorski <jogo@openwrt.org>
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
862306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
962306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1262306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1362306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1462306a36Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1562306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1662306a36Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1762306a36Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1862306a36Sopenharmony_ci */
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#ifndef __B53_REGS_H
2162306a36Sopenharmony_ci#define __B53_REGS_H
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci/* Management Port (SMP) Page offsets */
2462306a36Sopenharmony_ci#define B53_CTRL_PAGE			0x00 /* Control */
2562306a36Sopenharmony_ci#define B53_STAT_PAGE			0x01 /* Status */
2662306a36Sopenharmony_ci#define B53_MGMT_PAGE			0x02 /* Management Mode */
2762306a36Sopenharmony_ci#define B53_MIB_AC_PAGE			0x03 /* MIB Autocast */
2862306a36Sopenharmony_ci#define B53_ARLCTRL_PAGE		0x04 /* ARL Control */
2962306a36Sopenharmony_ci#define B53_ARLIO_PAGE			0x05 /* ARL Access */
3062306a36Sopenharmony_ci#define B53_FRAMEBUF_PAGE		0x06 /* Management frame access */
3162306a36Sopenharmony_ci#define B53_MEM_ACCESS_PAGE		0x08 /* Memory access */
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci/* PHY Registers */
3462306a36Sopenharmony_ci#define B53_PORT_MII_PAGE(i)		(0x10 + (i)) /* Port i MII Registers */
3562306a36Sopenharmony_ci#define B53_IM_PORT_PAGE		0x18 /* Inverse MII Port (to EMAC) */
3662306a36Sopenharmony_ci#define B53_ALL_PORT_PAGE		0x19 /* All ports MII (broadcast) */
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci/* MIB registers */
3962306a36Sopenharmony_ci#define B53_MIB_PAGE(i)			(0x20 + (i))
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci/* Quality of Service (QoS) Registers */
4262306a36Sopenharmony_ci#define B53_QOS_PAGE			0x30
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/* Port VLAN Page */
4562306a36Sopenharmony_ci#define B53_PVLAN_PAGE			0x31
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/* VLAN Registers */
4862306a36Sopenharmony_ci#define B53_VLAN_PAGE			0x34
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci/* Jumbo Frame Registers */
5162306a36Sopenharmony_ci#define B53_JUMBO_PAGE			0x40
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci/* EEE Control Registers Page */
5462306a36Sopenharmony_ci#define B53_EEE_PAGE			0x92
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci/* CFP Configuration Registers Page */
5762306a36Sopenharmony_ci#define B53_CFP_PAGE			0xa1
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci/*************************************************************************
6062306a36Sopenharmony_ci * Control Page registers
6162306a36Sopenharmony_ci *************************************************************************/
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci/* Port Control Register (8 bit) */
6462306a36Sopenharmony_ci#define B53_PORT_CTRL(i)		(0x00 + (i))
6562306a36Sopenharmony_ci#define   PORT_CTRL_RX_DISABLE		BIT(0)
6662306a36Sopenharmony_ci#define   PORT_CTRL_TX_DISABLE		BIT(1)
6762306a36Sopenharmony_ci#define   PORT_CTRL_RX_BCST_EN		BIT(2) /* Broadcast RX (P8 only) */
6862306a36Sopenharmony_ci#define   PORT_CTRL_RX_MCST_EN		BIT(3) /* Multicast RX (P8 only) */
6962306a36Sopenharmony_ci#define   PORT_CTRL_RX_UCST_EN		BIT(4) /* Unicast RX (P8 only) */
7062306a36Sopenharmony_ci#define	  PORT_CTRL_STP_STATE_S		5
7162306a36Sopenharmony_ci#define   PORT_CTRL_NO_STP		(0 << PORT_CTRL_STP_STATE_S)
7262306a36Sopenharmony_ci#define   PORT_CTRL_DIS_STATE		(1 << PORT_CTRL_STP_STATE_S)
7362306a36Sopenharmony_ci#define   PORT_CTRL_BLOCK_STATE		(2 << PORT_CTRL_STP_STATE_S)
7462306a36Sopenharmony_ci#define   PORT_CTRL_LISTEN_STATE	(3 << PORT_CTRL_STP_STATE_S)
7562306a36Sopenharmony_ci#define   PORT_CTRL_LEARN_STATE		(4 << PORT_CTRL_STP_STATE_S)
7662306a36Sopenharmony_ci#define   PORT_CTRL_FWD_STATE		(5 << PORT_CTRL_STP_STATE_S)
7762306a36Sopenharmony_ci#define   PORT_CTRL_STP_STATE_MASK	(0x7 << PORT_CTRL_STP_STATE_S)
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci/* SMP Control Register (8 bit) */
8062306a36Sopenharmony_ci#define B53_SMP_CTRL			0x0a
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci/* Switch Mode Control Register (8 bit) */
8362306a36Sopenharmony_ci#define B53_SWITCH_MODE			0x0b
8462306a36Sopenharmony_ci#define   SM_SW_FWD_MODE		BIT(0)	/* 1 = Managed Mode */
8562306a36Sopenharmony_ci#define   SM_SW_FWD_EN			BIT(1)	/* Forwarding Enable */
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci/* IMP Port state override register (8 bit) */
8862306a36Sopenharmony_ci#define B53_PORT_OVERRIDE_CTRL		0x0e
8962306a36Sopenharmony_ci#define   PORT_OVERRIDE_LINK		BIT(0)
9062306a36Sopenharmony_ci#define   PORT_OVERRIDE_FULL_DUPLEX	BIT(1) /* 0 = Half Duplex */
9162306a36Sopenharmony_ci#define   PORT_OVERRIDE_SPEED_S		2
9262306a36Sopenharmony_ci#define   PORT_OVERRIDE_SPEED_10M	(0 << PORT_OVERRIDE_SPEED_S)
9362306a36Sopenharmony_ci#define   PORT_OVERRIDE_SPEED_100M	(1 << PORT_OVERRIDE_SPEED_S)
9462306a36Sopenharmony_ci#define   PORT_OVERRIDE_SPEED_1000M	(2 << PORT_OVERRIDE_SPEED_S)
9562306a36Sopenharmony_ci#define   PORT_OVERRIDE_RV_MII_25	BIT(4) /* BCM5325 only */
9662306a36Sopenharmony_ci#define   PORT_OVERRIDE_RX_FLOW		BIT(4)
9762306a36Sopenharmony_ci#define   PORT_OVERRIDE_TX_FLOW		BIT(5)
9862306a36Sopenharmony_ci#define   PORT_OVERRIDE_SPEED_2000M	BIT(6) /* BCM5301X only, requires setting 1000M */
9962306a36Sopenharmony_ci#define   PORT_OVERRIDE_EN		BIT(7) /* Use the register contents */
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci/* Power-down mode control */
10262306a36Sopenharmony_ci#define B53_PD_MODE_CTRL_25		0x0f
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci/* IP Multicast control (8 bit) */
10562306a36Sopenharmony_ci#define B53_IP_MULTICAST_CTRL		0x21
10662306a36Sopenharmony_ci#define  B53_IPMC_FWD_EN		BIT(1)
10762306a36Sopenharmony_ci#define  B53_UC_FWD_EN			BIT(6)
10862306a36Sopenharmony_ci#define  B53_MC_FWD_EN			BIT(7)
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci/* Switch control (8 bit) */
11162306a36Sopenharmony_ci#define B53_SWITCH_CTRL			0x22
11262306a36Sopenharmony_ci#define  B53_MII_DUMB_FWDG_EN		BIT(6)
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci/* (16 bit) */
11562306a36Sopenharmony_ci#define B53_UC_FLOOD_MASK		0x32
11662306a36Sopenharmony_ci#define B53_MC_FLOOD_MASK		0x34
11762306a36Sopenharmony_ci#define B53_IPMC_FLOOD_MASK		0x36
11862306a36Sopenharmony_ci#define B53_DIS_LEARNING		0x3c
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci/*
12162306a36Sopenharmony_ci * Override Ports 0-7 State on devices with xMII interfaces (8 bit)
12262306a36Sopenharmony_ci *
12362306a36Sopenharmony_ci * For port 8 still use B53_PORT_OVERRIDE_CTRL
12462306a36Sopenharmony_ci * Please note that not all ports are available on every hardware, e.g. BCM5301X
12562306a36Sopenharmony_ci * don't include overriding port 6, BCM63xx also have some limitations.
12662306a36Sopenharmony_ci */
12762306a36Sopenharmony_ci#define B53_GMII_PORT_OVERRIDE_CTRL(i)	(0x58 + (i))
12862306a36Sopenharmony_ci#define   GMII_PO_LINK			BIT(0)
12962306a36Sopenharmony_ci#define   GMII_PO_FULL_DUPLEX		BIT(1) /* 0 = Half Duplex */
13062306a36Sopenharmony_ci#define   GMII_PO_SPEED_S		2
13162306a36Sopenharmony_ci#define   GMII_PO_SPEED_10M		(0 << GMII_PO_SPEED_S)
13262306a36Sopenharmony_ci#define   GMII_PO_SPEED_100M		(1 << GMII_PO_SPEED_S)
13362306a36Sopenharmony_ci#define   GMII_PO_SPEED_1000M		(2 << GMII_PO_SPEED_S)
13462306a36Sopenharmony_ci#define   GMII_PO_RX_FLOW		BIT(4)
13562306a36Sopenharmony_ci#define   GMII_PO_TX_FLOW		BIT(5)
13662306a36Sopenharmony_ci#define   GMII_PO_EN			BIT(6) /* Use the register contents */
13762306a36Sopenharmony_ci#define   GMII_PO_SPEED_2000M		BIT(7) /* BCM5301X only, requires setting 1000M */
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci#define B53_RGMII_CTRL_IMP		0x60
14062306a36Sopenharmony_ci#define   RGMII_CTRL_ENABLE_GMII	BIT(7)
14162306a36Sopenharmony_ci#define   RGMII_CTRL_MII_OVERRIDE	BIT(6)
14262306a36Sopenharmony_ci#define   RGMII_CTRL_TIMING_SEL		BIT(2)
14362306a36Sopenharmony_ci#define   RGMII_CTRL_DLL_RXC		BIT(1)
14462306a36Sopenharmony_ci#define   RGMII_CTRL_DLL_TXC		BIT(0)
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci#define B53_RGMII_CTRL_P(i)		(B53_RGMII_CTRL_IMP + (i))
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci/* Software reset register (8 bit) */
14962306a36Sopenharmony_ci#define B53_SOFTRESET			0x79
15062306a36Sopenharmony_ci#define   SW_RST			BIT(7)
15162306a36Sopenharmony_ci#define   EN_CH_RST			BIT(6)
15262306a36Sopenharmony_ci#define   EN_SW_RST			BIT(4)
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci/* Fast Aging Control register (8 bit) */
15562306a36Sopenharmony_ci#define B53_FAST_AGE_CTRL		0x88
15662306a36Sopenharmony_ci#define   FAST_AGE_STATIC		BIT(0)
15762306a36Sopenharmony_ci#define   FAST_AGE_DYNAMIC		BIT(1)
15862306a36Sopenharmony_ci#define   FAST_AGE_PORT			BIT(2)
15962306a36Sopenharmony_ci#define   FAST_AGE_VLAN			BIT(3)
16062306a36Sopenharmony_ci#define   FAST_AGE_STP			BIT(4)
16162306a36Sopenharmony_ci#define   FAST_AGE_MC			BIT(5)
16262306a36Sopenharmony_ci#define   FAST_AGE_DONE			BIT(7)
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci/* Fast Aging Port Control register (8 bit) */
16562306a36Sopenharmony_ci#define B53_FAST_AGE_PORT_CTRL		0x89
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci/* Fast Aging VID Control register (16 bit) */
16862306a36Sopenharmony_ci#define B53_FAST_AGE_VID_CTRL		0x8a
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci/*************************************************************************
17162306a36Sopenharmony_ci * Status Page registers
17262306a36Sopenharmony_ci *************************************************************************/
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ci/* Link Status Summary Register (16bit) */
17562306a36Sopenharmony_ci#define B53_LINK_STAT			0x00
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci/* Link Status Change Register (16 bit) */
17862306a36Sopenharmony_ci#define B53_LINK_STAT_CHANGE		0x02
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci/* Port Speed Summary Register (16 bit for FE, 32 bit for GE) */
18162306a36Sopenharmony_ci#define B53_SPEED_STAT			0x04
18262306a36Sopenharmony_ci#define  SPEED_PORT_FE(reg, port)	(((reg) >> (port)) & 1)
18362306a36Sopenharmony_ci#define  SPEED_PORT_GE(reg, port)	(((reg) >> 2 * (port)) & 3)
18462306a36Sopenharmony_ci#define  SPEED_STAT_10M			0
18562306a36Sopenharmony_ci#define  SPEED_STAT_100M		1
18662306a36Sopenharmony_ci#define  SPEED_STAT_1000M		2
18762306a36Sopenharmony_ci
18862306a36Sopenharmony_ci/* Duplex Status Summary (16 bit) */
18962306a36Sopenharmony_ci#define B53_DUPLEX_STAT_FE		0x06
19062306a36Sopenharmony_ci#define B53_DUPLEX_STAT_GE		0x08
19162306a36Sopenharmony_ci#define B53_DUPLEX_STAT_63XX		0x0c
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci/* Revision ID register for BCM5325 */
19462306a36Sopenharmony_ci#define B53_REV_ID_25			0x50
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ci/* Strap Value (48 bit) */
19762306a36Sopenharmony_ci#define B53_STRAP_VALUE			0x70
19862306a36Sopenharmony_ci#define   SV_GMII_CTRL_115		BIT(27)
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ci/*************************************************************************
20162306a36Sopenharmony_ci * Management Mode Page Registers
20262306a36Sopenharmony_ci *************************************************************************/
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci/* Global Management Config Register (8 bit) */
20562306a36Sopenharmony_ci#define B53_GLOBAL_CONFIG		0x00
20662306a36Sopenharmony_ci#define   GC_RESET_MIB			0x01
20762306a36Sopenharmony_ci#define   GC_RX_BPDU_EN			0x02
20862306a36Sopenharmony_ci#define   GC_MIB_AC_HDR_EN		0x10
20962306a36Sopenharmony_ci#define   GC_MIB_AC_EN			0x20
21062306a36Sopenharmony_ci#define   GC_FRM_MGMT_PORT_M		0xC0
21162306a36Sopenharmony_ci#define   GC_FRM_MGMT_PORT_04		0x00
21262306a36Sopenharmony_ci#define   GC_FRM_MGMT_PORT_MII		0x80
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci/* Broadcom Header control register (8 bit) */
21562306a36Sopenharmony_ci#define B53_BRCM_HDR			0x03
21662306a36Sopenharmony_ci#define   BRCM_HDR_P8_EN		BIT(0) /* Enable tagging on port 8 */
21762306a36Sopenharmony_ci#define   BRCM_HDR_P5_EN		BIT(1) /* Enable tagging on port 5 */
21862306a36Sopenharmony_ci#define   BRCM_HDR_P7_EN		BIT(2) /* Enable tagging on port 7 */
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci/* Mirror capture control register (16 bit) */
22162306a36Sopenharmony_ci#define B53_MIR_CAP_CTL			0x10
22262306a36Sopenharmony_ci#define  CAP_PORT_MASK			0xf
22362306a36Sopenharmony_ci#define  BLK_NOT_MIR			BIT(14)
22462306a36Sopenharmony_ci#define  MIRROR_EN			BIT(15)
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci/* Ingress mirror control register (16 bit) */
22762306a36Sopenharmony_ci#define B53_IG_MIR_CTL			0x12
22862306a36Sopenharmony_ci#define  MIRROR_MASK			0x1ff
22962306a36Sopenharmony_ci#define  DIV_EN				BIT(13)
23062306a36Sopenharmony_ci#define  MIRROR_FILTER_MASK		0x3
23162306a36Sopenharmony_ci#define  MIRROR_FILTER_SHIFT		14
23262306a36Sopenharmony_ci#define  MIRROR_ALL			0
23362306a36Sopenharmony_ci#define  MIRROR_DA			1
23462306a36Sopenharmony_ci#define  MIRROR_SA			2
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci/* Ingress mirror divider register (16 bit) */
23762306a36Sopenharmony_ci#define B53_IG_MIR_DIV			0x14
23862306a36Sopenharmony_ci#define  IN_MIRROR_DIV_MASK		0x3ff
23962306a36Sopenharmony_ci
24062306a36Sopenharmony_ci/* Ingress mirror MAC address register (48 bit) */
24162306a36Sopenharmony_ci#define B53_IG_MIR_MAC			0x16
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ci/* Egress mirror control register (16 bit) */
24462306a36Sopenharmony_ci#define B53_EG_MIR_CTL			0x1C
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci/* Egress mirror divider register (16 bit) */
24762306a36Sopenharmony_ci#define B53_EG_MIR_DIV			0x1E
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci/* Egress mirror MAC address register (48 bit) */
25062306a36Sopenharmony_ci#define B53_EG_MIR_MAC			0x20
25162306a36Sopenharmony_ci
25262306a36Sopenharmony_ci/* Device ID register (8 or 32 bit) */
25362306a36Sopenharmony_ci#define B53_DEVICE_ID			0x30
25462306a36Sopenharmony_ci
25562306a36Sopenharmony_ci/* Revision ID register (8 bit) */
25662306a36Sopenharmony_ci#define B53_REV_ID			0x40
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_ci/* Broadcom header RX control (16 bit) */
25962306a36Sopenharmony_ci#define B53_BRCM_HDR_RX_DIS		0x60
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ci/* Broadcom header TX control (16 bit)	*/
26262306a36Sopenharmony_ci#define B53_BRCM_HDR_TX_DIS		0x62
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ci/*************************************************************************
26562306a36Sopenharmony_ci * ARL Access Page Registers
26662306a36Sopenharmony_ci *************************************************************************/
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci/* VLAN Table Access Register (8 bit) */
26962306a36Sopenharmony_ci#define B53_VT_ACCESS			0x80
27062306a36Sopenharmony_ci#define B53_VT_ACCESS_9798		0x60 /* for BCM5397/BCM5398 */
27162306a36Sopenharmony_ci#define B53_VT_ACCESS_63XX		0x60 /* for BCM6328/62/68 */
27262306a36Sopenharmony_ci#define   VTA_CMD_WRITE			0
27362306a36Sopenharmony_ci#define   VTA_CMD_READ			1
27462306a36Sopenharmony_ci#define   VTA_CMD_CLEAR			2
27562306a36Sopenharmony_ci#define   VTA_START_CMD			BIT(7)
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ci/* VLAN Table Index Register (16 bit) */
27862306a36Sopenharmony_ci#define B53_VT_INDEX			0x81
27962306a36Sopenharmony_ci#define B53_VT_INDEX_9798		0x61
28062306a36Sopenharmony_ci#define B53_VT_INDEX_63XX		0x62
28162306a36Sopenharmony_ci
28262306a36Sopenharmony_ci/* VLAN Table Entry Register (32 bit) */
28362306a36Sopenharmony_ci#define B53_VT_ENTRY			0x83
28462306a36Sopenharmony_ci#define B53_VT_ENTRY_9798		0x63
28562306a36Sopenharmony_ci#define B53_VT_ENTRY_63XX		0x64
28662306a36Sopenharmony_ci#define   VTE_MEMBERS			0x1ff
28762306a36Sopenharmony_ci#define   VTE_UNTAG_S			9
28862306a36Sopenharmony_ci#define   VTE_UNTAG			(0x1ff << 9)
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ci/*************************************************************************
29162306a36Sopenharmony_ci * ARL I/O Registers
29262306a36Sopenharmony_ci *************************************************************************/
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_ci/* ARL Table Read/Write Register (8 bit) */
29562306a36Sopenharmony_ci#define B53_ARLTBL_RW_CTRL		0x00
29662306a36Sopenharmony_ci#define    ARLTBL_RW			BIT(0)
29762306a36Sopenharmony_ci#define    ARLTBL_IVL_SVL_SELECT	BIT(6)
29862306a36Sopenharmony_ci#define    ARLTBL_START_DONE		BIT(7)
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_ci/* MAC Address Index Register (48 bit) */
30162306a36Sopenharmony_ci#define B53_MAC_ADDR_IDX		0x02
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_ci/* VLAN ID Index Register (16 bit) */
30462306a36Sopenharmony_ci#define B53_VLAN_ID_IDX			0x08
30562306a36Sopenharmony_ci
30662306a36Sopenharmony_ci/* ARL Table MAC/VID Entry N Registers (64 bit)
30762306a36Sopenharmony_ci *
30862306a36Sopenharmony_ci * BCM5325 and BCM5365 share most definitions below
30962306a36Sopenharmony_ci */
31062306a36Sopenharmony_ci#define B53_ARLTBL_MAC_VID_ENTRY(n)	((0x10 * (n)) + 0x10)
31162306a36Sopenharmony_ci#define   ARLTBL_MAC_MASK		0xffffffffffffULL
31262306a36Sopenharmony_ci#define   ARLTBL_VID_S			48
31362306a36Sopenharmony_ci#define   ARLTBL_VID_MASK_25		0xff
31462306a36Sopenharmony_ci#define   ARLTBL_VID_MASK		0xfff
31562306a36Sopenharmony_ci#define   ARLTBL_DATA_PORT_ID_S_25	48
31662306a36Sopenharmony_ci#define   ARLTBL_DATA_PORT_ID_MASK_25	0xf
31762306a36Sopenharmony_ci#define   ARLTBL_AGE_25			BIT(61)
31862306a36Sopenharmony_ci#define   ARLTBL_STATIC_25		BIT(62)
31962306a36Sopenharmony_ci#define   ARLTBL_VALID_25		BIT(63)
32062306a36Sopenharmony_ci
32162306a36Sopenharmony_ci/* ARL Table Data Entry N Registers (32 bit) */
32262306a36Sopenharmony_ci#define B53_ARLTBL_DATA_ENTRY(n)	((0x10 * (n)) + 0x18)
32362306a36Sopenharmony_ci#define   ARLTBL_DATA_PORT_ID_MASK	0x1ff
32462306a36Sopenharmony_ci#define   ARLTBL_TC(tc)			((3 & tc) << 11)
32562306a36Sopenharmony_ci#define   ARLTBL_AGE			BIT(14)
32662306a36Sopenharmony_ci#define   ARLTBL_STATIC			BIT(15)
32762306a36Sopenharmony_ci#define   ARLTBL_VALID			BIT(16)
32862306a36Sopenharmony_ci
32962306a36Sopenharmony_ci/* Maximum number of bin entries in the ARL for all switches */
33062306a36Sopenharmony_ci#define B53_ARLTBL_MAX_BIN_ENTRIES	4
33162306a36Sopenharmony_ci
33262306a36Sopenharmony_ci/* ARL Search Control Register (8 bit) */
33362306a36Sopenharmony_ci#define B53_ARL_SRCH_CTL		0x50
33462306a36Sopenharmony_ci#define B53_ARL_SRCH_CTL_25		0x20
33562306a36Sopenharmony_ci#define   ARL_SRCH_VLID			BIT(0)
33662306a36Sopenharmony_ci#define   ARL_SRCH_STDN			BIT(7)
33762306a36Sopenharmony_ci
33862306a36Sopenharmony_ci/* ARL Search Address Register (16 bit) */
33962306a36Sopenharmony_ci#define B53_ARL_SRCH_ADDR		0x51
34062306a36Sopenharmony_ci#define B53_ARL_SRCH_ADDR_25		0x22
34162306a36Sopenharmony_ci#define B53_ARL_SRCH_ADDR_65		0x24
34262306a36Sopenharmony_ci#define  ARL_ADDR_MASK			GENMASK(14, 0)
34362306a36Sopenharmony_ci
34462306a36Sopenharmony_ci/* ARL Search MAC/VID Result (64 bit) */
34562306a36Sopenharmony_ci#define B53_ARL_SRCH_RSTL_0_MACVID	0x60
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_ci/* Single register search result on 5325 */
34862306a36Sopenharmony_ci#define B53_ARL_SRCH_RSTL_0_MACVID_25	0x24
34962306a36Sopenharmony_ci/* Single register search result on 5365 */
35062306a36Sopenharmony_ci#define B53_ARL_SRCH_RSTL_0_MACVID_65	0x30
35162306a36Sopenharmony_ci
35262306a36Sopenharmony_ci/* ARL Search Data Result (32 bit) */
35362306a36Sopenharmony_ci#define B53_ARL_SRCH_RSTL_0		0x68
35462306a36Sopenharmony_ci
35562306a36Sopenharmony_ci#define B53_ARL_SRCH_RSTL_MACVID(x)	(B53_ARL_SRCH_RSTL_0_MACVID + ((x) * 0x10))
35662306a36Sopenharmony_ci#define B53_ARL_SRCH_RSTL(x)		(B53_ARL_SRCH_RSTL_0 + ((x) * 0x10))
35762306a36Sopenharmony_ci
35862306a36Sopenharmony_ci/*************************************************************************
35962306a36Sopenharmony_ci * Port VLAN Registers
36062306a36Sopenharmony_ci *************************************************************************/
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_ci/* Port VLAN mask (16 bit) IMP port is always 8, also on 5325 & co */
36362306a36Sopenharmony_ci#define B53_PVLAN_PORT_MASK(i)		((i) * 2)
36462306a36Sopenharmony_ci
36562306a36Sopenharmony_ci/* Join all VLANs register (16 bit) */
36662306a36Sopenharmony_ci#define B53_JOIN_ALL_VLAN_EN		0x50
36762306a36Sopenharmony_ci
36862306a36Sopenharmony_ci/*************************************************************************
36962306a36Sopenharmony_ci * 802.1Q Page Registers
37062306a36Sopenharmony_ci *************************************************************************/
37162306a36Sopenharmony_ci
37262306a36Sopenharmony_ci/* Global QoS Control (8 bit) */
37362306a36Sopenharmony_ci#define B53_QOS_GLOBAL_CTL		0x00
37462306a36Sopenharmony_ci
37562306a36Sopenharmony_ci/* Enable 802.1Q for individual Ports (16 bit) */
37662306a36Sopenharmony_ci#define B53_802_1P_EN			0x04
37762306a36Sopenharmony_ci
37862306a36Sopenharmony_ci/*************************************************************************
37962306a36Sopenharmony_ci * VLAN Page Registers
38062306a36Sopenharmony_ci *************************************************************************/
38162306a36Sopenharmony_ci
38262306a36Sopenharmony_ci/* VLAN Control 0 (8 bit) */
38362306a36Sopenharmony_ci#define B53_VLAN_CTRL0			0x00
38462306a36Sopenharmony_ci#define   VC0_8021PF_CTRL_MASK		0x3
38562306a36Sopenharmony_ci#define   VC0_8021PF_CTRL_NONE		0x0
38662306a36Sopenharmony_ci#define   VC0_8021PF_CTRL_CHANGE_PRI	0x1
38762306a36Sopenharmony_ci#define   VC0_8021PF_CTRL_CHANGE_VID	0x2
38862306a36Sopenharmony_ci#define   VC0_8021PF_CTRL_CHANGE_BOTH	0x3
38962306a36Sopenharmony_ci#define   VC0_8021QF_CTRL_MASK		0xc
39062306a36Sopenharmony_ci#define   VC0_8021QF_CTRL_CHANGE_PRI	0x1
39162306a36Sopenharmony_ci#define   VC0_8021QF_CTRL_CHANGE_VID	0x2
39262306a36Sopenharmony_ci#define   VC0_8021QF_CTRL_CHANGE_BOTH	0x3
39362306a36Sopenharmony_ci#define   VC0_RESERVED_1		BIT(1)
39462306a36Sopenharmony_ci#define   VC0_DROP_VID_MISS		BIT(4)
39562306a36Sopenharmony_ci#define   VC0_VID_HASH_VID		BIT(5)
39662306a36Sopenharmony_ci#define   VC0_VID_CHK_EN		BIT(6)	/* Use VID,DA or VID,SA */
39762306a36Sopenharmony_ci#define   VC0_VLAN_EN			BIT(7)	/* 802.1Q VLAN Enabled */
39862306a36Sopenharmony_ci
39962306a36Sopenharmony_ci/* VLAN Control 1 (8 bit) */
40062306a36Sopenharmony_ci#define B53_VLAN_CTRL1			0x01
40162306a36Sopenharmony_ci#define   VC1_RX_MCST_TAG_EN		BIT(1)
40262306a36Sopenharmony_ci#define   VC1_RX_MCST_FWD_EN		BIT(2)
40362306a36Sopenharmony_ci#define   VC1_RX_MCST_UNTAG_EN		BIT(3)
40462306a36Sopenharmony_ci
40562306a36Sopenharmony_ci/* VLAN Control 2 (8 bit) */
40662306a36Sopenharmony_ci#define B53_VLAN_CTRL2			0x02
40762306a36Sopenharmony_ci
40862306a36Sopenharmony_ci/* VLAN Control 3 (8 bit when BCM5325, 16 bit else) */
40962306a36Sopenharmony_ci#define B53_VLAN_CTRL3			0x03
41062306a36Sopenharmony_ci#define B53_VLAN_CTRL3_63XX		0x04
41162306a36Sopenharmony_ci#define   VC3_MAXSIZE_1532		BIT(6) /* 5325 only */
41262306a36Sopenharmony_ci#define   VC3_HIGH_8BIT_EN		BIT(7) /* 5325 only */
41362306a36Sopenharmony_ci
41462306a36Sopenharmony_ci/* VLAN Control 4 (8 bit) */
41562306a36Sopenharmony_ci#define B53_VLAN_CTRL4			0x05
41662306a36Sopenharmony_ci#define B53_VLAN_CTRL4_25		0x04
41762306a36Sopenharmony_ci#define B53_VLAN_CTRL4_63XX		0x06
41862306a36Sopenharmony_ci#define   VC4_ING_VID_CHECK_S		6
41962306a36Sopenharmony_ci#define   VC4_ING_VID_CHECK_MASK	(0x3 << VC4_ING_VID_CHECK_S)
42062306a36Sopenharmony_ci#define   VC4_ING_VID_VIO_FWD		0 /* forward, but do not learn */
42162306a36Sopenharmony_ci#define   VC4_ING_VID_VIO_DROP		1 /* drop VID violations */
42262306a36Sopenharmony_ci#define   VC4_NO_ING_VID_CHK		2 /* do not check */
42362306a36Sopenharmony_ci#define   VC4_ING_VID_VIO_TO_IMP	3 /* redirect to MII port */
42462306a36Sopenharmony_ci
42562306a36Sopenharmony_ci/* VLAN Control 5 (8 bit) */
42662306a36Sopenharmony_ci#define B53_VLAN_CTRL5			0x06
42762306a36Sopenharmony_ci#define B53_VLAN_CTRL5_25		0x05
42862306a36Sopenharmony_ci#define B53_VLAN_CTRL5_63XX		0x07
42962306a36Sopenharmony_ci#define   VC5_VID_FFF_EN		BIT(2)
43062306a36Sopenharmony_ci#define   VC5_DROP_VTABLE_MISS		BIT(3)
43162306a36Sopenharmony_ci
43262306a36Sopenharmony_ci/* VLAN Control 6 (8 bit) */
43362306a36Sopenharmony_ci#define B53_VLAN_CTRL6			0x07
43462306a36Sopenharmony_ci#define B53_VLAN_CTRL6_63XX		0x08
43562306a36Sopenharmony_ci
43662306a36Sopenharmony_ci/* VLAN Table Access Register (16 bit) */
43762306a36Sopenharmony_ci#define B53_VLAN_TABLE_ACCESS_25	0x06	/* BCM5325E/5350 */
43862306a36Sopenharmony_ci#define B53_VLAN_TABLE_ACCESS_65	0x08	/* BCM5365 */
43962306a36Sopenharmony_ci#define   VTA_VID_LOW_MASK_25		0xf
44062306a36Sopenharmony_ci#define   VTA_VID_LOW_MASK_65		0xff
44162306a36Sopenharmony_ci#define   VTA_VID_HIGH_S_25		4
44262306a36Sopenharmony_ci#define   VTA_VID_HIGH_S_65		8
44362306a36Sopenharmony_ci#define   VTA_VID_HIGH_MASK_25		(0xff << VTA_VID_HIGH_S_25E)
44462306a36Sopenharmony_ci#define   VTA_VID_HIGH_MASK_65		(0xf << VTA_VID_HIGH_S_65)
44562306a36Sopenharmony_ci#define   VTA_RW_STATE			BIT(12)
44662306a36Sopenharmony_ci#define   VTA_RW_STATE_RD		0
44762306a36Sopenharmony_ci#define   VTA_RW_STATE_WR		BIT(12)
44862306a36Sopenharmony_ci#define   VTA_RW_OP_EN			BIT(13)
44962306a36Sopenharmony_ci
45062306a36Sopenharmony_ci/* VLAN Read/Write Registers for (16/32 bit) */
45162306a36Sopenharmony_ci#define B53_VLAN_WRITE_25		0x08
45262306a36Sopenharmony_ci#define B53_VLAN_WRITE_65		0x0a
45362306a36Sopenharmony_ci#define B53_VLAN_READ			0x0c
45462306a36Sopenharmony_ci#define   VA_MEMBER_MASK		0x3f
45562306a36Sopenharmony_ci#define   VA_UNTAG_S_25			6
45662306a36Sopenharmony_ci#define   VA_UNTAG_MASK_25		0x3f
45762306a36Sopenharmony_ci#define   VA_UNTAG_S_65			7
45862306a36Sopenharmony_ci#define   VA_UNTAG_MASK_65		0x1f
45962306a36Sopenharmony_ci#define   VA_VID_HIGH_S			12
46062306a36Sopenharmony_ci#define   VA_VID_HIGH_MASK		(0xffff << VA_VID_HIGH_S)
46162306a36Sopenharmony_ci#define   VA_VALID_25			BIT(20)
46262306a36Sopenharmony_ci#define   VA_VALID_25_R4		BIT(24)
46362306a36Sopenharmony_ci#define   VA_VALID_65			BIT(14)
46462306a36Sopenharmony_ci
46562306a36Sopenharmony_ci/* VLAN Port Default Tag (16 bit) */
46662306a36Sopenharmony_ci#define B53_VLAN_PORT_DEF_TAG(i)	(0x10 + 2 * (i))
46762306a36Sopenharmony_ci
46862306a36Sopenharmony_ci/*************************************************************************
46962306a36Sopenharmony_ci * Jumbo Frame Page Registers
47062306a36Sopenharmony_ci *************************************************************************/
47162306a36Sopenharmony_ci
47262306a36Sopenharmony_ci/* Jumbo Enable Port Mask (bit i == port i enabled) (32 bit) */
47362306a36Sopenharmony_ci#define B53_JUMBO_PORT_MASK		0x01
47462306a36Sopenharmony_ci#define B53_JUMBO_PORT_MASK_63XX	0x04
47562306a36Sopenharmony_ci#define   JPM_10_100_JUMBO_EN		BIT(24) /* GigE always enabled */
47662306a36Sopenharmony_ci
47762306a36Sopenharmony_ci/* Good Frame Max Size without 802.1Q TAG (16 bit) */
47862306a36Sopenharmony_ci#define B53_JUMBO_MAX_SIZE		0x05
47962306a36Sopenharmony_ci#define B53_JUMBO_MAX_SIZE_63XX		0x08
48062306a36Sopenharmony_ci#define   JMS_MIN_SIZE			1518
48162306a36Sopenharmony_ci#define   JMS_MAX_SIZE			9724
48262306a36Sopenharmony_ci
48362306a36Sopenharmony_ci/*************************************************************************
48462306a36Sopenharmony_ci * EEE Configuration Page Registers
48562306a36Sopenharmony_ci *************************************************************************/
48662306a36Sopenharmony_ci
48762306a36Sopenharmony_ci/* EEE Enable control register (16 bit) */
48862306a36Sopenharmony_ci#define B53_EEE_EN_CTRL			0x00
48962306a36Sopenharmony_ci
49062306a36Sopenharmony_ci/* EEE LPI assert status register (16 bit) */
49162306a36Sopenharmony_ci#define B53_EEE_LPI_ASSERT_STS		0x02
49262306a36Sopenharmony_ci
49362306a36Sopenharmony_ci/* EEE LPI indicate status register (16 bit) */
49462306a36Sopenharmony_ci#define B53_EEE_LPI_INDICATE		0x4
49562306a36Sopenharmony_ci
49662306a36Sopenharmony_ci/* EEE Receiving idle symbols status register (16 bit) */
49762306a36Sopenharmony_ci#define B53_EEE_RX_IDLE_SYM_STS		0x6
49862306a36Sopenharmony_ci
49962306a36Sopenharmony_ci/* EEE Pipeline timer register (32 bit) */
50062306a36Sopenharmony_ci#define B53_EEE_PIP_TIMER		0xC
50162306a36Sopenharmony_ci
50262306a36Sopenharmony_ci/* EEE Sleep timer Gig register (32 bit) */
50362306a36Sopenharmony_ci#define B53_EEE_SLEEP_TIMER_GIG(i)	(0x10 + 4 * (i))
50462306a36Sopenharmony_ci
50562306a36Sopenharmony_ci/* EEE Sleep timer FE register (32 bit) */
50662306a36Sopenharmony_ci#define B53_EEE_SLEEP_TIMER_FE(i)	(0x34 + 4 * (i))
50762306a36Sopenharmony_ci
50862306a36Sopenharmony_ci/* EEE Minimum LP timer Gig register (32 bit) */
50962306a36Sopenharmony_ci#define B53_EEE_MIN_LP_TIMER_GIG(i)	(0x58 + 4 * (i))
51062306a36Sopenharmony_ci
51162306a36Sopenharmony_ci/* EEE Minimum LP timer FE register (32 bit) */
51262306a36Sopenharmony_ci#define B53_EEE_MIN_LP_TIMER_FE(i)	(0x7c + 4 * (i))
51362306a36Sopenharmony_ci
51462306a36Sopenharmony_ci/* EEE Wake timer Gig register (16 bit) */
51562306a36Sopenharmony_ci#define B53_EEE_WAKE_TIMER_GIG(i)	(0xa0 + 2 * (i))
51662306a36Sopenharmony_ci
51762306a36Sopenharmony_ci/* EEE Wake timer FE register (16 bit) */
51862306a36Sopenharmony_ci#define B53_EEE_WAKE_TIMER_FE(i)	(0xb2 + 2 * (i))
51962306a36Sopenharmony_ci
52062306a36Sopenharmony_ci
52162306a36Sopenharmony_ci/*************************************************************************
52262306a36Sopenharmony_ci * CFP Configuration Page Registers
52362306a36Sopenharmony_ci *************************************************************************/
52462306a36Sopenharmony_ci
52562306a36Sopenharmony_ci/* CFP Control Register with ports map (8 bit) */
52662306a36Sopenharmony_ci#define B53_CFP_CTRL			0x00
52762306a36Sopenharmony_ci
52862306a36Sopenharmony_ci#endif /* !__B53_REGS_H */
529