1246d7f77SFlorian Fainelli /* 2246d7f77SFlorian Fainelli * Broadcom Starfighter 2 switch register defines 3246d7f77SFlorian Fainelli * 4246d7f77SFlorian Fainelli * Copyright (C) 2014, Broadcom Corporation 5246d7f77SFlorian Fainelli * 6246d7f77SFlorian Fainelli * This program is free software; you can redistribute it and/or modify 7246d7f77SFlorian Fainelli * it under the terms of the GNU General Public License as published by 8246d7f77SFlorian Fainelli * the Free Software Foundation; either version 2 of the License, or 9246d7f77SFlorian Fainelli * (at your option) any later version. 10246d7f77SFlorian Fainelli */ 11246d7f77SFlorian Fainelli #ifndef __BCM_SF2_REGS_H 12246d7f77SFlorian Fainelli #define __BCM_SF2_REGS_H 13246d7f77SFlorian Fainelli 14246d7f77SFlorian Fainelli /* Register set relative to 'REG' */ 15a78e86edSFlorian Fainelli 16a78e86edSFlorian Fainelli enum bcm_sf2_reg_offs { 17a78e86edSFlorian Fainelli REG_SWITCH_CNTRL = 0, 18a78e86edSFlorian Fainelli REG_SWITCH_STATUS, 19a78e86edSFlorian Fainelli REG_DIR_DATA_WRITE, 20a78e86edSFlorian Fainelli REG_DIR_DATA_READ, 21a78e86edSFlorian Fainelli REG_SWITCH_REVISION, 22a78e86edSFlorian Fainelli REG_PHY_REVISION, 23a78e86edSFlorian Fainelli REG_SPHY_CNTRL, 24a78e86edSFlorian Fainelli REG_RGMII_0_CNTRL, 25a78e86edSFlorian Fainelli REG_RGMII_1_CNTRL, 26a78e86edSFlorian Fainelli REG_RGMII_2_CNTRL, 27a78e86edSFlorian Fainelli REG_LED_0_CNTRL, 28a78e86edSFlorian Fainelli REG_LED_1_CNTRL, 29a78e86edSFlorian Fainelli REG_LED_2_CNTRL, 30a78e86edSFlorian Fainelli REG_SWITCH_REG_MAX, 31a78e86edSFlorian Fainelli }; 32a78e86edSFlorian Fainelli 33a78e86edSFlorian Fainelli /* Relative to REG_SWITCH_CNTRL */ 34246d7f77SFlorian Fainelli #define MDIO_MASTER_SEL (1 << 0) 35246d7f77SFlorian Fainelli 36a78e86edSFlorian Fainelli /* Relative to REG_SWITCH_REVISION */ 37246d7f77SFlorian Fainelli #define SF2_REV_MASK 0xffff 38246d7f77SFlorian Fainelli #define SWITCH_TOP_REV_SHIFT 16 39246d7f77SFlorian Fainelli #define SWITCH_TOP_REV_MASK 0xffff 40246d7f77SFlorian Fainelli 41a78e86edSFlorian Fainelli /* Relative to REG_PHY_REVISION */ 42aa9aef77SFlorian Fainelli #define PHY_REVISION_MASK 0xffff 43246d7f77SFlorian Fainelli 44a78e86edSFlorian Fainelli /* Relative to REG_SPHY_CNTRL */ 45246d7f77SFlorian Fainelli #define IDDQ_BIAS (1 << 0) 46246d7f77SFlorian Fainelli #define EXT_PWR_DOWN (1 << 1) 47246d7f77SFlorian Fainelli #define FORCE_DLL_EN (1 << 2) 48246d7f77SFlorian Fainelli #define IDDQ_GLOBAL_PWR (1 << 3) 49246d7f77SFlorian Fainelli #define CK25_DIS (1 << 4) 50246d7f77SFlorian Fainelli #define PHY_RESET (1 << 5) 51246d7f77SFlorian Fainelli #define PHY_PHYAD_SHIFT 8 52246d7f77SFlorian Fainelli #define PHY_PHYAD_MASK 0x1F 53246d7f77SFlorian Fainelli 54a78e86edSFlorian Fainelli #define REG_RGMII_CNTRL_P(x) (REG_RGMII_0_CNTRL + (x)) 55a78e86edSFlorian Fainelli 56246d7f77SFlorian Fainelli /* Relative to REG_RGMII_CNTRL */ 57246d7f77SFlorian Fainelli #define RGMII_MODE_EN (1 << 0) 58246d7f77SFlorian Fainelli #define ID_MODE_DIS (1 << 1) 59246d7f77SFlorian Fainelli #define PORT_MODE_SHIFT 2 60246d7f77SFlorian Fainelli #define INT_EPHY (0 << PORT_MODE_SHIFT) 61246d7f77SFlorian Fainelli #define INT_GPHY (1 << PORT_MODE_SHIFT) 62246d7f77SFlorian Fainelli #define EXT_EPHY (2 << PORT_MODE_SHIFT) 63246d7f77SFlorian Fainelli #define EXT_GPHY (3 << PORT_MODE_SHIFT) 64246d7f77SFlorian Fainelli #define EXT_REVMII (4 << PORT_MODE_SHIFT) 65246d7f77SFlorian Fainelli #define PORT_MODE_MASK 0x7 66246d7f77SFlorian Fainelli #define RVMII_REF_SEL (1 << 5) 67246d7f77SFlorian Fainelli #define RX_PAUSE_EN (1 << 6) 68246d7f77SFlorian Fainelli #define TX_PAUSE_EN (1 << 7) 69246d7f77SFlorian Fainelli #define TX_CLK_STOP_EN (1 << 8) 70246d7f77SFlorian Fainelli #define LPI_COUNT_SHIFT 9 71246d7f77SFlorian Fainelli #define LPI_COUNT_MASK 0x3F 72246d7f77SFlorian Fainelli 73a78e86edSFlorian Fainelli #define REG_LED_CNTRL(x) (REG_LED_0_CNTRL + (x)) 74a78e86edSFlorian Fainelli 759af197a8SFlorian Fainelli #define SPDLNK_SRC_SEL (1 << 24) 769af197a8SFlorian Fainelli 77246d7f77SFlorian Fainelli /* Register set relative to 'INTRL2_0' and 'INTRL2_1' */ 78246d7f77SFlorian Fainelli #define INTRL2_CPU_STATUS 0x00 79246d7f77SFlorian Fainelli #define INTRL2_CPU_SET 0x04 80246d7f77SFlorian Fainelli #define INTRL2_CPU_CLEAR 0x08 81246d7f77SFlorian Fainelli #define INTRL2_CPU_MASK_STATUS 0x0c 82246d7f77SFlorian Fainelli #define INTRL2_CPU_MASK_SET 0x10 83246d7f77SFlorian Fainelli #define INTRL2_CPU_MASK_CLEAR 0x14 84246d7f77SFlorian Fainelli 85246d7f77SFlorian Fainelli /* Shared INTRL2_0 and INTRL2_ interrupt sources macros */ 86246d7f77SFlorian Fainelli #define P_LINK_UP_IRQ(x) (1 << (0 + (x))) 87246d7f77SFlorian Fainelli #define P_LINK_DOWN_IRQ(x) (1 << (1 + (x))) 88246d7f77SFlorian Fainelli #define P_ENERGY_ON_IRQ(x) (1 << (2 + (x))) 89246d7f77SFlorian Fainelli #define P_ENERGY_OFF_IRQ(x) (1 << (3 + (x))) 90246d7f77SFlorian Fainelli #define P_GPHY_IRQ(x) (1 << (4 + (x))) 91246d7f77SFlorian Fainelli #define P_NUM_IRQ 5 92246d7f77SFlorian Fainelli #define P_IRQ_MASK(x) (P_LINK_UP_IRQ((x)) | \ 93246d7f77SFlorian Fainelli P_LINK_DOWN_IRQ((x)) | \ 94246d7f77SFlorian Fainelli P_ENERGY_ON_IRQ((x)) | \ 95246d7f77SFlorian Fainelli P_ENERGY_OFF_IRQ((x)) | \ 96246d7f77SFlorian Fainelli P_GPHY_IRQ((x))) 97246d7f77SFlorian Fainelli 98246d7f77SFlorian Fainelli /* INTRL2_0 interrupt sources */ 99246d7f77SFlorian Fainelli #define P0_IRQ_OFF 0 100246d7f77SFlorian Fainelli #define MEM_DOUBLE_IRQ (1 << 5) 101246d7f77SFlorian Fainelli #define EEE_LPI_IRQ (1 << 6) 102246d7f77SFlorian Fainelli #define P5_CPU_WAKE_IRQ (1 << 7) 103246d7f77SFlorian Fainelli #define P8_CPU_WAKE_IRQ (1 << 8) 104246d7f77SFlorian Fainelli #define P7_CPU_WAKE_IRQ (1 << 9) 105246d7f77SFlorian Fainelli #define IEEE1588_IRQ (1 << 10) 106246d7f77SFlorian Fainelli #define MDIO_ERR_IRQ (1 << 11) 107246d7f77SFlorian Fainelli #define MDIO_DONE_IRQ (1 << 12) 108246d7f77SFlorian Fainelli #define GISB_ERR_IRQ (1 << 13) 109246d7f77SFlorian Fainelli #define UBUS_ERR_IRQ (1 << 14) 110246d7f77SFlorian Fainelli #define FAILOVER_ON_IRQ (1 << 15) 111246d7f77SFlorian Fainelli #define FAILOVER_OFF_IRQ (1 << 16) 112246d7f77SFlorian Fainelli #define TCAM_SOFT_ERR_IRQ (1 << 17) 113246d7f77SFlorian Fainelli 114246d7f77SFlorian Fainelli /* INTRL2_1 interrupt sources */ 115246d7f77SFlorian Fainelli #define P7_IRQ_OFF 0 116246d7f77SFlorian Fainelli #define P_IRQ_OFF(x) ((6 - (x)) * P_NUM_IRQ) 117246d7f77SFlorian Fainelli 11832e47ff0SFlorian Fainelli /* Register set relative to 'ACB' */ 11932e47ff0SFlorian Fainelli #define ACB_CONTROL 0x00 12032e47ff0SFlorian Fainelli #define ACB_EN (1 << 0) 12132e47ff0SFlorian Fainelli #define ACB_ALGORITHM (1 << 1) 12232e47ff0SFlorian Fainelli #define ACB_FLUSH_SHIFT 2 12332e47ff0SFlorian Fainelli #define ACB_FLUSH_MASK 0x3 12432e47ff0SFlorian Fainelli 12532e47ff0SFlorian Fainelli #define ACB_QUEUE_0_CFG 0x08 12632e47ff0SFlorian Fainelli #define XOFF_THRESHOLD_MASK 0x7ff 12732e47ff0SFlorian Fainelli #define XON_EN (1 << 11) 12832e47ff0SFlorian Fainelli #define TOTAL_XOFF_THRESHOLD_SHIFT 12 12932e47ff0SFlorian Fainelli #define TOTAL_XOFF_THRESHOLD_MASK 0x7ff 13032e47ff0SFlorian Fainelli #define TOTAL_XOFF_EN (1 << 23) 13132e47ff0SFlorian Fainelli #define TOTAL_XON_EN (1 << 24) 13232e47ff0SFlorian Fainelli #define PKTLEN_SHIFT 25 13332e47ff0SFlorian Fainelli #define PKTLEN_MASK 0x3f 13432e47ff0SFlorian Fainelli #define ACB_QUEUE_CFG(x) (ACB_QUEUE_0_CFG + ((x) * 0x4)) 13532e47ff0SFlorian Fainelli 136246d7f77SFlorian Fainelli /* Register set relative to 'CORE' */ 137246d7f77SFlorian Fainelli #define CORE_G_PCTL_PORT0 0x00000 138246d7f77SFlorian Fainelli #define CORE_G_PCTL_PORT(x) (CORE_G_PCTL_PORT0 + (x * 0x4)) 139246d7f77SFlorian Fainelli #define CORE_IMP_CTL 0x00020 140246d7f77SFlorian Fainelli #define RX_DIS (1 << 0) 141246d7f77SFlorian Fainelli #define TX_DIS (1 << 1) 142246d7f77SFlorian Fainelli #define RX_BCST_EN (1 << 2) 143246d7f77SFlorian Fainelli #define RX_MCST_EN (1 << 3) 144246d7f77SFlorian Fainelli #define RX_UCST_EN (1 << 4) 145246d7f77SFlorian Fainelli 146246d7f77SFlorian Fainelli #define CORE_SWMODE 0x0002c 147246d7f77SFlorian Fainelli #define SW_FWDG_MODE (1 << 0) 148246d7f77SFlorian Fainelli #define SW_FWDG_EN (1 << 1) 149246d7f77SFlorian Fainelli #define RTRY_LMT_DIS (1 << 2) 150246d7f77SFlorian Fainelli 151246d7f77SFlorian Fainelli #define CORE_STS_OVERRIDE_IMP 0x00038 152246d7f77SFlorian Fainelli #define GMII_SPEED_UP_2G (1 << 6) 153246d7f77SFlorian Fainelli #define MII_SW_OR (1 << 7) 154246d7f77SFlorian Fainelli 1550fe99338SFlorian Fainelli /* Alternate layout for e.g: 7278 */ 1560fe99338SFlorian Fainelli #define CORE_STS_OVERRIDE_IMP2 0x39040 1570fe99338SFlorian Fainelli 158246d7f77SFlorian Fainelli #define CORE_NEW_CTRL 0x00084 159246d7f77SFlorian Fainelli #define IP_MC (1 << 0) 160246d7f77SFlorian Fainelli #define OUTRANGEERR_DISCARD (1 << 1) 161246d7f77SFlorian Fainelli #define INRANGEERR_DISCARD (1 << 2) 162246d7f77SFlorian Fainelli #define CABLE_DIAG_LEN (1 << 3) 163246d7f77SFlorian Fainelli #define OVERRIDE_AUTO_PD_WAR (1 << 4) 164246d7f77SFlorian Fainelli #define EN_AUTO_PD_WAR (1 << 5) 165246d7f77SFlorian Fainelli #define UC_FWD_EN (1 << 6) 166246d7f77SFlorian Fainelli #define MC_FWD_EN (1 << 7) 167246d7f77SFlorian Fainelli 168246d7f77SFlorian Fainelli #define CORE_SWITCH_CTRL 0x00088 169246d7f77SFlorian Fainelli #define MII_DUMB_FWDG_EN (1 << 6) 170246d7f77SFlorian Fainelli 171246d7f77SFlorian Fainelli #define CORE_SFT_LRN_CTRL 0x000f8 172246d7f77SFlorian Fainelli #define SW_LEARN_CNTL(x) (1 << (x)) 173246d7f77SFlorian Fainelli 174246d7f77SFlorian Fainelli #define CORE_STS_OVERRIDE_GMIIP_PORT(x) (0x160 + (x) * 4) 1750fe99338SFlorian Fainelli #define CORE_STS_OVERRIDE_GMIIP2_PORT(x) (0x39000 + (x) * 8) 176246d7f77SFlorian Fainelli #define LINK_STS (1 << 0) 177246d7f77SFlorian Fainelli #define DUPLX_MODE (1 << 1) 178246d7f77SFlorian Fainelli #define SPEED_SHIFT 2 179246d7f77SFlorian Fainelli #define SPEED_MASK 0x3 180246d7f77SFlorian Fainelli #define RXFLOW_CNTL (1 << 4) 181246d7f77SFlorian Fainelli #define TXFLOW_CNTL (1 << 5) 182246d7f77SFlorian Fainelli #define SW_OVERRIDE (1 << 6) 183246d7f77SFlorian Fainelli 184246d7f77SFlorian Fainelli #define CORE_WATCHDOG_CTRL 0x001e4 185246d7f77SFlorian Fainelli #define SOFTWARE_RESET (1 << 7) 186246d7f77SFlorian Fainelli #define EN_CHIP_RST (1 << 6) 187246d7f77SFlorian Fainelli #define EN_SW_RESET (1 << 4) 188246d7f77SFlorian Fainelli 18912f460f2SFlorian Fainelli #define CORE_FAST_AGE_CTRL 0x00220 19012f460f2SFlorian Fainelli #define EN_FAST_AGE_STATIC (1 << 0) 19112f460f2SFlorian Fainelli #define EN_AGE_DYNAMIC (1 << 1) 19212f460f2SFlorian Fainelli #define EN_AGE_PORT (1 << 2) 19312f460f2SFlorian Fainelli #define EN_AGE_VLAN (1 << 3) 19412f460f2SFlorian Fainelli #define EN_AGE_SPT (1 << 4) 19512f460f2SFlorian Fainelli #define EN_AGE_MCAST (1 << 5) 19612f460f2SFlorian Fainelli #define FAST_AGE_STR_DONE (1 << 7) 19712f460f2SFlorian Fainelli 19812f460f2SFlorian Fainelli #define CORE_FAST_AGE_PORT 0x00224 19912f460f2SFlorian Fainelli #define AGE_PORT_MASK 0xf 20012f460f2SFlorian Fainelli 20112f460f2SFlorian Fainelli #define CORE_FAST_AGE_VID 0x00228 20212f460f2SFlorian Fainelli #define AGE_VID_MASK 0x3fff 20312f460f2SFlorian Fainelli 204246d7f77SFlorian Fainelli #define CORE_LNKSTS 0x00400 205246d7f77SFlorian Fainelli #define LNK_STS_MASK 0x1ff 206246d7f77SFlorian Fainelli 207246d7f77SFlorian Fainelli #define CORE_SPDSTS 0x00410 208246d7f77SFlorian Fainelli #define SPDSTS_10 0 209246d7f77SFlorian Fainelli #define SPDSTS_100 1 210246d7f77SFlorian Fainelli #define SPDSTS_1000 2 211246d7f77SFlorian Fainelli #define SPDSTS_SHIFT 2 212246d7f77SFlorian Fainelli #define SPDSTS_MASK 0x3 213246d7f77SFlorian Fainelli 214246d7f77SFlorian Fainelli #define CORE_DUPSTS 0x00420 215246d7f77SFlorian Fainelli #define CORE_DUPSTS_MASK 0x1ff 216246d7f77SFlorian Fainelli 217246d7f77SFlorian Fainelli #define CORE_PAUSESTS 0x00428 218246d7f77SFlorian Fainelli #define PAUSESTS_TX_PAUSE_SHIFT 9 219246d7f77SFlorian Fainelli 220246d7f77SFlorian Fainelli #define CORE_GMNCFGCFG 0x0800 221246d7f77SFlorian Fainelli #define RST_MIB_CNT (1 << 0) 222246d7f77SFlorian Fainelli #define RXBPDU_EN (1 << 1) 223246d7f77SFlorian Fainelli 224246d7f77SFlorian Fainelli #define CORE_IMP0_PRT_ID 0x0804 225246d7f77SFlorian Fainelli 226246d7f77SFlorian Fainelli #define CORE_RST_MIB_CNT_EN 0x0950 227246d7f77SFlorian Fainelli 228064523ffSFlorian Fainelli #define CORE_ARLA_VTBL_RWCTRL 0x1600 229064523ffSFlorian Fainelli #define ARLA_VTBL_CMD_WRITE 0 230064523ffSFlorian Fainelli #define ARLA_VTBL_CMD_READ 1 231064523ffSFlorian Fainelli #define ARLA_VTBL_CMD_CLEAR 2 232064523ffSFlorian Fainelli #define ARLA_VTBL_STDN (1 << 7) 233064523ffSFlorian Fainelli 234064523ffSFlorian Fainelli #define CORE_ARLA_VTBL_ADDR 0x1604 235064523ffSFlorian Fainelli #define VTBL_ADDR_INDEX_MASK 0xfff 236064523ffSFlorian Fainelli 237064523ffSFlorian Fainelli #define CORE_ARLA_VTBL_ENTRY 0x160c 238064523ffSFlorian Fainelli #define FWD_MAP_MASK 0x1ff 239064523ffSFlorian Fainelli #define UNTAG_MAP_MASK 0x1ff 240064523ffSFlorian Fainelli #define UNTAG_MAP_SHIFT 9 241064523ffSFlorian Fainelli #define MSTP_INDEX_MASK 0x7 242064523ffSFlorian Fainelli #define MSTP_INDEX_SHIFT 18 243064523ffSFlorian Fainelli #define FWD_MODE (1 << 21) 244064523ffSFlorian Fainelli 245246d7f77SFlorian Fainelli #define CORE_MEM_PSM_VDD_CTRL 0x2380 246246d7f77SFlorian Fainelli #define P_TXQ_PSM_VDD_SHIFT 2 247246d7f77SFlorian Fainelli #define P_TXQ_PSM_VDD_MASK 0x3 248246d7f77SFlorian Fainelli #define P_TXQ_PSM_VDD(x) (P_TXQ_PSM_VDD_MASK << \ 249246d7f77SFlorian Fainelli ((x) * P_TXQ_PSM_VDD_SHIFT)) 250246d7f77SFlorian Fainelli 251e1b9147cSFlorian Fainelli #define CORE_PORT_TC2_QOS_MAP_PORT(x) (0xc1c0 + ((x) * 0x10)) 252e1b9147cSFlorian Fainelli #define PRT_TO_QID_MASK 0x3 253e1b9147cSFlorian Fainelli #define PRT_TO_QID_SHIFT 3 254e1b9147cSFlorian Fainelli 255246d7f77SFlorian Fainelli #define CORE_PORT_VLAN_CTL_PORT(x) (0xc400 + ((x) * 0x8)) 256246d7f77SFlorian Fainelli #define PORT_VLAN_CTRL_MASK 0x1ff 257246d7f77SFlorian Fainelli 25832e47ff0SFlorian Fainelli #define CORE_TXQ_THD_PAUSE_QN_PORT_0 0x2c80 25932e47ff0SFlorian Fainelli #define TXQ_PAUSE_THD_MASK 0x7ff 26032e47ff0SFlorian Fainelli #define CORE_TXQ_THD_PAUSE_QN_PORT(x) (CORE_TXQ_THD_PAUSE_QN_PORT_0 + \ 26132e47ff0SFlorian Fainelli (x) * 0x8) 26232e47ff0SFlorian Fainelli 263064523ffSFlorian Fainelli #define CORE_DEFAULT_1Q_TAG_P(x) (0xd040 + ((x) * 8)) 264064523ffSFlorian Fainelli #define CFI_SHIFT 12 265064523ffSFlorian Fainelli #define PRI_SHIFT 13 266064523ffSFlorian Fainelli #define PRI_MASK 0x7 267064523ffSFlorian Fainelli 268064523ffSFlorian Fainelli #define CORE_JOIN_ALL_VLAN_EN 0xd140 269064523ffSFlorian Fainelli 27085345808SFlorian Fainelli #define CORE_CFP_ACC 0x28000 27185345808SFlorian Fainelli #define OP_STR_DONE (1 << 0) 27285345808SFlorian Fainelli #define OP_SEL_SHIFT 1 27385345808SFlorian Fainelli #define OP_SEL_READ (1 << OP_SEL_SHIFT) 27485345808SFlorian Fainelli #define OP_SEL_WRITE (2 << OP_SEL_SHIFT) 27585345808SFlorian Fainelli #define OP_SEL_SEARCH (4 << OP_SEL_SHIFT) 27685345808SFlorian Fainelli #define OP_SEL_MASK (7 << OP_SEL_SHIFT) 27785345808SFlorian Fainelli #define CFP_RAM_CLEAR (1 << 4) 27885345808SFlorian Fainelli #define RAM_SEL_SHIFT 10 27985345808SFlorian Fainelli #define TCAM_SEL (1 << RAM_SEL_SHIFT) 28085345808SFlorian Fainelli #define ACT_POL_RAM (2 << RAM_SEL_SHIFT) 28185345808SFlorian Fainelli #define RATE_METER_RAM (4 << RAM_SEL_SHIFT) 28285345808SFlorian Fainelli #define GREEN_STAT_RAM (8 << RAM_SEL_SHIFT) 28385345808SFlorian Fainelli #define YELLOW_STAT_RAM (16 << RAM_SEL_SHIFT) 28485345808SFlorian Fainelli #define RED_STAT_RAM (24 << RAM_SEL_SHIFT) 28585345808SFlorian Fainelli #define RAM_SEL_MASK (0x1f << RAM_SEL_SHIFT) 28685345808SFlorian Fainelli #define TCAM_RESET (1 << 15) 28785345808SFlorian Fainelli #define XCESS_ADDR_SHIFT 16 28885345808SFlorian Fainelli #define XCESS_ADDR_MASK 0xff 28985345808SFlorian Fainelli #define SEARCH_STS (1 << 27) 29085345808SFlorian Fainelli #define RD_STS_SHIFT 28 29185345808SFlorian Fainelli #define RD_STS_TCAM (1 << RD_STS_SHIFT) 29285345808SFlorian Fainelli #define RD_STS_ACT_POL_RAM (2 << RD_STS_SHIFT) 29385345808SFlorian Fainelli #define RD_STS_RATE_METER_RAM (4 << RD_STS_SHIFT) 29485345808SFlorian Fainelli #define RD_STS_STAT_RAM (8 << RD_STS_SHIFT) 29585345808SFlorian Fainelli 29685345808SFlorian Fainelli #define CORE_CFP_RATE_METER_GLOBAL_CTL 0x28010 29785345808SFlorian Fainelli 29885345808SFlorian Fainelli #define CORE_CFP_DATA_PORT_0 0x28040 29985345808SFlorian Fainelli #define CORE_CFP_DATA_PORT(x) (CORE_CFP_DATA_PORT_0 + \ 30085345808SFlorian Fainelli (x) * 0x10) 30185345808SFlorian Fainelli 30285345808SFlorian Fainelli /* UDF_DATA7 */ 30385345808SFlorian Fainelli #define L3_FRAMING_SHIFT 24 30485345808SFlorian Fainelli #define L3_FRAMING_MASK (0x3 << L3_FRAMING_SHIFT) 30539cdd349SFlorian Fainelli #define IPTOS_SHIFT 16 30639cdd349SFlorian Fainelli #define IPTOS_MASK 0xff 30785345808SFlorian Fainelli #define IPPROTO_SHIFT 8 30885345808SFlorian Fainelli #define IPPROTO_MASK (0xff << IPPROTO_SHIFT) 30939cdd349SFlorian Fainelli #define IP_FRAG_SHIFT 7 31039cdd349SFlorian Fainelli #define IP_FRAG (1 << IP_FRAG_SHIFT) 31185345808SFlorian Fainelli 31285345808SFlorian Fainelli /* UDF_DATA0 */ 31385345808SFlorian Fainelli #define SLICE_VALID 3 31485345808SFlorian Fainelli #define SLICE_NUM_SHIFT 2 31585345808SFlorian Fainelli #define SLICE_NUM(x) ((x) << SLICE_NUM_SHIFT) 31685345808SFlorian Fainelli 31785345808SFlorian Fainelli #define CORE_CFP_MASK_PORT_0 0x280c0 31885345808SFlorian Fainelli 31985345808SFlorian Fainelli #define CORE_CFP_MASK_PORT(x) (CORE_CFP_MASK_PORT_0 + \ 32085345808SFlorian Fainelli (x) * 0x10) 32185345808SFlorian Fainelli 32285345808SFlorian Fainelli #define CORE_ACT_POL_DATA0 0x28140 32385345808SFlorian Fainelli #define VLAN_BYP (1 << 0) 32485345808SFlorian Fainelli #define EAP_BYP (1 << 1) 32585345808SFlorian Fainelli #define STP_BYP (1 << 2) 32685345808SFlorian Fainelli #define REASON_CODE_SHIFT 3 32785345808SFlorian Fainelli #define REASON_CODE_MASK 0x3f 32885345808SFlorian Fainelli #define LOOP_BK_EN (1 << 9) 32985345808SFlorian Fainelli #define NEW_TC_SHIFT 10 33085345808SFlorian Fainelli #define NEW_TC_MASK 0x7 33185345808SFlorian Fainelli #define CHANGE_TC (1 << 13) 33285345808SFlorian Fainelli #define DST_MAP_IB_SHIFT 14 33385345808SFlorian Fainelli #define DST_MAP_IB_MASK 0x1ff 33485345808SFlorian Fainelli #define CHANGE_FWRD_MAP_IB_SHIFT 24 33585345808SFlorian Fainelli #define CHANGE_FWRD_MAP_IB_MASK 0x3 33685345808SFlorian Fainelli #define CHANGE_FWRD_MAP_IB_NO_DEST (0 << CHANGE_FWRD_MAP_IB_SHIFT) 33785345808SFlorian Fainelli #define CHANGE_FWRD_MAP_IB_REM_ARL (1 << CHANGE_FWRD_MAP_IB_SHIFT) 33885345808SFlorian Fainelli #define CHANGE_FWRD_MAP_IB_REP_ARL (2 << CHANGE_FWRD_MAP_IB_SHIFT) 33985345808SFlorian Fainelli #define CHANGE_FWRD_MAP_IB_ADD_DST (3 << CHANGE_FWRD_MAP_IB_SHIFT) 34085345808SFlorian Fainelli #define NEW_DSCP_IB_SHIFT 26 34185345808SFlorian Fainelli #define NEW_DSCP_IB_MASK 0x3f 34285345808SFlorian Fainelli 34385345808SFlorian Fainelli #define CORE_ACT_POL_DATA1 0x28150 34485345808SFlorian Fainelli #define CHANGE_DSCP_IB (1 << 0) 34585345808SFlorian Fainelli #define DST_MAP_OB_SHIFT 1 34685345808SFlorian Fainelli #define DST_MAP_OB_MASK 0x3ff 34785345808SFlorian Fainelli #define CHANGE_FWRD_MAP_OB_SHIT 11 34885345808SFlorian Fainelli #define CHANGE_FWRD_MAP_OB_MASK 0x3 34985345808SFlorian Fainelli #define NEW_DSCP_OB_SHIFT 13 35085345808SFlorian Fainelli #define NEW_DSCP_OB_MASK 0x3f 35185345808SFlorian Fainelli #define CHANGE_DSCP_OB (1 << 19) 35285345808SFlorian Fainelli #define CHAIN_ID_SHIFT 20 35385345808SFlorian Fainelli #define CHAIN_ID_MASK 0xff 35485345808SFlorian Fainelli #define CHANGE_COLOR (1 << 28) 35585345808SFlorian Fainelli #define NEW_COLOR_SHIFT 29 35685345808SFlorian Fainelli #define NEW_COLOR_MASK 0x3 35785345808SFlorian Fainelli #define NEW_COLOR_GREEN (0 << NEW_COLOR_SHIFT) 35885345808SFlorian Fainelli #define NEW_COLOR_YELLOW (1 << NEW_COLOR_SHIFT) 35985345808SFlorian Fainelli #define NEW_COLOR_RED (2 << NEW_COLOR_SHIFT) 36085345808SFlorian Fainelli #define RED_DEFAULT (1 << 31) 36185345808SFlorian Fainelli 36285345808SFlorian Fainelli #define CORE_ACT_POL_DATA2 0x28160 36385345808SFlorian Fainelli #define MAC_LIMIT_BYPASS (1 << 0) 36485345808SFlorian Fainelli #define CHANGE_TC_O (1 << 1) 36585345808SFlorian Fainelli #define NEW_TC_O_SHIFT 2 36685345808SFlorian Fainelli #define NEW_TC_O_MASK 0x7 36785345808SFlorian Fainelli #define SPCP_RMK_DISABLE (1 << 5) 36885345808SFlorian Fainelli #define CPCP_RMK_DISABLE (1 << 6) 36985345808SFlorian Fainelli #define DEI_RMK_DISABLE (1 << 7) 37085345808SFlorian Fainelli 37185345808SFlorian Fainelli #define CORE_RATE_METER0 0x28180 37285345808SFlorian Fainelli #define COLOR_MODE (1 << 0) 37385345808SFlorian Fainelli #define POLICER_ACTION (1 << 1) 37485345808SFlorian Fainelli #define COUPLING_FLAG (1 << 2) 37585345808SFlorian Fainelli #define POLICER_MODE_SHIFT 3 37685345808SFlorian Fainelli #define POLICER_MODE_MASK 0x3 37785345808SFlorian Fainelli #define POLICER_MODE_RFC2698 (0 << POLICER_MODE_SHIFT) 37885345808SFlorian Fainelli #define POLICER_MODE_RFC4115 (1 << POLICER_MODE_SHIFT) 37985345808SFlorian Fainelli #define POLICER_MODE_MEF (2 << POLICER_MODE_SHIFT) 38085345808SFlorian Fainelli #define POLICER_MODE_DISABLE (3 << POLICER_MODE_SHIFT) 38185345808SFlorian Fainelli 38285345808SFlorian Fainelli #define CORE_RATE_METER1 0x28190 38385345808SFlorian Fainelli #define EIR_TK_BKT_MASK 0x7fffff 38485345808SFlorian Fainelli 38585345808SFlorian Fainelli #define CORE_RATE_METER2 0x281a0 38685345808SFlorian Fainelli #define EIR_BKT_SIZE_MASK 0xfffff 38785345808SFlorian Fainelli 38885345808SFlorian Fainelli #define CORE_RATE_METER3 0x281b0 38985345808SFlorian Fainelli #define EIR_REF_CNT_MASK 0x7ffff 39085345808SFlorian Fainelli 39185345808SFlorian Fainelli #define CORE_RATE_METER4 0x281c0 39285345808SFlorian Fainelli #define CIR_TK_BKT_MASK 0x7fffff 39385345808SFlorian Fainelli 39485345808SFlorian Fainelli #define CORE_RATE_METER5 0x281d0 39585345808SFlorian Fainelli #define CIR_BKT_SIZE_MASK 0xfffff 39685345808SFlorian Fainelli 39785345808SFlorian Fainelli #define CORE_RATE_METER6 0x281e0 39885345808SFlorian Fainelli #define CIR_REF_CNT_MASK 0x7ffff 39985345808SFlorian Fainelli 40085345808SFlorian Fainelli #define CORE_CFP_CTL_REG 0x28400 40185345808SFlorian Fainelli #define CFP_EN_MAP_MASK 0x1ff 40285345808SFlorian Fainelli 40385345808SFlorian Fainelli /* IPv4 slices, 3 of them */ 40485345808SFlorian Fainelli #define CORE_UDF_0_A_0_8_PORT_0 0x28440 40585345808SFlorian Fainelli #define CFG_UDF_OFFSET_MASK 0x1f 40685345808SFlorian Fainelli #define CFG_UDF_OFFSET_BASE_SHIFT 5 40785345808SFlorian Fainelli #define CFG_UDF_SOF (0 << CFG_UDF_OFFSET_BASE_SHIFT) 40885345808SFlorian Fainelli #define CFG_UDF_EOL2 (2 << CFG_UDF_OFFSET_BASE_SHIFT) 40985345808SFlorian Fainelli #define CFG_UDF_EOL3 (3 << CFG_UDF_OFFSET_BASE_SHIFT) 41085345808SFlorian Fainelli 41185345808SFlorian Fainelli /* Number of slices for IPv4, IPv6 and non-IP */ 412*5d80bcbbSFlorian Fainelli #define UDF_NUM_SLICES 4 413*5d80bcbbSFlorian Fainelli #define UDFS_PER_SLICE 9 41485345808SFlorian Fainelli 41585345808SFlorian Fainelli /* Spacing between different slices */ 41685345808SFlorian Fainelli #define UDF_SLICE_OFFSET 0x40 41785345808SFlorian Fainelli 41885345808SFlorian Fainelli #define CFP_NUM_RULES 256 41985345808SFlorian Fainelli 42018118377SFlorian Fainelli /* Number of egress queues per port */ 42118118377SFlorian Fainelli #define SF2_NUM_EGRESS_QUEUES 8 42218118377SFlorian Fainelli 423246d7f77SFlorian Fainelli #endif /* __BCM_SF2_REGS_H */ 424