xref: /linux/drivers/net/phy/mscc/mscc_macsec.h (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
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_MACSEC_H_
90b92f897SAntoine Tenart #define _MSCC_PHY_MACSEC_H_
10da80aa52SAntoine Tenart 
11fa164e40SAntoine Tenart #include <net/macsec.h>
12fa164e40SAntoine Tenart 
13da80aa52SAntoine Tenart #define MSCC_MS_MAX_FLOWS		16
14da80aa52SAntoine Tenart 
15da80aa52SAntoine Tenart #define CONTROL_TYPE_EGRESS		0x6
16da80aa52SAntoine Tenart #define CONTROL_TYPE_INGRESS		0xf
17da80aa52SAntoine Tenart #define CONTROL_IV0			BIT(5)
18da80aa52SAntoine Tenart #define CONTROL_IV1			BIT(6)
19da80aa52SAntoine Tenart #define CONTROL_IV2			BIT(7)
20da80aa52SAntoine Tenart #define CONTROL_UPDATE_SEQ		BIT(13)
21da80aa52SAntoine Tenart #define CONTROL_IV_IN_SEQ		BIT(14)
22da80aa52SAntoine Tenart #define CONTROL_ENCRYPT_AUTH		BIT(15)
23da80aa52SAntoine Tenart #define CONTROL_KEY_IN_CTX		BIT(16)
24da80aa52SAntoine Tenart #define CONTROL_CRYPTO_ALG(x)		((x) << 17)
25da80aa52SAntoine Tenart #define     CTRYPTO_ALG_AES_CTR_128	0x5
26da80aa52SAntoine Tenart #define     CTRYPTO_ALG_AES_CTR_192	0x6
27da80aa52SAntoine Tenart #define     CTRYPTO_ALG_AES_CTR_256	0x7
28da80aa52SAntoine Tenart #define CONTROL_DIGEST_TYPE(x)		((x) << 21)
29da80aa52SAntoine Tenart #define CONTROL_AUTH_ALG(x)		((x) << 23)
30da80aa52SAntoine Tenart #define     AUTH_ALG_AES_GHAS		0x4
31da80aa52SAntoine Tenart #define CONTROL_AN(x)			((x) << 26)
32da80aa52SAntoine Tenart #define CONTROL_SEQ_TYPE(x)		((x) << 28)
33da80aa52SAntoine Tenart #define CONTROL_SEQ_MASK		BIT(30)
34da80aa52SAntoine Tenart #define CONTROL_CONTEXT_ID		BIT(31)
35da80aa52SAntoine Tenart 
36da80aa52SAntoine Tenart enum mscc_macsec_destination_ports {
37da80aa52SAntoine Tenart 	MSCC_MS_PORT_COMMON		= 0,
38da80aa52SAntoine Tenart 	MSCC_MS_PORT_RSVD		= 1,
39da80aa52SAntoine Tenart 	MSCC_MS_PORT_CONTROLLED		= 2,
40da80aa52SAntoine Tenart 	MSCC_MS_PORT_UNCONTROLLED	= 3,
41da80aa52SAntoine Tenart };
42da80aa52SAntoine Tenart 
43da80aa52SAntoine Tenart enum mscc_macsec_drop_actions {
44da80aa52SAntoine Tenart 	MSCC_MS_ACTION_BYPASS_CRC	= 0,
45da80aa52SAntoine Tenart 	MSCC_MS_ACTION_BYPASS_BAD	= 1,
46da80aa52SAntoine Tenart 	MSCC_MS_ACTION_DROP		= 2,
47da80aa52SAntoine Tenart 	MSCC_MS_ACTION_BYPASS		= 3,
48da80aa52SAntoine Tenart };
49da80aa52SAntoine Tenart 
50da80aa52SAntoine Tenart enum mscc_macsec_flow_types {
51da80aa52SAntoine Tenart 	MSCC_MS_FLOW_BYPASS		= 0,
52da80aa52SAntoine Tenart 	MSCC_MS_FLOW_DROP		= 1,
53da80aa52SAntoine Tenart 	MSCC_MS_FLOW_INGRESS		= 2,
54da80aa52SAntoine Tenart 	MSCC_MS_FLOW_EGRESS		= 3,
55da80aa52SAntoine Tenart };
56da80aa52SAntoine Tenart 
57da80aa52SAntoine Tenart enum mscc_macsec_validate_levels {
58da80aa52SAntoine Tenart 	MSCC_MS_VALIDATE_DISABLED	= 0,
59da80aa52SAntoine Tenart 	MSCC_MS_VALIDATE_CHECK		= 1,
60da80aa52SAntoine Tenart 	MSCC_MS_VALIDATE_STRICT		= 2,
61da80aa52SAntoine Tenart };
62da80aa52SAntoine Tenart 
63fa164e40SAntoine Tenart enum macsec_bank {
64fa164e40SAntoine Tenart 	FC_BUFFER   = 0x04,
65fa164e40SAntoine Tenart 	HOST_MAC    = 0x05,
66fa164e40SAntoine Tenart 	LINE_MAC    = 0x06,
670ddfee1fSAntoine Tenart 	PROC_0      = 0x0e,
680ddfee1fSAntoine Tenart 	PROC_2      = 0x0f,
69fa164e40SAntoine Tenart 	MACSEC_INGR = 0x38,
70fa164e40SAntoine Tenart 	MACSEC_EGR  = 0x3c,
71fa164e40SAntoine Tenart };
72fa164e40SAntoine Tenart 
73fa164e40SAntoine Tenart struct macsec_flow {
74fa164e40SAntoine Tenart 	struct list_head list;
75fa164e40SAntoine Tenart 	enum mscc_macsec_destination_ports port;
76fa164e40SAntoine Tenart 	enum macsec_bank bank;
77fa164e40SAntoine Tenart 	u32 index;
78fa164e40SAntoine Tenart 	int assoc_num;
79fa164e40SAntoine Tenart 	bool has_transformation;
80fa164e40SAntoine Tenart 
81fa164e40SAntoine Tenart 	/* Highest takes precedence [0..15] */
82fa164e40SAntoine Tenart 	u8 priority;
83fa164e40SAntoine Tenart 
84fa164e40SAntoine Tenart 	union {
85fa164e40SAntoine Tenart 		struct macsec_rx_sa *rx_sa;
86fa164e40SAntoine Tenart 		struct macsec_tx_sa *tx_sa;
87fa164e40SAntoine Tenart 	};
88fa164e40SAntoine Tenart 
89fa164e40SAntoine Tenart 	/* Matching */
90fa164e40SAntoine Tenart 	struct {
91fa164e40SAntoine Tenart 		u8 sci:1;
92fa164e40SAntoine Tenart 		u8 tagged:1;
93fa164e40SAntoine Tenart 		u8 untagged:1;
94fa164e40SAntoine Tenart 		u8 etype:1;
95fa164e40SAntoine Tenart 	} match;
96fa164e40SAntoine Tenart 
97fa164e40SAntoine Tenart 	u16 etype;
98fa164e40SAntoine Tenart 
99fa164e40SAntoine Tenart 	/* Action */
100fa164e40SAntoine Tenart 	struct {
101fa164e40SAntoine Tenart 		u8 bypass:1;
102fa164e40SAntoine Tenart 		u8 drop:1;
103fa164e40SAntoine Tenart 	} action;
104fa164e40SAntoine Tenart };
105fa164e40SAntoine Tenart 
106fa164e40SAntoine Tenart #define MSCC_EXT_PAGE_MACSEC_17		17
107fa164e40SAntoine Tenart #define MSCC_EXT_PAGE_MACSEC_18		18
108fa164e40SAntoine Tenart 
109fa164e40SAntoine Tenart #define MSCC_EXT_PAGE_MACSEC_19		19
110fa164e40SAntoine Tenart #define MSCC_PHY_MACSEC_19_REG_ADDR(x)	(x)
111fa164e40SAntoine Tenart #define MSCC_PHY_MACSEC_19_TARGET(x)	((x) << 12)
112fa164e40SAntoine Tenart #define MSCC_PHY_MACSEC_19_READ		BIT(14)
113fa164e40SAntoine Tenart #define MSCC_PHY_MACSEC_19_CMD		BIT(15)
114fa164e40SAntoine Tenart 
115fa164e40SAntoine Tenart #define MSCC_EXT_PAGE_MACSEC_20		20
116fa164e40SAntoine Tenart #define MSCC_PHY_MACSEC_20_TARGET(x)	(x)
117fa164e40SAntoine Tenart 
118da80aa52SAntoine Tenart #define MSCC_MS_XFORM_REC(x, y)		(((x) << 5) + (y))
119da80aa52SAntoine Tenart #define MSCC_MS_ENA_CFG			0x800
120da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG			0x804
121da80aa52SAntoine Tenart #define MSCC_MS_SAM_MAC_SA_MATCH_LO(x)	(0x1000 + ((x) << 4))
122da80aa52SAntoine Tenart #define MSCC_MS_SAM_MAC_SA_MATCH_HI(x)	(0x1001 + ((x) << 4))
123da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH(x)	(0x1004 + ((x) << 4))
124da80aa52SAntoine Tenart #define MSCC_MS_SAM_MATCH_SCI_LO(x)	(0x1005 + ((x) << 4))
125da80aa52SAntoine Tenart #define MSCC_MS_SAM_MATCH_SCI_HI(x)	(0x1006 + ((x) << 4))
126da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK(x)		(0x1007 + ((x) << 4))
127da80aa52SAntoine Tenart #define MSCC_MS_SAM_ENTRY_SET1		0x1808
128da80aa52SAntoine Tenart #define MSCC_MS_SAM_ENTRY_CLEAR1	0x180c
129da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL(x)	(0x1c00 + (x))
130da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG		0x1e40
131da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP		0x1e51
132da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP		0x1e52
133da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL		0x1e5f
134da80aa52SAntoine Tenart #define MSCC_MS_COUNT_CONTROL		0x3204
135da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CC_CONTROL	0x3a10
136da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG	0x3a14
137da80aa52SAntoine Tenart #define MSCC_MS_VLAN_MTU_CHECK(x)	(0x3c40 + (x))
138da80aa52SAntoine Tenart #define MSCC_MS_NON_VLAN_MTU_CHECK	0x3c48
139da80aa52SAntoine Tenart #define MSCC_MS_PP_CTRL			0x3c4b
140da80aa52SAntoine Tenart #define MSCC_MS_STATUS_CONTEXT_CTRL	0x3d02
141da80aa52SAntoine Tenart #define MSCC_MS_INTR_CTRL_STATUS	0x3d04
142da80aa52SAntoine Tenart #define MSCC_MS_BLOCK_CTX_UPDATE	0x3d0c
143da80aa52SAntoine Tenart #define MSCC_MS_AIC_CTRL		0x3e02
144da80aa52SAntoine Tenart 
145da80aa52SAntoine Tenart /* MACSEC_ENA_CFG */
146da80aa52SAntoine Tenart #define MSCC_MS_ENA_CFG_CLK_ENA				BIT(0)
147da80aa52SAntoine Tenart #define MSCC_MS_ENA_CFG_SW_RST				BIT(1)
148da80aa52SAntoine Tenart #define MSCC_MS_ENA_CFG_MACSEC_BYPASS_ENA		BIT(8)
149da80aa52SAntoine Tenart #define MSCC_MS_ENA_CFG_MACSEC_ENA			BIT(9)
150da80aa52SAntoine Tenart #define MSCC_MS_ENA_CFG_MACSEC_SPEED_MODE(x)		((x) << 10)
151da80aa52SAntoine Tenart #define MSCC_MS_ENA_CFG_MACSEC_SPEED_MODE_M		GENMASK(12, 10)
152da80aa52SAntoine Tenart 
153da80aa52SAntoine Tenart /* MACSEC_FC_CFG */
154da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_FCBUF_ENA			BIT(0)
155da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_USE_PKT_EXPANSION_INDICATION	BIT(1)
156da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_LOW_THRESH(x)			((x) << 4)
157da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_LOW_THRESH_M			GENMASK(7, 4)
158da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_HIGH_THRESH(x)			((x) << 8)
159da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_HIGH_THRESH_M			GENMASK(11, 8)
160da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_LOW_BYTES_VAL(x)			((x) << 12)
161da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_LOW_BYTES_VAL_M			GENMASK(14, 12)
162da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_HIGH_BYTES_VAL(x)		((x) << 16)
163da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_HIGH_BYTES_VAL_M			GENMASK(18, 16)
164da80aa52SAntoine Tenart 
165da80aa52SAntoine Tenart /* MSCC_MS_SAM_MAC_SA_MATCH_HI */
166da80aa52SAntoine Tenart #define MSCC_MS_SAM_MAC_SA_MATCH_HI_ETYPE(x)		((x) << 16)
167da80aa52SAntoine Tenart #define MSCC_MS_SAM_MAC_SA_MATCH_HI_ETYPE_M		GENMASK(31, 16)
168da80aa52SAntoine Tenart 
169da80aa52SAntoine Tenart /* MACSEC_SAM_MISC_MATCH */
170da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_VLAN_VALID		BIT(0)
171da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_QINQ_FOUND		BIT(1)
172da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_STAG_VALID		BIT(2)
173da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_QTAG_VALID		BIT(3)
174da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_VLAN_UP(x)		((x) << 4)
175da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_VLAN_UP_M		GENMASK(6, 4)
176da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_CONTROL_PACKET		BIT(7)
177da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_UNTAGGED			BIT(8)
178da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_TAGGED			BIT(9)
179da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_BAD_TAG			BIT(10)
180da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_KAY_TAG			BIT(11)
181da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_SOURCE_PORT(x)		((x) << 12)
182da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_SOURCE_PORT_M		GENMASK(13, 12)
183da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_PRIORITY(x)		((x) << 16)
184da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_PRIORITY_M		GENMASK(19, 16)
185da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_AN(x)			((x) << 24)
186da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_TCI(x)			((x) << 26)
187da80aa52SAntoine Tenart 
188da80aa52SAntoine Tenart /* MACSEC_SAM_MASK */
189da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_MAC_SA_MASK(x)			(x)
190da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_MAC_SA_MASK_M			GENMASK(5, 0)
191da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_MAC_DA_MASK(x)			((x) << 6)
192da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_MAC_DA_MASK_M			GENMASK(11, 6)
193da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_MAC_ETYPE_MASK			BIT(12)
194da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_VLAN_VLD_MASK			BIT(13)
195da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_QINQ_FOUND_MASK		BIT(14)
196da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_STAG_VLD_MASK			BIT(15)
197da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_QTAG_VLD_MASK			BIT(16)
198da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_VLAN_UP_MASK			BIT(17)
199da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_VLAN_ID_MASK			BIT(18)
200da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_SOURCE_PORT_MASK		BIT(19)
201da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_CTL_PACKET_MASK		BIT(20)
202da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_VLAN_UP_INNER_MASK		BIT(21)
203da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_VLAN_ID_INNER_MASK		BIT(22)
204da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_SCI_MASK			BIT(23)
205da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_AN_MASK(x)			((x) << 24)
206da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_TCI_MASK(x)			((x) << 26)
207da80aa52SAntoine Tenart 
208da80aa52SAntoine Tenart /* MACSEC_SAM_FLOW_CTRL_EGR */
209da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_FLOW_TYPE(x)		(x)
210da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_FLOW_TYPE_M		GENMASK(1, 0)
211da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_DEST_PORT(x)		((x) << 2)
212da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_DEST_PORT_M		GENMASK(3, 2)
213da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_RESV_4			BIT(4)
214da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_FLOW_CRYPT_AUTH		BIT(5)
215da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_DROP_ACTION(x)		((x) << 6)
216da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_DROP_ACTION_M		GENMASK(7, 6)
217da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_RESV_15_TO_8(x)		((x) << 8)
218da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_RESV_15_TO_8_M		GENMASK(15, 8)
219da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_PROTECT_FRAME		BIT(16)
220da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_REPLAY_PROTECT		BIT(16)
221da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_SA_IN_USE			BIT(17)
222da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_INCLUDE_SCI		BIT(18)
223da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_USE_ES			BIT(19)
224da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_USE_SCB			BIT(20)
225da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_VALIDATE_FRAMES(x)	((x) << 19)
226da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_TAG_BYPASS_SIZE(x)	((x) << 21)
227da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_TAG_BYPASS_SIZE_M		GENMASK(22, 21)
228da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_RESV_23			BIT(23)
229da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_CONFIDENTIALITY_OFFSET(x)	((x) << 24)
230da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_CONFIDENTIALITY_OFFSET_M	GENMASK(30, 24)
231da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_CONF_PROTECT		BIT(31)
232da80aa52SAntoine Tenart 
233da80aa52SAntoine Tenart /* MACSEC_SAM_CP_TAG */
234da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_MAP_TBL(x)			(x)
235da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_MAP_TBL_M			GENMASK(23, 0)
236da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_DEF_UP(x)			((x) << 24)
237da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_DEF_UP_M			GENMASK(26, 24)
238da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_STAG_UP_EN			BIT(27)
239da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_QTAG_UP_EN			BIT(28)
240da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_PARSE_QINQ			BIT(29)
241da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_PARSE_STAG			BIT(30)
242da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_PARSE_QTAG			BIT(31)
243da80aa52SAntoine Tenart 
244da80aa52SAntoine Tenart /* MACSEC_SAM_NM_FLOW_NCP */
245da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_UNTAGGED_FLOW_TYPE(x)	(x)
246da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_UNTAGGED_DEST_PORT(x)	((x) << 2)
247da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_UNTAGGED_DROP_ACTION(x)	((x) << 6)
248da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_TAGGED_FLOW_TYPE(x)	((x) << 8)
249da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_TAGGED_DEST_PORT(x)	((x) << 10)
250da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_TAGGED_DROP_ACTION(x)	((x) << 14)
251da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_BADTAG_FLOW_TYPE(x)	((x) << 16)
252da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_BADTAG_DEST_PORT(x)	((x) << 18)
253da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_BADTAG_DROP_ACTION(x)	((x) << 22)
254da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_KAY_FLOW_TYPE(x)	((x) << 24)
255da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_KAY_DEST_PORT(x)	((x) << 26)
256da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_KAY_DROP_ACTION(x)	((x) << 30)
257da80aa52SAntoine Tenart 
258da80aa52SAntoine Tenart /* MACSEC_SAM_NM_FLOW_CP */
259da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_UNTAGGED_FLOW_TYPE(x)	(x)
260da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_UNTAGGED_DEST_PORT(x)	((x) << 2)
261da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_UNTAGGED_DROP_ACTION(x)	((x) << 6)
262da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_TAGGED_FLOW_TYPE(x)	((x) << 8)
263da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_TAGGED_DEST_PORT(x)	((x) << 10)
264da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_TAGGED_DROP_ACTION(x)	((x) << 14)
265da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_BADTAG_FLOW_TYPE(x)	((x) << 16)
266da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_BADTAG_DEST_PORT(x)	((x) << 18)
267da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_BADTAG_DROP_ACTION(x)	((x) << 22)
268da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_KAY_FLOW_TYPE(x)		((x) << 24)
269da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_KAY_DEST_PORT(x)		((x) << 26)
270da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_KAY_DROP_ACTION(x)	((x) << 30)
271da80aa52SAntoine Tenart 
272da80aa52SAntoine Tenart /* MACSEC_MISC_CONTROL */
273da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_MC_LATENCY_FIX(x)		(x)
274da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_MC_LATENCY_FIX_M		GENMASK(5, 0)
275da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_STATIC_BYPASS		BIT(8)
276da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_NM_MACSEC_EN		BIT(9)
277da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_VALIDATE_FRAMES(x)		((x) << 10)
278da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_VALIDATE_FRAMES_M		GENMASK(11, 10)
279da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_XFORM_REC_SIZE(x)		((x) << 24)
280da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_XFORM_REC_SIZE_M		GENMASK(25, 24)
281da80aa52SAntoine Tenart 
282da80aa52SAntoine Tenart /* MACSEC_COUNT_CONTROL */
283da80aa52SAntoine Tenart #define MSCC_MS_COUNT_CONTROL_RESET_ALL			BIT(0)
284da80aa52SAntoine Tenart #define MSCC_MS_COUNT_CONTROL_DEBUG_ACCESS		BIT(1)
285da80aa52SAntoine Tenart #define MSCC_MS_COUNT_CONTROL_SATURATE_CNTRS		BIT(2)
286da80aa52SAntoine Tenart #define MSCC_MS_COUNT_CONTROL_AUTO_CNTR_RESET		BIT(3)
287da80aa52SAntoine Tenart 
288da80aa52SAntoine Tenart /* MACSEC_PARAMS2_IG_CC_CONTROL */
289da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CC_CONTROL_NON_MATCH_CTRL_ACT	BIT(14)
290da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CC_CONTROL_NON_MATCH_ACT	BIT(15)
291da80aa52SAntoine Tenart 
292da80aa52SAntoine Tenart /* MACSEC_PARAMS2_IG_CP_TAG */
293da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_MAP_TBL(x)		(x)
294da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_MAP_TBL_M		GENMASK(23, 0)
295da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_DEF_UP(x)		((x) << 24)
296da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_DEF_UP_M		GENMASK(26, 24)
297da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_STAG_UP_EN		BIT(27)
298da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_QTAG_UP_EN		BIT(28)
299da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_PARSE_QINQ		BIT(29)
300da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_PARSE_STAG		BIT(30)
301da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_PARSE_QTAG		BIT(31)
302da80aa52SAntoine Tenart 
303da80aa52SAntoine Tenart /* MACSEC_VLAN_MTU_CHECK */
304da80aa52SAntoine Tenart #define MSCC_MS_VLAN_MTU_CHECK_MTU_COMPARE(x)		(x)
305da80aa52SAntoine Tenart #define MSCC_MS_VLAN_MTU_CHECK_MTU_COMPARE_M		GENMASK(14, 0)
306da80aa52SAntoine Tenart #define MSCC_MS_VLAN_MTU_CHECK_MTU_COMP_DROP		BIT(15)
307da80aa52SAntoine Tenart 
308da80aa52SAntoine Tenart /* MACSEC_NON_VLAN_MTU_CHECK */
309da80aa52SAntoine Tenart #define MSCC_MS_NON_VLAN_MTU_CHECK_NV_MTU_COMPARE(x)	(x)
310da80aa52SAntoine Tenart #define MSCC_MS_NON_VLAN_MTU_CHECK_NV_MTU_COMPARE_M	GENMASK(14, 0)
311da80aa52SAntoine Tenart #define MSCC_MS_NON_VLAN_MTU_CHECK_NV_MTU_COMP_DROP	BIT(15)
312da80aa52SAntoine Tenart 
313da80aa52SAntoine Tenart /* MACSEC_PP_CTRL */
314da80aa52SAntoine Tenart #define MSCC_MS_PP_CTRL_MACSEC_OCTET_INCR_MODE		BIT(0)
315da80aa52SAntoine Tenart 
316da80aa52SAntoine Tenart /* MACSEC_INTR_CTRL_STATUS */
317da80aa52SAntoine Tenart #define MSCC_MS_INTR_CTRL_STATUS_INTR_CLR_STATUS(x)	(x)
318da80aa52SAntoine Tenart #define MSCC_MS_INTR_CTRL_STATUS_INTR_CLR_STATUS_M	GENMASK(15, 0)
319da80aa52SAntoine Tenart #define MSCC_MS_INTR_CTRL_STATUS_INTR_ENABLE(x)		((x) << 16)
320da80aa52SAntoine Tenart #define MSCC_MS_INTR_CTRL_STATUS_INTR_ENABLE_M		GENMASK(31, 16)
321da80aa52SAntoine Tenart #define MACSEC_INTR_CTRL_STATUS_ROLLOVER		BIT(5)
322da80aa52SAntoine Tenart 
3230b92f897SAntoine Tenart #endif /* _MSCC_PHY_MACSEC_H_ */
324