0001
0002
0003
0004
0005 #ifndef __LAN937X_REG_H
0006 #define __LAN937X_REG_H
0007
0008 #define PORT_CTRL_ADDR(port, addr) ((addr) | (((port) + 1) << 12))
0009
0010
0011 #define REG_GLOBAL_CTRL_0 0x0007
0012
0013 #define SW_PHY_REG_BLOCK BIT(7)
0014 #define SW_FAST_MODE BIT(3)
0015 #define SW_FAST_MODE_OVERRIDE BIT(2)
0016
0017 #define REG_SW_INT_STATUS__4 0x0010
0018 #define REG_SW_INT_MASK__4 0x0014
0019
0020 #define LUE_INT BIT(31)
0021 #define TRIG_TS_INT BIT(30)
0022 #define APB_TIMEOUT_INT BIT(29)
0023 #define OVER_TEMP_INT BIT(28)
0024 #define HSR_INT BIT(27)
0025 #define PIO_INT BIT(26)
0026 #define POR_READY_INT BIT(25)
0027
0028 #define SWITCH_INT_MASK \
0029 (LUE_INT | TRIG_TS_INT | APB_TIMEOUT_INT | OVER_TEMP_INT | HSR_INT | \
0030 PIO_INT | POR_READY_INT)
0031
0032 #define REG_SW_PORT_INT_STATUS__4 0x0018
0033 #define REG_SW_PORT_INT_MASK__4 0x001C
0034
0035
0036 #define REG_SW_GLOBAL_OUTPUT_CTRL__1 0x0103
0037 #define SW_CLK125_ENB BIT(1)
0038 #define SW_CLK25_ENB BIT(0)
0039
0040
0041 #define REG_SW_OPERATION 0x0300
0042
0043 #define SW_DOUBLE_TAG BIT(7)
0044 #define SW_OVER_TEMP_ENABLE BIT(2)
0045 #define SW_RESET BIT(1)
0046
0047 #define REG_SW_LUE_CTRL_0 0x0310
0048
0049 #define SW_VLAN_ENABLE BIT(7)
0050 #define SW_DROP_INVALID_VID BIT(6)
0051 #define SW_AGE_CNT_M 0x7
0052 #define SW_AGE_CNT_S 3
0053 #define SW_RESV_MCAST_ENABLE BIT(2)
0054
0055 #define REG_SW_LUE_CTRL_1 0x0311
0056
0057 #define UNICAST_LEARN_DISABLE BIT(7)
0058 #define SW_FLUSH_STP_TABLE BIT(5)
0059 #define SW_FLUSH_MSTP_TABLE BIT(4)
0060 #define SW_SRC_ADDR_FILTER BIT(3)
0061 #define SW_AGING_ENABLE BIT(2)
0062 #define SW_FAST_AGING BIT(1)
0063 #define SW_LINK_AUTO_AGING BIT(0)
0064
0065 #define REG_SW_MAC_CTRL_0 0x0330
0066 #define SW_NEW_BACKOFF BIT(7)
0067 #define SW_PAUSE_UNH_MODE BIT(1)
0068 #define SW_AGGR_BACKOFF BIT(0)
0069
0070 #define REG_SW_MAC_CTRL_1 0x0331
0071 #define SW_SHORT_IFG BIT(7)
0072 #define MULTICAST_STORM_DISABLE BIT(6)
0073 #define SW_BACK_PRESSURE BIT(5)
0074 #define FAIR_FLOW_CTRL BIT(4)
0075 #define NO_EXC_COLLISION_DROP BIT(3)
0076 #define SW_LEGAL_PACKET_DISABLE BIT(1)
0077 #define SW_PASS_SHORT_FRAME BIT(0)
0078
0079 #define REG_SW_MAC_CTRL_6 0x0336
0080 #define SW_MIB_COUNTER_FLUSH BIT(7)
0081 #define SW_MIB_COUNTER_FREEZE BIT(6)
0082
0083
0084 #define REG_SW_ALU_STAT_CTRL__4 0x041C
0085
0086 #define REG_SW_ALU_VAL_B 0x0424
0087 #define ALU_V_OVERRIDE BIT(31)
0088 #define ALU_V_USE_FID BIT(30)
0089 #define ALU_V_PORT_MAP 0xFF
0090
0091
0092 #define REG_VPHY_IND_ADDR__2 0x075C
0093 #define REG_VPHY_IND_DATA__2 0x0760
0094
0095 #define REG_VPHY_IND_CTRL__2 0x0768
0096
0097 #define VPHY_IND_WRITE BIT(1)
0098 #define VPHY_IND_BUSY BIT(0)
0099
0100 #define REG_VPHY_SPECIAL_CTRL__2 0x077C
0101 #define VPHY_SMI_INDIRECT_ENABLE BIT(15)
0102 #define VPHY_SW_LOOPBACK BIT(14)
0103 #define VPHY_MDIO_INTERNAL_ENABLE BIT(13)
0104 #define VPHY_SPI_INDIRECT_ENABLE BIT(12)
0105 #define VPHY_PORT_MODE_M 0x3
0106 #define VPHY_PORT_MODE_S 8
0107 #define VPHY_MODE_RGMII 0
0108 #define VPHY_MODE_MII_PHY 1
0109 #define VPHY_MODE_SGMII 2
0110 #define VPHY_MODE_RMII_PHY 3
0111 #define VPHY_SW_COLLISION_TEST BIT(7)
0112 #define VPHY_SPEED_DUPLEX_STAT_M 0x7
0113 #define VPHY_SPEED_DUPLEX_STAT_S 2
0114 #define VPHY_SPEED_1000 BIT(4)
0115 #define VPHY_SPEED_100 BIT(3)
0116 #define VPHY_FULL_DUPLEX BIT(2)
0117
0118
0119
0120
0121 #define REG_PORT_CTRL_0 0x0020
0122
0123 #define PORT_MAC_LOOPBACK BIT(7)
0124 #define PORT_MAC_REMOTE_LOOPBACK BIT(6)
0125 #define PORT_K2L_INSERT_ENABLE BIT(5)
0126 #define PORT_K2L_DEBUG_ENABLE BIT(4)
0127 #define PORT_TAIL_TAG_ENABLE BIT(2)
0128 #define PORT_QUEUE_SPLIT_ENABLE 0x3
0129
0130
0131 #define REG_PORT_T1_PHY_CTRL_BASE 0x0100
0132
0133
0134 #define PORT_SGMII_SEL BIT(7)
0135 #define PORT_GRXC_ENABLE BIT(0)
0136
0137 #define PORT_MII_SEL_EDGE BIT(5)
0138
0139 #define REG_PORT_XMII_CTRL_4 0x0304
0140 #define REG_PORT_XMII_CTRL_5 0x0306
0141
0142 #define PORT_DLL_RESET BIT(15)
0143 #define PORT_TUNE_ADJ GENMASK(13, 7)
0144
0145
0146 #define REG_PORT_MAC_CTRL_0 0x0400
0147 #define PORT_CHECK_LENGTH BIT(2)
0148 #define PORT_BROADCAST_STORM BIT(1)
0149 #define PORT_JUMBO_PACKET BIT(0)
0150
0151 #define REG_PORT_MAC_CTRL_1 0x0401
0152 #define PORT_BACK_PRESSURE BIT(3)
0153 #define PORT_PASS_ALL BIT(0)
0154
0155 #define PORT_MAX_FR_SIZE 0x404
0156 #define FR_MIN_SIZE 1522
0157
0158
0159 #define REG_PORT_MRI_PRIO_CTRL 0x0801
0160 #define PORT_HIGHEST_PRIO BIT(7)
0161 #define PORT_OR_PRIO BIT(6)
0162 #define PORT_MAC_PRIO_ENABLE BIT(4)
0163 #define PORT_VLAN_PRIO_ENABLE BIT(3)
0164 #define PORT_802_1P_PRIO_ENABLE BIT(2)
0165 #define PORT_DIFFSERV_PRIO_ENABLE BIT(1)
0166 #define PORT_ACL_PRIO_ENABLE BIT(0)
0167
0168 #define P_PRIO_CTRL REG_PORT_MRI_PRIO_CTRL
0169
0170
0171 #define RGMII_2_PORT_NUM 5
0172 #define RGMII_1_PORT_NUM 6
0173
0174 #define LAN937X_RGMII_2_PORT (RGMII_2_PORT_NUM - 1)
0175 #define LAN937X_RGMII_1_PORT (RGMII_1_PORT_NUM - 1)
0176
0177 #define RGMII_1_TX_DELAY_2NS 2
0178 #define RGMII_2_TX_DELAY_2NS 0
0179 #define RGMII_1_RX_DELAY_2NS 0x1B
0180 #define RGMII_2_RX_DELAY_2NS 0x14
0181
0182 #define LAN937X_TAG_LEN 2
0183
0184 #endif