blob: 3b81b83f57e08c846291a1496f70115005130c69 [file] [log] [blame]
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001/*
2 * AMD 10Gb Ethernet driver
3 *
4 * This file is available to you under your choice of the following two
5 * licenses:
6 *
7 * License 1: GPLv2
8 *
Lendacky, Thomasc3727d62016-02-17 11:49:16 -06009 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -050010 *
11 * This file is free software; you may copy, redistribute and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 2 of the License, or (at
14 * your option) any later version.
15 *
16 * This file is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 *
24 * This file incorporates work covered by the following copyright and
25 * permission notice:
26 * The Synopsys DWC ETHER XGMAC Software Driver and documentation
27 * (hereinafter "Software") is an unsupported proprietary work of Synopsys,
28 * Inc. unless otherwise expressly agreed to in writing between Synopsys
29 * and you.
30 *
31 * The Software IS NOT an item of Licensed Software or Licensed Product
32 * under any End User Software License Agreement or Agreement for Licensed
33 * Product with Synopsys or any supplement thereto. Permission is hereby
34 * granted, free of charge, to any person obtaining a copy of this software
35 * annotated with this license and the Software, to deal in the Software
36 * without restriction, including without limitation the rights to use,
37 * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
38 * of the Software, and to permit persons to whom the Software is furnished
39 * to do so, subject to the following conditions:
40 *
41 * The above copyright notice and this permission notice shall be included
42 * in all copies or substantial portions of the Software.
43 *
44 * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
45 * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
46 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
47 * PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
48 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
49 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
50 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
51 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
52 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
54 * THE POSSIBILITY OF SUCH DAMAGE.
55 *
56 *
57 * License 2: Modified BSD
58 *
Lendacky, Thomasc3727d62016-02-17 11:49:16 -060059 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -050060 * All rights reserved.
61 *
62 * Redistribution and use in source and binary forms, with or without
63 * modification, are permitted provided that the following conditions are met:
64 * * Redistributions of source code must retain the above copyright
65 * notice, this list of conditions and the following disclaimer.
66 * * Redistributions in binary form must reproduce the above copyright
67 * notice, this list of conditions and the following disclaimer in the
68 * documentation and/or other materials provided with the distribution.
69 * * Neither the name of Advanced Micro Devices, Inc. nor the
70 * names of its contributors may be used to endorse or promote products
71 * derived from this software without specific prior written permission.
72 *
73 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
74 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
75 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
76 * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
77 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
78 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
79 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
80 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
81 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
82 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
83 *
84 * This file incorporates work covered by the following copyright and
85 * permission notice:
86 * The Synopsys DWC ETHER XGMAC Software Driver and documentation
87 * (hereinafter "Software") is an unsupported proprietary work of Synopsys,
88 * Inc. unless otherwise expressly agreed to in writing between Synopsys
89 * and you.
90 *
91 * The Software IS NOT an item of Licensed Software or Licensed Product
92 * under any End User Software License Agreement or Agreement for Licensed
93 * Product with Synopsys or any supplement thereto. Permission is hereby
94 * granted, free of charge, to any person obtaining a copy of this software
95 * annotated with this license and the Software, to deal in the Software
96 * without restriction, including without limitation the rights to use,
97 * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
98 * of the Software, and to permit persons to whom the Software is furnished
99 * to do so, subject to the following conditions:
100 *
101 * The above copyright notice and this permission notice shall be included
102 * in all copies or substantial portions of the Software.
103 *
104 * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
105 * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
106 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
107 * PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
108 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
109 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
110 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
111 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
112 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
113 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
114 * THE POSSIBILITY OF SUCH DAMAGE.
115 */
116
117#ifndef __XGBE_COMMON_H__
118#define __XGBE_COMMON_H__
119
120/* DMA register offsets */
121#define DMA_MR 0x3000
122#define DMA_SBMR 0x3004
123#define DMA_ISR 0x3008
124#define DMA_AXIARCR 0x3010
125#define DMA_AXIAWCR 0x3018
126#define DMA_DSR0 0x3020
127#define DMA_DSR1 0x3024
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500128
129/* DMA register entry bit positions and sizes */
130#define DMA_AXIARCR_DRC_INDEX 0
131#define DMA_AXIARCR_DRC_WIDTH 4
132#define DMA_AXIARCR_DRD_INDEX 4
133#define DMA_AXIARCR_DRD_WIDTH 2
134#define DMA_AXIARCR_TEC_INDEX 8
135#define DMA_AXIARCR_TEC_WIDTH 4
136#define DMA_AXIARCR_TED_INDEX 12
137#define DMA_AXIARCR_TED_WIDTH 2
138#define DMA_AXIARCR_THC_INDEX 16
139#define DMA_AXIARCR_THC_WIDTH 4
140#define DMA_AXIARCR_THD_INDEX 20
141#define DMA_AXIARCR_THD_WIDTH 2
142#define DMA_AXIAWCR_DWC_INDEX 0
143#define DMA_AXIAWCR_DWC_WIDTH 4
144#define DMA_AXIAWCR_DWD_INDEX 4
145#define DMA_AXIAWCR_DWD_WIDTH 2
146#define DMA_AXIAWCR_RPC_INDEX 8
147#define DMA_AXIAWCR_RPC_WIDTH 4
148#define DMA_AXIAWCR_RPD_INDEX 12
149#define DMA_AXIAWCR_RPD_WIDTH 2
150#define DMA_AXIAWCR_RHC_INDEX 16
151#define DMA_AXIAWCR_RHC_WIDTH 4
152#define DMA_AXIAWCR_RHD_INDEX 20
153#define DMA_AXIAWCR_RHD_WIDTH 2
154#define DMA_AXIAWCR_TDC_INDEX 24
155#define DMA_AXIAWCR_TDC_WIDTH 4
156#define DMA_AXIAWCR_TDD_INDEX 28
157#define DMA_AXIAWCR_TDD_WIDTH 2
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500158#define DMA_ISR_MACIS_INDEX 17
159#define DMA_ISR_MACIS_WIDTH 1
160#define DMA_ISR_MTLIS_INDEX 16
161#define DMA_ISR_MTLIS_WIDTH 1
Lendacky, Thomas4c70dd82016-11-10 17:10:17 -0600162#define DMA_MR_INTM_INDEX 12
163#define DMA_MR_INTM_WIDTH 2
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500164#define DMA_MR_SWR_INDEX 0
165#define DMA_MR_SWR_WIDTH 1
166#define DMA_SBMR_EAME_INDEX 11
167#define DMA_SBMR_EAME_WIDTH 1
Lendacky, Thomas9867e8f2014-07-02 13:04:46 -0500168#define DMA_SBMR_BLEN_256_INDEX 7
169#define DMA_SBMR_BLEN_256_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500170#define DMA_SBMR_UNDEF_INDEX 0
171#define DMA_SBMR_UNDEF_WIDTH 1
172
Lendacky, Thomas16edd342014-11-20 11:03:32 -0600173/* DMA register values */
174#define DMA_DSR_RPS_WIDTH 4
175#define DMA_DSR_TPS_WIDTH 4
176#define DMA_DSR_Q_WIDTH (DMA_DSR_RPS_WIDTH + DMA_DSR_TPS_WIDTH)
177#define DMA_DSR0_RPS_START 8
178#define DMA_DSR0_TPS_START 12
179#define DMA_DSRX_FIRST_QUEUE 3
180#define DMA_DSRX_INC 4
181#define DMA_DSRX_QPR 4
182#define DMA_DSRX_RPS_START 0
183#define DMA_DSRX_TPS_START 4
184#define DMA_TPS_STOPPED 0x00
185#define DMA_TPS_SUSPENDED 0x06
186
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500187/* DMA channel register offsets
188 * Multiple channels can be active. The first channel has registers
189 * that begin at 0x3100. Each subsequent channel has registers that
190 * are accessed using an offset of 0x80 from the previous channel.
191 */
192#define DMA_CH_BASE 0x3100
193#define DMA_CH_INC 0x80
194
195#define DMA_CH_CR 0x00
196#define DMA_CH_TCR 0x04
197#define DMA_CH_RCR 0x08
198#define DMA_CH_TDLR_HI 0x10
199#define DMA_CH_TDLR_LO 0x14
200#define DMA_CH_RDLR_HI 0x18
201#define DMA_CH_RDLR_LO 0x1c
202#define DMA_CH_TDTR_LO 0x24
203#define DMA_CH_RDTR_LO 0x2c
204#define DMA_CH_TDRLR 0x30
205#define DMA_CH_RDRLR 0x34
206#define DMA_CH_IER 0x38
207#define DMA_CH_RIWT 0x3c
208#define DMA_CH_CATDR_LO 0x44
209#define DMA_CH_CARDR_LO 0x4c
210#define DMA_CH_CATBR_HI 0x50
211#define DMA_CH_CATBR_LO 0x54
212#define DMA_CH_CARBR_HI 0x58
213#define DMA_CH_CARBR_LO 0x5c
214#define DMA_CH_SR 0x60
215
216/* DMA channel register entry bit positions and sizes */
217#define DMA_CH_CR_PBLX8_INDEX 16
218#define DMA_CH_CR_PBLX8_WIDTH 1
Lendacky, Thomas174fd252014-11-04 16:06:50 -0600219#define DMA_CH_CR_SPH_INDEX 24
220#define DMA_CH_CR_SPH_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500221#define DMA_CH_IER_AIE_INDEX 15
222#define DMA_CH_IER_AIE_WIDTH 1
223#define DMA_CH_IER_FBEE_INDEX 12
224#define DMA_CH_IER_FBEE_WIDTH 1
225#define DMA_CH_IER_NIE_INDEX 16
226#define DMA_CH_IER_NIE_WIDTH 1
227#define DMA_CH_IER_RBUE_INDEX 7
228#define DMA_CH_IER_RBUE_WIDTH 1
229#define DMA_CH_IER_RIE_INDEX 6
230#define DMA_CH_IER_RIE_WIDTH 1
231#define DMA_CH_IER_RSE_INDEX 8
232#define DMA_CH_IER_RSE_WIDTH 1
233#define DMA_CH_IER_TBUE_INDEX 2
234#define DMA_CH_IER_TBUE_WIDTH 1
235#define DMA_CH_IER_TIE_INDEX 0
236#define DMA_CH_IER_TIE_WIDTH 1
237#define DMA_CH_IER_TXSE_INDEX 1
238#define DMA_CH_IER_TXSE_WIDTH 1
239#define DMA_CH_RCR_PBL_INDEX 16
240#define DMA_CH_RCR_PBL_WIDTH 6
241#define DMA_CH_RCR_RBSZ_INDEX 1
242#define DMA_CH_RCR_RBSZ_WIDTH 14
243#define DMA_CH_RCR_SR_INDEX 0
244#define DMA_CH_RCR_SR_WIDTH 1
245#define DMA_CH_RIWT_RWT_INDEX 0
246#define DMA_CH_RIWT_RWT_WIDTH 8
247#define DMA_CH_SR_FBE_INDEX 12
248#define DMA_CH_SR_FBE_WIDTH 1
249#define DMA_CH_SR_RBU_INDEX 7
250#define DMA_CH_SR_RBU_WIDTH 1
251#define DMA_CH_SR_RI_INDEX 6
252#define DMA_CH_SR_RI_WIDTH 1
253#define DMA_CH_SR_RPS_INDEX 8
254#define DMA_CH_SR_RPS_WIDTH 1
255#define DMA_CH_SR_TBU_INDEX 2
256#define DMA_CH_SR_TBU_WIDTH 1
257#define DMA_CH_SR_TI_INDEX 0
258#define DMA_CH_SR_TI_WIDTH 1
259#define DMA_CH_SR_TPS_INDEX 1
260#define DMA_CH_SR_TPS_WIDTH 1
261#define DMA_CH_TCR_OSP_INDEX 4
262#define DMA_CH_TCR_OSP_WIDTH 1
263#define DMA_CH_TCR_PBL_INDEX 16
264#define DMA_CH_TCR_PBL_WIDTH 6
265#define DMA_CH_TCR_ST_INDEX 0
266#define DMA_CH_TCR_ST_WIDTH 1
267#define DMA_CH_TCR_TSE_INDEX 12
268#define DMA_CH_TCR_TSE_WIDTH 1
269
270/* DMA channel register values */
271#define DMA_OSP_DISABLE 0x00
272#define DMA_OSP_ENABLE 0x01
273#define DMA_PBL_1 1
274#define DMA_PBL_2 2
275#define DMA_PBL_4 4
276#define DMA_PBL_8 8
277#define DMA_PBL_16 16
278#define DMA_PBL_32 32
279#define DMA_PBL_64 64 /* 8 x 8 */
280#define DMA_PBL_128 128 /* 8 x 16 */
281#define DMA_PBL_256 256 /* 8 x 32 */
282#define DMA_PBL_X8_DISABLE 0x00
283#define DMA_PBL_X8_ENABLE 0x01
284
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500285/* MAC register offsets */
286#define MAC_TCR 0x0000
287#define MAC_RCR 0x0004
288#define MAC_PFR 0x0008
289#define MAC_WTR 0x000c
290#define MAC_HTR0 0x0010
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500291#define MAC_VLANTR 0x0050
292#define MAC_VLANHTR 0x0058
293#define MAC_VLANIR 0x0060
294#define MAC_IVLANIR 0x0064
295#define MAC_RETMR 0x006c
296#define MAC_Q0TFCR 0x0070
297#define MAC_RFCR 0x0090
298#define MAC_RQC0R 0x00a0
299#define MAC_RQC1R 0x00a4
300#define MAC_RQC2R 0x00a8
301#define MAC_RQC3R 0x00ac
302#define MAC_ISR 0x00b0
303#define MAC_IER 0x00b4
304#define MAC_RTSR 0x00b8
305#define MAC_PMTCSR 0x00c0
306#define MAC_RWKPFR 0x00c4
307#define MAC_LPICSR 0x00d0
308#define MAC_LPITCR 0x00d4
309#define MAC_VR 0x0110
310#define MAC_DR 0x0114
311#define MAC_HWF0R 0x011c
312#define MAC_HWF1R 0x0120
313#define MAC_HWF2R 0x0124
314#define MAC_GPIOCR 0x0278
315#define MAC_GPIOSR 0x027c
316#define MAC_MACA0HR 0x0300
317#define MAC_MACA0LR 0x0304
318#define MAC_MACA1HR 0x0308
319#define MAC_MACA1LR 0x030c
Lendacky, Thomas5b9dfe22014-11-04 16:07:02 -0600320#define MAC_RSSCR 0x0c80
321#define MAC_RSSAR 0x0c88
322#define MAC_RSSDR 0x0c8c
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500323#define MAC_TSCR 0x0d00
324#define MAC_SSIR 0x0d04
325#define MAC_STSR 0x0d08
326#define MAC_STNR 0x0d0c
327#define MAC_STSUR 0x0d10
328#define MAC_STNUR 0x0d14
329#define MAC_TSAR 0x0d18
330#define MAC_TSSR 0x0d20
331#define MAC_TXSNR 0x0d30
332#define MAC_TXSSR 0x0d34
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500333
334#define MAC_QTFCR_INC 4
335#define MAC_MACA_INC 4
Lendacky, Thomasb85e4d82014-06-24 16:19:29 -0500336#define MAC_HTR_INC 4
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500337
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500338#define MAC_RQC2_INC 4
339#define MAC_RQC2_Q_PER_REG 4
340
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500341/* MAC register entry bit positions and sizes */
342#define MAC_HWF0R_ADDMACADRSEL_INDEX 18
343#define MAC_HWF0R_ADDMACADRSEL_WIDTH 5
344#define MAC_HWF0R_ARPOFFSEL_INDEX 9
345#define MAC_HWF0R_ARPOFFSEL_WIDTH 1
346#define MAC_HWF0R_EEESEL_INDEX 13
347#define MAC_HWF0R_EEESEL_WIDTH 1
348#define MAC_HWF0R_GMIISEL_INDEX 1
349#define MAC_HWF0R_GMIISEL_WIDTH 1
350#define MAC_HWF0R_MGKSEL_INDEX 7
351#define MAC_HWF0R_MGKSEL_WIDTH 1
352#define MAC_HWF0R_MMCSEL_INDEX 8
353#define MAC_HWF0R_MMCSEL_WIDTH 1
354#define MAC_HWF0R_RWKSEL_INDEX 6
355#define MAC_HWF0R_RWKSEL_WIDTH 1
356#define MAC_HWF0R_RXCOESEL_INDEX 16
357#define MAC_HWF0R_RXCOESEL_WIDTH 1
358#define MAC_HWF0R_SAVLANINS_INDEX 27
359#define MAC_HWF0R_SAVLANINS_WIDTH 1
360#define MAC_HWF0R_SMASEL_INDEX 5
361#define MAC_HWF0R_SMASEL_WIDTH 1
362#define MAC_HWF0R_TSSEL_INDEX 12
363#define MAC_HWF0R_TSSEL_WIDTH 1
364#define MAC_HWF0R_TSSTSSEL_INDEX 25
365#define MAC_HWF0R_TSSTSSEL_WIDTH 2
366#define MAC_HWF0R_TXCOESEL_INDEX 14
367#define MAC_HWF0R_TXCOESEL_WIDTH 1
368#define MAC_HWF0R_VLHASH_INDEX 4
369#define MAC_HWF0R_VLHASH_WIDTH 1
Lendacky, Thomas386d3252015-03-20 11:50:22 -0500370#define MAC_HWF1R_ADDR64_INDEX 14
371#define MAC_HWF1R_ADDR64_WIDTH 2
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500372#define MAC_HWF1R_ADVTHWORD_INDEX 13
373#define MAC_HWF1R_ADVTHWORD_WIDTH 1
374#define MAC_HWF1R_DBGMEMA_INDEX 19
375#define MAC_HWF1R_DBGMEMA_WIDTH 1
376#define MAC_HWF1R_DCBEN_INDEX 16
377#define MAC_HWF1R_DCBEN_WIDTH 1
378#define MAC_HWF1R_HASHTBLSZ_INDEX 24
379#define MAC_HWF1R_HASHTBLSZ_WIDTH 3
380#define MAC_HWF1R_L3L4FNUM_INDEX 27
381#define MAC_HWF1R_L3L4FNUM_WIDTH 4
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500382#define MAC_HWF1R_NUMTC_INDEX 21
383#define MAC_HWF1R_NUMTC_WIDTH 3
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500384#define MAC_HWF1R_RSSEN_INDEX 20
385#define MAC_HWF1R_RSSEN_WIDTH 1
386#define MAC_HWF1R_RXFIFOSIZE_INDEX 0
387#define MAC_HWF1R_RXFIFOSIZE_WIDTH 5
388#define MAC_HWF1R_SPHEN_INDEX 17
389#define MAC_HWF1R_SPHEN_WIDTH 1
390#define MAC_HWF1R_TSOEN_INDEX 18
391#define MAC_HWF1R_TSOEN_WIDTH 1
392#define MAC_HWF1R_TXFIFOSIZE_INDEX 6
393#define MAC_HWF1R_TXFIFOSIZE_WIDTH 5
394#define MAC_HWF2R_AUXSNAPNUM_INDEX 28
395#define MAC_HWF2R_AUXSNAPNUM_WIDTH 3
396#define MAC_HWF2R_PPSOUTNUM_INDEX 24
397#define MAC_HWF2R_PPSOUTNUM_WIDTH 3
398#define MAC_HWF2R_RXCHCNT_INDEX 12
399#define MAC_HWF2R_RXCHCNT_WIDTH 4
400#define MAC_HWF2R_RXQCNT_INDEX 0
401#define MAC_HWF2R_RXQCNT_WIDTH 4
402#define MAC_HWF2R_TXCHCNT_INDEX 18
403#define MAC_HWF2R_TXCHCNT_WIDTH 4
404#define MAC_HWF2R_TXQCNT_INDEX 6
405#define MAC_HWF2R_TXQCNT_WIDTH 4
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500406#define MAC_IER_TSIE_INDEX 12
407#define MAC_IER_TSIE_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500408#define MAC_ISR_MMCRXIS_INDEX 9
409#define MAC_ISR_MMCRXIS_WIDTH 1
410#define MAC_ISR_MMCTXIS_INDEX 10
411#define MAC_ISR_MMCTXIS_WIDTH 1
412#define MAC_ISR_PMTIS_INDEX 4
413#define MAC_ISR_PMTIS_WIDTH 1
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500414#define MAC_ISR_TSIS_INDEX 12
415#define MAC_ISR_TSIS_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500416#define MAC_MACA1HR_AE_INDEX 31
417#define MAC_MACA1HR_AE_WIDTH 1
418#define MAC_PFR_HMC_INDEX 2
419#define MAC_PFR_HMC_WIDTH 1
Lendacky, Thomasb85e4d82014-06-24 16:19:29 -0500420#define MAC_PFR_HPF_INDEX 10
421#define MAC_PFR_HPF_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500422#define MAC_PFR_HUC_INDEX 1
423#define MAC_PFR_HUC_WIDTH 1
424#define MAC_PFR_PM_INDEX 4
425#define MAC_PFR_PM_WIDTH 1
426#define MAC_PFR_PR_INDEX 0
427#define MAC_PFR_PR_WIDTH 1
Lendacky, Thomas801c62d2014-06-24 16:19:24 -0500428#define MAC_PFR_VTFE_INDEX 16
429#define MAC_PFR_VTFE_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500430#define MAC_PMTCSR_MGKPKTEN_INDEX 1
431#define MAC_PMTCSR_MGKPKTEN_WIDTH 1
432#define MAC_PMTCSR_PWRDWN_INDEX 0
433#define MAC_PMTCSR_PWRDWN_WIDTH 1
434#define MAC_PMTCSR_RWKFILTRST_INDEX 31
435#define MAC_PMTCSR_RWKFILTRST_WIDTH 1
436#define MAC_PMTCSR_RWKPKTEN_INDEX 2
437#define MAC_PMTCSR_RWKPKTEN_WIDTH 1
438#define MAC_Q0TFCR_PT_INDEX 16
439#define MAC_Q0TFCR_PT_WIDTH 16
440#define MAC_Q0TFCR_TFE_INDEX 1
441#define MAC_Q0TFCR_TFE_WIDTH 1
442#define MAC_RCR_ACS_INDEX 1
443#define MAC_RCR_ACS_WIDTH 1
444#define MAC_RCR_CST_INDEX 2
445#define MAC_RCR_CST_WIDTH 1
446#define MAC_RCR_DCRCC_INDEX 3
447#define MAC_RCR_DCRCC_WIDTH 1
Lendacky, Thomas174fd252014-11-04 16:06:50 -0600448#define MAC_RCR_HDSMS_INDEX 12
449#define MAC_RCR_HDSMS_WIDTH 3
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500450#define MAC_RCR_IPC_INDEX 9
451#define MAC_RCR_IPC_WIDTH 1
452#define MAC_RCR_JE_INDEX 8
453#define MAC_RCR_JE_WIDTH 1
454#define MAC_RCR_LM_INDEX 10
455#define MAC_RCR_LM_WIDTH 1
456#define MAC_RCR_RE_INDEX 0
457#define MAC_RCR_RE_WIDTH 1
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500458#define MAC_RFCR_PFCE_INDEX 8
459#define MAC_RFCR_PFCE_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500460#define MAC_RFCR_RFE_INDEX 0
461#define MAC_RFCR_RFE_WIDTH 1
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500462#define MAC_RFCR_UP_INDEX 1
463#define MAC_RFCR_UP_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500464#define MAC_RQC0R_RXQ0EN_INDEX 0
465#define MAC_RQC0R_RXQ0EN_WIDTH 2
Lendacky, Thomas5b9dfe22014-11-04 16:07:02 -0600466#define MAC_RSSAR_ADDRT_INDEX 2
467#define MAC_RSSAR_ADDRT_WIDTH 1
468#define MAC_RSSAR_CT_INDEX 1
469#define MAC_RSSAR_CT_WIDTH 1
470#define MAC_RSSAR_OB_INDEX 0
471#define MAC_RSSAR_OB_WIDTH 1
472#define MAC_RSSAR_RSSIA_INDEX 8
473#define MAC_RSSAR_RSSIA_WIDTH 8
474#define MAC_RSSCR_IP2TE_INDEX 1
475#define MAC_RSSCR_IP2TE_WIDTH 1
476#define MAC_RSSCR_RSSE_INDEX 0
477#define MAC_RSSCR_RSSE_WIDTH 1
478#define MAC_RSSCR_TCP4TE_INDEX 2
479#define MAC_RSSCR_TCP4TE_WIDTH 1
480#define MAC_RSSCR_UDP4TE_INDEX 3
481#define MAC_RSSCR_UDP4TE_WIDTH 1
482#define MAC_RSSDR_DMCH_INDEX 0
483#define MAC_RSSDR_DMCH_WIDTH 4
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500484#define MAC_SSIR_SNSINC_INDEX 8
485#define MAC_SSIR_SNSINC_WIDTH 8
486#define MAC_SSIR_SSINC_INDEX 16
487#define MAC_SSIR_SSINC_WIDTH 8
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500488#define MAC_TCR_SS_INDEX 29
489#define MAC_TCR_SS_WIDTH 2
490#define MAC_TCR_TE_INDEX 0
491#define MAC_TCR_TE_WIDTH 1
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500492#define MAC_TSCR_AV8021ASMEN_INDEX 28
493#define MAC_TSCR_AV8021ASMEN_WIDTH 1
494#define MAC_TSCR_SNAPTYPSEL_INDEX 16
495#define MAC_TSCR_SNAPTYPSEL_WIDTH 2
496#define MAC_TSCR_TSADDREG_INDEX 5
497#define MAC_TSCR_TSADDREG_WIDTH 1
498#define MAC_TSCR_TSCFUPDT_INDEX 1
499#define MAC_TSCR_TSCFUPDT_WIDTH 1
500#define MAC_TSCR_TSCTRLSSR_INDEX 9
501#define MAC_TSCR_TSCTRLSSR_WIDTH 1
502#define MAC_TSCR_TSENA_INDEX 0
503#define MAC_TSCR_TSENA_WIDTH 1
504#define MAC_TSCR_TSENALL_INDEX 8
505#define MAC_TSCR_TSENALL_WIDTH 1
506#define MAC_TSCR_TSEVNTENA_INDEX 14
507#define MAC_TSCR_TSEVNTENA_WIDTH 1
508#define MAC_TSCR_TSINIT_INDEX 2
509#define MAC_TSCR_TSINIT_WIDTH 1
510#define MAC_TSCR_TSIPENA_INDEX 11
511#define MAC_TSCR_TSIPENA_WIDTH 1
512#define MAC_TSCR_TSIPV4ENA_INDEX 13
513#define MAC_TSCR_TSIPV4ENA_WIDTH 1
514#define MAC_TSCR_TSIPV6ENA_INDEX 12
515#define MAC_TSCR_TSIPV6ENA_WIDTH 1
516#define MAC_TSCR_TSMSTRENA_INDEX 15
517#define MAC_TSCR_TSMSTRENA_WIDTH 1
518#define MAC_TSCR_TSVER2ENA_INDEX 10
519#define MAC_TSCR_TSVER2ENA_WIDTH 1
520#define MAC_TSCR_TXTSSTSM_INDEX 24
521#define MAC_TSCR_TXTSSTSM_WIDTH 1
522#define MAC_TSSR_TXTSC_INDEX 15
523#define MAC_TSSR_TXTSC_WIDTH 1
524#define MAC_TXSNR_TXTSSTSMIS_INDEX 31
525#define MAC_TXSNR_TXTSSTSMIS_WIDTH 1
Lendacky, Thomas801c62d2014-06-24 16:19:24 -0500526#define MAC_VLANHTR_VLHT_INDEX 0
527#define MAC_VLANHTR_VLHT_WIDTH 16
Lendacky, Thomas6e5eed02014-06-24 16:19:12 -0500528#define MAC_VLANIR_VLTI_INDEX 20
529#define MAC_VLANIR_VLTI_WIDTH 1
530#define MAC_VLANIR_CSVL_INDEX 19
531#define MAC_VLANIR_CSVL_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500532#define MAC_VLANTR_DOVLTC_INDEX 20
533#define MAC_VLANTR_DOVLTC_WIDTH 1
534#define MAC_VLANTR_ERSVLM_INDEX 19
535#define MAC_VLANTR_ERSVLM_WIDTH 1
536#define MAC_VLANTR_ESVL_INDEX 18
537#define MAC_VLANTR_ESVL_WIDTH 1
Lendacky, Thomas801c62d2014-06-24 16:19:24 -0500538#define MAC_VLANTR_ETV_INDEX 16
539#define MAC_VLANTR_ETV_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500540#define MAC_VLANTR_EVLS_INDEX 21
541#define MAC_VLANTR_EVLS_WIDTH 2
542#define MAC_VLANTR_EVLRXS_INDEX 24
543#define MAC_VLANTR_EVLRXS_WIDTH 1
Lendacky, Thomas801c62d2014-06-24 16:19:24 -0500544#define MAC_VLANTR_VL_INDEX 0
545#define MAC_VLANTR_VL_WIDTH 16
546#define MAC_VLANTR_VTHM_INDEX 25
547#define MAC_VLANTR_VTHM_WIDTH 1
548#define MAC_VLANTR_VTIM_INDEX 17
549#define MAC_VLANTR_VTIM_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500550#define MAC_VR_DEVID_INDEX 8
551#define MAC_VR_DEVID_WIDTH 8
552#define MAC_VR_SNPSVER_INDEX 0
553#define MAC_VR_SNPSVER_WIDTH 8
554#define MAC_VR_USERVER_INDEX 16
555#define MAC_VR_USERVER_WIDTH 8
556
557/* MMC register offsets */
558#define MMC_CR 0x0800
559#define MMC_RISR 0x0804
560#define MMC_TISR 0x0808
561#define MMC_RIER 0x080c
562#define MMC_TIER 0x0810
563#define MMC_TXOCTETCOUNT_GB_LO 0x0814
564#define MMC_TXOCTETCOUNT_GB_HI 0x0818
565#define MMC_TXFRAMECOUNT_GB_LO 0x081c
566#define MMC_TXFRAMECOUNT_GB_HI 0x0820
567#define MMC_TXBROADCASTFRAMES_G_LO 0x0824
568#define MMC_TXBROADCASTFRAMES_G_HI 0x0828
569#define MMC_TXMULTICASTFRAMES_G_LO 0x082c
570#define MMC_TXMULTICASTFRAMES_G_HI 0x0830
571#define MMC_TX64OCTETS_GB_LO 0x0834
572#define MMC_TX64OCTETS_GB_HI 0x0838
573#define MMC_TX65TO127OCTETS_GB_LO 0x083c
574#define MMC_TX65TO127OCTETS_GB_HI 0x0840
575#define MMC_TX128TO255OCTETS_GB_LO 0x0844
576#define MMC_TX128TO255OCTETS_GB_HI 0x0848
577#define MMC_TX256TO511OCTETS_GB_LO 0x084c
578#define MMC_TX256TO511OCTETS_GB_HI 0x0850
579#define MMC_TX512TO1023OCTETS_GB_LO 0x0854
580#define MMC_TX512TO1023OCTETS_GB_HI 0x0858
581#define MMC_TX1024TOMAXOCTETS_GB_LO 0x085c
582#define MMC_TX1024TOMAXOCTETS_GB_HI 0x0860
583#define MMC_TXUNICASTFRAMES_GB_LO 0x0864
584#define MMC_TXUNICASTFRAMES_GB_HI 0x0868
585#define MMC_TXMULTICASTFRAMES_GB_LO 0x086c
586#define MMC_TXMULTICASTFRAMES_GB_HI 0x0870
587#define MMC_TXBROADCASTFRAMES_GB_LO 0x0874
588#define MMC_TXBROADCASTFRAMES_GB_HI 0x0878
589#define MMC_TXUNDERFLOWERROR_LO 0x087c
590#define MMC_TXUNDERFLOWERROR_HI 0x0880
591#define MMC_TXOCTETCOUNT_G_LO 0x0884
592#define MMC_TXOCTETCOUNT_G_HI 0x0888
593#define MMC_TXFRAMECOUNT_G_LO 0x088c
594#define MMC_TXFRAMECOUNT_G_HI 0x0890
595#define MMC_TXPAUSEFRAMES_LO 0x0894
596#define MMC_TXPAUSEFRAMES_HI 0x0898
597#define MMC_TXVLANFRAMES_G_LO 0x089c
598#define MMC_TXVLANFRAMES_G_HI 0x08a0
599#define MMC_RXFRAMECOUNT_GB_LO 0x0900
600#define MMC_RXFRAMECOUNT_GB_HI 0x0904
601#define MMC_RXOCTETCOUNT_GB_LO 0x0908
602#define MMC_RXOCTETCOUNT_GB_HI 0x090c
603#define MMC_RXOCTETCOUNT_G_LO 0x0910
604#define MMC_RXOCTETCOUNT_G_HI 0x0914
605#define MMC_RXBROADCASTFRAMES_G_LO 0x0918
606#define MMC_RXBROADCASTFRAMES_G_HI 0x091c
607#define MMC_RXMULTICASTFRAMES_G_LO 0x0920
608#define MMC_RXMULTICASTFRAMES_G_HI 0x0924
609#define MMC_RXCRCERROR_LO 0x0928
610#define MMC_RXCRCERROR_HI 0x092c
611#define MMC_RXRUNTERROR 0x0930
612#define MMC_RXJABBERERROR 0x0934
613#define MMC_RXUNDERSIZE_G 0x0938
614#define MMC_RXOVERSIZE_G 0x093c
615#define MMC_RX64OCTETS_GB_LO 0x0940
616#define MMC_RX64OCTETS_GB_HI 0x0944
617#define MMC_RX65TO127OCTETS_GB_LO 0x0948
618#define MMC_RX65TO127OCTETS_GB_HI 0x094c
619#define MMC_RX128TO255OCTETS_GB_LO 0x0950
620#define MMC_RX128TO255OCTETS_GB_HI 0x0954
621#define MMC_RX256TO511OCTETS_GB_LO 0x0958
622#define MMC_RX256TO511OCTETS_GB_HI 0x095c
623#define MMC_RX512TO1023OCTETS_GB_LO 0x0960
624#define MMC_RX512TO1023OCTETS_GB_HI 0x0964
625#define MMC_RX1024TOMAXOCTETS_GB_LO 0x0968
626#define MMC_RX1024TOMAXOCTETS_GB_HI 0x096c
627#define MMC_RXUNICASTFRAMES_G_LO 0x0970
628#define MMC_RXUNICASTFRAMES_G_HI 0x0974
629#define MMC_RXLENGTHERROR_LO 0x0978
630#define MMC_RXLENGTHERROR_HI 0x097c
631#define MMC_RXOUTOFRANGETYPE_LO 0x0980
632#define MMC_RXOUTOFRANGETYPE_HI 0x0984
633#define MMC_RXPAUSEFRAMES_LO 0x0988
634#define MMC_RXPAUSEFRAMES_HI 0x098c
635#define MMC_RXFIFOOVERFLOW_LO 0x0990
636#define MMC_RXFIFOOVERFLOW_HI 0x0994
637#define MMC_RXVLANFRAMES_GB_LO 0x0998
638#define MMC_RXVLANFRAMES_GB_HI 0x099c
639#define MMC_RXWATCHDOGERROR 0x09a0
640
641/* MMC register entry bit positions and sizes */
642#define MMC_CR_CR_INDEX 0
643#define MMC_CR_CR_WIDTH 1
644#define MMC_CR_CSR_INDEX 1
645#define MMC_CR_CSR_WIDTH 1
646#define MMC_CR_ROR_INDEX 2
647#define MMC_CR_ROR_WIDTH 1
648#define MMC_CR_MCF_INDEX 3
649#define MMC_CR_MCF_WIDTH 1
650#define MMC_CR_MCT_INDEX 4
651#define MMC_CR_MCT_WIDTH 2
652#define MMC_RIER_ALL_INTERRUPTS_INDEX 0
653#define MMC_RIER_ALL_INTERRUPTS_WIDTH 23
654#define MMC_RISR_RXFRAMECOUNT_GB_INDEX 0
655#define MMC_RISR_RXFRAMECOUNT_GB_WIDTH 1
656#define MMC_RISR_RXOCTETCOUNT_GB_INDEX 1
657#define MMC_RISR_RXOCTETCOUNT_GB_WIDTH 1
658#define MMC_RISR_RXOCTETCOUNT_G_INDEX 2
659#define MMC_RISR_RXOCTETCOUNT_G_WIDTH 1
660#define MMC_RISR_RXBROADCASTFRAMES_G_INDEX 3
661#define MMC_RISR_RXBROADCASTFRAMES_G_WIDTH 1
662#define MMC_RISR_RXMULTICASTFRAMES_G_INDEX 4
663#define MMC_RISR_RXMULTICASTFRAMES_G_WIDTH 1
664#define MMC_RISR_RXCRCERROR_INDEX 5
665#define MMC_RISR_RXCRCERROR_WIDTH 1
666#define MMC_RISR_RXRUNTERROR_INDEX 6
667#define MMC_RISR_RXRUNTERROR_WIDTH 1
668#define MMC_RISR_RXJABBERERROR_INDEX 7
669#define MMC_RISR_RXJABBERERROR_WIDTH 1
670#define MMC_RISR_RXUNDERSIZE_G_INDEX 8
671#define MMC_RISR_RXUNDERSIZE_G_WIDTH 1
672#define MMC_RISR_RXOVERSIZE_G_INDEX 9
673#define MMC_RISR_RXOVERSIZE_G_WIDTH 1
674#define MMC_RISR_RX64OCTETS_GB_INDEX 10
675#define MMC_RISR_RX64OCTETS_GB_WIDTH 1
676#define MMC_RISR_RX65TO127OCTETS_GB_INDEX 11
677#define MMC_RISR_RX65TO127OCTETS_GB_WIDTH 1
678#define MMC_RISR_RX128TO255OCTETS_GB_INDEX 12
679#define MMC_RISR_RX128TO255OCTETS_GB_WIDTH 1
680#define MMC_RISR_RX256TO511OCTETS_GB_INDEX 13
681#define MMC_RISR_RX256TO511OCTETS_GB_WIDTH 1
682#define MMC_RISR_RX512TO1023OCTETS_GB_INDEX 14
683#define MMC_RISR_RX512TO1023OCTETS_GB_WIDTH 1
684#define MMC_RISR_RX1024TOMAXOCTETS_GB_INDEX 15
685#define MMC_RISR_RX1024TOMAXOCTETS_GB_WIDTH 1
686#define MMC_RISR_RXUNICASTFRAMES_G_INDEX 16
687#define MMC_RISR_RXUNICASTFRAMES_G_WIDTH 1
688#define MMC_RISR_RXLENGTHERROR_INDEX 17
689#define MMC_RISR_RXLENGTHERROR_WIDTH 1
690#define MMC_RISR_RXOUTOFRANGETYPE_INDEX 18
691#define MMC_RISR_RXOUTOFRANGETYPE_WIDTH 1
692#define MMC_RISR_RXPAUSEFRAMES_INDEX 19
693#define MMC_RISR_RXPAUSEFRAMES_WIDTH 1
694#define MMC_RISR_RXFIFOOVERFLOW_INDEX 20
695#define MMC_RISR_RXFIFOOVERFLOW_WIDTH 1
696#define MMC_RISR_RXVLANFRAMES_GB_INDEX 21
697#define MMC_RISR_RXVLANFRAMES_GB_WIDTH 1
698#define MMC_RISR_RXWATCHDOGERROR_INDEX 22
699#define MMC_RISR_RXWATCHDOGERROR_WIDTH 1
700#define MMC_TIER_ALL_INTERRUPTS_INDEX 0
701#define MMC_TIER_ALL_INTERRUPTS_WIDTH 18
702#define MMC_TISR_TXOCTETCOUNT_GB_INDEX 0
703#define MMC_TISR_TXOCTETCOUNT_GB_WIDTH 1
704#define MMC_TISR_TXFRAMECOUNT_GB_INDEX 1
705#define MMC_TISR_TXFRAMECOUNT_GB_WIDTH 1
706#define MMC_TISR_TXBROADCASTFRAMES_G_INDEX 2
707#define MMC_TISR_TXBROADCASTFRAMES_G_WIDTH 1
708#define MMC_TISR_TXMULTICASTFRAMES_G_INDEX 3
709#define MMC_TISR_TXMULTICASTFRAMES_G_WIDTH 1
710#define MMC_TISR_TX64OCTETS_GB_INDEX 4
711#define MMC_TISR_TX64OCTETS_GB_WIDTH 1
712#define MMC_TISR_TX65TO127OCTETS_GB_INDEX 5
713#define MMC_TISR_TX65TO127OCTETS_GB_WIDTH 1
714#define MMC_TISR_TX128TO255OCTETS_GB_INDEX 6
715#define MMC_TISR_TX128TO255OCTETS_GB_WIDTH 1
716#define MMC_TISR_TX256TO511OCTETS_GB_INDEX 7
717#define MMC_TISR_TX256TO511OCTETS_GB_WIDTH 1
718#define MMC_TISR_TX512TO1023OCTETS_GB_INDEX 8
719#define MMC_TISR_TX512TO1023OCTETS_GB_WIDTH 1
720#define MMC_TISR_TX1024TOMAXOCTETS_GB_INDEX 9
721#define MMC_TISR_TX1024TOMAXOCTETS_GB_WIDTH 1
722#define MMC_TISR_TXUNICASTFRAMES_GB_INDEX 10
723#define MMC_TISR_TXUNICASTFRAMES_GB_WIDTH 1
724#define MMC_TISR_TXMULTICASTFRAMES_GB_INDEX 11
725#define MMC_TISR_TXMULTICASTFRAMES_GB_WIDTH 1
726#define MMC_TISR_TXBROADCASTFRAMES_GB_INDEX 12
727#define MMC_TISR_TXBROADCASTFRAMES_GB_WIDTH 1
728#define MMC_TISR_TXUNDERFLOWERROR_INDEX 13
729#define MMC_TISR_TXUNDERFLOWERROR_WIDTH 1
730#define MMC_TISR_TXOCTETCOUNT_G_INDEX 14
731#define MMC_TISR_TXOCTETCOUNT_G_WIDTH 1
732#define MMC_TISR_TXFRAMECOUNT_G_INDEX 15
733#define MMC_TISR_TXFRAMECOUNT_G_WIDTH 1
734#define MMC_TISR_TXPAUSEFRAMES_INDEX 16
735#define MMC_TISR_TXPAUSEFRAMES_WIDTH 1
736#define MMC_TISR_TXVLANFRAMES_G_INDEX 17
737#define MMC_TISR_TXVLANFRAMES_G_WIDTH 1
738
739/* MTL register offsets */
740#define MTL_OMR 0x1000
741#define MTL_FDCR 0x1008
742#define MTL_FDSR 0x100c
743#define MTL_FDDR 0x1010
744#define MTL_ISR 0x1020
745#define MTL_RQDCM0R 0x1030
746#define MTL_TCPM0R 0x1040
747#define MTL_TCPM1R 0x1044
748
749#define MTL_RQDCM_INC 4
750#define MTL_RQDCM_Q_PER_REG 4
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500751#define MTL_TCPM_INC 4
752#define MTL_TCPM_TC_PER_REG 4
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500753
754/* MTL register entry bit positions and sizes */
755#define MTL_OMR_ETSALG_INDEX 5
756#define MTL_OMR_ETSALG_WIDTH 2
757#define MTL_OMR_RAA_INDEX 2
758#define MTL_OMR_RAA_WIDTH 1
759
760/* MTL queue register offsets
761 * Multiple queues can be active. The first queue has registers
762 * that begin at 0x1100. Each subsequent queue has registers that
763 * are accessed using an offset of 0x80 from the previous queue.
764 */
765#define MTL_Q_BASE 0x1100
766#define MTL_Q_INC 0x80
767
768#define MTL_Q_TQOMR 0x00
769#define MTL_Q_TQUR 0x04
770#define MTL_Q_TQDR 0x08
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500771#define MTL_Q_RQOMR 0x40
772#define MTL_Q_RQMPOCR 0x44
Lendacky, Thomasc3727d62016-02-17 11:49:16 -0600773#define MTL_Q_RQDR 0x48
Lendacky, Thomase2a27292015-01-20 12:20:31 -0600774#define MTL_Q_RQFCR 0x50
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500775#define MTL_Q_IER 0x70
776#define MTL_Q_ISR 0x74
777
778/* MTL queue register entry bit positions and sizes */
Lendacky, Thomasc3727d62016-02-17 11:49:16 -0600779#define MTL_Q_RQDR_PRXQ_INDEX 16
780#define MTL_Q_RQDR_PRXQ_WIDTH 14
781#define MTL_Q_RQDR_RXQSTS_INDEX 4
782#define MTL_Q_RQDR_RXQSTS_WIDTH 2
Lendacky, Thomase2a27292015-01-20 12:20:31 -0600783#define MTL_Q_RQFCR_RFA_INDEX 1
784#define MTL_Q_RQFCR_RFA_WIDTH 6
785#define MTL_Q_RQFCR_RFD_INDEX 17
786#define MTL_Q_RQFCR_RFD_WIDTH 6
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500787#define MTL_Q_RQOMR_EHFC_INDEX 7
788#define MTL_Q_RQOMR_EHFC_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500789#define MTL_Q_RQOMR_RQS_INDEX 16
790#define MTL_Q_RQOMR_RQS_WIDTH 9
791#define MTL_Q_RQOMR_RSF_INDEX 5
792#define MTL_Q_RQOMR_RSF_WIDTH 1
793#define MTL_Q_RQOMR_RTC_INDEX 0
794#define MTL_Q_RQOMR_RTC_WIDTH 2
Lendacky, Thomas4b8acdf2016-11-03 13:19:17 -0500795#define MTL_Q_TQDR_TRCSTS_INDEX 1
796#define MTL_Q_TQDR_TRCSTS_WIDTH 2
797#define MTL_Q_TQDR_TXQSTS_INDEX 4
798#define MTL_Q_TQDR_TXQSTS_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500799#define MTL_Q_TQOMR_FTQ_INDEX 0
800#define MTL_Q_TQOMR_FTQ_WIDTH 1
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500801#define MTL_Q_TQOMR_Q2TCMAP_INDEX 8
802#define MTL_Q_TQOMR_Q2TCMAP_WIDTH 3
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500803#define MTL_Q_TQOMR_TQS_INDEX 16
804#define MTL_Q_TQOMR_TQS_WIDTH 10
805#define MTL_Q_TQOMR_TSF_INDEX 1
806#define MTL_Q_TQOMR_TSF_WIDTH 1
807#define MTL_Q_TQOMR_TTC_INDEX 4
808#define MTL_Q_TQOMR_TTC_WIDTH 3
809#define MTL_Q_TQOMR_TXQEN_INDEX 2
810#define MTL_Q_TQOMR_TXQEN_WIDTH 2
811
812/* MTL queue register value */
813#define MTL_RSF_DISABLE 0x00
814#define MTL_RSF_ENABLE 0x01
815#define MTL_TSF_DISABLE 0x00
816#define MTL_TSF_ENABLE 0x01
817
818#define MTL_RX_THRESHOLD_64 0x00
819#define MTL_RX_THRESHOLD_96 0x02
820#define MTL_RX_THRESHOLD_128 0x03
821#define MTL_TX_THRESHOLD_32 0x01
822#define MTL_TX_THRESHOLD_64 0x00
823#define MTL_TX_THRESHOLD_96 0x02
824#define MTL_TX_THRESHOLD_128 0x03
825#define MTL_TX_THRESHOLD_192 0x04
826#define MTL_TX_THRESHOLD_256 0x05
827#define MTL_TX_THRESHOLD_384 0x06
828#define MTL_TX_THRESHOLD_512 0x07
829
830#define MTL_ETSALG_WRR 0x00
831#define MTL_ETSALG_WFQ 0x01
832#define MTL_ETSALG_DWRR 0x02
833#define MTL_RAA_SP 0x00
834#define MTL_RAA_WSP 0x01
835
836#define MTL_Q_DISABLED 0x00
837#define MTL_Q_ENABLED 0x02
838
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500839/* MTL traffic class register offsets
840 * Multiple traffic classes can be active. The first class has registers
841 * that begin at 0x1100. Each subsequent queue has registers that
842 * are accessed using an offset of 0x80 from the previous queue.
843 */
844#define MTL_TC_BASE MTL_Q_BASE
845#define MTL_TC_INC MTL_Q_INC
846
847#define MTL_TC_ETSCR 0x10
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500848#define MTL_TC_ETSSR 0x14
849#define MTL_TC_QWR 0x18
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500850
851/* MTL traffic class register entry bit positions and sizes */
852#define MTL_TC_ETSCR_TSA_INDEX 0
853#define MTL_TC_ETSCR_TSA_WIDTH 2
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500854#define MTL_TC_QWR_QW_INDEX 0
855#define MTL_TC_QWR_QW_WIDTH 21
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500856
857/* MTL traffic class register value */
858#define MTL_TSA_SP 0x00
859#define MTL_TSA_ETS 0x02
860
Lendacky, Thomasb03a4a62016-11-03 13:18:56 -0500861/* PCS register offsets */
862#define PCS_V1_WINDOW_SELECT 0x03fc
Lendacky, Thomas47f164d2016-11-10 17:09:55 -0600863#define PCS_V2_WINDOW_DEF 0x9060
Lendacky, Thomasb03a4a62016-11-03 13:18:56 -0500864#define PCS_V2_WINDOW_SELECT 0x9064
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500865
Lendacky, Thomas47f164d2016-11-10 17:09:55 -0600866/* PCS register entry bit positions and sizes */
867#define PCS_V2_WINDOW_DEF_OFFSET_INDEX 6
868#define PCS_V2_WINDOW_DEF_OFFSET_WIDTH 14
869#define PCS_V2_WINDOW_DEF_SIZE_INDEX 2
870#define PCS_V2_WINDOW_DEF_SIZE_WIDTH 4
871
Lendacky, Thomas7c12aa02015-05-14 11:44:15 -0500872/* SerDes integration register offsets */
873#define SIR0_KR_RT_1 0x002c
874#define SIR0_STATUS 0x0040
875#define SIR1_SPEED 0x0000
876
877/* SerDes integration register entry bit positions and sizes */
878#define SIR0_KR_RT_1_RESET_INDEX 11
879#define SIR0_KR_RT_1_RESET_WIDTH 1
880#define SIR0_STATUS_RX_READY_INDEX 0
881#define SIR0_STATUS_RX_READY_WIDTH 1
882#define SIR0_STATUS_TX_READY_INDEX 8
883#define SIR0_STATUS_TX_READY_WIDTH 1
884#define SIR1_SPEED_CDR_RATE_INDEX 12
885#define SIR1_SPEED_CDR_RATE_WIDTH 4
886#define SIR1_SPEED_DATARATE_INDEX 4
887#define SIR1_SPEED_DATARATE_WIDTH 2
888#define SIR1_SPEED_PLLSEL_INDEX 3
889#define SIR1_SPEED_PLLSEL_WIDTH 1
890#define SIR1_SPEED_RATECHANGE_INDEX 6
891#define SIR1_SPEED_RATECHANGE_WIDTH 1
892#define SIR1_SPEED_TXAMP_INDEX 8
893#define SIR1_SPEED_TXAMP_WIDTH 4
894#define SIR1_SPEED_WORDMODE_INDEX 0
895#define SIR1_SPEED_WORDMODE_WIDTH 3
896
897/* SerDes RxTx register offsets */
898#define RXTX_REG6 0x0018
899#define RXTX_REG20 0x0050
900#define RXTX_REG22 0x0058
901#define RXTX_REG114 0x01c8
902#define RXTX_REG129 0x0204
903
904/* SerDes RxTx register entry bit positions and sizes */
905#define RXTX_REG6_RESETB_RXD_INDEX 8
906#define RXTX_REG6_RESETB_RXD_WIDTH 1
907#define RXTX_REG20_BLWC_ENA_INDEX 2
908#define RXTX_REG20_BLWC_ENA_WIDTH 1
909#define RXTX_REG114_PQ_REG_INDEX 9
910#define RXTX_REG114_PQ_REG_WIDTH 7
911#define RXTX_REG129_RXDFE_CONFIG_INDEX 14
912#define RXTX_REG129_RXDFE_CONFIG_WIDTH 2
913
Lendacky, Thomas47f164d2016-11-10 17:09:55 -0600914/* MAC Control register offsets */
915#define XP_PROP_0 0x0000
916#define XP_PROP_1 0x0004
917#define XP_PROP_2 0x0008
918#define XP_PROP_3 0x000c
919#define XP_PROP_4 0x0010
920#define XP_PROP_5 0x0014
921#define XP_MAC_ADDR_LO 0x0020
922#define XP_MAC_ADDR_HI 0x0024
Lendacky, Thomase78332b2016-11-10 17:10:26 -0600923#define XP_ECC_ISR 0x0030
924#define XP_ECC_IER 0x0034
925#define XP_ECC_CNT0 0x003c
926#define XP_ECC_CNT1 0x0040
Lendacky, Thomas47f164d2016-11-10 17:09:55 -0600927#define XP_DRIVER_INT_REQ 0x0060
928#define XP_DRIVER_INT_RO 0x0064
929#define XP_DRIVER_SCRATCH_0 0x0068
930#define XP_DRIVER_SCRATCH_1 0x006c
931#define XP_INT_EN 0x0078
932
933/* MAC Control register entry bit positions and sizes */
934#define XP_DRIVER_INT_REQ_REQUEST_INDEX 0
935#define XP_DRIVER_INT_REQ_REQUEST_WIDTH 1
936#define XP_DRIVER_INT_RO_STATUS_INDEX 0
937#define XP_DRIVER_INT_RO_STATUS_WIDTH 1
938#define XP_DRIVER_SCRATCH_0_COMMAND_INDEX 0
939#define XP_DRIVER_SCRATCH_0_COMMAND_WIDTH 8
940#define XP_DRIVER_SCRATCH_0_SUB_COMMAND_INDEX 8
941#define XP_DRIVER_SCRATCH_0_SUB_COMMAND_WIDTH 8
Lendacky, Thomase78332b2016-11-10 17:10:26 -0600942#define XP_ECC_CNT0_RX_DED_INDEX 24
943#define XP_ECC_CNT0_RX_DED_WIDTH 8
944#define XP_ECC_CNT0_RX_SEC_INDEX 16
945#define XP_ECC_CNT0_RX_SEC_WIDTH 8
946#define XP_ECC_CNT0_TX_DED_INDEX 8
947#define XP_ECC_CNT0_TX_DED_WIDTH 8
948#define XP_ECC_CNT0_TX_SEC_INDEX 0
949#define XP_ECC_CNT0_TX_SEC_WIDTH 8
950#define XP_ECC_CNT1_DESC_DED_INDEX 8
951#define XP_ECC_CNT1_DESC_DED_WIDTH 8
952#define XP_ECC_CNT1_DESC_SEC_INDEX 0
953#define XP_ECC_CNT1_DESC_SEC_WIDTH 8
954#define XP_ECC_IER_DESC_DED_INDEX 0
955#define XP_ECC_IER_DESC_DED_WIDTH 1
956#define XP_ECC_IER_DESC_SEC_INDEX 1
957#define XP_ECC_IER_DESC_SEC_WIDTH 1
958#define XP_ECC_IER_RX_DED_INDEX 2
959#define XP_ECC_IER_RX_DED_WIDTH 1
960#define XP_ECC_IER_RX_SEC_INDEX 3
961#define XP_ECC_IER_RX_SEC_WIDTH 1
962#define XP_ECC_IER_TX_DED_INDEX 4
963#define XP_ECC_IER_TX_DED_WIDTH 1
964#define XP_ECC_IER_TX_SEC_INDEX 5
965#define XP_ECC_IER_TX_SEC_WIDTH 1
966#define XP_ECC_ISR_DESC_DED_INDEX 0
967#define XP_ECC_ISR_DESC_DED_WIDTH 1
968#define XP_ECC_ISR_DESC_SEC_INDEX 1
969#define XP_ECC_ISR_DESC_SEC_WIDTH 1
970#define XP_ECC_ISR_RX_DED_INDEX 2
971#define XP_ECC_ISR_RX_DED_WIDTH 1
972#define XP_ECC_ISR_RX_SEC_INDEX 3
973#define XP_ECC_ISR_RX_SEC_WIDTH 1
974#define XP_ECC_ISR_TX_DED_INDEX 4
975#define XP_ECC_ISR_TX_DED_WIDTH 1
976#define XP_ECC_ISR_TX_SEC_INDEX 5
977#define XP_ECC_ISR_TX_SEC_WIDTH 1
Lendacky, Thomas47f164d2016-11-10 17:09:55 -0600978#define XP_MAC_ADDR_HI_VALID_INDEX 31
979#define XP_MAC_ADDR_HI_VALID_WIDTH 1
980#define XP_PROP_0_CONN_TYPE_INDEX 28
981#define XP_PROP_0_CONN_TYPE_WIDTH 3
982#define XP_PROP_0_MDIO_ADDR_INDEX 16
983#define XP_PROP_0_MDIO_ADDR_WIDTH 5
984#define XP_PROP_0_PORT_ID_INDEX 0
985#define XP_PROP_0_PORT_ID_WIDTH 8
986#define XP_PROP_0_PORT_MODE_INDEX 8
987#define XP_PROP_0_PORT_MODE_WIDTH 4
988#define XP_PROP_0_PORT_SPEEDS_INDEX 23
989#define XP_PROP_0_PORT_SPEEDS_WIDTH 4
990#define XP_PROP_1_MAX_RX_DMA_INDEX 24
991#define XP_PROP_1_MAX_RX_DMA_WIDTH 5
992#define XP_PROP_1_MAX_RX_QUEUES_INDEX 8
993#define XP_PROP_1_MAX_RX_QUEUES_WIDTH 5
994#define XP_PROP_1_MAX_TX_DMA_INDEX 16
995#define XP_PROP_1_MAX_TX_DMA_WIDTH 5
996#define XP_PROP_1_MAX_TX_QUEUES_INDEX 0
997#define XP_PROP_1_MAX_TX_QUEUES_WIDTH 5
998#define XP_PROP_2_RX_FIFO_SIZE_INDEX 16
999#define XP_PROP_2_RX_FIFO_SIZE_WIDTH 16
1000#define XP_PROP_2_TX_FIFO_SIZE_INDEX 0
1001#define XP_PROP_2_TX_FIFO_SIZE_WIDTH 16
1002
Lendacky, Thomas5ab1dcd2016-11-10 17:10:36 -06001003/* I2C Control register offsets */
1004#define IC_CON 0x0000
1005#define IC_TAR 0x0004
1006#define IC_DATA_CMD 0x0010
1007#define IC_INTR_STAT 0x002c
1008#define IC_INTR_MASK 0x0030
1009#define IC_RAW_INTR_STAT 0x0034
1010#define IC_CLR_INTR 0x0040
1011#define IC_CLR_TX_ABRT 0x0054
1012#define IC_CLR_STOP_DET 0x0060
1013#define IC_ENABLE 0x006c
1014#define IC_TXFLR 0x0074
1015#define IC_RXFLR 0x0078
1016#define IC_TX_ABRT_SOURCE 0x0080
1017#define IC_ENABLE_STATUS 0x009c
1018#define IC_COMP_PARAM_1 0x00f4
1019
1020/* I2C Control register entry bit positions and sizes */
1021#define IC_COMP_PARAM_1_MAX_SPEED_MODE_INDEX 2
1022#define IC_COMP_PARAM_1_MAX_SPEED_MODE_WIDTH 2
1023#define IC_COMP_PARAM_1_RX_BUFFER_DEPTH_INDEX 8
1024#define IC_COMP_PARAM_1_RX_BUFFER_DEPTH_WIDTH 8
1025#define IC_COMP_PARAM_1_TX_BUFFER_DEPTH_INDEX 16
1026#define IC_COMP_PARAM_1_TX_BUFFER_DEPTH_WIDTH 8
1027#define IC_CON_MASTER_MODE_INDEX 0
1028#define IC_CON_MASTER_MODE_WIDTH 1
1029#define IC_CON_RESTART_EN_INDEX 5
1030#define IC_CON_RESTART_EN_WIDTH 1
1031#define IC_CON_RX_FIFO_FULL_HOLD_INDEX 9
1032#define IC_CON_RX_FIFO_FULL_HOLD_WIDTH 1
1033#define IC_CON_SLAVE_DISABLE_INDEX 6
1034#define IC_CON_SLAVE_DISABLE_WIDTH 1
1035#define IC_CON_SPEED_INDEX 1
1036#define IC_CON_SPEED_WIDTH 2
1037#define IC_DATA_CMD_CMD_INDEX 8
1038#define IC_DATA_CMD_CMD_WIDTH 1
1039#define IC_DATA_CMD_STOP_INDEX 9
1040#define IC_DATA_CMD_STOP_WIDTH 1
1041#define IC_ENABLE_ABORT_INDEX 1
1042#define IC_ENABLE_ABORT_WIDTH 1
1043#define IC_ENABLE_EN_INDEX 0
1044#define IC_ENABLE_EN_WIDTH 1
1045#define IC_ENABLE_STATUS_EN_INDEX 0
1046#define IC_ENABLE_STATUS_EN_WIDTH 1
1047#define IC_INTR_MASK_TX_EMPTY_INDEX 4
1048#define IC_INTR_MASK_TX_EMPTY_WIDTH 1
1049#define IC_RAW_INTR_STAT_RX_FULL_INDEX 2
1050#define IC_RAW_INTR_STAT_RX_FULL_WIDTH 1
1051#define IC_RAW_INTR_STAT_STOP_DET_INDEX 9
1052#define IC_RAW_INTR_STAT_STOP_DET_WIDTH 1
1053#define IC_RAW_INTR_STAT_TX_ABRT_INDEX 6
1054#define IC_RAW_INTR_STAT_TX_ABRT_WIDTH 1
1055#define IC_RAW_INTR_STAT_TX_EMPTY_INDEX 4
1056#define IC_RAW_INTR_STAT_TX_EMPTY_WIDTH 1
1057
1058/* I2C Control register value */
1059#define IC_TX_ABRT_7B_ADDR_NOACK 0x0001
1060#define IC_TX_ABRT_ARB_LOST 0x1000
1061
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001062/* Descriptor/Packet entry bit positions and sizes */
1063#define RX_PACKET_ERRORS_CRC_INDEX 2
1064#define RX_PACKET_ERRORS_CRC_WIDTH 1
1065#define RX_PACKET_ERRORS_FRAME_INDEX 3
1066#define RX_PACKET_ERRORS_FRAME_WIDTH 1
1067#define RX_PACKET_ERRORS_LENGTH_INDEX 0
1068#define RX_PACKET_ERRORS_LENGTH_WIDTH 1
1069#define RX_PACKET_ERRORS_OVERRUN_INDEX 1
1070#define RX_PACKET_ERRORS_OVERRUN_WIDTH 1
1071
1072#define RX_PACKET_ATTRIBUTES_CSUM_DONE_INDEX 0
1073#define RX_PACKET_ATTRIBUTES_CSUM_DONE_WIDTH 1
1074#define RX_PACKET_ATTRIBUTES_VLAN_CTAG_INDEX 1
1075#define RX_PACKET_ATTRIBUTES_VLAN_CTAG_WIDTH 1
1076#define RX_PACKET_ATTRIBUTES_INCOMPLETE_INDEX 2
1077#define RX_PACKET_ATTRIBUTES_INCOMPLETE_WIDTH 1
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -05001078#define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_INDEX 3
1079#define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_WIDTH 1
1080#define RX_PACKET_ATTRIBUTES_CONTEXT_INDEX 4
1081#define RX_PACKET_ATTRIBUTES_CONTEXT_WIDTH 1
1082#define RX_PACKET_ATTRIBUTES_RX_TSTAMP_INDEX 5
1083#define RX_PACKET_ATTRIBUTES_RX_TSTAMP_WIDTH 1
Lendacky, Thomas5b9dfe22014-11-04 16:07:02 -06001084#define RX_PACKET_ATTRIBUTES_RSS_HASH_INDEX 6
1085#define RX_PACKET_ATTRIBUTES_RSS_HASH_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001086
1087#define RX_NORMAL_DESC0_OVT_INDEX 0
1088#define RX_NORMAL_DESC0_OVT_WIDTH 16
Lendacky, Thomas174fd252014-11-04 16:06:50 -06001089#define RX_NORMAL_DESC2_HL_INDEX 0
1090#define RX_NORMAL_DESC2_HL_WIDTH 10
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -05001091#define RX_NORMAL_DESC3_CDA_INDEX 27
1092#define RX_NORMAL_DESC3_CDA_WIDTH 1
1093#define RX_NORMAL_DESC3_CTXT_INDEX 30
1094#define RX_NORMAL_DESC3_CTXT_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001095#define RX_NORMAL_DESC3_ES_INDEX 15
1096#define RX_NORMAL_DESC3_ES_WIDTH 1
1097#define RX_NORMAL_DESC3_ETLT_INDEX 16
1098#define RX_NORMAL_DESC3_ETLT_WIDTH 4
Lendacky, Thomas174fd252014-11-04 16:06:50 -06001099#define RX_NORMAL_DESC3_FD_INDEX 29
1100#define RX_NORMAL_DESC3_FD_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001101#define RX_NORMAL_DESC3_INTE_INDEX 30
1102#define RX_NORMAL_DESC3_INTE_WIDTH 1
Lendacky, Thomas5b9dfe22014-11-04 16:07:02 -06001103#define RX_NORMAL_DESC3_L34T_INDEX 20
1104#define RX_NORMAL_DESC3_L34T_WIDTH 4
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001105#define RX_NORMAL_DESC3_LD_INDEX 28
1106#define RX_NORMAL_DESC3_LD_WIDTH 1
1107#define RX_NORMAL_DESC3_OWN_INDEX 31
1108#define RX_NORMAL_DESC3_OWN_WIDTH 1
1109#define RX_NORMAL_DESC3_PL_INDEX 0
1110#define RX_NORMAL_DESC3_PL_WIDTH 14
Lendacky, Thomas5b9dfe22014-11-04 16:07:02 -06001111#define RX_NORMAL_DESC3_RSV_INDEX 26
1112#define RX_NORMAL_DESC3_RSV_WIDTH 1
1113
1114#define RX_DESC3_L34T_IPV4_TCP 1
1115#define RX_DESC3_L34T_IPV4_UDP 2
1116#define RX_DESC3_L34T_IPV4_ICMP 3
1117#define RX_DESC3_L34T_IPV6_TCP 9
1118#define RX_DESC3_L34T_IPV6_UDP 10
1119#define RX_DESC3_L34T_IPV6_ICMP 11
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001120
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -05001121#define RX_CONTEXT_DESC3_TSA_INDEX 4
1122#define RX_CONTEXT_DESC3_TSA_WIDTH 1
1123#define RX_CONTEXT_DESC3_TSD_INDEX 6
1124#define RX_CONTEXT_DESC3_TSD_WIDTH 1
1125
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001126#define TX_PACKET_ATTRIBUTES_CSUM_ENABLE_INDEX 0
1127#define TX_PACKET_ATTRIBUTES_CSUM_ENABLE_WIDTH 1
1128#define TX_PACKET_ATTRIBUTES_TSO_ENABLE_INDEX 1
1129#define TX_PACKET_ATTRIBUTES_TSO_ENABLE_WIDTH 1
1130#define TX_PACKET_ATTRIBUTES_VLAN_CTAG_INDEX 2
1131#define TX_PACKET_ATTRIBUTES_VLAN_CTAG_WIDTH 1
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -05001132#define TX_PACKET_ATTRIBUTES_PTP_INDEX 3
1133#define TX_PACKET_ATTRIBUTES_PTP_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001134
1135#define TX_CONTEXT_DESC2_MSS_INDEX 0
1136#define TX_CONTEXT_DESC2_MSS_WIDTH 15
1137#define TX_CONTEXT_DESC3_CTXT_INDEX 30
1138#define TX_CONTEXT_DESC3_CTXT_WIDTH 1
1139#define TX_CONTEXT_DESC3_TCMSSV_INDEX 26
1140#define TX_CONTEXT_DESC3_TCMSSV_WIDTH 1
1141#define TX_CONTEXT_DESC3_VLTV_INDEX 16
1142#define TX_CONTEXT_DESC3_VLTV_WIDTH 1
1143#define TX_CONTEXT_DESC3_VT_INDEX 0
1144#define TX_CONTEXT_DESC3_VT_WIDTH 16
1145
1146#define TX_NORMAL_DESC2_HL_B1L_INDEX 0
1147#define TX_NORMAL_DESC2_HL_B1L_WIDTH 14
1148#define TX_NORMAL_DESC2_IC_INDEX 31
1149#define TX_NORMAL_DESC2_IC_WIDTH 1
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -05001150#define TX_NORMAL_DESC2_TTSE_INDEX 30
1151#define TX_NORMAL_DESC2_TTSE_WIDTH 1
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001152#define TX_NORMAL_DESC2_VTIR_INDEX 14
1153#define TX_NORMAL_DESC2_VTIR_WIDTH 2
1154#define TX_NORMAL_DESC3_CIC_INDEX 16
1155#define TX_NORMAL_DESC3_CIC_WIDTH 2
1156#define TX_NORMAL_DESC3_CPC_INDEX 26
1157#define TX_NORMAL_DESC3_CPC_WIDTH 2
1158#define TX_NORMAL_DESC3_CTXT_INDEX 30
1159#define TX_NORMAL_DESC3_CTXT_WIDTH 1
1160#define TX_NORMAL_DESC3_FD_INDEX 29
1161#define TX_NORMAL_DESC3_FD_WIDTH 1
1162#define TX_NORMAL_DESC3_FL_INDEX 0
1163#define TX_NORMAL_DESC3_FL_WIDTH 15
1164#define TX_NORMAL_DESC3_LD_INDEX 28
1165#define TX_NORMAL_DESC3_LD_WIDTH 1
1166#define TX_NORMAL_DESC3_OWN_INDEX 31
1167#define TX_NORMAL_DESC3_OWN_WIDTH 1
1168#define TX_NORMAL_DESC3_TCPHDRLEN_INDEX 19
1169#define TX_NORMAL_DESC3_TCPHDRLEN_WIDTH 4
1170#define TX_NORMAL_DESC3_TCPPL_INDEX 0
1171#define TX_NORMAL_DESC3_TCPPL_WIDTH 18
1172#define TX_NORMAL_DESC3_TSE_INDEX 18
1173#define TX_NORMAL_DESC3_TSE_WIDTH 1
1174
1175#define TX_NORMAL_DESC2_VLAN_INSERT 0x2
1176
1177/* MDIO undefined or vendor specific registers */
Lendacky, Thomas7c12aa02015-05-14 11:44:15 -05001178#ifndef MDIO_PMA_10GBR_PMD_CTRL
1179#define MDIO_PMA_10GBR_PMD_CTRL 0x0096
1180#endif
1181
1182#ifndef MDIO_PMA_10GBR_FECCTRL
1183#define MDIO_PMA_10GBR_FECCTRL 0x00ab
1184#endif
1185
Lendacky, Thomas1bf40ad2016-11-03 13:18:47 -05001186#ifndef MDIO_PCS_DIG_CTRL
1187#define MDIO_PCS_DIG_CTRL 0x8000
1188#endif
1189
Lendacky, Thomas7c12aa02015-05-14 11:44:15 -05001190#ifndef MDIO_AN_XNP
1191#define MDIO_AN_XNP 0x0016
1192#endif
1193
1194#ifndef MDIO_AN_LPX
1195#define MDIO_AN_LPX 0x0019
1196#endif
1197
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001198#ifndef MDIO_AN_COMP_STAT
1199#define MDIO_AN_COMP_STAT 0x0030
1200#endif
1201
Lendacky, Thomas7c12aa02015-05-14 11:44:15 -05001202#ifndef MDIO_AN_INTMASK
1203#define MDIO_AN_INTMASK 0x8001
1204#endif
1205
1206#ifndef MDIO_AN_INT
1207#define MDIO_AN_INT 0x8002
1208#endif
1209
Lendacky, Thomas1bf40ad2016-11-03 13:18:47 -05001210#ifndef MDIO_VEND2_AN_ADVERTISE
1211#define MDIO_VEND2_AN_ADVERTISE 0x0004
1212#endif
1213
1214#ifndef MDIO_VEND2_AN_LP_ABILITY
1215#define MDIO_VEND2_AN_LP_ABILITY 0x0005
1216#endif
1217
1218#ifndef MDIO_VEND2_AN_CTRL
1219#define MDIO_VEND2_AN_CTRL 0x8001
1220#endif
1221
1222#ifndef MDIO_VEND2_AN_STAT
1223#define MDIO_VEND2_AN_STAT 0x8002
1224#endif
1225
Lendacky, Thomas7c12aa02015-05-14 11:44:15 -05001226#ifndef MDIO_CTRL1_SPEED1G
1227#define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100)
1228#endif
1229
Lendacky, Thomas1bf40ad2016-11-03 13:18:47 -05001230#ifndef MDIO_VEND2_CTRL1_AN_ENABLE
1231#define MDIO_VEND2_CTRL1_AN_ENABLE BIT(12)
1232#endif
1233
1234#ifndef MDIO_VEND2_CTRL1_AN_RESTART
1235#define MDIO_VEND2_CTRL1_AN_RESTART BIT(9)
1236#endif
1237
Lendacky, Thomas7c12aa02015-05-14 11:44:15 -05001238/* MDIO mask values */
Lendacky, Thomasa64def42016-11-03 13:18:38 -05001239#define XGBE_AN_CL73_INT_CMPLT BIT(0)
1240#define XGBE_AN_CL73_INC_LINK BIT(1)
1241#define XGBE_AN_CL73_PG_RCV BIT(2)
1242#define XGBE_AN_CL73_INT_MASK 0x07
1243
Lendacky, Thomas7c12aa02015-05-14 11:44:15 -05001244#define XGBE_XNP_MCF_NULL_MESSAGE 0x001
1245#define XGBE_XNP_ACK_PROCESSED BIT(12)
1246#define XGBE_XNP_MP_FORMATTED BIT(13)
1247#define XGBE_XNP_NP_EXCHANGE BIT(15)
1248
1249#define XGBE_KR_TRAINING_START BIT(0)
1250#define XGBE_KR_TRAINING_ENABLE BIT(1)
1251
Lendacky, Thomas1bf40ad2016-11-03 13:18:47 -05001252#define XGBE_PCS_CL37_BP BIT(12)
1253
1254#define XGBE_AN_CL37_INT_CMPLT BIT(0)
1255#define XGBE_AN_CL37_INT_MASK 0x01
1256
1257#define XGBE_AN_CL37_HD_MASK 0x40
1258#define XGBE_AN_CL37_FD_MASK 0x20
1259
1260#define XGBE_AN_CL37_PCS_MODE_MASK 0x06
1261#define XGBE_AN_CL37_PCS_MODE_BASEX 0x00
1262#define XGBE_AN_CL37_PCS_MODE_SGMII 0x04
1263#define XGBE_AN_CL37_TX_CONFIG_MASK 0x08
1264
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001265/* Bit setting and getting macros
1266 * The get macro will extract the current bit field value from within
1267 * the variable
1268 *
1269 * The set macro will clear the current bit field value within the
1270 * variable and then set the bit field of the variable to the
1271 * specified value
1272 */
1273#define GET_BITS(_var, _index, _width) \
1274 (((_var) >> (_index)) & ((0x1 << (_width)) - 1))
1275
1276#define SET_BITS(_var, _index, _width, _val) \
1277do { \
1278 (_var) &= ~(((0x1 << (_width)) - 1) << (_index)); \
1279 (_var) |= (((_val) & ((0x1 << (_width)) - 1)) << (_index)); \
1280} while (0)
1281
1282#define GET_BITS_LE(_var, _index, _width) \
1283 ((le32_to_cpu((_var)) >> (_index)) & ((0x1 << (_width)) - 1))
1284
1285#define SET_BITS_LE(_var, _index, _width, _val) \
1286do { \
1287 (_var) &= cpu_to_le32(~(((0x1 << (_width)) - 1) << (_index))); \
1288 (_var) |= cpu_to_le32((((_val) & \
1289 ((0x1 << (_width)) - 1)) << (_index))); \
1290} while (0)
1291
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001292/* Bit setting and getting macros based on register fields
1293 * The get macro uses the bit field definitions formed using the input
1294 * names to extract the current bit field value from within the
1295 * variable
1296 *
1297 * The set macro uses the bit field definitions formed using the input
1298 * names to set the bit field of the variable to the specified value
1299 */
1300#define XGMAC_GET_BITS(_var, _prefix, _field) \
1301 GET_BITS((_var), \
1302 _prefix##_##_field##_INDEX, \
1303 _prefix##_##_field##_WIDTH)
1304
1305#define XGMAC_SET_BITS(_var, _prefix, _field, _val) \
1306 SET_BITS((_var), \
1307 _prefix##_##_field##_INDEX, \
1308 _prefix##_##_field##_WIDTH, (_val))
1309
1310#define XGMAC_GET_BITS_LE(_var, _prefix, _field) \
1311 GET_BITS_LE((_var), \
1312 _prefix##_##_field##_INDEX, \
1313 _prefix##_##_field##_WIDTH)
1314
1315#define XGMAC_SET_BITS_LE(_var, _prefix, _field, _val) \
1316 SET_BITS_LE((_var), \
1317 _prefix##_##_field##_INDEX, \
1318 _prefix##_##_field##_WIDTH, (_val))
1319
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001320/* Macros for reading or writing registers
1321 * The ioread macros will get bit fields or full values using the
1322 * register definitions formed using the input names
1323 *
1324 * The iowrite macros will set bit fields or full values using the
1325 * register definitions formed using the input names
1326 */
1327#define XGMAC_IOREAD(_pdata, _reg) \
1328 ioread32((_pdata)->xgmac_regs + _reg)
1329
1330#define XGMAC_IOREAD_BITS(_pdata, _reg, _field) \
1331 GET_BITS(XGMAC_IOREAD((_pdata), _reg), \
1332 _reg##_##_field##_INDEX, \
1333 _reg##_##_field##_WIDTH)
1334
1335#define XGMAC_IOWRITE(_pdata, _reg, _val) \
1336 iowrite32((_val), (_pdata)->xgmac_regs + _reg)
1337
1338#define XGMAC_IOWRITE_BITS(_pdata, _reg, _field, _val) \
1339do { \
1340 u32 reg_val = XGMAC_IOREAD((_pdata), _reg); \
1341 SET_BITS(reg_val, \
1342 _reg##_##_field##_INDEX, \
1343 _reg##_##_field##_WIDTH, (_val)); \
1344 XGMAC_IOWRITE((_pdata), _reg, reg_val); \
1345} while (0)
1346
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001347/* Macros for reading or writing MTL queue or traffic class registers
1348 * Similar to the standard read and write macros except that the
1349 * base register value is calculated by the queue or traffic class number
1350 */
1351#define XGMAC_MTL_IOREAD(_pdata, _n, _reg) \
1352 ioread32((_pdata)->xgmac_regs + \
1353 MTL_Q_BASE + ((_n) * MTL_Q_INC) + _reg)
1354
1355#define XGMAC_MTL_IOREAD_BITS(_pdata, _n, _reg, _field) \
1356 GET_BITS(XGMAC_MTL_IOREAD((_pdata), (_n), _reg), \
1357 _reg##_##_field##_INDEX, \
1358 _reg##_##_field##_WIDTH)
1359
1360#define XGMAC_MTL_IOWRITE(_pdata, _n, _reg, _val) \
1361 iowrite32((_val), (_pdata)->xgmac_regs + \
1362 MTL_Q_BASE + ((_n) * MTL_Q_INC) + _reg)
1363
1364#define XGMAC_MTL_IOWRITE_BITS(_pdata, _n, _reg, _field, _val) \
1365do { \
1366 u32 reg_val = XGMAC_MTL_IOREAD((_pdata), (_n), _reg); \
1367 SET_BITS(reg_val, \
1368 _reg##_##_field##_INDEX, \
1369 _reg##_##_field##_WIDTH, (_val)); \
1370 XGMAC_MTL_IOWRITE((_pdata), (_n), _reg, reg_val); \
1371} while (0)
1372
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001373/* Macros for reading or writing DMA channel registers
1374 * Similar to the standard read and write macros except that the
1375 * base register value is obtained from the ring
1376 */
1377#define XGMAC_DMA_IOREAD(_channel, _reg) \
1378 ioread32((_channel)->dma_regs + _reg)
1379
1380#define XGMAC_DMA_IOREAD_BITS(_channel, _reg, _field) \
1381 GET_BITS(XGMAC_DMA_IOREAD((_channel), _reg), \
1382 _reg##_##_field##_INDEX, \
1383 _reg##_##_field##_WIDTH)
1384
1385#define XGMAC_DMA_IOWRITE(_channel, _reg, _val) \
1386 iowrite32((_val), (_channel)->dma_regs + _reg)
1387
1388#define XGMAC_DMA_IOWRITE_BITS(_channel, _reg, _field, _val) \
1389do { \
1390 u32 reg_val = XGMAC_DMA_IOREAD((_channel), _reg); \
1391 SET_BITS(reg_val, \
1392 _reg##_##_field##_INDEX, \
1393 _reg##_##_field##_WIDTH, (_val)); \
1394 XGMAC_DMA_IOWRITE((_channel), _reg, reg_val); \
1395} while (0)
1396
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001397/* Macros for building, reading or writing register values or bits
1398 * within the register values of XPCS registers.
1399 */
Lendacky, Thomas47f164d2016-11-10 17:09:55 -06001400#define XPCS_GET_BITS(_var, _prefix, _field) \
1401 GET_BITS((_var), \
1402 _prefix##_##_field##_INDEX, \
1403 _prefix##_##_field##_WIDTH)
1404
1405#define XPCS_SET_BITS(_var, _prefix, _field, _val) \
1406 SET_BITS((_var), \
1407 _prefix##_##_field##_INDEX, \
1408 _prefix##_##_field##_WIDTH, (_val))
1409
Lendacky, Thomasb03a4a62016-11-03 13:18:56 -05001410#define XPCS32_IOWRITE(_pdata, _off, _val) \
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001411 iowrite32(_val, (_pdata)->xpcs_regs + (_off))
1412
Lendacky, Thomasb03a4a62016-11-03 13:18:56 -05001413#define XPCS32_IOREAD(_pdata, _off) \
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001414 ioread32((_pdata)->xpcs_regs + (_off))
1415
Lendacky, Thomasb03a4a62016-11-03 13:18:56 -05001416#define XPCS16_IOWRITE(_pdata, _off, _val) \
1417 iowrite16(_val, (_pdata)->xpcs_regs + (_off))
1418
1419#define XPCS16_IOREAD(_pdata, _off) \
1420 ioread16((_pdata)->xpcs_regs + (_off))
1421
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001422/* Macros for building, reading or writing register values or bits
Lendacky, Thomas7c12aa02015-05-14 11:44:15 -05001423 * within the register values of SerDes integration registers.
1424 */
1425#define XSIR_GET_BITS(_var, _prefix, _field) \
1426 GET_BITS((_var), \
1427 _prefix##_##_field##_INDEX, \
1428 _prefix##_##_field##_WIDTH)
1429
1430#define XSIR_SET_BITS(_var, _prefix, _field, _val) \
1431 SET_BITS((_var), \
1432 _prefix##_##_field##_INDEX, \
1433 _prefix##_##_field##_WIDTH, (_val))
1434
1435#define XSIR0_IOREAD(_pdata, _reg) \
1436 ioread16((_pdata)->sir0_regs + _reg)
1437
1438#define XSIR0_IOREAD_BITS(_pdata, _reg, _field) \
1439 GET_BITS(XSIR0_IOREAD((_pdata), _reg), \
1440 _reg##_##_field##_INDEX, \
1441 _reg##_##_field##_WIDTH)
1442
1443#define XSIR0_IOWRITE(_pdata, _reg, _val) \
1444 iowrite16((_val), (_pdata)->sir0_regs + _reg)
1445
1446#define XSIR0_IOWRITE_BITS(_pdata, _reg, _field, _val) \
1447do { \
1448 u16 reg_val = XSIR0_IOREAD((_pdata), _reg); \
1449 SET_BITS(reg_val, \
1450 _reg##_##_field##_INDEX, \
1451 _reg##_##_field##_WIDTH, (_val)); \
1452 XSIR0_IOWRITE((_pdata), _reg, reg_val); \
1453} while (0)
1454
1455#define XSIR1_IOREAD(_pdata, _reg) \
1456 ioread16((_pdata)->sir1_regs + _reg)
1457
1458#define XSIR1_IOREAD_BITS(_pdata, _reg, _field) \
1459 GET_BITS(XSIR1_IOREAD((_pdata), _reg), \
1460 _reg##_##_field##_INDEX, \
1461 _reg##_##_field##_WIDTH)
1462
1463#define XSIR1_IOWRITE(_pdata, _reg, _val) \
1464 iowrite16((_val), (_pdata)->sir1_regs + _reg)
1465
1466#define XSIR1_IOWRITE_BITS(_pdata, _reg, _field, _val) \
1467do { \
1468 u16 reg_val = XSIR1_IOREAD((_pdata), _reg); \
1469 SET_BITS(reg_val, \
1470 _reg##_##_field##_INDEX, \
1471 _reg##_##_field##_WIDTH, (_val)); \
1472 XSIR1_IOWRITE((_pdata), _reg, reg_val); \
1473} while (0)
1474
1475/* Macros for building, reading or writing register values or bits
1476 * within the register values of SerDes RxTx registers.
1477 */
1478#define XRXTX_IOREAD(_pdata, _reg) \
1479 ioread16((_pdata)->rxtx_regs + _reg)
1480
1481#define XRXTX_IOREAD_BITS(_pdata, _reg, _field) \
1482 GET_BITS(XRXTX_IOREAD((_pdata), _reg), \
1483 _reg##_##_field##_INDEX, \
1484 _reg##_##_field##_WIDTH)
1485
1486#define XRXTX_IOWRITE(_pdata, _reg, _val) \
1487 iowrite16((_val), (_pdata)->rxtx_regs + _reg)
1488
1489#define XRXTX_IOWRITE_BITS(_pdata, _reg, _field, _val) \
1490do { \
1491 u16 reg_val = XRXTX_IOREAD((_pdata), _reg); \
1492 SET_BITS(reg_val, \
1493 _reg##_##_field##_INDEX, \
1494 _reg##_##_field##_WIDTH, (_val)); \
1495 XRXTX_IOWRITE((_pdata), _reg, reg_val); \
1496} while (0)
1497
1498/* Macros for building, reading or writing register values or bits
Lendacky, Thomas47f164d2016-11-10 17:09:55 -06001499 * within the register values of MAC Control registers.
1500 */
1501#define XP_GET_BITS(_var, _prefix, _field) \
1502 GET_BITS((_var), \
1503 _prefix##_##_field##_INDEX, \
1504 _prefix##_##_field##_WIDTH)
1505
1506#define XP_SET_BITS(_var, _prefix, _field, _val) \
1507 SET_BITS((_var), \
1508 _prefix##_##_field##_INDEX, \
1509 _prefix##_##_field##_WIDTH, (_val))
1510
1511#define XP_IOREAD(_pdata, _reg) \
1512 ioread32((_pdata)->xprop_regs + (_reg))
1513
1514#define XP_IOREAD_BITS(_pdata, _reg, _field) \
1515 GET_BITS(XP_IOREAD((_pdata), (_reg)), \
1516 _reg##_##_field##_INDEX, \
1517 _reg##_##_field##_WIDTH)
1518
1519#define XP_IOWRITE(_pdata, _reg, _val) \
1520 iowrite32((_val), (_pdata)->xprop_regs + (_reg))
1521
1522#define XP_IOWRITE_BITS(_pdata, _reg, _field, _val) \
1523do { \
1524 u32 reg_val = XP_IOREAD((_pdata), (_reg)); \
1525 SET_BITS(reg_val, \
1526 _reg##_##_field##_INDEX, \
1527 _reg##_##_field##_WIDTH, (_val)); \
1528 XP_IOWRITE((_pdata), (_reg), reg_val); \
1529} while (0)
1530
1531/* Macros for building, reading or writing register values or bits
Lendacky, Thomas5ab1dcd2016-11-10 17:10:36 -06001532 * within the register values of I2C Control registers.
1533 */
1534#define XI2C_GET_BITS(_var, _prefix, _field) \
1535 GET_BITS((_var), \
1536 _prefix##_##_field##_INDEX, \
1537 _prefix##_##_field##_WIDTH)
1538
1539#define XI2C_SET_BITS(_var, _prefix, _field, _val) \
1540 SET_BITS((_var), \
1541 _prefix##_##_field##_INDEX, \
1542 _prefix##_##_field##_WIDTH, (_val))
1543
1544#define XI2C_IOREAD(_pdata, _reg) \
1545 ioread32((_pdata)->xi2c_regs + (_reg))
1546
1547#define XI2C_IOREAD_BITS(_pdata, _reg, _field) \
1548 GET_BITS(XI2C_IOREAD((_pdata), (_reg)), \
1549 _reg##_##_field##_INDEX, \
1550 _reg##_##_field##_WIDTH)
1551
1552#define XI2C_IOWRITE(_pdata, _reg, _val) \
1553 iowrite32((_val), (_pdata)->xi2c_regs + (_reg))
1554
1555#define XI2C_IOWRITE_BITS(_pdata, _reg, _field, _val) \
1556do { \
1557 u32 reg_val = XI2C_IOREAD((_pdata), (_reg)); \
1558 SET_BITS(reg_val, \
1559 _reg##_##_field##_INDEX, \
1560 _reg##_##_field##_WIDTH, (_val)); \
1561 XI2C_IOWRITE((_pdata), (_reg), reg_val); \
1562} while (0)
1563
1564/* Macros for building, reading or writing register values or bits
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001565 * using MDIO. Different from above because of the use of standardized
1566 * Linux include values. No shifting is performed with the bit
1567 * operations, everything works on mask values.
1568 */
1569#define XMDIO_READ(_pdata, _mmd, _reg) \
1570 ((_pdata)->hw_if.read_mmd_regs((_pdata), 0, \
1571 MII_ADDR_C45 | (_mmd << 16) | ((_reg) & 0xffff)))
1572
1573#define XMDIO_READ_BITS(_pdata, _mmd, _reg, _mask) \
1574 (XMDIO_READ((_pdata), _mmd, _reg) & _mask)
1575
1576#define XMDIO_WRITE(_pdata, _mmd, _reg, _val) \
1577 ((_pdata)->hw_if.write_mmd_regs((_pdata), 0, \
1578 MII_ADDR_C45 | (_mmd << 16) | ((_reg) & 0xffff), (_val)))
1579
1580#define XMDIO_WRITE_BITS(_pdata, _mmd, _reg, _mask, _val) \
1581do { \
1582 u32 mmd_val = XMDIO_READ((_pdata), _mmd, _reg); \
1583 mmd_val &= ~_mask; \
1584 mmd_val |= (_val); \
1585 XMDIO_WRITE((_pdata), _mmd, _reg, mmd_val); \
1586} while (0)
1587
1588#endif