1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2020 Marvell International Ltd.
4  */
5 
6 #ifndef __CVMX_MIO_DEFS_H__
7 #define __CVMX_MIO_DEFS_H__
8 
9 #define CVMX_MIO_PTP_CLOCK_CFG	  (0x0001070000000F00ull)
10 #define CVMX_MIO_PTP_EVT_CNT	  (0x0001070000000F28ull)
11 #define CVMX_MIO_RST_BOOT	  (0x0001180000001600ull)
12 #define CVMX_MIO_RST_CTLX(offset) (0x0001180000001618ull + ((offset) & 1))
13 #define CVMX_MIO_QLMX_CFG(offset) (0x0001180000001590ull + ((offset) & 7) * 8)
14 
15 /**
16  * cvmx_mio_ptp_clock_cfg
17  *
18  * This register configures the timestamp architecture.
19  *
20  */
21 union cvmx_mio_ptp_clock_cfg {
22 	u64 u64;
23 	struct cvmx_mio_ptp_clock_cfg_s {
24 		u64 reserved_40_63 : 24;
25 		u64 ext_clk_edge : 2;
26 		u64 ckout_out4 : 1;
27 		u64 pps_out : 5;
28 		u64 pps_inv : 1;
29 		u64 pps_en : 1;
30 		u64 ckout_out : 4;
31 		u64 ckout_inv : 1;
32 		u64 ckout_en : 1;
33 		u64 evcnt_in : 6;
34 		u64 evcnt_edge : 1;
35 		u64 evcnt_en : 1;
36 		u64 tstmp_in : 6;
37 		u64 tstmp_edge : 1;
38 		u64 tstmp_en : 1;
39 		u64 ext_clk_in : 6;
40 		u64 ext_clk_en : 1;
41 		u64 ptp_en : 1;
42 	} s;
43 	struct cvmx_mio_ptp_clock_cfg_cn61xx {
44 		u64 reserved_42_63 : 22;
45 		u64 pps : 1;
46 		u64 ckout : 1;
47 		u64 ext_clk_edge : 2;
48 		u64 ckout_out4 : 1;
49 		u64 pps_out : 5;
50 		u64 pps_inv : 1;
51 		u64 pps_en : 1;
52 		u64 ckout_out : 4;
53 		u64 ckout_inv : 1;
54 		u64 ckout_en : 1;
55 		u64 evcnt_in : 6;
56 		u64 evcnt_edge : 1;
57 		u64 evcnt_en : 1;
58 		u64 tstmp_in : 6;
59 		u64 tstmp_edge : 1;
60 		u64 tstmp_en : 1;
61 		u64 ext_clk_in : 6;
62 		u64 ext_clk_en : 1;
63 		u64 ptp_en : 1;
64 	} cn61xx;
65 	struct cvmx_mio_ptp_clock_cfg_cn63xx {
66 		u64 reserved_24_63 : 40;
67 		u64 evcnt_in : 6;
68 		u64 evcnt_edge : 1;
69 		u64 evcnt_en : 1;
70 		u64 tstmp_in : 6;
71 		u64 tstmp_edge : 1;
72 		u64 tstmp_en : 1;
73 		u64 ext_clk_in : 6;
74 		u64 ext_clk_en : 1;
75 		u64 ptp_en : 1;
76 	} cn63xx;
77 	struct cvmx_mio_ptp_clock_cfg_cn63xx cn63xxp1;
78 	struct cvmx_mio_ptp_clock_cfg_s cn66xx;
79 	struct cvmx_mio_ptp_clock_cfg_cn61xx cn68xx;
80 	struct cvmx_mio_ptp_clock_cfg_cn63xx cn68xxp1;
81 	struct cvmx_mio_ptp_clock_cfg_cn70xx {
82 		u64 reserved_42_63 : 22;
83 		u64 ckout : 1;
84 		u64 pps : 1;
85 		u64 ext_clk_edge : 2;
86 		u64 reserved_32_37 : 6;
87 		u64 pps_inv : 1;
88 		u64 pps_en : 1;
89 		u64 reserved_26_29 : 4;
90 		u64 ckout_inv : 1;
91 		u64 ckout_en : 1;
92 		u64 evcnt_in : 6;
93 		u64 evcnt_edge : 1;
94 		u64 evcnt_en : 1;
95 		u64 tstmp_in : 6;
96 		u64 tstmp_edge : 1;
97 		u64 tstmp_en : 1;
98 		u64 ext_clk_in : 6;
99 		u64 ext_clk_en : 1;
100 		u64 ptp_en : 1;
101 	} cn70xx;
102 	struct cvmx_mio_ptp_clock_cfg_cn70xx cn70xxp1;
103 	struct cvmx_mio_ptp_clock_cfg_cn70xx cn73xx;
104 	struct cvmx_mio_ptp_clock_cfg_cn70xx cn78xx;
105 	struct cvmx_mio_ptp_clock_cfg_cn70xx cn78xxp1;
106 	struct cvmx_mio_ptp_clock_cfg_cn61xx cnf71xx;
107 	struct cvmx_mio_ptp_clock_cfg_cn70xx cnf75xx;
108 };
109 
110 typedef union cvmx_mio_ptp_clock_cfg cvmx_mio_ptp_clock_cfg_t;
111 
112 /**
113  * cvmx_mio_ptp_evt_cnt
114  *
115  * This register contains the PTP event counter.
116  *
117  */
118 union cvmx_mio_ptp_evt_cnt {
119 	u64 u64;
120 	struct cvmx_mio_ptp_evt_cnt_s {
121 		u64 cntr : 64;
122 	} s;
123 	struct cvmx_mio_ptp_evt_cnt_s cn61xx;
124 	struct cvmx_mio_ptp_evt_cnt_s cn63xx;
125 	struct cvmx_mio_ptp_evt_cnt_s cn63xxp1;
126 	struct cvmx_mio_ptp_evt_cnt_s cn66xx;
127 	struct cvmx_mio_ptp_evt_cnt_s cn68xx;
128 	struct cvmx_mio_ptp_evt_cnt_s cn68xxp1;
129 	struct cvmx_mio_ptp_evt_cnt_s cn70xx;
130 	struct cvmx_mio_ptp_evt_cnt_s cn70xxp1;
131 	struct cvmx_mio_ptp_evt_cnt_s cn73xx;
132 	struct cvmx_mio_ptp_evt_cnt_s cn78xx;
133 	struct cvmx_mio_ptp_evt_cnt_s cn78xxp1;
134 	struct cvmx_mio_ptp_evt_cnt_s cnf71xx;
135 	struct cvmx_mio_ptp_evt_cnt_s cnf75xx;
136 };
137 
138 typedef union cvmx_mio_ptp_evt_cnt cvmx_mio_ptp_evt_cnt_t;
139 
140 /**
141  * cvmx_mio_rst_boot
142  *
143  * Notes:
144  * JTCSRDIS, EJTAGDIS, ROMEN reset to 1 in authentik mode; in all other modes they reset to 0.
145  *
146  */
147 union cvmx_mio_rst_boot {
148 	u64 u64;
149 	struct cvmx_mio_rst_boot_s {
150 		u64 chipkill : 1;
151 		u64 jtcsrdis : 1;
152 		u64 ejtagdis : 1;
153 		u64 romen : 1;
154 		u64 ckill_ppdis : 1;
155 		u64 jt_tstmode : 1;
156 		u64 reserved_50_57 : 8;
157 		u64 lboot_ext : 2;
158 		u64 reserved_44_47 : 4;
159 		u64 qlm4_spd : 4;
160 		u64 qlm3_spd : 4;
161 		u64 c_mul : 6;
162 		u64 pnr_mul : 6;
163 		u64 qlm2_spd : 4;
164 		u64 qlm1_spd : 4;
165 		u64 qlm0_spd : 4;
166 		u64 lboot : 10;
167 		u64 rboot : 1;
168 		u64 rboot_pin : 1;
169 	} s;
170 	struct cvmx_mio_rst_boot_cn61xx {
171 		u64 chipkill : 1;
172 		u64 jtcsrdis : 1;
173 		u64 ejtagdis : 1;
174 		u64 romen : 1;
175 		u64 ckill_ppdis : 1;
176 		u64 jt_tstmode : 1;
177 		u64 reserved_50_57 : 8;
178 		u64 lboot_ext : 2;
179 		u64 reserved_36_47 : 12;
180 		u64 c_mul : 6;
181 		u64 pnr_mul : 6;
182 		u64 qlm2_spd : 4;
183 		u64 qlm1_spd : 4;
184 		u64 qlm0_spd : 4;
185 		u64 lboot : 10;
186 		u64 rboot : 1;
187 		u64 rboot_pin : 1;
188 	} cn61xx;
189 	struct cvmx_mio_rst_boot_cn63xx {
190 		u64 reserved_36_63 : 28;
191 		u64 c_mul : 6;
192 		u64 pnr_mul : 6;
193 		u64 qlm2_spd : 4;
194 		u64 qlm1_spd : 4;
195 		u64 qlm0_spd : 4;
196 		u64 lboot : 10;
197 		u64 rboot : 1;
198 		u64 rboot_pin : 1;
199 	} cn63xx;
200 	struct cvmx_mio_rst_boot_cn63xx cn63xxp1;
201 	struct cvmx_mio_rst_boot_cn66xx {
202 		u64 chipkill : 1;
203 		u64 jtcsrdis : 1;
204 		u64 ejtagdis : 1;
205 		u64 romen : 1;
206 		u64 ckill_ppdis : 1;
207 		u64 reserved_50_58 : 9;
208 		u64 lboot_ext : 2;
209 		u64 reserved_36_47 : 12;
210 		u64 c_mul : 6;
211 		u64 pnr_mul : 6;
212 		u64 qlm2_spd : 4;
213 		u64 qlm1_spd : 4;
214 		u64 qlm0_spd : 4;
215 		u64 lboot : 10;
216 		u64 rboot : 1;
217 		u64 rboot_pin : 1;
218 	} cn66xx;
219 	struct cvmx_mio_rst_boot_cn68xx {
220 		u64 reserved_59_63 : 5;
221 		u64 jt_tstmode : 1;
222 		u64 reserved_44_57 : 14;
223 		u64 qlm4_spd : 4;
224 		u64 qlm3_spd : 4;
225 		u64 c_mul : 6;
226 		u64 pnr_mul : 6;
227 		u64 qlm2_spd : 4;
228 		u64 qlm1_spd : 4;
229 		u64 qlm0_spd : 4;
230 		u64 lboot : 10;
231 		u64 rboot : 1;
232 		u64 rboot_pin : 1;
233 	} cn68xx;
234 	struct cvmx_mio_rst_boot_cn68xxp1 {
235 		u64 reserved_44_63 : 20;
236 		u64 qlm4_spd : 4;
237 		u64 qlm3_spd : 4;
238 		u64 c_mul : 6;
239 		u64 pnr_mul : 6;
240 		u64 qlm2_spd : 4;
241 		u64 qlm1_spd : 4;
242 		u64 qlm0_spd : 4;
243 		u64 lboot : 10;
244 		u64 rboot : 1;
245 		u64 rboot_pin : 1;
246 	} cn68xxp1;
247 	struct cvmx_mio_rst_boot_cn61xx cnf71xx;
248 };
249 
250 typedef union cvmx_mio_rst_boot cvmx_mio_rst_boot_t;
251 
252 /**
253  * cvmx_mio_rst_ctl#
254  *
255  * Notes:
256  * GEN1_Only mode is enabled for PEM0 when QLM1_SPD[0] is set or when sclk < 550Mhz.
257  * GEN1_Only mode is enabled for PEM1 when QLM1_SPD[1] is set or when sclk < 550Mhz.
258  */
259 union cvmx_mio_rst_ctlx {
260 	u64 u64;
261 	struct cvmx_mio_rst_ctlx_s {
262 		u64 reserved_13_63 : 51;
263 		u64 in_rev_ln : 1;
264 		u64 rev_lanes : 1;
265 		u64 gen1_only : 1;
266 		u64 prst_link : 1;
267 		u64 rst_done : 1;
268 		u64 rst_link : 1;
269 		u64 host_mode : 1;
270 		u64 prtmode : 2;
271 		u64 rst_drv : 1;
272 		u64 rst_rcv : 1;
273 		u64 rst_chip : 1;
274 		u64 rst_val : 1;
275 	} s;
276 	struct cvmx_mio_rst_ctlx_s cn61xx;
277 	struct cvmx_mio_rst_ctlx_cn63xx {
278 		u64 reserved_10_63 : 54;
279 		u64 prst_link : 1;
280 		u64 rst_done : 1;
281 		u64 rst_link : 1;
282 		u64 host_mode : 1;
283 		u64 prtmode : 2;
284 		u64 rst_drv : 1;
285 		u64 rst_rcv : 1;
286 		u64 rst_chip : 1;
287 		u64 rst_val : 1;
288 	} cn63xx;
289 	struct cvmx_mio_rst_ctlx_cn63xxp1 {
290 		u64 reserved_9_63 : 55;
291 		u64 rst_done : 1;
292 		u64 rst_link : 1;
293 		u64 host_mode : 1;
294 		u64 prtmode : 2;
295 		u64 rst_drv : 1;
296 		u64 rst_rcv : 1;
297 		u64 rst_chip : 1;
298 		u64 rst_val : 1;
299 	} cn63xxp1;
300 	struct cvmx_mio_rst_ctlx_cn63xx cn66xx;
301 	struct cvmx_mio_rst_ctlx_cn63xx cn68xx;
302 	struct cvmx_mio_rst_ctlx_cn63xx cn68xxp1;
303 	struct cvmx_mio_rst_ctlx_s cnf71xx;
304 };
305 
306 typedef union cvmx_mio_rst_ctlx cvmx_mio_rst_ctlx_t;
307 
308 /**
309  * cvmx_mio_qlm#_cfg
310  *
311  * Notes:
312  * Certain QLM_SPD is valid only for certain QLM_CFG configuration, refer to HRM for valid
313  * combinations.  These csrs are reset only on COLD_RESET.  The Reset values for QLM_SPD and QLM_CFG
314  * are as follows:               MIO_QLM0_CFG  SPD=F, CFG=2 SGMII (AGX0)
315  *                               MIO_QLM1_CFG  SPD=0, CFG=1 PCIE 2x1 (PEM0/PEM1)
316  */
317 union cvmx_mio_qlmx_cfg {
318 	u64 u64;
319 	struct cvmx_mio_qlmx_cfg_s {
320 		u64 reserved_15_63 : 49;
321 		u64 prtmode : 1;
322 		u64 reserved_12_13 : 2;
323 		u64 qlm_spd : 4;
324 		u64 reserved_4_7 : 4;
325 		u64 qlm_cfg : 4;
326 	} s;
327 	struct cvmx_mio_qlmx_cfg_cn61xx {
328 		u64 reserved_15_63 : 49;
329 		u64 prtmode : 1;
330 		u64 reserved_12_13 : 2;
331 		u64 qlm_spd : 4;
332 		u64 reserved_2_7 : 6;
333 		u64 qlm_cfg : 2;
334 	} cn61xx;
335 	struct cvmx_mio_qlmx_cfg_cn66xx {
336 		u64 reserved_12_63 : 52;
337 		u64 qlm_spd : 4;
338 		u64 reserved_4_7 : 4;
339 		u64 qlm_cfg : 4;
340 	} cn66xx;
341 	struct cvmx_mio_qlmx_cfg_cn68xx {
342 		u64 reserved_12_63 : 52;
343 		u64 qlm_spd : 4;
344 		u64 reserved_3_7 : 5;
345 		u64 qlm_cfg : 3;
346 	} cn68xx;
347 	struct cvmx_mio_qlmx_cfg_cn68xx cn68xxp1;
348 	struct cvmx_mio_qlmx_cfg_cn61xx cnf71xx;
349 };
350 
351 typedef union cvmx_mio_qlmx_cfg cvmx_mio_qlmx_cfg_t;
352 
353 #endif
354