linux/drivers/net/dsa/microchip/lan937x_reg.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Microchip LAN937X switch register definitions
 * Copyright (C) 2019-2021 Microchip Technology Inc.
 */
#ifndef __LAN937X_REG_H
#define __LAN937X_REG_H

#define PORT_CTRL_ADDR(port, addr)

/* 0 - Operation */
#define REG_GLOBAL_CTRL_0

#define SW_PHY_REG_BLOCK
#define SW_FAST_MODE
#define SW_FAST_MODE_OVERRIDE

#define REG_SW_INT_STATUS__4
#define REG_SW_INT_MASK__4

#define LUE_INT
#define TRIG_TS_INT
#define APB_TIMEOUT_INT
#define OVER_TEMP_INT
#define HSR_INT
#define PIO_INT
#define POR_READY_INT

#define SWITCH_INT_MASK

#define REG_SW_PORT_INT_STATUS__4
#define REG_SW_PORT_INT_MASK__4

/* 1 - Global */
#define REG_SW_GLOBAL_OUTPUT_CTRL__1
#define SW_CLK125_ENB
#define SW_CLK25_ENB

/* 2 - PHY Control */
#define REG_SW_CFG_STRAP_OVR
#define SW_VPHY_DISABLE

/* 3 - Operation Control */
#define REG_SW_OPERATION

#define SW_DOUBLE_TAG
#define SW_OVER_TEMP_ENABLE
#define SW_RESET

#define REG_SW_LUE_CTRL_0

#define SW_VLAN_ENABLE
#define SW_DROP_INVALID_VID
#define SW_AGE_CNT_M
#define SW_AGE_CNT_S
#define SW_RESV_MCAST_ENABLE

#define REG_SW_LUE_CTRL_1

#define UNICAST_LEARN_DISABLE
#define SW_FLUSH_STP_TABLE
#define SW_FLUSH_MSTP_TABLE
#define SW_SRC_ADDR_FILTER
#define SW_AGING_ENABLE
#define SW_FAST_AGING
#define SW_LINK_AUTO_AGING

#define REG_SW_AGE_PERIOD__1
#define SW_AGE_PERIOD_7_0_M

#define REG_SW_AGE_PERIOD__2
#define SW_AGE_PERIOD_19_8_M

#define REG_SW_MAC_CTRL_0
#define SW_NEW_BACKOFF
#define SW_PAUSE_UNH_MODE
#define SW_AGGR_BACKOFF

#define REG_SW_MAC_CTRL_1
#define SW_SHORT_IFG
#define MULTICAST_STORM_DISABLE
#define SW_BACK_PRESSURE
#define FAIR_FLOW_CTRL
#define NO_EXC_COLLISION_DROP
#define SW_LEGAL_PACKET_DISABLE
#define SW_PASS_SHORT_FRAME

#define REG_SW_MAC_CTRL_6
#define SW_MIB_COUNTER_FLUSH
#define SW_MIB_COUNTER_FREEZE

/* 4 - LUE */
#define REG_SW_ALU_STAT_CTRL__4

#define REG_SW_ALU_VAL_B
#define ALU_V_OVERRIDE
#define ALU_V_USE_FID
#define ALU_V_PORT_MAP

/* 7 - VPhy */
#define REG_VPHY_IND_ADDR__2
#define REG_VPHY_IND_DATA__2

#define REG_VPHY_IND_CTRL__2

#define VPHY_IND_WRITE
#define VPHY_IND_BUSY

#define REG_VPHY_SPECIAL_CTRL__2
#define VPHY_SMI_INDIRECT_ENABLE
#define VPHY_SW_LOOPBACK
#define VPHY_MDIO_INTERNAL_ENABLE
#define VPHY_SPI_INDIRECT_ENABLE
#define VPHY_PORT_MODE_M
#define VPHY_PORT_MODE_S
#define VPHY_MODE_RGMII
#define VPHY_MODE_MII_PHY
#define VPHY_MODE_SGMII
#define VPHY_MODE_RMII_PHY
#define VPHY_SW_COLLISION_TEST
#define VPHY_SPEED_DUPLEX_STAT_M
#define VPHY_SPEED_DUPLEX_STAT_S
#define VPHY_SPEED_1000
#define VPHY_SPEED_100
#define VPHY_FULL_DUPLEX

/* Port Registers */

/* 0 - Operation */
#define REG_PORT_INT_STATUS
#define REG_PORT_INT_MASK

#define PORT_TAS_INT
#define PORT_QCI_INT
#define PORT_SGMII_INT
#define PORT_PTP_INT
#define PORT_PHY_INT
#define PORT_ACL_INT

#define PORT_SRC_PHY_INT

#define REG_PORT_CTRL_0

#define PORT_MAC_LOOPBACK
#define PORT_MAC_REMOTE_LOOPBACK
#define PORT_K2L_INSERT_ENABLE
#define PORT_K2L_DEBUG_ENABLE
#define PORT_TAIL_TAG_ENABLE
#define PORT_QUEUE_SPLIT_ENABLE

/* 1 - Phy */
#define REG_PORT_T1_PHY_CTRL_BASE
#define REG_PORT_TX_PHY_CTRL_BASE

/* 3 - xMII */
#define PORT_SGMII_SEL
#define PORT_GRXC_ENABLE

#define PORT_MII_SEL_EDGE

#define REG_PORT_XMII_CTRL_4
#define REG_PORT_XMII_CTRL_5

#define PORT_DLL_RESET
#define PORT_TUNE_ADJ

/* 4 - MAC */
#define REG_PORT_MAC_CTRL_0
#define PORT_CHECK_LENGTH
#define PORT_BROADCAST_STORM
#define PORT_JUMBO_PACKET

#define REG_PORT_MAC_CTRL_1
#define PORT_BACK_PRESSURE
#define PORT_PASS_ALL

#define PORT_MAX_FR_SIZE
#define FR_MIN_SIZE

/* 8 - Classification and Policing */
#define REG_PORT_MRI_PRIO_CTRL
#define PORT_HIGHEST_PRIO
#define PORT_OR_PRIO
#define PORT_MAC_PRIO_ENABLE
#define PORT_VLAN_PRIO_ENABLE
#define PORT_802_1P_PRIO_ENABLE
#define PORT_DIFFSERV_PRIO_ENABLE
#define PORT_ACL_PRIO_ENABLE

#define P_PRIO_CTRL

/* 9 - Shaping */
#define REG_PORT_MTI_CREDIT_INCREMENT

/* The port number as per the datasheet */
#define RGMII_2_PORT_NUM
#define RGMII_1_PORT_NUM

#define LAN937X_RGMII_2_PORT
#define LAN937X_RGMII_1_PORT

#define RGMII_1_TX_DELAY_2NS
#define RGMII_2_TX_DELAY_2NS
#define RGMII_1_RX_DELAY_2NS
#define RGMII_2_RX_DELAY_2NS

#define LAN937X_TAG_LEN

#endif