xref: /linux/drivers/net/phy/mscc/mscc_macsec.h (revision c7cd2a6a7b084f3d57ce4d783685e37d16327f9f)
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 	u8 key[MACSEC_KEYID_LEN];
85fa164e40SAntoine Tenart 
86fa164e40SAntoine Tenart 	union {
87fa164e40SAntoine Tenart 		struct macsec_rx_sa *rx_sa;
88fa164e40SAntoine Tenart 		struct macsec_tx_sa *tx_sa;
89fa164e40SAntoine Tenart 	};
90fa164e40SAntoine Tenart 
91fa164e40SAntoine Tenart 	/* Matching */
92fa164e40SAntoine Tenart 	struct {
93fa164e40SAntoine Tenart 		u8 sci:1;
94fa164e40SAntoine Tenart 		u8 tagged:1;
95fa164e40SAntoine Tenart 		u8 untagged:1;
96fa164e40SAntoine Tenart 		u8 etype:1;
97fa164e40SAntoine Tenart 	} match;
98fa164e40SAntoine Tenart 
99fa164e40SAntoine Tenart 	u16 etype;
100fa164e40SAntoine Tenart 
101fa164e40SAntoine Tenart 	/* Action */
102fa164e40SAntoine Tenart 	struct {
103fa164e40SAntoine Tenart 		u8 bypass:1;
104fa164e40SAntoine Tenart 		u8 drop:1;
105fa164e40SAntoine Tenart 	} action;
106fa164e40SAntoine Tenart };
107fa164e40SAntoine Tenart 
108fa164e40SAntoine Tenart #define MSCC_EXT_PAGE_MACSEC_17		17
109fa164e40SAntoine Tenart #define MSCC_EXT_PAGE_MACSEC_18		18
110fa164e40SAntoine Tenart 
111fa164e40SAntoine Tenart #define MSCC_EXT_PAGE_MACSEC_19		19
112fa164e40SAntoine Tenart #define MSCC_PHY_MACSEC_19_REG_ADDR(x)	(x)
113fa164e40SAntoine Tenart #define MSCC_PHY_MACSEC_19_TARGET(x)	((x) << 12)
114fa164e40SAntoine Tenart #define MSCC_PHY_MACSEC_19_READ		BIT(14)
115fa164e40SAntoine Tenart #define MSCC_PHY_MACSEC_19_CMD		BIT(15)
116fa164e40SAntoine Tenart 
117fa164e40SAntoine Tenart #define MSCC_EXT_PAGE_MACSEC_20		20
118fa164e40SAntoine Tenart #define MSCC_PHY_MACSEC_20_TARGET(x)	(x)
119fa164e40SAntoine Tenart 
120da80aa52SAntoine Tenart #define MSCC_MS_XFORM_REC(x, y)		(((x) << 5) + (y))
121da80aa52SAntoine Tenart #define MSCC_MS_ENA_CFG			0x800
122da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG			0x804
123da80aa52SAntoine Tenart #define MSCC_MS_SAM_MAC_SA_MATCH_LO(x)	(0x1000 + ((x) << 4))
124da80aa52SAntoine Tenart #define MSCC_MS_SAM_MAC_SA_MATCH_HI(x)	(0x1001 + ((x) << 4))
125da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH(x)	(0x1004 + ((x) << 4))
126da80aa52SAntoine Tenart #define MSCC_MS_SAM_MATCH_SCI_LO(x)	(0x1005 + ((x) << 4))
127da80aa52SAntoine Tenart #define MSCC_MS_SAM_MATCH_SCI_HI(x)	(0x1006 + ((x) << 4))
128da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK(x)		(0x1007 + ((x) << 4))
129da80aa52SAntoine Tenart #define MSCC_MS_SAM_ENTRY_SET1		0x1808
130da80aa52SAntoine Tenart #define MSCC_MS_SAM_ENTRY_CLEAR1	0x180c
131da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL(x)	(0x1c00 + (x))
132da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG		0x1e40
133da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP		0x1e51
134da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP		0x1e52
135da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL		0x1e5f
136da80aa52SAntoine Tenart #define MSCC_MS_COUNT_CONTROL		0x3204
137da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CC_CONTROL	0x3a10
138da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG	0x3a14
139da80aa52SAntoine Tenart #define MSCC_MS_VLAN_MTU_CHECK(x)	(0x3c40 + (x))
140da80aa52SAntoine Tenart #define MSCC_MS_NON_VLAN_MTU_CHECK	0x3c48
141da80aa52SAntoine Tenart #define MSCC_MS_PP_CTRL			0x3c4b
142da80aa52SAntoine Tenart #define MSCC_MS_STATUS_CONTEXT_CTRL	0x3d02
143da80aa52SAntoine Tenart #define MSCC_MS_INTR_CTRL_STATUS	0x3d04
144da80aa52SAntoine Tenart #define MSCC_MS_BLOCK_CTX_UPDATE	0x3d0c
145da80aa52SAntoine Tenart #define MSCC_MS_AIC_CTRL		0x3e02
146da80aa52SAntoine Tenart 
147da80aa52SAntoine Tenart /* MACSEC_ENA_CFG */
148da80aa52SAntoine Tenart #define MSCC_MS_ENA_CFG_CLK_ENA				BIT(0)
149da80aa52SAntoine Tenart #define MSCC_MS_ENA_CFG_SW_RST				BIT(1)
150da80aa52SAntoine Tenart #define MSCC_MS_ENA_CFG_MACSEC_BYPASS_ENA		BIT(8)
151da80aa52SAntoine Tenart #define MSCC_MS_ENA_CFG_MACSEC_ENA			BIT(9)
152da80aa52SAntoine Tenart #define MSCC_MS_ENA_CFG_MACSEC_SPEED_MODE(x)		((x) << 10)
153da80aa52SAntoine Tenart #define MSCC_MS_ENA_CFG_MACSEC_SPEED_MODE_M		GENMASK(12, 10)
154da80aa52SAntoine Tenart 
155da80aa52SAntoine Tenart /* MACSEC_FC_CFG */
156da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_FCBUF_ENA			BIT(0)
157da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_USE_PKT_EXPANSION_INDICATION	BIT(1)
158da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_LOW_THRESH(x)			((x) << 4)
159da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_LOW_THRESH_M			GENMASK(7, 4)
160da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_HIGH_THRESH(x)			((x) << 8)
161da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_HIGH_THRESH_M			GENMASK(11, 8)
162da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_LOW_BYTES_VAL(x)			((x) << 12)
163da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_LOW_BYTES_VAL_M			GENMASK(14, 12)
164da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_HIGH_BYTES_VAL(x)		((x) << 16)
165da80aa52SAntoine Tenart #define MSCC_MS_FC_CFG_HIGH_BYTES_VAL_M			GENMASK(18, 16)
166da80aa52SAntoine Tenart 
167da80aa52SAntoine Tenart /* MSCC_MS_SAM_MAC_SA_MATCH_HI */
168da80aa52SAntoine Tenart #define MSCC_MS_SAM_MAC_SA_MATCH_HI_ETYPE(x)		((x) << 16)
169da80aa52SAntoine Tenart #define MSCC_MS_SAM_MAC_SA_MATCH_HI_ETYPE_M		GENMASK(31, 16)
170da80aa52SAntoine Tenart 
171da80aa52SAntoine Tenart /* MACSEC_SAM_MISC_MATCH */
172da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_VLAN_VALID		BIT(0)
173da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_QINQ_FOUND		BIT(1)
174da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_STAG_VALID		BIT(2)
175da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_QTAG_VALID		BIT(3)
176da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_VLAN_UP(x)		((x) << 4)
177da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_VLAN_UP_M		GENMASK(6, 4)
178da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_CONTROL_PACKET		BIT(7)
179da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_UNTAGGED			BIT(8)
180da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_TAGGED			BIT(9)
181da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_BAD_TAG			BIT(10)
182da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_KAY_TAG			BIT(11)
183da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_SOURCE_PORT(x)		((x) << 12)
184da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_SOURCE_PORT_M		GENMASK(13, 12)
185da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_PRIORITY(x)		((x) << 16)
186da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_PRIORITY_M		GENMASK(19, 16)
187da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_AN(x)			((x) << 24)
188da80aa52SAntoine Tenart #define MSCC_MS_SAM_MISC_MATCH_TCI(x)			((x) << 26)
189da80aa52SAntoine Tenart 
190da80aa52SAntoine Tenart /* MACSEC_SAM_MASK */
191da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_MAC_SA_MASK(x)			(x)
192da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_MAC_SA_MASK_M			GENMASK(5, 0)
193da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_MAC_DA_MASK(x)			((x) << 6)
194da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_MAC_DA_MASK_M			GENMASK(11, 6)
195da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_MAC_ETYPE_MASK			BIT(12)
196da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_VLAN_VLD_MASK			BIT(13)
197da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_QINQ_FOUND_MASK		BIT(14)
198da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_STAG_VLD_MASK			BIT(15)
199da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_QTAG_VLD_MASK			BIT(16)
200da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_VLAN_UP_MASK			BIT(17)
201da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_VLAN_ID_MASK			BIT(18)
202da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_SOURCE_PORT_MASK		BIT(19)
203da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_CTL_PACKET_MASK		BIT(20)
204da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_VLAN_UP_INNER_MASK		BIT(21)
205da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_VLAN_ID_INNER_MASK		BIT(22)
206da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_SCI_MASK			BIT(23)
207da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_AN_MASK(x)			((x) << 24)
208da80aa52SAntoine Tenart #define MSCC_MS_SAM_MASK_TCI_MASK(x)			((x) << 26)
209da80aa52SAntoine Tenart 
210da80aa52SAntoine Tenart /* MACSEC_SAM_FLOW_CTRL_EGR */
211da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_FLOW_TYPE(x)		(x)
212da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_FLOW_TYPE_M		GENMASK(1, 0)
213da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_DEST_PORT(x)		((x) << 2)
214da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_DEST_PORT_M		GENMASK(3, 2)
215da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_RESV_4			BIT(4)
216da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_FLOW_CRYPT_AUTH		BIT(5)
217da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_DROP_ACTION(x)		((x) << 6)
218da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_DROP_ACTION_M		GENMASK(7, 6)
219da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_RESV_15_TO_8(x)		((x) << 8)
220da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_RESV_15_TO_8_M		GENMASK(15, 8)
221da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_PROTECT_FRAME		BIT(16)
222da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_REPLAY_PROTECT		BIT(16)
223da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_SA_IN_USE			BIT(17)
224da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_INCLUDE_SCI		BIT(18)
225da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_USE_ES			BIT(19)
226da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_USE_SCB			BIT(20)
227da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_VALIDATE_FRAMES(x)	((x) << 19)
228da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_TAG_BYPASS_SIZE(x)	((x) << 21)
229da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_TAG_BYPASS_SIZE_M		GENMASK(22, 21)
230da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_RESV_23			BIT(23)
231da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_CONFIDENTIALITY_OFFSET(x)	((x) << 24)
232da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_CONFIDENTIALITY_OFFSET_M	GENMASK(30, 24)
233da80aa52SAntoine Tenart #define MSCC_MS_SAM_FLOW_CTRL_CONF_PROTECT		BIT(31)
234da80aa52SAntoine Tenart 
235da80aa52SAntoine Tenart /* MACSEC_SAM_CP_TAG */
236da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_MAP_TBL(x)			(x)
237da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_MAP_TBL_M			GENMASK(23, 0)
238da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_DEF_UP(x)			((x) << 24)
239da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_DEF_UP_M			GENMASK(26, 24)
240da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_STAG_UP_EN			BIT(27)
241da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_QTAG_UP_EN			BIT(28)
242da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_PARSE_QINQ			BIT(29)
243da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_PARSE_STAG			BIT(30)
244da80aa52SAntoine Tenart #define MSCC_MS_SAM_CP_TAG_PARSE_QTAG			BIT(31)
245da80aa52SAntoine Tenart 
246da80aa52SAntoine Tenart /* MACSEC_SAM_NM_FLOW_NCP */
247da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_UNTAGGED_FLOW_TYPE(x)	(x)
248da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_UNTAGGED_DEST_PORT(x)	((x) << 2)
249da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_UNTAGGED_DROP_ACTION(x)	((x) << 6)
250da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_TAGGED_FLOW_TYPE(x)	((x) << 8)
251da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_TAGGED_DEST_PORT(x)	((x) << 10)
252da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_TAGGED_DROP_ACTION(x)	((x) << 14)
253da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_BADTAG_FLOW_TYPE(x)	((x) << 16)
254da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_BADTAG_DEST_PORT(x)	((x) << 18)
255da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_BADTAG_DROP_ACTION(x)	((x) << 22)
256da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_KAY_FLOW_TYPE(x)	((x) << 24)
257da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_KAY_DEST_PORT(x)	((x) << 26)
258da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_NCP_KAY_DROP_ACTION(x)	((x) << 30)
259da80aa52SAntoine Tenart 
260da80aa52SAntoine Tenart /* MACSEC_SAM_NM_FLOW_CP */
261da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_UNTAGGED_FLOW_TYPE(x)	(x)
262da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_UNTAGGED_DEST_PORT(x)	((x) << 2)
263da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_UNTAGGED_DROP_ACTION(x)	((x) << 6)
264da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_TAGGED_FLOW_TYPE(x)	((x) << 8)
265da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_TAGGED_DEST_PORT(x)	((x) << 10)
266da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_TAGGED_DROP_ACTION(x)	((x) << 14)
267da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_BADTAG_FLOW_TYPE(x)	((x) << 16)
268da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_BADTAG_DEST_PORT(x)	((x) << 18)
269da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_BADTAG_DROP_ACTION(x)	((x) << 22)
270da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_KAY_FLOW_TYPE(x)		((x) << 24)
271da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_KAY_DEST_PORT(x)		((x) << 26)
272da80aa52SAntoine Tenart #define MSCC_MS_SAM_NM_FLOW_CP_KAY_DROP_ACTION(x)	((x) << 30)
273da80aa52SAntoine Tenart 
274da80aa52SAntoine Tenart /* MACSEC_MISC_CONTROL */
275da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_MC_LATENCY_FIX(x)		(x)
276da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_MC_LATENCY_FIX_M		GENMASK(5, 0)
277da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_STATIC_BYPASS		BIT(8)
278da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_NM_MACSEC_EN		BIT(9)
279da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_VALIDATE_FRAMES(x)		((x) << 10)
280da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_VALIDATE_FRAMES_M		GENMASK(11, 10)
281da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_XFORM_REC_SIZE(x)		((x) << 24)
282da80aa52SAntoine Tenart #define MSCC_MS_MISC_CONTROL_XFORM_REC_SIZE_M		GENMASK(25, 24)
283da80aa52SAntoine Tenart 
284da80aa52SAntoine Tenart /* MACSEC_COUNT_CONTROL */
285da80aa52SAntoine Tenart #define MSCC_MS_COUNT_CONTROL_RESET_ALL			BIT(0)
286da80aa52SAntoine Tenart #define MSCC_MS_COUNT_CONTROL_DEBUG_ACCESS		BIT(1)
287da80aa52SAntoine Tenart #define MSCC_MS_COUNT_CONTROL_SATURATE_CNTRS		BIT(2)
288da80aa52SAntoine Tenart #define MSCC_MS_COUNT_CONTROL_AUTO_CNTR_RESET		BIT(3)
289da80aa52SAntoine Tenart 
290da80aa52SAntoine Tenart /* MACSEC_PARAMS2_IG_CC_CONTROL */
291da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CC_CONTROL_NON_MATCH_CTRL_ACT	BIT(14)
292da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CC_CONTROL_NON_MATCH_ACT	BIT(15)
293da80aa52SAntoine Tenart 
294da80aa52SAntoine Tenart /* MACSEC_PARAMS2_IG_CP_TAG */
295da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_MAP_TBL(x)		(x)
296da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_MAP_TBL_M		GENMASK(23, 0)
297da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_DEF_UP(x)		((x) << 24)
298da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_DEF_UP_M		GENMASK(26, 24)
299da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_STAG_UP_EN		BIT(27)
300da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_QTAG_UP_EN		BIT(28)
301da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_PARSE_QINQ		BIT(29)
302da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_PARSE_STAG		BIT(30)
303da80aa52SAntoine Tenart #define MSCC_MS_PARAMS2_IG_CP_TAG_PARSE_QTAG		BIT(31)
304da80aa52SAntoine Tenart 
305da80aa52SAntoine Tenart /* MACSEC_VLAN_MTU_CHECK */
306da80aa52SAntoine Tenart #define MSCC_MS_VLAN_MTU_CHECK_MTU_COMPARE(x)		(x)
307da80aa52SAntoine Tenart #define MSCC_MS_VLAN_MTU_CHECK_MTU_COMPARE_M		GENMASK(14, 0)
308da80aa52SAntoine Tenart #define MSCC_MS_VLAN_MTU_CHECK_MTU_COMP_DROP		BIT(15)
309da80aa52SAntoine Tenart 
310da80aa52SAntoine Tenart /* MACSEC_NON_VLAN_MTU_CHECK */
311da80aa52SAntoine Tenart #define MSCC_MS_NON_VLAN_MTU_CHECK_NV_MTU_COMPARE(x)	(x)
312da80aa52SAntoine Tenart #define MSCC_MS_NON_VLAN_MTU_CHECK_NV_MTU_COMPARE_M	GENMASK(14, 0)
313da80aa52SAntoine Tenart #define MSCC_MS_NON_VLAN_MTU_CHECK_NV_MTU_COMP_DROP	BIT(15)
314da80aa52SAntoine Tenart 
315da80aa52SAntoine Tenart /* MACSEC_PP_CTRL */
316da80aa52SAntoine Tenart #define MSCC_MS_PP_CTRL_MACSEC_OCTET_INCR_MODE		BIT(0)
317da80aa52SAntoine Tenart 
318da80aa52SAntoine Tenart /* MACSEC_INTR_CTRL_STATUS */
319da80aa52SAntoine Tenart #define MSCC_MS_INTR_CTRL_STATUS_INTR_CLR_STATUS(x)	(x)
320da80aa52SAntoine Tenart #define MSCC_MS_INTR_CTRL_STATUS_INTR_CLR_STATUS_M	GENMASK(15, 0)
321da80aa52SAntoine Tenart #define MSCC_MS_INTR_CTRL_STATUS_INTR_ENABLE(x)		((x) << 16)
322da80aa52SAntoine Tenart #define MSCC_MS_INTR_CTRL_STATUS_INTR_ENABLE_M		GENMASK(31, 16)
323da80aa52SAntoine Tenart #define MACSEC_INTR_CTRL_STATUS_ROLLOVER		BIT(5)
324da80aa52SAntoine Tenart 
3250b92f897SAntoine Tenart #endif /* _MSCC_PHY_MACSEC_H_ */
326