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