xref: /linux/drivers/net/phy/mscc/mscc_mac.h (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1da80aa52SAntoine Tenart /* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
2da80aa52SAntoine Tenart /*
30b92f897SAntoine Tenart  * Driver for Microsemi VSC85xx PHYs
4da80aa52SAntoine Tenart  *
5*c7cd2a6aSAntoine Tenart  * Copyright (c) 2020 Microsemi Corporation
6da80aa52SAntoine Tenart  */
7da80aa52SAntoine Tenart 
80b92f897SAntoine Tenart #ifndef _MSCC_PHY_LINE_MAC_H_
90b92f897SAntoine Tenart #define _MSCC_PHY_LINE_MAC_H_
10da80aa52SAntoine Tenart 
11da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ENA_CFG					0x00
12da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MODE_CFG					0x01
13da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MAXLEN_CFG					0x02
14da80aa52SAntoine Tenart #define MSCC_MAC_CFG_NUM_TAGS_CFG				0x03
15da80aa52SAntoine Tenart #define MSCC_MAC_CFG_TAGS_CFG					0x04
16da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ADV_CHK_CFG				0x07
17da80aa52SAntoine Tenart #define MSCC_MAC_CFG_LFS_CFG					0x08
18da80aa52SAntoine Tenart #define MSCC_MAC_CFG_LB_CFG					0x09
19da80aa52SAntoine Tenart #define MSCC_MAC_CFG_PKTINF_CFG					0x0a
20da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_TX_FRAME_CTRL			0x0b
21da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_TX_FRAME_CTRL_2			0x0c
22da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_RX_FRAME_CTRL			0x0d
23da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_STATE				0x0e
24da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_MAC_ADDRESS_LSB			0x0f
25da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_MAC_ADDRESS_MSB			0x10
26da80aa52SAntoine Tenart #define MSCC_MAC_STATUS_RX_LANE_STICKY_0			0x11
27da80aa52SAntoine Tenart #define MSCC_MAC_STATUS_RX_LANE_STICKY_1			0x12
28da80aa52SAntoine Tenart #define MSCC_MAC_STATUS_TX_MONITOR_STICKY			0x13
29da80aa52SAntoine Tenart #define MSCC_MAC_STATUS_TX_MONITOR_STICKY_MASK			0x14
30da80aa52SAntoine Tenart #define MSCC_MAC_STATUS_STICKY					0x15
31da80aa52SAntoine Tenart #define MSCC_MAC_STATUS_STICKY_MASK				0x16
32da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_HIH_CKSM_ERR_CNT		0x17
33da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_XGMII_PROT_ERR_CNT		0x18
34da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_SYMBOL_ERR_CNT			0x19
35da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_PAUSE_CNT			0x1a
36da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_UNSUP_OPCODE_CNT		0x1b
37da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_UC_CNT				0x1c
38da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_MC_CNT				0x1d
39da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_BC_CNT				0x1e
40da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_CRC_ERR_CNT			0x1f
41da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_UNDERSIZE_CNT			0x20
42da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_FRAGMENTS_CNT			0x21
43da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_IN_RANGE_LEN_ERR_CNT		0x22
44da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_OUT_OF_RANGE_LEN_ERR_CNT	0x23
45da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_OVERSIZE_CNT			0x24
46da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_JABBERS_CNT			0x25
47da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_SIZE64_CNT			0x26
48da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_SIZE65TO127_CNT			0x27
49da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_SIZE128TO255_CNT		0x28
50da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_SIZE256TO511_CNT		0x29
51da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_SIZE512TO1023_CNT		0x2a
52da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_SIZE1024TO1518_CNT		0x2b
53da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_SIZE1519TOMAX_CNT		0x2c
54da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_RX_IPG_SHRINK_CNT			0x2d
55da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_TX_PAUSE_CNT			0x2e
56da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_TX_UC_CNT				0x2f
57da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_TX_MC_CNT				0x30
58da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_TX_BC_CNT				0x31
59da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_TX_SIZE64_CNT			0x32
60da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_TX_SIZE65TO127_CNT			0x33
61da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_TX_SIZE128TO255_CNT		0x34
62da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_TX_SIZE256TO511_CNT		0x35
63da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_TX_SIZE512TO1023_CNT		0x36
64da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_TX_SIZE1024TO1518_CNT		0x37
65da80aa52SAntoine Tenart #define MSCC_MAC_STATS_32BIT_TX_SIZE1519TOMAX_CNT		0x38
66da80aa52SAntoine Tenart #define MSCC_MAC_STATS_40BIT_RX_BAD_BYTES_CNT			0x39
67da80aa52SAntoine Tenart #define MSCC_MAC_STATS_40BIT_RX_BAD_BYTES_MSB_CNT		0x3a
68da80aa52SAntoine Tenart #define MSCC_MAC_STATS_40BIT_RX_OK_BYTES_CNT			0x3b
69da80aa52SAntoine Tenart #define MSCC_MAC_STATS_40BIT_RX_OK_BYTES_MSB_CNT		0x3c
70da80aa52SAntoine Tenart #define MSCC_MAC_STATS_40BIT_RX_IN_BYTES_CNT			0x3d
71da80aa52SAntoine Tenart #define MSCC_MAC_STATS_40BIT_RX_IN_BYTES_MSB_CNT		0x3e
72da80aa52SAntoine Tenart #define MSCC_MAC_STATS_40BIT_TX_OK_BYTES_CNT			0x3f
73da80aa52SAntoine Tenart #define MSCC_MAC_STATS_40BIT_TX_OK_BYTES_MSB_CNT		0x40
74da80aa52SAntoine Tenart #define MSCC_MAC_STATS_40BIT_TX_OUT_BYTES_CNT			0x41
75da80aa52SAntoine Tenart #define MSCC_MAC_STATS_40BIT_TX_OUT_BYTES_MSB_CNT		0x42
76da80aa52SAntoine Tenart 
77da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ENA_CFG_RX_CLK_ENA				BIT(0)
78da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ENA_CFG_TX_CLK_ENA				BIT(4)
79da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ENA_CFG_RX_SW_RST				BIT(8)
80da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ENA_CFG_TX_SW_RST				BIT(12)
81da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ENA_CFG_RX_ENA				BIT(16)
82da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ENA_CFG_TX_ENA				BIT(20)
83da80aa52SAntoine Tenart 
84da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MODE_CFG_FORCE_CW_UPDATE_INTERVAL(x)	((x) << 20)
85da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MODE_CFG_FORCE_CW_UPDATE_INTERVAL_M	GENMASK(29, 20)
86da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MODE_CFG_FORCE_CW_UPDATE			BIT(16)
87da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MODE_CFG_TUNNEL_PAUSE_FRAMES		BIT(14)
88da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MODE_CFG_MAC_PREAMBLE_CFG(x)		((x) << 10)
89da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MODE_CFG_MAC_PREAMBLE_CFG_M		GENMASK(12, 10)
90da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MODE_CFG_MAC_IPG_CFG			BIT(6)
91da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MODE_CFG_XGMII_GEN_MODE_ENA		BIT(4)
92da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MODE_CFG_HIH_CRC_CHECK			BIT(2)
93da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MODE_CFG_UNDERSIZED_FRAME_DROP_DIS		BIT(1)
94da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MODE_CFG_DISABLE_DIC			BIT(0)
95da80aa52SAntoine Tenart 
96da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MAXLEN_CFG_MAX_LEN_TAG_CHK			BIT(16)
97da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MAXLEN_CFG_MAX_LEN(x)			(x)
98da80aa52SAntoine Tenart #define MSCC_MAC_CFG_MAXLEN_CFG_MAX_LEN_M			GENMASK(15, 0)
99da80aa52SAntoine Tenart 
100da80aa52SAntoine Tenart #define MSCC_MAC_CFG_TAGS_CFG_RSZ				0x4
101da80aa52SAntoine Tenart #define MSCC_MAC_CFG_TAGS_CFG_TAG_ID(x)				((x) << 16)
102da80aa52SAntoine Tenart #define MSCC_MAC_CFG_TAGS_CFG_TAG_ID_M				GENMASK(31, 16)
103da80aa52SAntoine Tenart #define MSCC_MAC_CFG_TAGS_CFG_TAG_ENA				BIT(4)
104da80aa52SAntoine Tenart 
105da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ADV_CHK_CFG_EXT_EOP_CHK_ENA		BIT(24)
106da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ADV_CHK_CFG_EXT_SOP_CHK_ENA		BIT(20)
107da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ADV_CHK_CFG_SFD_CHK_ENA			BIT(16)
108da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ADV_CHK_CFG_PRM_SHK_CHK_DIS		BIT(12)
109da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ADV_CHK_CFG_PRM_CHK_ENA			BIT(8)
110da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ADV_CHK_CFG_OOR_ERR_ENA			BIT(4)
111da80aa52SAntoine Tenart #define MSCC_MAC_CFG_ADV_CHK_CFG_INR_ERR_ENA			BIT(0)
112da80aa52SAntoine Tenart 
113da80aa52SAntoine Tenart #define MSCC_MAC_CFG_LFS_CFG_LFS_INH_TX				BIT(8)
114da80aa52SAntoine Tenart #define MSCC_MAC_CFG_LFS_CFG_LFS_DIS_TX				BIT(4)
115da80aa52SAntoine Tenart #define MSCC_MAC_CFG_LFS_CFG_LFS_UNIDIR_ENA			BIT(3)
116da80aa52SAntoine Tenart #define MSCC_MAC_CFG_LFS_CFG_USE_LEADING_EDGE_DETECT		BIT(2)
117da80aa52SAntoine Tenart #define MSCC_MAC_CFG_LFS_CFG_SPURIOUS_Q_DIS			BIT(1)
118da80aa52SAntoine Tenart #define MSCC_MAC_CFG_LFS_CFG_LFS_MODE_ENA			BIT(0)
119da80aa52SAntoine Tenart 
120da80aa52SAntoine Tenart #define MSCC_MAC_CFG_LB_CFG_XGMII_HOST_LB_ENA			BIT(4)
121da80aa52SAntoine Tenart #define MSCC_MAC_CFG_LB_CFG_XGMII_PHY_LB_ENA			BIT(0)
122da80aa52SAntoine Tenart 
123da80aa52SAntoine Tenart #define MSCC_MAC_CFG_PKTINF_CFG_STRIP_FCS_ENA			BIT(0)
124da80aa52SAntoine Tenart #define MSCC_MAC_CFG_PKTINF_CFG_INSERT_FCS_ENA			BIT(4)
125da80aa52SAntoine Tenart #define MSCC_MAC_CFG_PKTINF_CFG_STRIP_PREAMBLE_ENA		BIT(8)
126da80aa52SAntoine Tenart #define MSCC_MAC_CFG_PKTINF_CFG_INSERT_PREAMBLE_ENA		BIT(12)
127da80aa52SAntoine Tenart #define MSCC_MAC_CFG_PKTINF_CFG_LPI_RELAY_ENA			BIT(16)
128da80aa52SAntoine Tenart #define MSCC_MAC_CFG_PKTINF_CFG_LF_RELAY_ENA			BIT(20)
129da80aa52SAntoine Tenart #define MSCC_MAC_CFG_PKTINF_CFG_RF_RELAY_ENA			BIT(24)
130da80aa52SAntoine Tenart #define MSCC_MAC_CFG_PKTINF_CFG_ENABLE_TX_PADDING		BIT(25)
131da80aa52SAntoine Tenart #define MSCC_MAC_CFG_PKTINF_CFG_ENABLE_RX_PADDING		BIT(26)
132da80aa52SAntoine Tenart #define MSCC_MAC_CFG_PKTINF_CFG_ENABLE_4BYTE_PREAMBLE		BIT(27)
133da80aa52SAntoine Tenart #define MSCC_MAC_CFG_PKTINF_CFG_MACSEC_BYPASS_NUM_PTP_STALL_CLKS(x)	((x) << 28)
134da80aa52SAntoine Tenart #define MSCC_MAC_CFG_PKTINF_CFG_MACSEC_BYPASS_NUM_PTP_STALL_CLKS_M	GENMASK(30, 28)
135da80aa52SAntoine Tenart 
136da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_TX_FRAME_CTRL_PAUSE_VALUE(x)		((x) << 16)
137da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_TX_FRAME_CTRL_PAUSE_VALUE_M		GENMASK(31, 16)
138da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_TX_FRAME_CTRL_WAIT_FOR_LPI_LOW	BIT(12)
139da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_TX_FRAME_CTRL_USE_PAUSE_STALL_ENA	BIT(8)
140da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_TX_FRAME_CTRL_PAUSE_REPL_MODE	BIT(4)
141da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_TX_FRAME_CTRL_PAUSE_FRC_FRAME	BIT(2)
142da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_TX_FRAME_CTRL_PAUSE_MODE(x)		(x)
143da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_TX_FRAME_CTRL_PAUSE_MODE_M		GENMASK(1, 0)
144da80aa52SAntoine Tenart 
145da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_RX_FRAME_CTRL_EARLY_PAUSE_DETECT_ENA	BIT(16)
146da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_RX_FRAME_CTRL_PRE_CRC_MODE		BIT(20)
147da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_RX_FRAME_CTRL_PAUSE_TIMER_ENA	BIT(12)
148da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_RX_FRAME_CTRL_PAUSE_REACT_ENA	BIT(8)
149da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_RX_FRAME_CTRL_PAUSE_FRAME_DROP_ENA	BIT(4)
150da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_RX_FRAME_CTRL_PAUSE_MODE		BIT(0)
151da80aa52SAntoine Tenart 
152da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_STATE_PAUSE_STATE			BIT(0)
153da80aa52SAntoine Tenart #define MSCC_MAC_PAUSE_CFG_STATE_MAC_TX_PAUSE_GEN		BIT(4)
154da80aa52SAntoine Tenart 
1550ddfee1fSAntoine Tenart #define MSCC_PROC_IP_1588_TOP_CFG_STAT_MODE_CTL			0x2
1560ddfee1fSAntoine Tenart #define MSCC_PROC_IP_1588_TOP_CFG_STAT_MODE_CTL_PROTOCOL_MODE(x)	(x)
1570ddfee1fSAntoine Tenart #define MSCC_PROC_IP_1588_TOP_CFG_STAT_MODE_CTL_PROTOCOL_MODE_M	GENMASK(2, 0)
158da80aa52SAntoine Tenart 
1590b92f897SAntoine Tenart #endif /* _MSCC_PHY_LINE_MAC_H_ */
160