162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * AMD 10Gb Ethernet driver
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * This file is available to you under your choice of the following two
562306a36Sopenharmony_ci * licenses:
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * License 1: GPLv2
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * This file is free software; you may copy, redistribute and/or modify
1262306a36Sopenharmony_ci * it under the terms of the GNU General Public License as published by
1362306a36Sopenharmony_ci * the Free Software Foundation, either version 2 of the License, or (at
1462306a36Sopenharmony_ci * your option) any later version.
1562306a36Sopenharmony_ci *
1662306a36Sopenharmony_ci * This file is distributed in the hope that it will be useful, but
1762306a36Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of
1862306a36Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1962306a36Sopenharmony_ci * General Public License for more details.
2062306a36Sopenharmony_ci *
2162306a36Sopenharmony_ci * You should have received a copy of the GNU General Public License
2262306a36Sopenharmony_ci * along with this program.  If not, see <http://www.gnu.org/licenses/>.
2362306a36Sopenharmony_ci *
2462306a36Sopenharmony_ci * This file incorporates work covered by the following copyright and
2562306a36Sopenharmony_ci * permission notice:
2662306a36Sopenharmony_ci *     The Synopsys DWC ETHER XGMAC Software Driver and documentation
2762306a36Sopenharmony_ci *     (hereinafter "Software") is an unsupported proprietary work of Synopsys,
2862306a36Sopenharmony_ci *     Inc. unless otherwise expressly agreed to in writing between Synopsys
2962306a36Sopenharmony_ci *     and you.
3062306a36Sopenharmony_ci *
3162306a36Sopenharmony_ci *     The Software IS NOT an item of Licensed Software or Licensed Product
3262306a36Sopenharmony_ci *     under any End User Software License Agreement or Agreement for Licensed
3362306a36Sopenharmony_ci *     Product with Synopsys or any supplement thereto.  Permission is hereby
3462306a36Sopenharmony_ci *     granted, free of charge, to any person obtaining a copy of this software
3562306a36Sopenharmony_ci *     annotated with this license and the Software, to deal in the Software
3662306a36Sopenharmony_ci *     without restriction, including without limitation the rights to use,
3762306a36Sopenharmony_ci *     copy, modify, merge, publish, distribute, sublicense, and/or sell copies
3862306a36Sopenharmony_ci *     of the Software, and to permit persons to whom the Software is furnished
3962306a36Sopenharmony_ci *     to do so, subject to the following conditions:
4062306a36Sopenharmony_ci *
4162306a36Sopenharmony_ci *     The above copyright notice and this permission notice shall be included
4262306a36Sopenharmony_ci *     in all copies or substantial portions of the Software.
4362306a36Sopenharmony_ci *
4462306a36Sopenharmony_ci *     THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
4562306a36Sopenharmony_ci *     BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
4662306a36Sopenharmony_ci *     TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
4762306a36Sopenharmony_ci *     PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
4862306a36Sopenharmony_ci *     BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
4962306a36Sopenharmony_ci *     CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
5062306a36Sopenharmony_ci *     SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
5162306a36Sopenharmony_ci *     INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
5262306a36Sopenharmony_ci *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
5362306a36Sopenharmony_ci *     ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
5462306a36Sopenharmony_ci *     THE POSSIBILITY OF SUCH DAMAGE.
5562306a36Sopenharmony_ci *
5662306a36Sopenharmony_ci *
5762306a36Sopenharmony_ci * License 2: Modified BSD
5862306a36Sopenharmony_ci *
5962306a36Sopenharmony_ci * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
6062306a36Sopenharmony_ci * All rights reserved.
6162306a36Sopenharmony_ci *
6262306a36Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
6362306a36Sopenharmony_ci * modification, are permitted provided that the following conditions are met:
6462306a36Sopenharmony_ci *     * Redistributions of source code must retain the above copyright
6562306a36Sopenharmony_ci *       notice, this list of conditions and the following disclaimer.
6662306a36Sopenharmony_ci *     * Redistributions in binary form must reproduce the above copyright
6762306a36Sopenharmony_ci *       notice, this list of conditions and the following disclaimer in the
6862306a36Sopenharmony_ci *       documentation and/or other materials provided with the distribution.
6962306a36Sopenharmony_ci *     * Neither the name of Advanced Micro Devices, Inc. nor the
7062306a36Sopenharmony_ci *       names of its contributors may be used to endorse or promote products
7162306a36Sopenharmony_ci *       derived from this software without specific prior written permission.
7262306a36Sopenharmony_ci *
7362306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
7462306a36Sopenharmony_ci * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
7562306a36Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
7662306a36Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
7762306a36Sopenharmony_ci * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
7862306a36Sopenharmony_ci * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
7962306a36Sopenharmony_ci * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
8062306a36Sopenharmony_ci * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8162306a36Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
8262306a36Sopenharmony_ci * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8362306a36Sopenharmony_ci *
8462306a36Sopenharmony_ci * This file incorporates work covered by the following copyright and
8562306a36Sopenharmony_ci * permission notice:
8662306a36Sopenharmony_ci *     The Synopsys DWC ETHER XGMAC Software Driver and documentation
8762306a36Sopenharmony_ci *     (hereinafter "Software") is an unsupported proprietary work of Synopsys,
8862306a36Sopenharmony_ci *     Inc. unless otherwise expressly agreed to in writing between Synopsys
8962306a36Sopenharmony_ci *     and you.
9062306a36Sopenharmony_ci *
9162306a36Sopenharmony_ci *     The Software IS NOT an item of Licensed Software or Licensed Product
9262306a36Sopenharmony_ci *     under any End User Software License Agreement or Agreement for Licensed
9362306a36Sopenharmony_ci *     Product with Synopsys or any supplement thereto.  Permission is hereby
9462306a36Sopenharmony_ci *     granted, free of charge, to any person obtaining a copy of this software
9562306a36Sopenharmony_ci *     annotated with this license and the Software, to deal in the Software
9662306a36Sopenharmony_ci *     without restriction, including without limitation the rights to use,
9762306a36Sopenharmony_ci *     copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9862306a36Sopenharmony_ci *     of the Software, and to permit persons to whom the Software is furnished
9962306a36Sopenharmony_ci *     to do so, subject to the following conditions:
10062306a36Sopenharmony_ci *
10162306a36Sopenharmony_ci *     The above copyright notice and this permission notice shall be included
10262306a36Sopenharmony_ci *     in all copies or substantial portions of the Software.
10362306a36Sopenharmony_ci *
10462306a36Sopenharmony_ci *     THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
10562306a36Sopenharmony_ci *     BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
10662306a36Sopenharmony_ci *     TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
10762306a36Sopenharmony_ci *     PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
10862306a36Sopenharmony_ci *     BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
10962306a36Sopenharmony_ci *     CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
11062306a36Sopenharmony_ci *     SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
11162306a36Sopenharmony_ci *     INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
11262306a36Sopenharmony_ci *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
11362306a36Sopenharmony_ci *     ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
11462306a36Sopenharmony_ci *     THE POSSIBILITY OF SUCH DAMAGE.
11562306a36Sopenharmony_ci */
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci#ifndef __XGBE_COMMON_H__
11862306a36Sopenharmony_ci#define __XGBE_COMMON_H__
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci/* DMA register offsets */
12162306a36Sopenharmony_ci#define DMA_MR				0x3000
12262306a36Sopenharmony_ci#define DMA_SBMR			0x3004
12362306a36Sopenharmony_ci#define DMA_ISR				0x3008
12462306a36Sopenharmony_ci#define DMA_AXIARCR			0x3010
12562306a36Sopenharmony_ci#define DMA_AXIAWCR			0x3018
12662306a36Sopenharmony_ci#define DMA_AXIAWARCR			0x301c
12762306a36Sopenharmony_ci#define DMA_DSR0			0x3020
12862306a36Sopenharmony_ci#define DMA_DSR1			0x3024
12962306a36Sopenharmony_ci#define DMA_TXEDMACR			0x3040
13062306a36Sopenharmony_ci#define DMA_RXEDMACR			0x3044
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ci/* DMA register entry bit positions and sizes */
13362306a36Sopenharmony_ci#define DMA_ISR_MACIS_INDEX		17
13462306a36Sopenharmony_ci#define DMA_ISR_MACIS_WIDTH		1
13562306a36Sopenharmony_ci#define DMA_ISR_MTLIS_INDEX		16
13662306a36Sopenharmony_ci#define DMA_ISR_MTLIS_WIDTH		1
13762306a36Sopenharmony_ci#define DMA_MR_INTM_INDEX		12
13862306a36Sopenharmony_ci#define DMA_MR_INTM_WIDTH		2
13962306a36Sopenharmony_ci#define DMA_MR_SWR_INDEX		0
14062306a36Sopenharmony_ci#define DMA_MR_SWR_WIDTH		1
14162306a36Sopenharmony_ci#define DMA_RXEDMACR_RDPS_INDEX		0
14262306a36Sopenharmony_ci#define DMA_RXEDMACR_RDPS_WIDTH		3
14362306a36Sopenharmony_ci#define DMA_SBMR_AAL_INDEX		12
14462306a36Sopenharmony_ci#define DMA_SBMR_AAL_WIDTH		1
14562306a36Sopenharmony_ci#define DMA_SBMR_EAME_INDEX		11
14662306a36Sopenharmony_ci#define DMA_SBMR_EAME_WIDTH		1
14762306a36Sopenharmony_ci#define DMA_SBMR_BLEN_INDEX		1
14862306a36Sopenharmony_ci#define DMA_SBMR_BLEN_WIDTH		7
14962306a36Sopenharmony_ci#define DMA_SBMR_RD_OSR_LMT_INDEX	16
15062306a36Sopenharmony_ci#define DMA_SBMR_RD_OSR_LMT_WIDTH	6
15162306a36Sopenharmony_ci#define DMA_SBMR_UNDEF_INDEX		0
15262306a36Sopenharmony_ci#define DMA_SBMR_UNDEF_WIDTH		1
15362306a36Sopenharmony_ci#define DMA_SBMR_WR_OSR_LMT_INDEX	24
15462306a36Sopenharmony_ci#define DMA_SBMR_WR_OSR_LMT_WIDTH	6
15562306a36Sopenharmony_ci#define DMA_TXEDMACR_TDPS_INDEX		0
15662306a36Sopenharmony_ci#define DMA_TXEDMACR_TDPS_WIDTH		3
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci/* DMA register values */
15962306a36Sopenharmony_ci#define DMA_SBMR_BLEN_256		256
16062306a36Sopenharmony_ci#define DMA_SBMR_BLEN_128		128
16162306a36Sopenharmony_ci#define DMA_SBMR_BLEN_64		64
16262306a36Sopenharmony_ci#define DMA_SBMR_BLEN_32		32
16362306a36Sopenharmony_ci#define DMA_SBMR_BLEN_16		16
16462306a36Sopenharmony_ci#define DMA_SBMR_BLEN_8			8
16562306a36Sopenharmony_ci#define DMA_SBMR_BLEN_4			4
16662306a36Sopenharmony_ci#define DMA_DSR_RPS_WIDTH		4
16762306a36Sopenharmony_ci#define DMA_DSR_TPS_WIDTH		4
16862306a36Sopenharmony_ci#define DMA_DSR_Q_WIDTH			(DMA_DSR_RPS_WIDTH + DMA_DSR_TPS_WIDTH)
16962306a36Sopenharmony_ci#define DMA_DSR0_RPS_START		8
17062306a36Sopenharmony_ci#define DMA_DSR0_TPS_START		12
17162306a36Sopenharmony_ci#define DMA_DSRX_FIRST_QUEUE		3
17262306a36Sopenharmony_ci#define DMA_DSRX_INC			4
17362306a36Sopenharmony_ci#define DMA_DSRX_QPR			4
17462306a36Sopenharmony_ci#define DMA_DSRX_RPS_START		0
17562306a36Sopenharmony_ci#define DMA_DSRX_TPS_START		4
17662306a36Sopenharmony_ci#define DMA_TPS_STOPPED			0x00
17762306a36Sopenharmony_ci#define DMA_TPS_SUSPENDED		0x06
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ci/* DMA channel register offsets
18062306a36Sopenharmony_ci *   Multiple channels can be active.  The first channel has registers
18162306a36Sopenharmony_ci *   that begin at 0x3100.  Each subsequent channel has registers that
18262306a36Sopenharmony_ci *   are accessed using an offset of 0x80 from the previous channel.
18362306a36Sopenharmony_ci */
18462306a36Sopenharmony_ci#define DMA_CH_BASE			0x3100
18562306a36Sopenharmony_ci#define DMA_CH_INC			0x80
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci#define DMA_CH_CR			0x00
18862306a36Sopenharmony_ci#define DMA_CH_TCR			0x04
18962306a36Sopenharmony_ci#define DMA_CH_RCR			0x08
19062306a36Sopenharmony_ci#define DMA_CH_TDLR_HI			0x10
19162306a36Sopenharmony_ci#define DMA_CH_TDLR_LO			0x14
19262306a36Sopenharmony_ci#define DMA_CH_RDLR_HI			0x18
19362306a36Sopenharmony_ci#define DMA_CH_RDLR_LO			0x1c
19462306a36Sopenharmony_ci#define DMA_CH_TDTR_LO			0x24
19562306a36Sopenharmony_ci#define DMA_CH_RDTR_LO			0x2c
19662306a36Sopenharmony_ci#define DMA_CH_TDRLR			0x30
19762306a36Sopenharmony_ci#define DMA_CH_RDRLR			0x34
19862306a36Sopenharmony_ci#define DMA_CH_IER			0x38
19962306a36Sopenharmony_ci#define DMA_CH_RIWT			0x3c
20062306a36Sopenharmony_ci#define DMA_CH_CATDR_LO			0x44
20162306a36Sopenharmony_ci#define DMA_CH_CARDR_LO			0x4c
20262306a36Sopenharmony_ci#define DMA_CH_CATBR_HI			0x50
20362306a36Sopenharmony_ci#define DMA_CH_CATBR_LO			0x54
20462306a36Sopenharmony_ci#define DMA_CH_CARBR_HI			0x58
20562306a36Sopenharmony_ci#define DMA_CH_CARBR_LO			0x5c
20662306a36Sopenharmony_ci#define DMA_CH_SR			0x60
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci/* DMA channel register entry bit positions and sizes */
20962306a36Sopenharmony_ci#define DMA_CH_CR_PBLX8_INDEX		16
21062306a36Sopenharmony_ci#define DMA_CH_CR_PBLX8_WIDTH		1
21162306a36Sopenharmony_ci#define DMA_CH_CR_SPH_INDEX		24
21262306a36Sopenharmony_ci#define DMA_CH_CR_SPH_WIDTH		1
21362306a36Sopenharmony_ci#define DMA_CH_IER_AIE20_INDEX		15
21462306a36Sopenharmony_ci#define DMA_CH_IER_AIE20_WIDTH		1
21562306a36Sopenharmony_ci#define DMA_CH_IER_AIE_INDEX		14
21662306a36Sopenharmony_ci#define DMA_CH_IER_AIE_WIDTH		1
21762306a36Sopenharmony_ci#define DMA_CH_IER_FBEE_INDEX		12
21862306a36Sopenharmony_ci#define DMA_CH_IER_FBEE_WIDTH		1
21962306a36Sopenharmony_ci#define DMA_CH_IER_NIE20_INDEX		16
22062306a36Sopenharmony_ci#define DMA_CH_IER_NIE20_WIDTH		1
22162306a36Sopenharmony_ci#define DMA_CH_IER_NIE_INDEX		15
22262306a36Sopenharmony_ci#define DMA_CH_IER_NIE_WIDTH		1
22362306a36Sopenharmony_ci#define DMA_CH_IER_RBUE_INDEX		7
22462306a36Sopenharmony_ci#define DMA_CH_IER_RBUE_WIDTH		1
22562306a36Sopenharmony_ci#define DMA_CH_IER_RIE_INDEX		6
22662306a36Sopenharmony_ci#define DMA_CH_IER_RIE_WIDTH		1
22762306a36Sopenharmony_ci#define DMA_CH_IER_RSE_INDEX		8
22862306a36Sopenharmony_ci#define DMA_CH_IER_RSE_WIDTH		1
22962306a36Sopenharmony_ci#define DMA_CH_IER_TBUE_INDEX		2
23062306a36Sopenharmony_ci#define DMA_CH_IER_TBUE_WIDTH		1
23162306a36Sopenharmony_ci#define DMA_CH_IER_TIE_INDEX		0
23262306a36Sopenharmony_ci#define DMA_CH_IER_TIE_WIDTH		1
23362306a36Sopenharmony_ci#define DMA_CH_IER_TXSE_INDEX		1
23462306a36Sopenharmony_ci#define DMA_CH_IER_TXSE_WIDTH		1
23562306a36Sopenharmony_ci#define DMA_CH_RCR_PBL_INDEX		16
23662306a36Sopenharmony_ci#define DMA_CH_RCR_PBL_WIDTH		6
23762306a36Sopenharmony_ci#define DMA_CH_RCR_RBSZ_INDEX		1
23862306a36Sopenharmony_ci#define DMA_CH_RCR_RBSZ_WIDTH		14
23962306a36Sopenharmony_ci#define DMA_CH_RCR_SR_INDEX		0
24062306a36Sopenharmony_ci#define DMA_CH_RCR_SR_WIDTH		1
24162306a36Sopenharmony_ci#define DMA_CH_RIWT_RWT_INDEX		0
24262306a36Sopenharmony_ci#define DMA_CH_RIWT_RWT_WIDTH		8
24362306a36Sopenharmony_ci#define DMA_CH_SR_FBE_INDEX		12
24462306a36Sopenharmony_ci#define DMA_CH_SR_FBE_WIDTH		1
24562306a36Sopenharmony_ci#define DMA_CH_SR_RBU_INDEX		7
24662306a36Sopenharmony_ci#define DMA_CH_SR_RBU_WIDTH		1
24762306a36Sopenharmony_ci#define DMA_CH_SR_RI_INDEX		6
24862306a36Sopenharmony_ci#define DMA_CH_SR_RI_WIDTH		1
24962306a36Sopenharmony_ci#define DMA_CH_SR_RPS_INDEX		8
25062306a36Sopenharmony_ci#define DMA_CH_SR_RPS_WIDTH		1
25162306a36Sopenharmony_ci#define DMA_CH_SR_TBU_INDEX		2
25262306a36Sopenharmony_ci#define DMA_CH_SR_TBU_WIDTH		1
25362306a36Sopenharmony_ci#define DMA_CH_SR_TI_INDEX		0
25462306a36Sopenharmony_ci#define DMA_CH_SR_TI_WIDTH		1
25562306a36Sopenharmony_ci#define DMA_CH_SR_TPS_INDEX		1
25662306a36Sopenharmony_ci#define DMA_CH_SR_TPS_WIDTH		1
25762306a36Sopenharmony_ci#define DMA_CH_TCR_OSP_INDEX		4
25862306a36Sopenharmony_ci#define DMA_CH_TCR_OSP_WIDTH		1
25962306a36Sopenharmony_ci#define DMA_CH_TCR_PBL_INDEX		16
26062306a36Sopenharmony_ci#define DMA_CH_TCR_PBL_WIDTH		6
26162306a36Sopenharmony_ci#define DMA_CH_TCR_ST_INDEX		0
26262306a36Sopenharmony_ci#define DMA_CH_TCR_ST_WIDTH		1
26362306a36Sopenharmony_ci#define DMA_CH_TCR_TSE_INDEX		12
26462306a36Sopenharmony_ci#define DMA_CH_TCR_TSE_WIDTH		1
26562306a36Sopenharmony_ci
26662306a36Sopenharmony_ci/* DMA channel register values */
26762306a36Sopenharmony_ci#define DMA_OSP_DISABLE			0x00
26862306a36Sopenharmony_ci#define DMA_OSP_ENABLE			0x01
26962306a36Sopenharmony_ci#define DMA_PBL_1			1
27062306a36Sopenharmony_ci#define DMA_PBL_2			2
27162306a36Sopenharmony_ci#define DMA_PBL_4			4
27262306a36Sopenharmony_ci#define DMA_PBL_8			8
27362306a36Sopenharmony_ci#define DMA_PBL_16			16
27462306a36Sopenharmony_ci#define DMA_PBL_32			32
27562306a36Sopenharmony_ci#define DMA_PBL_64			64      /* 8 x 8 */
27662306a36Sopenharmony_ci#define DMA_PBL_128			128     /* 8 x 16 */
27762306a36Sopenharmony_ci#define DMA_PBL_256			256     /* 8 x 32 */
27862306a36Sopenharmony_ci#define DMA_PBL_X8_DISABLE		0x00
27962306a36Sopenharmony_ci#define DMA_PBL_X8_ENABLE		0x01
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci/* MAC register offsets */
28262306a36Sopenharmony_ci#define MAC_TCR				0x0000
28362306a36Sopenharmony_ci#define MAC_RCR				0x0004
28462306a36Sopenharmony_ci#define MAC_PFR				0x0008
28562306a36Sopenharmony_ci#define MAC_WTR				0x000c
28662306a36Sopenharmony_ci#define MAC_HTR0			0x0010
28762306a36Sopenharmony_ci#define MAC_VLANTR			0x0050
28862306a36Sopenharmony_ci#define MAC_VLANHTR			0x0058
28962306a36Sopenharmony_ci#define MAC_VLANIR			0x0060
29062306a36Sopenharmony_ci#define MAC_IVLANIR			0x0064
29162306a36Sopenharmony_ci#define MAC_RETMR			0x006c
29262306a36Sopenharmony_ci#define MAC_Q0TFCR			0x0070
29362306a36Sopenharmony_ci#define MAC_RFCR			0x0090
29462306a36Sopenharmony_ci#define MAC_RQC0R			0x00a0
29562306a36Sopenharmony_ci#define MAC_RQC1R			0x00a4
29662306a36Sopenharmony_ci#define MAC_RQC2R			0x00a8
29762306a36Sopenharmony_ci#define MAC_RQC3R			0x00ac
29862306a36Sopenharmony_ci#define MAC_ISR				0x00b0
29962306a36Sopenharmony_ci#define MAC_IER				0x00b4
30062306a36Sopenharmony_ci#define MAC_RTSR			0x00b8
30162306a36Sopenharmony_ci#define MAC_PMTCSR			0x00c0
30262306a36Sopenharmony_ci#define MAC_RWKPFR			0x00c4
30362306a36Sopenharmony_ci#define MAC_LPICSR			0x00d0
30462306a36Sopenharmony_ci#define MAC_LPITCR			0x00d4
30562306a36Sopenharmony_ci#define MAC_TIR				0x00e0
30662306a36Sopenharmony_ci#define MAC_VR				0x0110
30762306a36Sopenharmony_ci#define MAC_DR				0x0114
30862306a36Sopenharmony_ci#define MAC_HWF0R			0x011c
30962306a36Sopenharmony_ci#define MAC_HWF1R			0x0120
31062306a36Sopenharmony_ci#define MAC_HWF2R			0x0124
31162306a36Sopenharmony_ci#define MAC_MDIOSCAR			0x0200
31262306a36Sopenharmony_ci#define MAC_MDIOSCCDR			0x0204
31362306a36Sopenharmony_ci#define MAC_MDIOISR			0x0214
31462306a36Sopenharmony_ci#define MAC_MDIOIER			0x0218
31562306a36Sopenharmony_ci#define MAC_MDIOCL22R			0x0220
31662306a36Sopenharmony_ci#define MAC_GPIOCR			0x0278
31762306a36Sopenharmony_ci#define MAC_GPIOSR			0x027c
31862306a36Sopenharmony_ci#define MAC_MACA0HR			0x0300
31962306a36Sopenharmony_ci#define MAC_MACA0LR			0x0304
32062306a36Sopenharmony_ci#define MAC_MACA1HR			0x0308
32162306a36Sopenharmony_ci#define MAC_MACA1LR			0x030c
32262306a36Sopenharmony_ci#define MAC_RSSCR			0x0c80
32362306a36Sopenharmony_ci#define MAC_RSSAR			0x0c88
32462306a36Sopenharmony_ci#define MAC_RSSDR			0x0c8c
32562306a36Sopenharmony_ci#define MAC_TSCR			0x0d00
32662306a36Sopenharmony_ci#define MAC_SSIR			0x0d04
32762306a36Sopenharmony_ci#define MAC_STSR			0x0d08
32862306a36Sopenharmony_ci#define MAC_STNR			0x0d0c
32962306a36Sopenharmony_ci#define MAC_STSUR			0x0d10
33062306a36Sopenharmony_ci#define MAC_STNUR			0x0d14
33162306a36Sopenharmony_ci#define MAC_TSAR			0x0d18
33262306a36Sopenharmony_ci#define MAC_TSSR			0x0d20
33362306a36Sopenharmony_ci#define MAC_TXSNR			0x0d30
33462306a36Sopenharmony_ci#define MAC_TXSSR			0x0d34
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_ci#define MAC_QTFCR_INC			4
33762306a36Sopenharmony_ci#define MAC_MACA_INC			4
33862306a36Sopenharmony_ci#define MAC_HTR_INC			4
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_ci#define MAC_RQC2_INC			4
34162306a36Sopenharmony_ci#define MAC_RQC2_Q_PER_REG		4
34262306a36Sopenharmony_ci
34362306a36Sopenharmony_ci/* MAC register entry bit positions and sizes */
34462306a36Sopenharmony_ci#define MAC_HWF0R_ADDMACADRSEL_INDEX	18
34562306a36Sopenharmony_ci#define MAC_HWF0R_ADDMACADRSEL_WIDTH	5
34662306a36Sopenharmony_ci#define MAC_HWF0R_ARPOFFSEL_INDEX	9
34762306a36Sopenharmony_ci#define MAC_HWF0R_ARPOFFSEL_WIDTH	1
34862306a36Sopenharmony_ci#define MAC_HWF0R_EEESEL_INDEX		13
34962306a36Sopenharmony_ci#define MAC_HWF0R_EEESEL_WIDTH		1
35062306a36Sopenharmony_ci#define MAC_HWF0R_GMIISEL_INDEX		1
35162306a36Sopenharmony_ci#define MAC_HWF0R_GMIISEL_WIDTH		1
35262306a36Sopenharmony_ci#define MAC_HWF0R_MGKSEL_INDEX		7
35362306a36Sopenharmony_ci#define MAC_HWF0R_MGKSEL_WIDTH		1
35462306a36Sopenharmony_ci#define MAC_HWF0R_MMCSEL_INDEX		8
35562306a36Sopenharmony_ci#define MAC_HWF0R_MMCSEL_WIDTH		1
35662306a36Sopenharmony_ci#define MAC_HWF0R_RWKSEL_INDEX		6
35762306a36Sopenharmony_ci#define MAC_HWF0R_RWKSEL_WIDTH		1
35862306a36Sopenharmony_ci#define MAC_HWF0R_RXCOESEL_INDEX	16
35962306a36Sopenharmony_ci#define MAC_HWF0R_RXCOESEL_WIDTH	1
36062306a36Sopenharmony_ci#define MAC_HWF0R_SAVLANINS_INDEX	27
36162306a36Sopenharmony_ci#define MAC_HWF0R_SAVLANINS_WIDTH	1
36262306a36Sopenharmony_ci#define MAC_HWF0R_SMASEL_INDEX		5
36362306a36Sopenharmony_ci#define MAC_HWF0R_SMASEL_WIDTH		1
36462306a36Sopenharmony_ci#define MAC_HWF0R_TSSEL_INDEX		12
36562306a36Sopenharmony_ci#define MAC_HWF0R_TSSEL_WIDTH		1
36662306a36Sopenharmony_ci#define MAC_HWF0R_TSSTSSEL_INDEX	25
36762306a36Sopenharmony_ci#define MAC_HWF0R_TSSTSSEL_WIDTH	2
36862306a36Sopenharmony_ci#define MAC_HWF0R_TXCOESEL_INDEX	14
36962306a36Sopenharmony_ci#define MAC_HWF0R_TXCOESEL_WIDTH	1
37062306a36Sopenharmony_ci#define MAC_HWF0R_VLHASH_INDEX		4
37162306a36Sopenharmony_ci#define MAC_HWF0R_VLHASH_WIDTH		1
37262306a36Sopenharmony_ci#define MAC_HWF0R_VXN_INDEX		29
37362306a36Sopenharmony_ci#define MAC_HWF0R_VXN_WIDTH		1
37462306a36Sopenharmony_ci#define MAC_HWF1R_ADDR64_INDEX		14
37562306a36Sopenharmony_ci#define MAC_HWF1R_ADDR64_WIDTH		2
37662306a36Sopenharmony_ci#define MAC_HWF1R_ADVTHWORD_INDEX	13
37762306a36Sopenharmony_ci#define MAC_HWF1R_ADVTHWORD_WIDTH	1
37862306a36Sopenharmony_ci#define MAC_HWF1R_DBGMEMA_INDEX		19
37962306a36Sopenharmony_ci#define MAC_HWF1R_DBGMEMA_WIDTH		1
38062306a36Sopenharmony_ci#define MAC_HWF1R_DCBEN_INDEX		16
38162306a36Sopenharmony_ci#define MAC_HWF1R_DCBEN_WIDTH		1
38262306a36Sopenharmony_ci#define MAC_HWF1R_HASHTBLSZ_INDEX	24
38362306a36Sopenharmony_ci#define MAC_HWF1R_HASHTBLSZ_WIDTH	3
38462306a36Sopenharmony_ci#define MAC_HWF1R_L3L4FNUM_INDEX	27
38562306a36Sopenharmony_ci#define MAC_HWF1R_L3L4FNUM_WIDTH	4
38662306a36Sopenharmony_ci#define MAC_HWF1R_NUMTC_INDEX		21
38762306a36Sopenharmony_ci#define MAC_HWF1R_NUMTC_WIDTH		3
38862306a36Sopenharmony_ci#define MAC_HWF1R_RSSEN_INDEX		20
38962306a36Sopenharmony_ci#define MAC_HWF1R_RSSEN_WIDTH		1
39062306a36Sopenharmony_ci#define MAC_HWF1R_RXFIFOSIZE_INDEX	0
39162306a36Sopenharmony_ci#define MAC_HWF1R_RXFIFOSIZE_WIDTH	5
39262306a36Sopenharmony_ci#define MAC_HWF1R_SPHEN_INDEX		17
39362306a36Sopenharmony_ci#define MAC_HWF1R_SPHEN_WIDTH		1
39462306a36Sopenharmony_ci#define MAC_HWF1R_TSOEN_INDEX		18
39562306a36Sopenharmony_ci#define MAC_HWF1R_TSOEN_WIDTH		1
39662306a36Sopenharmony_ci#define MAC_HWF1R_TXFIFOSIZE_INDEX	6
39762306a36Sopenharmony_ci#define MAC_HWF1R_TXFIFOSIZE_WIDTH	5
39862306a36Sopenharmony_ci#define MAC_HWF2R_AUXSNAPNUM_INDEX	28
39962306a36Sopenharmony_ci#define MAC_HWF2R_AUXSNAPNUM_WIDTH	3
40062306a36Sopenharmony_ci#define MAC_HWF2R_PPSOUTNUM_INDEX	24
40162306a36Sopenharmony_ci#define MAC_HWF2R_PPSOUTNUM_WIDTH	3
40262306a36Sopenharmony_ci#define MAC_HWF2R_RXCHCNT_INDEX		12
40362306a36Sopenharmony_ci#define MAC_HWF2R_RXCHCNT_WIDTH		4
40462306a36Sopenharmony_ci#define MAC_HWF2R_RXQCNT_INDEX		0
40562306a36Sopenharmony_ci#define MAC_HWF2R_RXQCNT_WIDTH		4
40662306a36Sopenharmony_ci#define MAC_HWF2R_TXCHCNT_INDEX		18
40762306a36Sopenharmony_ci#define MAC_HWF2R_TXCHCNT_WIDTH		4
40862306a36Sopenharmony_ci#define MAC_HWF2R_TXQCNT_INDEX		6
40962306a36Sopenharmony_ci#define MAC_HWF2R_TXQCNT_WIDTH		4
41062306a36Sopenharmony_ci#define MAC_IER_TSIE_INDEX		12
41162306a36Sopenharmony_ci#define MAC_IER_TSIE_WIDTH		1
41262306a36Sopenharmony_ci#define MAC_ISR_MMCRXIS_INDEX		9
41362306a36Sopenharmony_ci#define MAC_ISR_MMCRXIS_WIDTH		1
41462306a36Sopenharmony_ci#define MAC_ISR_MMCTXIS_INDEX		10
41562306a36Sopenharmony_ci#define MAC_ISR_MMCTXIS_WIDTH		1
41662306a36Sopenharmony_ci#define MAC_ISR_PMTIS_INDEX		4
41762306a36Sopenharmony_ci#define MAC_ISR_PMTIS_WIDTH		1
41862306a36Sopenharmony_ci#define MAC_ISR_SMI_INDEX		1
41962306a36Sopenharmony_ci#define MAC_ISR_SMI_WIDTH		1
42062306a36Sopenharmony_ci#define MAC_ISR_TSIS_INDEX		12
42162306a36Sopenharmony_ci#define MAC_ISR_TSIS_WIDTH		1
42262306a36Sopenharmony_ci#define MAC_MACA1HR_AE_INDEX		31
42362306a36Sopenharmony_ci#define MAC_MACA1HR_AE_WIDTH		1
42462306a36Sopenharmony_ci#define MAC_MDIOIER_SNGLCOMPIE_INDEX	12
42562306a36Sopenharmony_ci#define MAC_MDIOIER_SNGLCOMPIE_WIDTH	1
42662306a36Sopenharmony_ci#define MAC_MDIOISR_SNGLCOMPINT_INDEX	12
42762306a36Sopenharmony_ci#define MAC_MDIOISR_SNGLCOMPINT_WIDTH	1
42862306a36Sopenharmony_ci#define MAC_MDIOSCAR_DA_INDEX		21
42962306a36Sopenharmony_ci#define MAC_MDIOSCAR_DA_WIDTH		5
43062306a36Sopenharmony_ci#define MAC_MDIOSCAR_PA_INDEX		16
43162306a36Sopenharmony_ci#define MAC_MDIOSCAR_PA_WIDTH		5
43262306a36Sopenharmony_ci#define MAC_MDIOSCAR_RA_INDEX		0
43362306a36Sopenharmony_ci#define MAC_MDIOSCAR_RA_WIDTH		16
43462306a36Sopenharmony_ci#define MAC_MDIOSCCDR_BUSY_INDEX	22
43562306a36Sopenharmony_ci#define MAC_MDIOSCCDR_BUSY_WIDTH	1
43662306a36Sopenharmony_ci#define MAC_MDIOSCCDR_CMD_INDEX		16
43762306a36Sopenharmony_ci#define MAC_MDIOSCCDR_CMD_WIDTH		2
43862306a36Sopenharmony_ci#define MAC_MDIOSCCDR_CR_INDEX		19
43962306a36Sopenharmony_ci#define MAC_MDIOSCCDR_CR_WIDTH		3
44062306a36Sopenharmony_ci#define MAC_MDIOSCCDR_DATA_INDEX	0
44162306a36Sopenharmony_ci#define MAC_MDIOSCCDR_DATA_WIDTH	16
44262306a36Sopenharmony_ci#define MAC_MDIOSCCDR_SADDR_INDEX	18
44362306a36Sopenharmony_ci#define MAC_MDIOSCCDR_SADDR_WIDTH	1
44462306a36Sopenharmony_ci#define MAC_PFR_HMC_INDEX		2
44562306a36Sopenharmony_ci#define MAC_PFR_HMC_WIDTH		1
44662306a36Sopenharmony_ci#define MAC_PFR_HPF_INDEX		10
44762306a36Sopenharmony_ci#define MAC_PFR_HPF_WIDTH		1
44862306a36Sopenharmony_ci#define MAC_PFR_HUC_INDEX		1
44962306a36Sopenharmony_ci#define MAC_PFR_HUC_WIDTH		1
45062306a36Sopenharmony_ci#define MAC_PFR_PM_INDEX		4
45162306a36Sopenharmony_ci#define MAC_PFR_PM_WIDTH		1
45262306a36Sopenharmony_ci#define MAC_PFR_PR_INDEX		0
45362306a36Sopenharmony_ci#define MAC_PFR_PR_WIDTH		1
45462306a36Sopenharmony_ci#define MAC_PFR_VTFE_INDEX		16
45562306a36Sopenharmony_ci#define MAC_PFR_VTFE_WIDTH		1
45662306a36Sopenharmony_ci#define MAC_PFR_VUCC_INDEX		22
45762306a36Sopenharmony_ci#define MAC_PFR_VUCC_WIDTH		1
45862306a36Sopenharmony_ci#define MAC_PMTCSR_MGKPKTEN_INDEX	1
45962306a36Sopenharmony_ci#define MAC_PMTCSR_MGKPKTEN_WIDTH	1
46062306a36Sopenharmony_ci#define MAC_PMTCSR_PWRDWN_INDEX		0
46162306a36Sopenharmony_ci#define MAC_PMTCSR_PWRDWN_WIDTH		1
46262306a36Sopenharmony_ci#define MAC_PMTCSR_RWKFILTRST_INDEX	31
46362306a36Sopenharmony_ci#define MAC_PMTCSR_RWKFILTRST_WIDTH	1
46462306a36Sopenharmony_ci#define MAC_PMTCSR_RWKPKTEN_INDEX	2
46562306a36Sopenharmony_ci#define MAC_PMTCSR_RWKPKTEN_WIDTH	1
46662306a36Sopenharmony_ci#define MAC_Q0TFCR_PT_INDEX		16
46762306a36Sopenharmony_ci#define MAC_Q0TFCR_PT_WIDTH		16
46862306a36Sopenharmony_ci#define MAC_Q0TFCR_TFE_INDEX		1
46962306a36Sopenharmony_ci#define MAC_Q0TFCR_TFE_WIDTH		1
47062306a36Sopenharmony_ci#define MAC_RCR_ACS_INDEX		1
47162306a36Sopenharmony_ci#define MAC_RCR_ACS_WIDTH		1
47262306a36Sopenharmony_ci#define MAC_RCR_CST_INDEX		2
47362306a36Sopenharmony_ci#define MAC_RCR_CST_WIDTH		1
47462306a36Sopenharmony_ci#define MAC_RCR_DCRCC_INDEX		3
47562306a36Sopenharmony_ci#define MAC_RCR_DCRCC_WIDTH		1
47662306a36Sopenharmony_ci#define MAC_RCR_HDSMS_INDEX		12
47762306a36Sopenharmony_ci#define MAC_RCR_HDSMS_WIDTH		3
47862306a36Sopenharmony_ci#define MAC_RCR_IPC_INDEX		9
47962306a36Sopenharmony_ci#define MAC_RCR_IPC_WIDTH		1
48062306a36Sopenharmony_ci#define MAC_RCR_JE_INDEX		8
48162306a36Sopenharmony_ci#define MAC_RCR_JE_WIDTH		1
48262306a36Sopenharmony_ci#define MAC_RCR_LM_INDEX		10
48362306a36Sopenharmony_ci#define MAC_RCR_LM_WIDTH		1
48462306a36Sopenharmony_ci#define MAC_RCR_RE_INDEX		0
48562306a36Sopenharmony_ci#define MAC_RCR_RE_WIDTH		1
48662306a36Sopenharmony_ci#define MAC_RFCR_PFCE_INDEX		8
48762306a36Sopenharmony_ci#define MAC_RFCR_PFCE_WIDTH		1
48862306a36Sopenharmony_ci#define MAC_RFCR_RFE_INDEX		0
48962306a36Sopenharmony_ci#define MAC_RFCR_RFE_WIDTH		1
49062306a36Sopenharmony_ci#define MAC_RFCR_UP_INDEX		1
49162306a36Sopenharmony_ci#define MAC_RFCR_UP_WIDTH		1
49262306a36Sopenharmony_ci#define MAC_RQC0R_RXQ0EN_INDEX		0
49362306a36Sopenharmony_ci#define MAC_RQC0R_RXQ0EN_WIDTH		2
49462306a36Sopenharmony_ci#define MAC_RSSAR_ADDRT_INDEX		2
49562306a36Sopenharmony_ci#define MAC_RSSAR_ADDRT_WIDTH		1
49662306a36Sopenharmony_ci#define MAC_RSSAR_CT_INDEX		1
49762306a36Sopenharmony_ci#define MAC_RSSAR_CT_WIDTH		1
49862306a36Sopenharmony_ci#define MAC_RSSAR_OB_INDEX		0
49962306a36Sopenharmony_ci#define MAC_RSSAR_OB_WIDTH		1
50062306a36Sopenharmony_ci#define MAC_RSSAR_RSSIA_INDEX		8
50162306a36Sopenharmony_ci#define MAC_RSSAR_RSSIA_WIDTH		8
50262306a36Sopenharmony_ci#define MAC_RSSCR_IP2TE_INDEX		1
50362306a36Sopenharmony_ci#define MAC_RSSCR_IP2TE_WIDTH		1
50462306a36Sopenharmony_ci#define MAC_RSSCR_RSSE_INDEX		0
50562306a36Sopenharmony_ci#define MAC_RSSCR_RSSE_WIDTH		1
50662306a36Sopenharmony_ci#define MAC_RSSCR_TCP4TE_INDEX		2
50762306a36Sopenharmony_ci#define MAC_RSSCR_TCP4TE_WIDTH		1
50862306a36Sopenharmony_ci#define MAC_RSSCR_UDP4TE_INDEX		3
50962306a36Sopenharmony_ci#define MAC_RSSCR_UDP4TE_WIDTH		1
51062306a36Sopenharmony_ci#define MAC_RSSDR_DMCH_INDEX		0
51162306a36Sopenharmony_ci#define MAC_RSSDR_DMCH_WIDTH		4
51262306a36Sopenharmony_ci#define MAC_SSIR_SNSINC_INDEX		8
51362306a36Sopenharmony_ci#define MAC_SSIR_SNSINC_WIDTH		8
51462306a36Sopenharmony_ci#define MAC_SSIR_SSINC_INDEX		16
51562306a36Sopenharmony_ci#define MAC_SSIR_SSINC_WIDTH		8
51662306a36Sopenharmony_ci#define MAC_TCR_SS_INDEX		29
51762306a36Sopenharmony_ci#define MAC_TCR_SS_WIDTH		2
51862306a36Sopenharmony_ci#define MAC_TCR_TE_INDEX		0
51962306a36Sopenharmony_ci#define MAC_TCR_TE_WIDTH		1
52062306a36Sopenharmony_ci#define MAC_TCR_VNE_INDEX		24
52162306a36Sopenharmony_ci#define MAC_TCR_VNE_WIDTH		1
52262306a36Sopenharmony_ci#define MAC_TCR_VNM_INDEX		25
52362306a36Sopenharmony_ci#define MAC_TCR_VNM_WIDTH		1
52462306a36Sopenharmony_ci#define MAC_TIR_TNID_INDEX		0
52562306a36Sopenharmony_ci#define MAC_TIR_TNID_WIDTH		16
52662306a36Sopenharmony_ci#define MAC_TSCR_AV8021ASMEN_INDEX	28
52762306a36Sopenharmony_ci#define MAC_TSCR_AV8021ASMEN_WIDTH	1
52862306a36Sopenharmony_ci#define MAC_TSCR_SNAPTYPSEL_INDEX	16
52962306a36Sopenharmony_ci#define MAC_TSCR_SNAPTYPSEL_WIDTH	2
53062306a36Sopenharmony_ci#define MAC_TSCR_TSADDREG_INDEX		5
53162306a36Sopenharmony_ci#define MAC_TSCR_TSADDREG_WIDTH		1
53262306a36Sopenharmony_ci#define MAC_TSCR_TSCFUPDT_INDEX		1
53362306a36Sopenharmony_ci#define MAC_TSCR_TSCFUPDT_WIDTH		1
53462306a36Sopenharmony_ci#define MAC_TSCR_TSCTRLSSR_INDEX	9
53562306a36Sopenharmony_ci#define MAC_TSCR_TSCTRLSSR_WIDTH	1
53662306a36Sopenharmony_ci#define MAC_TSCR_TSENA_INDEX		0
53762306a36Sopenharmony_ci#define MAC_TSCR_TSENA_WIDTH		1
53862306a36Sopenharmony_ci#define MAC_TSCR_TSENALL_INDEX		8
53962306a36Sopenharmony_ci#define MAC_TSCR_TSENALL_WIDTH		1
54062306a36Sopenharmony_ci#define MAC_TSCR_TSEVNTENA_INDEX	14
54162306a36Sopenharmony_ci#define MAC_TSCR_TSEVNTENA_WIDTH	1
54262306a36Sopenharmony_ci#define MAC_TSCR_TSINIT_INDEX		2
54362306a36Sopenharmony_ci#define MAC_TSCR_TSINIT_WIDTH		1
54462306a36Sopenharmony_ci#define MAC_TSCR_TSIPENA_INDEX		11
54562306a36Sopenharmony_ci#define MAC_TSCR_TSIPENA_WIDTH		1
54662306a36Sopenharmony_ci#define MAC_TSCR_TSIPV4ENA_INDEX	13
54762306a36Sopenharmony_ci#define MAC_TSCR_TSIPV4ENA_WIDTH	1
54862306a36Sopenharmony_ci#define MAC_TSCR_TSIPV6ENA_INDEX	12
54962306a36Sopenharmony_ci#define MAC_TSCR_TSIPV6ENA_WIDTH	1
55062306a36Sopenharmony_ci#define MAC_TSCR_TSMSTRENA_INDEX	15
55162306a36Sopenharmony_ci#define MAC_TSCR_TSMSTRENA_WIDTH	1
55262306a36Sopenharmony_ci#define MAC_TSCR_TSVER2ENA_INDEX	10
55362306a36Sopenharmony_ci#define MAC_TSCR_TSVER2ENA_WIDTH	1
55462306a36Sopenharmony_ci#define MAC_TSCR_TXTSSTSM_INDEX		24
55562306a36Sopenharmony_ci#define MAC_TSCR_TXTSSTSM_WIDTH		1
55662306a36Sopenharmony_ci#define MAC_TSSR_TXTSC_INDEX		15
55762306a36Sopenharmony_ci#define MAC_TSSR_TXTSC_WIDTH		1
55862306a36Sopenharmony_ci#define MAC_TXSNR_TXTSSTSMIS_INDEX	31
55962306a36Sopenharmony_ci#define MAC_TXSNR_TXTSSTSMIS_WIDTH	1
56062306a36Sopenharmony_ci#define MAC_VLANHTR_VLHT_INDEX		0
56162306a36Sopenharmony_ci#define MAC_VLANHTR_VLHT_WIDTH		16
56262306a36Sopenharmony_ci#define MAC_VLANIR_VLTI_INDEX		20
56362306a36Sopenharmony_ci#define MAC_VLANIR_VLTI_WIDTH		1
56462306a36Sopenharmony_ci#define MAC_VLANIR_CSVL_INDEX		19
56562306a36Sopenharmony_ci#define MAC_VLANIR_CSVL_WIDTH		1
56662306a36Sopenharmony_ci#define MAC_VLANTR_DOVLTC_INDEX		20
56762306a36Sopenharmony_ci#define MAC_VLANTR_DOVLTC_WIDTH		1
56862306a36Sopenharmony_ci#define MAC_VLANTR_ERSVLM_INDEX		19
56962306a36Sopenharmony_ci#define MAC_VLANTR_ERSVLM_WIDTH		1
57062306a36Sopenharmony_ci#define MAC_VLANTR_ESVL_INDEX		18
57162306a36Sopenharmony_ci#define MAC_VLANTR_ESVL_WIDTH		1
57262306a36Sopenharmony_ci#define MAC_VLANTR_ETV_INDEX		16
57362306a36Sopenharmony_ci#define MAC_VLANTR_ETV_WIDTH		1
57462306a36Sopenharmony_ci#define MAC_VLANTR_EVLS_INDEX		21
57562306a36Sopenharmony_ci#define MAC_VLANTR_EVLS_WIDTH		2
57662306a36Sopenharmony_ci#define MAC_VLANTR_EVLRXS_INDEX		24
57762306a36Sopenharmony_ci#define MAC_VLANTR_EVLRXS_WIDTH		1
57862306a36Sopenharmony_ci#define MAC_VLANTR_VL_INDEX		0
57962306a36Sopenharmony_ci#define MAC_VLANTR_VL_WIDTH		16
58062306a36Sopenharmony_ci#define MAC_VLANTR_VTHM_INDEX		25
58162306a36Sopenharmony_ci#define MAC_VLANTR_VTHM_WIDTH		1
58262306a36Sopenharmony_ci#define MAC_VLANTR_VTIM_INDEX		17
58362306a36Sopenharmony_ci#define MAC_VLANTR_VTIM_WIDTH		1
58462306a36Sopenharmony_ci#define MAC_VR_DEVID_INDEX		8
58562306a36Sopenharmony_ci#define MAC_VR_DEVID_WIDTH		8
58662306a36Sopenharmony_ci#define MAC_VR_SNPSVER_INDEX		0
58762306a36Sopenharmony_ci#define MAC_VR_SNPSVER_WIDTH		8
58862306a36Sopenharmony_ci#define MAC_VR_USERVER_INDEX		16
58962306a36Sopenharmony_ci#define MAC_VR_USERVER_WIDTH		8
59062306a36Sopenharmony_ci
59162306a36Sopenharmony_ci/* MMC register offsets */
59262306a36Sopenharmony_ci#define MMC_CR				0x0800
59362306a36Sopenharmony_ci#define MMC_RISR			0x0804
59462306a36Sopenharmony_ci#define MMC_TISR			0x0808
59562306a36Sopenharmony_ci#define MMC_RIER			0x080c
59662306a36Sopenharmony_ci#define MMC_TIER			0x0810
59762306a36Sopenharmony_ci#define MMC_TXOCTETCOUNT_GB_LO		0x0814
59862306a36Sopenharmony_ci#define MMC_TXOCTETCOUNT_GB_HI		0x0818
59962306a36Sopenharmony_ci#define MMC_TXFRAMECOUNT_GB_LO		0x081c
60062306a36Sopenharmony_ci#define MMC_TXFRAMECOUNT_GB_HI		0x0820
60162306a36Sopenharmony_ci#define MMC_TXBROADCASTFRAMES_G_LO	0x0824
60262306a36Sopenharmony_ci#define MMC_TXBROADCASTFRAMES_G_HI	0x0828
60362306a36Sopenharmony_ci#define MMC_TXMULTICASTFRAMES_G_LO	0x082c
60462306a36Sopenharmony_ci#define MMC_TXMULTICASTFRAMES_G_HI	0x0830
60562306a36Sopenharmony_ci#define MMC_TX64OCTETS_GB_LO		0x0834
60662306a36Sopenharmony_ci#define MMC_TX64OCTETS_GB_HI		0x0838
60762306a36Sopenharmony_ci#define MMC_TX65TO127OCTETS_GB_LO	0x083c
60862306a36Sopenharmony_ci#define MMC_TX65TO127OCTETS_GB_HI	0x0840
60962306a36Sopenharmony_ci#define MMC_TX128TO255OCTETS_GB_LO	0x0844
61062306a36Sopenharmony_ci#define MMC_TX128TO255OCTETS_GB_HI	0x0848
61162306a36Sopenharmony_ci#define MMC_TX256TO511OCTETS_GB_LO	0x084c
61262306a36Sopenharmony_ci#define MMC_TX256TO511OCTETS_GB_HI	0x0850
61362306a36Sopenharmony_ci#define MMC_TX512TO1023OCTETS_GB_LO	0x0854
61462306a36Sopenharmony_ci#define MMC_TX512TO1023OCTETS_GB_HI	0x0858
61562306a36Sopenharmony_ci#define MMC_TX1024TOMAXOCTETS_GB_LO	0x085c
61662306a36Sopenharmony_ci#define MMC_TX1024TOMAXOCTETS_GB_HI	0x0860
61762306a36Sopenharmony_ci#define MMC_TXUNICASTFRAMES_GB_LO	0x0864
61862306a36Sopenharmony_ci#define MMC_TXUNICASTFRAMES_GB_HI	0x0868
61962306a36Sopenharmony_ci#define MMC_TXMULTICASTFRAMES_GB_LO	0x086c
62062306a36Sopenharmony_ci#define MMC_TXMULTICASTFRAMES_GB_HI	0x0870
62162306a36Sopenharmony_ci#define MMC_TXBROADCASTFRAMES_GB_LO	0x0874
62262306a36Sopenharmony_ci#define MMC_TXBROADCASTFRAMES_GB_HI	0x0878
62362306a36Sopenharmony_ci#define MMC_TXUNDERFLOWERROR_LO		0x087c
62462306a36Sopenharmony_ci#define MMC_TXUNDERFLOWERROR_HI		0x0880
62562306a36Sopenharmony_ci#define MMC_TXOCTETCOUNT_G_LO		0x0884
62662306a36Sopenharmony_ci#define MMC_TXOCTETCOUNT_G_HI		0x0888
62762306a36Sopenharmony_ci#define MMC_TXFRAMECOUNT_G_LO		0x088c
62862306a36Sopenharmony_ci#define MMC_TXFRAMECOUNT_G_HI		0x0890
62962306a36Sopenharmony_ci#define MMC_TXPAUSEFRAMES_LO		0x0894
63062306a36Sopenharmony_ci#define MMC_TXPAUSEFRAMES_HI		0x0898
63162306a36Sopenharmony_ci#define MMC_TXVLANFRAMES_G_LO		0x089c
63262306a36Sopenharmony_ci#define MMC_TXVLANFRAMES_G_HI		0x08a0
63362306a36Sopenharmony_ci#define MMC_RXFRAMECOUNT_GB_LO		0x0900
63462306a36Sopenharmony_ci#define MMC_RXFRAMECOUNT_GB_HI		0x0904
63562306a36Sopenharmony_ci#define MMC_RXOCTETCOUNT_GB_LO		0x0908
63662306a36Sopenharmony_ci#define MMC_RXOCTETCOUNT_GB_HI		0x090c
63762306a36Sopenharmony_ci#define MMC_RXOCTETCOUNT_G_LO		0x0910
63862306a36Sopenharmony_ci#define MMC_RXOCTETCOUNT_G_HI		0x0914
63962306a36Sopenharmony_ci#define MMC_RXBROADCASTFRAMES_G_LO	0x0918
64062306a36Sopenharmony_ci#define MMC_RXBROADCASTFRAMES_G_HI	0x091c
64162306a36Sopenharmony_ci#define MMC_RXMULTICASTFRAMES_G_LO	0x0920
64262306a36Sopenharmony_ci#define MMC_RXMULTICASTFRAMES_G_HI	0x0924
64362306a36Sopenharmony_ci#define MMC_RXCRCERROR_LO		0x0928
64462306a36Sopenharmony_ci#define MMC_RXCRCERROR_HI		0x092c
64562306a36Sopenharmony_ci#define MMC_RXRUNTERROR			0x0930
64662306a36Sopenharmony_ci#define MMC_RXJABBERERROR		0x0934
64762306a36Sopenharmony_ci#define MMC_RXUNDERSIZE_G		0x0938
64862306a36Sopenharmony_ci#define MMC_RXOVERSIZE_G		0x093c
64962306a36Sopenharmony_ci#define MMC_RX64OCTETS_GB_LO		0x0940
65062306a36Sopenharmony_ci#define MMC_RX64OCTETS_GB_HI		0x0944
65162306a36Sopenharmony_ci#define MMC_RX65TO127OCTETS_GB_LO	0x0948
65262306a36Sopenharmony_ci#define MMC_RX65TO127OCTETS_GB_HI	0x094c
65362306a36Sopenharmony_ci#define MMC_RX128TO255OCTETS_GB_LO	0x0950
65462306a36Sopenharmony_ci#define MMC_RX128TO255OCTETS_GB_HI	0x0954
65562306a36Sopenharmony_ci#define MMC_RX256TO511OCTETS_GB_LO	0x0958
65662306a36Sopenharmony_ci#define MMC_RX256TO511OCTETS_GB_HI	0x095c
65762306a36Sopenharmony_ci#define MMC_RX512TO1023OCTETS_GB_LO	0x0960
65862306a36Sopenharmony_ci#define MMC_RX512TO1023OCTETS_GB_HI	0x0964
65962306a36Sopenharmony_ci#define MMC_RX1024TOMAXOCTETS_GB_LO	0x0968
66062306a36Sopenharmony_ci#define MMC_RX1024TOMAXOCTETS_GB_HI	0x096c
66162306a36Sopenharmony_ci#define MMC_RXUNICASTFRAMES_G_LO	0x0970
66262306a36Sopenharmony_ci#define MMC_RXUNICASTFRAMES_G_HI	0x0974
66362306a36Sopenharmony_ci#define MMC_RXLENGTHERROR_LO		0x0978
66462306a36Sopenharmony_ci#define MMC_RXLENGTHERROR_HI		0x097c
66562306a36Sopenharmony_ci#define MMC_RXOUTOFRANGETYPE_LO		0x0980
66662306a36Sopenharmony_ci#define MMC_RXOUTOFRANGETYPE_HI		0x0984
66762306a36Sopenharmony_ci#define MMC_RXPAUSEFRAMES_LO		0x0988
66862306a36Sopenharmony_ci#define MMC_RXPAUSEFRAMES_HI		0x098c
66962306a36Sopenharmony_ci#define MMC_RXFIFOOVERFLOW_LO		0x0990
67062306a36Sopenharmony_ci#define MMC_RXFIFOOVERFLOW_HI		0x0994
67162306a36Sopenharmony_ci#define MMC_RXVLANFRAMES_GB_LO		0x0998
67262306a36Sopenharmony_ci#define MMC_RXVLANFRAMES_GB_HI		0x099c
67362306a36Sopenharmony_ci#define MMC_RXWATCHDOGERROR		0x09a0
67462306a36Sopenharmony_ci
67562306a36Sopenharmony_ci/* MMC register entry bit positions and sizes */
67662306a36Sopenharmony_ci#define MMC_CR_CR_INDEX				0
67762306a36Sopenharmony_ci#define MMC_CR_CR_WIDTH				1
67862306a36Sopenharmony_ci#define MMC_CR_CSR_INDEX			1
67962306a36Sopenharmony_ci#define MMC_CR_CSR_WIDTH			1
68062306a36Sopenharmony_ci#define MMC_CR_ROR_INDEX			2
68162306a36Sopenharmony_ci#define MMC_CR_ROR_WIDTH			1
68262306a36Sopenharmony_ci#define MMC_CR_MCF_INDEX			3
68362306a36Sopenharmony_ci#define MMC_CR_MCF_WIDTH			1
68462306a36Sopenharmony_ci#define MMC_CR_MCT_INDEX			4
68562306a36Sopenharmony_ci#define MMC_CR_MCT_WIDTH			2
68662306a36Sopenharmony_ci#define MMC_RIER_ALL_INTERRUPTS_INDEX		0
68762306a36Sopenharmony_ci#define MMC_RIER_ALL_INTERRUPTS_WIDTH		23
68862306a36Sopenharmony_ci#define MMC_RISR_RXFRAMECOUNT_GB_INDEX		0
68962306a36Sopenharmony_ci#define MMC_RISR_RXFRAMECOUNT_GB_WIDTH		1
69062306a36Sopenharmony_ci#define MMC_RISR_RXOCTETCOUNT_GB_INDEX		1
69162306a36Sopenharmony_ci#define MMC_RISR_RXOCTETCOUNT_GB_WIDTH		1
69262306a36Sopenharmony_ci#define MMC_RISR_RXOCTETCOUNT_G_INDEX		2
69362306a36Sopenharmony_ci#define MMC_RISR_RXOCTETCOUNT_G_WIDTH		1
69462306a36Sopenharmony_ci#define MMC_RISR_RXBROADCASTFRAMES_G_INDEX	3
69562306a36Sopenharmony_ci#define MMC_RISR_RXBROADCASTFRAMES_G_WIDTH	1
69662306a36Sopenharmony_ci#define MMC_RISR_RXMULTICASTFRAMES_G_INDEX	4
69762306a36Sopenharmony_ci#define MMC_RISR_RXMULTICASTFRAMES_G_WIDTH	1
69862306a36Sopenharmony_ci#define MMC_RISR_RXCRCERROR_INDEX		5
69962306a36Sopenharmony_ci#define MMC_RISR_RXCRCERROR_WIDTH		1
70062306a36Sopenharmony_ci#define MMC_RISR_RXRUNTERROR_INDEX		6
70162306a36Sopenharmony_ci#define MMC_RISR_RXRUNTERROR_WIDTH		1
70262306a36Sopenharmony_ci#define MMC_RISR_RXJABBERERROR_INDEX		7
70362306a36Sopenharmony_ci#define MMC_RISR_RXJABBERERROR_WIDTH		1
70462306a36Sopenharmony_ci#define MMC_RISR_RXUNDERSIZE_G_INDEX		8
70562306a36Sopenharmony_ci#define MMC_RISR_RXUNDERSIZE_G_WIDTH		1
70662306a36Sopenharmony_ci#define MMC_RISR_RXOVERSIZE_G_INDEX		9
70762306a36Sopenharmony_ci#define MMC_RISR_RXOVERSIZE_G_WIDTH		1
70862306a36Sopenharmony_ci#define MMC_RISR_RX64OCTETS_GB_INDEX		10
70962306a36Sopenharmony_ci#define MMC_RISR_RX64OCTETS_GB_WIDTH		1
71062306a36Sopenharmony_ci#define MMC_RISR_RX65TO127OCTETS_GB_INDEX	11
71162306a36Sopenharmony_ci#define MMC_RISR_RX65TO127OCTETS_GB_WIDTH	1
71262306a36Sopenharmony_ci#define MMC_RISR_RX128TO255OCTETS_GB_INDEX	12
71362306a36Sopenharmony_ci#define MMC_RISR_RX128TO255OCTETS_GB_WIDTH	1
71462306a36Sopenharmony_ci#define MMC_RISR_RX256TO511OCTETS_GB_INDEX	13
71562306a36Sopenharmony_ci#define MMC_RISR_RX256TO511OCTETS_GB_WIDTH	1
71662306a36Sopenharmony_ci#define MMC_RISR_RX512TO1023OCTETS_GB_INDEX	14
71762306a36Sopenharmony_ci#define MMC_RISR_RX512TO1023OCTETS_GB_WIDTH	1
71862306a36Sopenharmony_ci#define MMC_RISR_RX1024TOMAXOCTETS_GB_INDEX	15
71962306a36Sopenharmony_ci#define MMC_RISR_RX1024TOMAXOCTETS_GB_WIDTH	1
72062306a36Sopenharmony_ci#define MMC_RISR_RXUNICASTFRAMES_G_INDEX	16
72162306a36Sopenharmony_ci#define MMC_RISR_RXUNICASTFRAMES_G_WIDTH	1
72262306a36Sopenharmony_ci#define MMC_RISR_RXLENGTHERROR_INDEX		17
72362306a36Sopenharmony_ci#define MMC_RISR_RXLENGTHERROR_WIDTH		1
72462306a36Sopenharmony_ci#define MMC_RISR_RXOUTOFRANGETYPE_INDEX		18
72562306a36Sopenharmony_ci#define MMC_RISR_RXOUTOFRANGETYPE_WIDTH		1
72662306a36Sopenharmony_ci#define MMC_RISR_RXPAUSEFRAMES_INDEX		19
72762306a36Sopenharmony_ci#define MMC_RISR_RXPAUSEFRAMES_WIDTH		1
72862306a36Sopenharmony_ci#define MMC_RISR_RXFIFOOVERFLOW_INDEX		20
72962306a36Sopenharmony_ci#define MMC_RISR_RXFIFOOVERFLOW_WIDTH		1
73062306a36Sopenharmony_ci#define MMC_RISR_RXVLANFRAMES_GB_INDEX		21
73162306a36Sopenharmony_ci#define MMC_RISR_RXVLANFRAMES_GB_WIDTH		1
73262306a36Sopenharmony_ci#define MMC_RISR_RXWATCHDOGERROR_INDEX		22
73362306a36Sopenharmony_ci#define MMC_RISR_RXWATCHDOGERROR_WIDTH		1
73462306a36Sopenharmony_ci#define MMC_TIER_ALL_INTERRUPTS_INDEX		0
73562306a36Sopenharmony_ci#define MMC_TIER_ALL_INTERRUPTS_WIDTH		18
73662306a36Sopenharmony_ci#define MMC_TISR_TXOCTETCOUNT_GB_INDEX		0
73762306a36Sopenharmony_ci#define MMC_TISR_TXOCTETCOUNT_GB_WIDTH		1
73862306a36Sopenharmony_ci#define MMC_TISR_TXFRAMECOUNT_GB_INDEX		1
73962306a36Sopenharmony_ci#define MMC_TISR_TXFRAMECOUNT_GB_WIDTH		1
74062306a36Sopenharmony_ci#define MMC_TISR_TXBROADCASTFRAMES_G_INDEX	2
74162306a36Sopenharmony_ci#define MMC_TISR_TXBROADCASTFRAMES_G_WIDTH	1
74262306a36Sopenharmony_ci#define MMC_TISR_TXMULTICASTFRAMES_G_INDEX	3
74362306a36Sopenharmony_ci#define MMC_TISR_TXMULTICASTFRAMES_G_WIDTH	1
74462306a36Sopenharmony_ci#define MMC_TISR_TX64OCTETS_GB_INDEX		4
74562306a36Sopenharmony_ci#define MMC_TISR_TX64OCTETS_GB_WIDTH		1
74662306a36Sopenharmony_ci#define MMC_TISR_TX65TO127OCTETS_GB_INDEX	5
74762306a36Sopenharmony_ci#define MMC_TISR_TX65TO127OCTETS_GB_WIDTH	1
74862306a36Sopenharmony_ci#define MMC_TISR_TX128TO255OCTETS_GB_INDEX	6
74962306a36Sopenharmony_ci#define MMC_TISR_TX128TO255OCTETS_GB_WIDTH	1
75062306a36Sopenharmony_ci#define MMC_TISR_TX256TO511OCTETS_GB_INDEX	7
75162306a36Sopenharmony_ci#define MMC_TISR_TX256TO511OCTETS_GB_WIDTH	1
75262306a36Sopenharmony_ci#define MMC_TISR_TX512TO1023OCTETS_GB_INDEX	8
75362306a36Sopenharmony_ci#define MMC_TISR_TX512TO1023OCTETS_GB_WIDTH	1
75462306a36Sopenharmony_ci#define MMC_TISR_TX1024TOMAXOCTETS_GB_INDEX	9
75562306a36Sopenharmony_ci#define MMC_TISR_TX1024TOMAXOCTETS_GB_WIDTH	1
75662306a36Sopenharmony_ci#define MMC_TISR_TXUNICASTFRAMES_GB_INDEX	10
75762306a36Sopenharmony_ci#define MMC_TISR_TXUNICASTFRAMES_GB_WIDTH	1
75862306a36Sopenharmony_ci#define MMC_TISR_TXMULTICASTFRAMES_GB_INDEX	11
75962306a36Sopenharmony_ci#define MMC_TISR_TXMULTICASTFRAMES_GB_WIDTH	1
76062306a36Sopenharmony_ci#define MMC_TISR_TXBROADCASTFRAMES_GB_INDEX	12
76162306a36Sopenharmony_ci#define MMC_TISR_TXBROADCASTFRAMES_GB_WIDTH	1
76262306a36Sopenharmony_ci#define MMC_TISR_TXUNDERFLOWERROR_INDEX		13
76362306a36Sopenharmony_ci#define MMC_TISR_TXUNDERFLOWERROR_WIDTH		1
76462306a36Sopenharmony_ci#define MMC_TISR_TXOCTETCOUNT_G_INDEX		14
76562306a36Sopenharmony_ci#define MMC_TISR_TXOCTETCOUNT_G_WIDTH		1
76662306a36Sopenharmony_ci#define MMC_TISR_TXFRAMECOUNT_G_INDEX		15
76762306a36Sopenharmony_ci#define MMC_TISR_TXFRAMECOUNT_G_WIDTH		1
76862306a36Sopenharmony_ci#define MMC_TISR_TXPAUSEFRAMES_INDEX		16
76962306a36Sopenharmony_ci#define MMC_TISR_TXPAUSEFRAMES_WIDTH		1
77062306a36Sopenharmony_ci#define MMC_TISR_TXVLANFRAMES_G_INDEX		17
77162306a36Sopenharmony_ci#define MMC_TISR_TXVLANFRAMES_G_WIDTH		1
77262306a36Sopenharmony_ci
77362306a36Sopenharmony_ci/* MTL register offsets */
77462306a36Sopenharmony_ci#define MTL_OMR				0x1000
77562306a36Sopenharmony_ci#define MTL_FDCR			0x1008
77662306a36Sopenharmony_ci#define MTL_FDSR			0x100c
77762306a36Sopenharmony_ci#define MTL_FDDR			0x1010
77862306a36Sopenharmony_ci#define MTL_ISR				0x1020
77962306a36Sopenharmony_ci#define MTL_RQDCM0R			0x1030
78062306a36Sopenharmony_ci#define MTL_TCPM0R			0x1040
78162306a36Sopenharmony_ci#define MTL_TCPM1R			0x1044
78262306a36Sopenharmony_ci
78362306a36Sopenharmony_ci#define MTL_RQDCM_INC			4
78462306a36Sopenharmony_ci#define MTL_RQDCM_Q_PER_REG		4
78562306a36Sopenharmony_ci#define MTL_TCPM_INC			4
78662306a36Sopenharmony_ci#define MTL_TCPM_TC_PER_REG		4
78762306a36Sopenharmony_ci
78862306a36Sopenharmony_ci/* MTL register entry bit positions and sizes */
78962306a36Sopenharmony_ci#define MTL_OMR_ETSALG_INDEX		5
79062306a36Sopenharmony_ci#define MTL_OMR_ETSALG_WIDTH		2
79162306a36Sopenharmony_ci#define MTL_OMR_RAA_INDEX		2
79262306a36Sopenharmony_ci#define MTL_OMR_RAA_WIDTH		1
79362306a36Sopenharmony_ci
79462306a36Sopenharmony_ci/* MTL queue register offsets
79562306a36Sopenharmony_ci *   Multiple queues can be active.  The first queue has registers
79662306a36Sopenharmony_ci *   that begin at 0x1100.  Each subsequent queue has registers that
79762306a36Sopenharmony_ci *   are accessed using an offset of 0x80 from the previous queue.
79862306a36Sopenharmony_ci */
79962306a36Sopenharmony_ci#define MTL_Q_BASE			0x1100
80062306a36Sopenharmony_ci#define MTL_Q_INC			0x80
80162306a36Sopenharmony_ci
80262306a36Sopenharmony_ci#define MTL_Q_TQOMR			0x00
80362306a36Sopenharmony_ci#define MTL_Q_TQUR			0x04
80462306a36Sopenharmony_ci#define MTL_Q_TQDR			0x08
80562306a36Sopenharmony_ci#define MTL_Q_RQOMR			0x40
80662306a36Sopenharmony_ci#define MTL_Q_RQMPOCR			0x44
80762306a36Sopenharmony_ci#define MTL_Q_RQDR			0x48
80862306a36Sopenharmony_ci#define MTL_Q_RQFCR			0x50
80962306a36Sopenharmony_ci#define MTL_Q_IER			0x70
81062306a36Sopenharmony_ci#define MTL_Q_ISR			0x74
81162306a36Sopenharmony_ci
81262306a36Sopenharmony_ci/* MTL queue register entry bit positions and sizes */
81362306a36Sopenharmony_ci#define MTL_Q_RQDR_PRXQ_INDEX		16
81462306a36Sopenharmony_ci#define MTL_Q_RQDR_PRXQ_WIDTH		14
81562306a36Sopenharmony_ci#define MTL_Q_RQDR_RXQSTS_INDEX		4
81662306a36Sopenharmony_ci#define MTL_Q_RQDR_RXQSTS_WIDTH		2
81762306a36Sopenharmony_ci#define MTL_Q_RQFCR_RFA_INDEX		1
81862306a36Sopenharmony_ci#define MTL_Q_RQFCR_RFA_WIDTH		6
81962306a36Sopenharmony_ci#define MTL_Q_RQFCR_RFD_INDEX		17
82062306a36Sopenharmony_ci#define MTL_Q_RQFCR_RFD_WIDTH		6
82162306a36Sopenharmony_ci#define MTL_Q_RQOMR_EHFC_INDEX		7
82262306a36Sopenharmony_ci#define MTL_Q_RQOMR_EHFC_WIDTH		1
82362306a36Sopenharmony_ci#define MTL_Q_RQOMR_RQS_INDEX		16
82462306a36Sopenharmony_ci#define MTL_Q_RQOMR_RQS_WIDTH		9
82562306a36Sopenharmony_ci#define MTL_Q_RQOMR_RSF_INDEX		5
82662306a36Sopenharmony_ci#define MTL_Q_RQOMR_RSF_WIDTH		1
82762306a36Sopenharmony_ci#define MTL_Q_RQOMR_RTC_INDEX		0
82862306a36Sopenharmony_ci#define MTL_Q_RQOMR_RTC_WIDTH		2
82962306a36Sopenharmony_ci#define MTL_Q_TQDR_TRCSTS_INDEX		1
83062306a36Sopenharmony_ci#define MTL_Q_TQDR_TRCSTS_WIDTH		2
83162306a36Sopenharmony_ci#define MTL_Q_TQDR_TXQSTS_INDEX		4
83262306a36Sopenharmony_ci#define MTL_Q_TQDR_TXQSTS_WIDTH		1
83362306a36Sopenharmony_ci#define MTL_Q_TQOMR_FTQ_INDEX		0
83462306a36Sopenharmony_ci#define MTL_Q_TQOMR_FTQ_WIDTH		1
83562306a36Sopenharmony_ci#define MTL_Q_TQOMR_Q2TCMAP_INDEX	8
83662306a36Sopenharmony_ci#define MTL_Q_TQOMR_Q2TCMAP_WIDTH	3
83762306a36Sopenharmony_ci#define MTL_Q_TQOMR_TQS_INDEX		16
83862306a36Sopenharmony_ci#define MTL_Q_TQOMR_TQS_WIDTH		10
83962306a36Sopenharmony_ci#define MTL_Q_TQOMR_TSF_INDEX		1
84062306a36Sopenharmony_ci#define MTL_Q_TQOMR_TSF_WIDTH		1
84162306a36Sopenharmony_ci#define MTL_Q_TQOMR_TTC_INDEX		4
84262306a36Sopenharmony_ci#define MTL_Q_TQOMR_TTC_WIDTH		3
84362306a36Sopenharmony_ci#define MTL_Q_TQOMR_TXQEN_INDEX		2
84462306a36Sopenharmony_ci#define MTL_Q_TQOMR_TXQEN_WIDTH		2
84562306a36Sopenharmony_ci
84662306a36Sopenharmony_ci/* MTL queue register value */
84762306a36Sopenharmony_ci#define MTL_RSF_DISABLE			0x00
84862306a36Sopenharmony_ci#define MTL_RSF_ENABLE			0x01
84962306a36Sopenharmony_ci#define MTL_TSF_DISABLE			0x00
85062306a36Sopenharmony_ci#define MTL_TSF_ENABLE			0x01
85162306a36Sopenharmony_ci
85262306a36Sopenharmony_ci#define MTL_RX_THRESHOLD_64		0x00
85362306a36Sopenharmony_ci#define MTL_RX_THRESHOLD_96		0x02
85462306a36Sopenharmony_ci#define MTL_RX_THRESHOLD_128		0x03
85562306a36Sopenharmony_ci#define MTL_TX_THRESHOLD_32		0x01
85662306a36Sopenharmony_ci#define MTL_TX_THRESHOLD_64		0x00
85762306a36Sopenharmony_ci#define MTL_TX_THRESHOLD_96		0x02
85862306a36Sopenharmony_ci#define MTL_TX_THRESHOLD_128		0x03
85962306a36Sopenharmony_ci#define MTL_TX_THRESHOLD_192		0x04
86062306a36Sopenharmony_ci#define MTL_TX_THRESHOLD_256		0x05
86162306a36Sopenharmony_ci#define MTL_TX_THRESHOLD_384		0x06
86262306a36Sopenharmony_ci#define MTL_TX_THRESHOLD_512		0x07
86362306a36Sopenharmony_ci
86462306a36Sopenharmony_ci#define MTL_ETSALG_WRR			0x00
86562306a36Sopenharmony_ci#define MTL_ETSALG_WFQ			0x01
86662306a36Sopenharmony_ci#define MTL_ETSALG_DWRR			0x02
86762306a36Sopenharmony_ci#define MTL_RAA_SP			0x00
86862306a36Sopenharmony_ci#define MTL_RAA_WSP			0x01
86962306a36Sopenharmony_ci
87062306a36Sopenharmony_ci#define MTL_Q_DISABLED			0x00
87162306a36Sopenharmony_ci#define MTL_Q_ENABLED			0x02
87262306a36Sopenharmony_ci
87362306a36Sopenharmony_ci/* MTL traffic class register offsets
87462306a36Sopenharmony_ci *   Multiple traffic classes can be active.  The first class has registers
87562306a36Sopenharmony_ci *   that begin at 0x1100.  Each subsequent queue has registers that
87662306a36Sopenharmony_ci *   are accessed using an offset of 0x80 from the previous queue.
87762306a36Sopenharmony_ci */
87862306a36Sopenharmony_ci#define MTL_TC_BASE			MTL_Q_BASE
87962306a36Sopenharmony_ci#define MTL_TC_INC			MTL_Q_INC
88062306a36Sopenharmony_ci
88162306a36Sopenharmony_ci#define MTL_TC_ETSCR			0x10
88262306a36Sopenharmony_ci#define MTL_TC_ETSSR			0x14
88362306a36Sopenharmony_ci#define MTL_TC_QWR			0x18
88462306a36Sopenharmony_ci
88562306a36Sopenharmony_ci/* MTL traffic class register entry bit positions and sizes */
88662306a36Sopenharmony_ci#define MTL_TC_ETSCR_TSA_INDEX		0
88762306a36Sopenharmony_ci#define MTL_TC_ETSCR_TSA_WIDTH		2
88862306a36Sopenharmony_ci#define MTL_TC_QWR_QW_INDEX		0
88962306a36Sopenharmony_ci#define MTL_TC_QWR_QW_WIDTH		21
89062306a36Sopenharmony_ci
89162306a36Sopenharmony_ci/* MTL traffic class register value */
89262306a36Sopenharmony_ci#define MTL_TSA_SP			0x00
89362306a36Sopenharmony_ci#define MTL_TSA_ETS			0x02
89462306a36Sopenharmony_ci
89562306a36Sopenharmony_ci/* PCS register offsets */
89662306a36Sopenharmony_ci#define PCS_V1_WINDOW_SELECT		0x03fc
89762306a36Sopenharmony_ci#define PCS_V2_WINDOW_DEF		0x9060
89862306a36Sopenharmony_ci#define PCS_V2_WINDOW_SELECT		0x9064
89962306a36Sopenharmony_ci#define PCS_V2_RV_WINDOW_DEF		0x1060
90062306a36Sopenharmony_ci#define PCS_V2_RV_WINDOW_SELECT		0x1064
90162306a36Sopenharmony_ci#define PCS_V2_YC_WINDOW_DEF		0x18060
90262306a36Sopenharmony_ci#define PCS_V2_YC_WINDOW_SELECT		0x18064
90362306a36Sopenharmony_ci
90462306a36Sopenharmony_ci/* PCS register entry bit positions and sizes */
90562306a36Sopenharmony_ci#define PCS_V2_WINDOW_DEF_OFFSET_INDEX	6
90662306a36Sopenharmony_ci#define PCS_V2_WINDOW_DEF_OFFSET_WIDTH	14
90762306a36Sopenharmony_ci#define PCS_V2_WINDOW_DEF_SIZE_INDEX	2
90862306a36Sopenharmony_ci#define PCS_V2_WINDOW_DEF_SIZE_WIDTH	4
90962306a36Sopenharmony_ci
91062306a36Sopenharmony_ci/* SerDes integration register offsets */
91162306a36Sopenharmony_ci#define SIR0_KR_RT_1			0x002c
91262306a36Sopenharmony_ci#define SIR0_STATUS			0x0040
91362306a36Sopenharmony_ci#define SIR1_SPEED			0x0000
91462306a36Sopenharmony_ci
91562306a36Sopenharmony_ci/* SerDes integration register entry bit positions and sizes */
91662306a36Sopenharmony_ci#define SIR0_KR_RT_1_RESET_INDEX	11
91762306a36Sopenharmony_ci#define SIR0_KR_RT_1_RESET_WIDTH	1
91862306a36Sopenharmony_ci#define SIR0_STATUS_RX_READY_INDEX	0
91962306a36Sopenharmony_ci#define SIR0_STATUS_RX_READY_WIDTH	1
92062306a36Sopenharmony_ci#define SIR0_STATUS_TX_READY_INDEX	8
92162306a36Sopenharmony_ci#define SIR0_STATUS_TX_READY_WIDTH	1
92262306a36Sopenharmony_ci#define SIR1_SPEED_CDR_RATE_INDEX	12
92362306a36Sopenharmony_ci#define SIR1_SPEED_CDR_RATE_WIDTH	4
92462306a36Sopenharmony_ci#define SIR1_SPEED_DATARATE_INDEX	4
92562306a36Sopenharmony_ci#define SIR1_SPEED_DATARATE_WIDTH	2
92662306a36Sopenharmony_ci#define SIR1_SPEED_PLLSEL_INDEX		3
92762306a36Sopenharmony_ci#define SIR1_SPEED_PLLSEL_WIDTH		1
92862306a36Sopenharmony_ci#define SIR1_SPEED_RATECHANGE_INDEX	6
92962306a36Sopenharmony_ci#define SIR1_SPEED_RATECHANGE_WIDTH	1
93062306a36Sopenharmony_ci#define SIR1_SPEED_TXAMP_INDEX		8
93162306a36Sopenharmony_ci#define SIR1_SPEED_TXAMP_WIDTH		4
93262306a36Sopenharmony_ci#define SIR1_SPEED_WORDMODE_INDEX	0
93362306a36Sopenharmony_ci#define SIR1_SPEED_WORDMODE_WIDTH	3
93462306a36Sopenharmony_ci
93562306a36Sopenharmony_ci/* SerDes RxTx register offsets */
93662306a36Sopenharmony_ci#define RXTX_REG6			0x0018
93762306a36Sopenharmony_ci#define RXTX_REG20			0x0050
93862306a36Sopenharmony_ci#define RXTX_REG22			0x0058
93962306a36Sopenharmony_ci#define RXTX_REG114			0x01c8
94062306a36Sopenharmony_ci#define RXTX_REG129			0x0204
94162306a36Sopenharmony_ci
94262306a36Sopenharmony_ci/* SerDes RxTx register entry bit positions and sizes */
94362306a36Sopenharmony_ci#define RXTX_REG6_RESETB_RXD_INDEX	8
94462306a36Sopenharmony_ci#define RXTX_REG6_RESETB_RXD_WIDTH	1
94562306a36Sopenharmony_ci#define RXTX_REG20_BLWC_ENA_INDEX	2
94662306a36Sopenharmony_ci#define RXTX_REG20_BLWC_ENA_WIDTH	1
94762306a36Sopenharmony_ci#define RXTX_REG114_PQ_REG_INDEX	9
94862306a36Sopenharmony_ci#define RXTX_REG114_PQ_REG_WIDTH	7
94962306a36Sopenharmony_ci#define RXTX_REG129_RXDFE_CONFIG_INDEX	14
95062306a36Sopenharmony_ci#define RXTX_REG129_RXDFE_CONFIG_WIDTH	2
95162306a36Sopenharmony_ci
95262306a36Sopenharmony_ci/* MAC Control register offsets */
95362306a36Sopenharmony_ci#define XP_PROP_0			0x0000
95462306a36Sopenharmony_ci#define XP_PROP_1			0x0004
95562306a36Sopenharmony_ci#define XP_PROP_2			0x0008
95662306a36Sopenharmony_ci#define XP_PROP_3			0x000c
95762306a36Sopenharmony_ci#define XP_PROP_4			0x0010
95862306a36Sopenharmony_ci#define XP_PROP_5			0x0014
95962306a36Sopenharmony_ci#define XP_MAC_ADDR_LO			0x0020
96062306a36Sopenharmony_ci#define XP_MAC_ADDR_HI			0x0024
96162306a36Sopenharmony_ci#define XP_ECC_ISR			0x0030
96262306a36Sopenharmony_ci#define XP_ECC_IER			0x0034
96362306a36Sopenharmony_ci#define XP_ECC_CNT0			0x003c
96462306a36Sopenharmony_ci#define XP_ECC_CNT1			0x0040
96562306a36Sopenharmony_ci#define XP_DRIVER_INT_REQ		0x0060
96662306a36Sopenharmony_ci#define XP_DRIVER_INT_RO		0x0064
96762306a36Sopenharmony_ci#define XP_DRIVER_SCRATCH_0		0x0068
96862306a36Sopenharmony_ci#define XP_DRIVER_SCRATCH_1		0x006c
96962306a36Sopenharmony_ci#define XP_INT_REISSUE_EN		0x0074
97062306a36Sopenharmony_ci#define XP_INT_EN			0x0078
97162306a36Sopenharmony_ci#define XP_I2C_MUTEX			0x0080
97262306a36Sopenharmony_ci#define XP_MDIO_MUTEX			0x0084
97362306a36Sopenharmony_ci
97462306a36Sopenharmony_ci/* MAC Control register entry bit positions and sizes */
97562306a36Sopenharmony_ci#define XP_DRIVER_INT_REQ_REQUEST_INDEX		0
97662306a36Sopenharmony_ci#define XP_DRIVER_INT_REQ_REQUEST_WIDTH		1
97762306a36Sopenharmony_ci#define XP_DRIVER_INT_RO_STATUS_INDEX		0
97862306a36Sopenharmony_ci#define XP_DRIVER_INT_RO_STATUS_WIDTH		1
97962306a36Sopenharmony_ci#define XP_DRIVER_SCRATCH_0_COMMAND_INDEX	0
98062306a36Sopenharmony_ci#define XP_DRIVER_SCRATCH_0_COMMAND_WIDTH	8
98162306a36Sopenharmony_ci#define XP_DRIVER_SCRATCH_0_SUB_COMMAND_INDEX	8
98262306a36Sopenharmony_ci#define XP_DRIVER_SCRATCH_0_SUB_COMMAND_WIDTH	8
98362306a36Sopenharmony_ci#define XP_ECC_CNT0_RX_DED_INDEX		24
98462306a36Sopenharmony_ci#define XP_ECC_CNT0_RX_DED_WIDTH		8
98562306a36Sopenharmony_ci#define XP_ECC_CNT0_RX_SEC_INDEX		16
98662306a36Sopenharmony_ci#define XP_ECC_CNT0_RX_SEC_WIDTH		8
98762306a36Sopenharmony_ci#define XP_ECC_CNT0_TX_DED_INDEX		8
98862306a36Sopenharmony_ci#define XP_ECC_CNT0_TX_DED_WIDTH		8
98962306a36Sopenharmony_ci#define XP_ECC_CNT0_TX_SEC_INDEX		0
99062306a36Sopenharmony_ci#define XP_ECC_CNT0_TX_SEC_WIDTH		8
99162306a36Sopenharmony_ci#define XP_ECC_CNT1_DESC_DED_INDEX		8
99262306a36Sopenharmony_ci#define XP_ECC_CNT1_DESC_DED_WIDTH		8
99362306a36Sopenharmony_ci#define XP_ECC_CNT1_DESC_SEC_INDEX		0
99462306a36Sopenharmony_ci#define XP_ECC_CNT1_DESC_SEC_WIDTH		8
99562306a36Sopenharmony_ci#define XP_ECC_IER_DESC_DED_INDEX		5
99662306a36Sopenharmony_ci#define XP_ECC_IER_DESC_DED_WIDTH		1
99762306a36Sopenharmony_ci#define XP_ECC_IER_DESC_SEC_INDEX		4
99862306a36Sopenharmony_ci#define XP_ECC_IER_DESC_SEC_WIDTH		1
99962306a36Sopenharmony_ci#define XP_ECC_IER_RX_DED_INDEX			3
100062306a36Sopenharmony_ci#define XP_ECC_IER_RX_DED_WIDTH			1
100162306a36Sopenharmony_ci#define XP_ECC_IER_RX_SEC_INDEX			2
100262306a36Sopenharmony_ci#define XP_ECC_IER_RX_SEC_WIDTH			1
100362306a36Sopenharmony_ci#define XP_ECC_IER_TX_DED_INDEX			1
100462306a36Sopenharmony_ci#define XP_ECC_IER_TX_DED_WIDTH			1
100562306a36Sopenharmony_ci#define XP_ECC_IER_TX_SEC_INDEX			0
100662306a36Sopenharmony_ci#define XP_ECC_IER_TX_SEC_WIDTH			1
100762306a36Sopenharmony_ci#define XP_ECC_ISR_DESC_DED_INDEX		5
100862306a36Sopenharmony_ci#define XP_ECC_ISR_DESC_DED_WIDTH		1
100962306a36Sopenharmony_ci#define XP_ECC_ISR_DESC_SEC_INDEX		4
101062306a36Sopenharmony_ci#define XP_ECC_ISR_DESC_SEC_WIDTH		1
101162306a36Sopenharmony_ci#define XP_ECC_ISR_RX_DED_INDEX			3
101262306a36Sopenharmony_ci#define XP_ECC_ISR_RX_DED_WIDTH			1
101362306a36Sopenharmony_ci#define XP_ECC_ISR_RX_SEC_INDEX			2
101462306a36Sopenharmony_ci#define XP_ECC_ISR_RX_SEC_WIDTH			1
101562306a36Sopenharmony_ci#define XP_ECC_ISR_TX_DED_INDEX			1
101662306a36Sopenharmony_ci#define XP_ECC_ISR_TX_DED_WIDTH			1
101762306a36Sopenharmony_ci#define XP_ECC_ISR_TX_SEC_INDEX			0
101862306a36Sopenharmony_ci#define XP_ECC_ISR_TX_SEC_WIDTH			1
101962306a36Sopenharmony_ci#define XP_I2C_MUTEX_BUSY_INDEX			31
102062306a36Sopenharmony_ci#define XP_I2C_MUTEX_BUSY_WIDTH			1
102162306a36Sopenharmony_ci#define XP_I2C_MUTEX_ID_INDEX			29
102262306a36Sopenharmony_ci#define XP_I2C_MUTEX_ID_WIDTH			2
102362306a36Sopenharmony_ci#define XP_I2C_MUTEX_ACTIVE_INDEX		0
102462306a36Sopenharmony_ci#define XP_I2C_MUTEX_ACTIVE_WIDTH		1
102562306a36Sopenharmony_ci#define XP_MAC_ADDR_HI_VALID_INDEX		31
102662306a36Sopenharmony_ci#define XP_MAC_ADDR_HI_VALID_WIDTH		1
102762306a36Sopenharmony_ci#define XP_PROP_0_CONN_TYPE_INDEX		28
102862306a36Sopenharmony_ci#define XP_PROP_0_CONN_TYPE_WIDTH		3
102962306a36Sopenharmony_ci#define XP_PROP_0_MDIO_ADDR_INDEX		16
103062306a36Sopenharmony_ci#define XP_PROP_0_MDIO_ADDR_WIDTH		5
103162306a36Sopenharmony_ci#define XP_PROP_0_PORT_ID_INDEX			0
103262306a36Sopenharmony_ci#define XP_PROP_0_PORT_ID_WIDTH			8
103362306a36Sopenharmony_ci#define XP_PROP_0_PORT_MODE_INDEX		8
103462306a36Sopenharmony_ci#define XP_PROP_0_PORT_MODE_WIDTH		4
103562306a36Sopenharmony_ci#define XP_PROP_0_PORT_SPEEDS_INDEX		22
103662306a36Sopenharmony_ci#define XP_PROP_0_PORT_SPEEDS_WIDTH		5
103762306a36Sopenharmony_ci#define XP_PROP_1_MAX_RX_DMA_INDEX		24
103862306a36Sopenharmony_ci#define XP_PROP_1_MAX_RX_DMA_WIDTH		5
103962306a36Sopenharmony_ci#define XP_PROP_1_MAX_RX_QUEUES_INDEX		8
104062306a36Sopenharmony_ci#define XP_PROP_1_MAX_RX_QUEUES_WIDTH		5
104162306a36Sopenharmony_ci#define XP_PROP_1_MAX_TX_DMA_INDEX		16
104262306a36Sopenharmony_ci#define XP_PROP_1_MAX_TX_DMA_WIDTH		5
104362306a36Sopenharmony_ci#define XP_PROP_1_MAX_TX_QUEUES_INDEX		0
104462306a36Sopenharmony_ci#define XP_PROP_1_MAX_TX_QUEUES_WIDTH		5
104562306a36Sopenharmony_ci#define XP_PROP_2_RX_FIFO_SIZE_INDEX		16
104662306a36Sopenharmony_ci#define XP_PROP_2_RX_FIFO_SIZE_WIDTH		16
104762306a36Sopenharmony_ci#define XP_PROP_2_TX_FIFO_SIZE_INDEX		0
104862306a36Sopenharmony_ci#define XP_PROP_2_TX_FIFO_SIZE_WIDTH		16
104962306a36Sopenharmony_ci#define XP_PROP_3_GPIO_MASK_INDEX		28
105062306a36Sopenharmony_ci#define XP_PROP_3_GPIO_MASK_WIDTH		4
105162306a36Sopenharmony_ci#define XP_PROP_3_GPIO_MOD_ABS_INDEX		20
105262306a36Sopenharmony_ci#define XP_PROP_3_GPIO_MOD_ABS_WIDTH		4
105362306a36Sopenharmony_ci#define XP_PROP_3_GPIO_RATE_SELECT_INDEX	16
105462306a36Sopenharmony_ci#define XP_PROP_3_GPIO_RATE_SELECT_WIDTH	4
105562306a36Sopenharmony_ci#define XP_PROP_3_GPIO_RX_LOS_INDEX		24
105662306a36Sopenharmony_ci#define XP_PROP_3_GPIO_RX_LOS_WIDTH		4
105762306a36Sopenharmony_ci#define XP_PROP_3_GPIO_TX_FAULT_INDEX		12
105862306a36Sopenharmony_ci#define XP_PROP_3_GPIO_TX_FAULT_WIDTH		4
105962306a36Sopenharmony_ci#define XP_PROP_3_GPIO_ADDR_INDEX		8
106062306a36Sopenharmony_ci#define XP_PROP_3_GPIO_ADDR_WIDTH		3
106162306a36Sopenharmony_ci#define XP_PROP_3_MDIO_RESET_INDEX		0
106262306a36Sopenharmony_ci#define XP_PROP_3_MDIO_RESET_WIDTH		2
106362306a36Sopenharmony_ci#define XP_PROP_3_MDIO_RESET_I2C_ADDR_INDEX	8
106462306a36Sopenharmony_ci#define XP_PROP_3_MDIO_RESET_I2C_ADDR_WIDTH	3
106562306a36Sopenharmony_ci#define XP_PROP_3_MDIO_RESET_I2C_GPIO_INDEX	12
106662306a36Sopenharmony_ci#define XP_PROP_3_MDIO_RESET_I2C_GPIO_WIDTH	4
106762306a36Sopenharmony_ci#define XP_PROP_3_MDIO_RESET_INT_GPIO_INDEX	4
106862306a36Sopenharmony_ci#define XP_PROP_3_MDIO_RESET_INT_GPIO_WIDTH	2
106962306a36Sopenharmony_ci#define XP_PROP_4_MUX_ADDR_HI_INDEX		8
107062306a36Sopenharmony_ci#define XP_PROP_4_MUX_ADDR_HI_WIDTH		5
107162306a36Sopenharmony_ci#define XP_PROP_4_MUX_ADDR_LO_INDEX		0
107262306a36Sopenharmony_ci#define XP_PROP_4_MUX_ADDR_LO_WIDTH		3
107362306a36Sopenharmony_ci#define XP_PROP_4_MUX_CHAN_INDEX		4
107462306a36Sopenharmony_ci#define XP_PROP_4_MUX_CHAN_WIDTH		3
107562306a36Sopenharmony_ci#define XP_PROP_4_REDRV_ADDR_INDEX		16
107662306a36Sopenharmony_ci#define XP_PROP_4_REDRV_ADDR_WIDTH		7
107762306a36Sopenharmony_ci#define XP_PROP_4_REDRV_IF_INDEX		23
107862306a36Sopenharmony_ci#define XP_PROP_4_REDRV_IF_WIDTH		1
107962306a36Sopenharmony_ci#define XP_PROP_4_REDRV_LANE_INDEX		24
108062306a36Sopenharmony_ci#define XP_PROP_4_REDRV_LANE_WIDTH		3
108162306a36Sopenharmony_ci#define XP_PROP_4_REDRV_MODEL_INDEX		28
108262306a36Sopenharmony_ci#define XP_PROP_4_REDRV_MODEL_WIDTH		3
108362306a36Sopenharmony_ci#define XP_PROP_4_REDRV_PRESENT_INDEX		31
108462306a36Sopenharmony_ci#define XP_PROP_4_REDRV_PRESENT_WIDTH		1
108562306a36Sopenharmony_ci
108662306a36Sopenharmony_ci/* I2C Control register offsets */
108762306a36Sopenharmony_ci#define IC_CON					0x0000
108862306a36Sopenharmony_ci#define IC_TAR					0x0004
108962306a36Sopenharmony_ci#define IC_DATA_CMD				0x0010
109062306a36Sopenharmony_ci#define IC_INTR_STAT				0x002c
109162306a36Sopenharmony_ci#define IC_INTR_MASK				0x0030
109262306a36Sopenharmony_ci#define IC_RAW_INTR_STAT			0x0034
109362306a36Sopenharmony_ci#define IC_CLR_INTR				0x0040
109462306a36Sopenharmony_ci#define IC_CLR_TX_ABRT				0x0054
109562306a36Sopenharmony_ci#define IC_CLR_STOP_DET				0x0060
109662306a36Sopenharmony_ci#define IC_ENABLE				0x006c
109762306a36Sopenharmony_ci#define IC_TXFLR				0x0074
109862306a36Sopenharmony_ci#define IC_RXFLR				0x0078
109962306a36Sopenharmony_ci#define IC_TX_ABRT_SOURCE			0x0080
110062306a36Sopenharmony_ci#define IC_ENABLE_STATUS			0x009c
110162306a36Sopenharmony_ci#define IC_COMP_PARAM_1				0x00f4
110262306a36Sopenharmony_ci
110362306a36Sopenharmony_ci/* I2C Control register entry bit positions and sizes */
110462306a36Sopenharmony_ci#define IC_COMP_PARAM_1_MAX_SPEED_MODE_INDEX	2
110562306a36Sopenharmony_ci#define IC_COMP_PARAM_1_MAX_SPEED_MODE_WIDTH	2
110662306a36Sopenharmony_ci#define IC_COMP_PARAM_1_RX_BUFFER_DEPTH_INDEX	8
110762306a36Sopenharmony_ci#define IC_COMP_PARAM_1_RX_BUFFER_DEPTH_WIDTH	8
110862306a36Sopenharmony_ci#define IC_COMP_PARAM_1_TX_BUFFER_DEPTH_INDEX	16
110962306a36Sopenharmony_ci#define IC_COMP_PARAM_1_TX_BUFFER_DEPTH_WIDTH	8
111062306a36Sopenharmony_ci#define IC_CON_MASTER_MODE_INDEX		0
111162306a36Sopenharmony_ci#define IC_CON_MASTER_MODE_WIDTH		1
111262306a36Sopenharmony_ci#define IC_CON_RESTART_EN_INDEX			5
111362306a36Sopenharmony_ci#define IC_CON_RESTART_EN_WIDTH			1
111462306a36Sopenharmony_ci#define IC_CON_RX_FIFO_FULL_HOLD_INDEX		9
111562306a36Sopenharmony_ci#define IC_CON_RX_FIFO_FULL_HOLD_WIDTH		1
111662306a36Sopenharmony_ci#define IC_CON_SLAVE_DISABLE_INDEX		6
111762306a36Sopenharmony_ci#define IC_CON_SLAVE_DISABLE_WIDTH		1
111862306a36Sopenharmony_ci#define IC_CON_SPEED_INDEX			1
111962306a36Sopenharmony_ci#define IC_CON_SPEED_WIDTH			2
112062306a36Sopenharmony_ci#define IC_DATA_CMD_CMD_INDEX			8
112162306a36Sopenharmony_ci#define IC_DATA_CMD_CMD_WIDTH			1
112262306a36Sopenharmony_ci#define IC_DATA_CMD_STOP_INDEX			9
112362306a36Sopenharmony_ci#define IC_DATA_CMD_STOP_WIDTH			1
112462306a36Sopenharmony_ci#define IC_ENABLE_ABORT_INDEX			1
112562306a36Sopenharmony_ci#define IC_ENABLE_ABORT_WIDTH			1
112662306a36Sopenharmony_ci#define IC_ENABLE_EN_INDEX			0
112762306a36Sopenharmony_ci#define IC_ENABLE_EN_WIDTH			1
112862306a36Sopenharmony_ci#define IC_ENABLE_STATUS_EN_INDEX		0
112962306a36Sopenharmony_ci#define IC_ENABLE_STATUS_EN_WIDTH		1
113062306a36Sopenharmony_ci#define IC_INTR_MASK_TX_EMPTY_INDEX		4
113162306a36Sopenharmony_ci#define IC_INTR_MASK_TX_EMPTY_WIDTH		1
113262306a36Sopenharmony_ci#define IC_RAW_INTR_STAT_RX_FULL_INDEX		2
113362306a36Sopenharmony_ci#define IC_RAW_INTR_STAT_RX_FULL_WIDTH		1
113462306a36Sopenharmony_ci#define IC_RAW_INTR_STAT_STOP_DET_INDEX		9
113562306a36Sopenharmony_ci#define IC_RAW_INTR_STAT_STOP_DET_WIDTH		1
113662306a36Sopenharmony_ci#define IC_RAW_INTR_STAT_TX_ABRT_INDEX		6
113762306a36Sopenharmony_ci#define IC_RAW_INTR_STAT_TX_ABRT_WIDTH		1
113862306a36Sopenharmony_ci#define IC_RAW_INTR_STAT_TX_EMPTY_INDEX		4
113962306a36Sopenharmony_ci#define IC_RAW_INTR_STAT_TX_EMPTY_WIDTH		1
114062306a36Sopenharmony_ci
114162306a36Sopenharmony_ci/* I2C Control register value */
114262306a36Sopenharmony_ci#define IC_TX_ABRT_7B_ADDR_NOACK		0x0001
114362306a36Sopenharmony_ci#define IC_TX_ABRT_ARB_LOST			0x1000
114462306a36Sopenharmony_ci
114562306a36Sopenharmony_ci/* Descriptor/Packet entry bit positions and sizes */
114662306a36Sopenharmony_ci#define RX_PACKET_ERRORS_CRC_INDEX		2
114762306a36Sopenharmony_ci#define RX_PACKET_ERRORS_CRC_WIDTH		1
114862306a36Sopenharmony_ci#define RX_PACKET_ERRORS_FRAME_INDEX		3
114962306a36Sopenharmony_ci#define RX_PACKET_ERRORS_FRAME_WIDTH		1
115062306a36Sopenharmony_ci#define RX_PACKET_ERRORS_LENGTH_INDEX		0
115162306a36Sopenharmony_ci#define RX_PACKET_ERRORS_LENGTH_WIDTH		1
115262306a36Sopenharmony_ci#define RX_PACKET_ERRORS_OVERRUN_INDEX		1
115362306a36Sopenharmony_ci#define RX_PACKET_ERRORS_OVERRUN_WIDTH		1
115462306a36Sopenharmony_ci
115562306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_CSUM_DONE_INDEX	0
115662306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_CSUM_DONE_WIDTH	1
115762306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_VLAN_CTAG_INDEX	1
115862306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_VLAN_CTAG_WIDTH	1
115962306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_LAST_INDEX		2
116062306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_LAST_WIDTH		1
116162306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_INDEX	3
116262306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_WIDTH	1
116362306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_CONTEXT_INDEX	4
116462306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_CONTEXT_WIDTH	1
116562306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_RX_TSTAMP_INDEX	5
116662306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_RX_TSTAMP_WIDTH	1
116762306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_RSS_HASH_INDEX	6
116862306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_RSS_HASH_WIDTH	1
116962306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_FIRST_INDEX	7
117062306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_FIRST_WIDTH	1
117162306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_TNP_INDEX		8
117262306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_TNP_WIDTH		1
117362306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_TNPCSUM_DONE_INDEX	9
117462306a36Sopenharmony_ci#define RX_PACKET_ATTRIBUTES_TNPCSUM_DONE_WIDTH	1
117562306a36Sopenharmony_ci
117662306a36Sopenharmony_ci#define RX_NORMAL_DESC0_OVT_INDEX		0
117762306a36Sopenharmony_ci#define RX_NORMAL_DESC0_OVT_WIDTH		16
117862306a36Sopenharmony_ci#define RX_NORMAL_DESC2_HL_INDEX		0
117962306a36Sopenharmony_ci#define RX_NORMAL_DESC2_HL_WIDTH		10
118062306a36Sopenharmony_ci#define RX_NORMAL_DESC2_TNP_INDEX		11
118162306a36Sopenharmony_ci#define RX_NORMAL_DESC2_TNP_WIDTH		1
118262306a36Sopenharmony_ci#define RX_NORMAL_DESC3_CDA_INDEX		27
118362306a36Sopenharmony_ci#define RX_NORMAL_DESC3_CDA_WIDTH		1
118462306a36Sopenharmony_ci#define RX_NORMAL_DESC3_CTXT_INDEX		30
118562306a36Sopenharmony_ci#define RX_NORMAL_DESC3_CTXT_WIDTH		1
118662306a36Sopenharmony_ci#define RX_NORMAL_DESC3_ES_INDEX		15
118762306a36Sopenharmony_ci#define RX_NORMAL_DESC3_ES_WIDTH		1
118862306a36Sopenharmony_ci#define RX_NORMAL_DESC3_ETLT_INDEX		16
118962306a36Sopenharmony_ci#define RX_NORMAL_DESC3_ETLT_WIDTH		4
119062306a36Sopenharmony_ci#define RX_NORMAL_DESC3_FD_INDEX		29
119162306a36Sopenharmony_ci#define RX_NORMAL_DESC3_FD_WIDTH		1
119262306a36Sopenharmony_ci#define RX_NORMAL_DESC3_INTE_INDEX		30
119362306a36Sopenharmony_ci#define RX_NORMAL_DESC3_INTE_WIDTH		1
119462306a36Sopenharmony_ci#define RX_NORMAL_DESC3_L34T_INDEX		20
119562306a36Sopenharmony_ci#define RX_NORMAL_DESC3_L34T_WIDTH		4
119662306a36Sopenharmony_ci#define RX_NORMAL_DESC3_LD_INDEX		28
119762306a36Sopenharmony_ci#define RX_NORMAL_DESC3_LD_WIDTH		1
119862306a36Sopenharmony_ci#define RX_NORMAL_DESC3_OWN_INDEX		31
119962306a36Sopenharmony_ci#define RX_NORMAL_DESC3_OWN_WIDTH		1
120062306a36Sopenharmony_ci#define RX_NORMAL_DESC3_PL_INDEX		0
120162306a36Sopenharmony_ci#define RX_NORMAL_DESC3_PL_WIDTH		14
120262306a36Sopenharmony_ci#define RX_NORMAL_DESC3_RSV_INDEX		26
120362306a36Sopenharmony_ci#define RX_NORMAL_DESC3_RSV_WIDTH		1
120462306a36Sopenharmony_ci
120562306a36Sopenharmony_ci#define RX_DESC3_L34T_IPV4_TCP			1
120662306a36Sopenharmony_ci#define RX_DESC3_L34T_IPV4_UDP			2
120762306a36Sopenharmony_ci#define RX_DESC3_L34T_IPV4_ICMP			3
120862306a36Sopenharmony_ci#define RX_DESC3_L34T_IPV4_UNKNOWN		7
120962306a36Sopenharmony_ci#define RX_DESC3_L34T_IPV6_TCP			9
121062306a36Sopenharmony_ci#define RX_DESC3_L34T_IPV6_UDP			10
121162306a36Sopenharmony_ci#define RX_DESC3_L34T_IPV6_ICMP			11
121262306a36Sopenharmony_ci#define RX_DESC3_L34T_IPV6_UNKNOWN		15
121362306a36Sopenharmony_ci
121462306a36Sopenharmony_ci#define RX_CONTEXT_DESC3_TSA_INDEX		4
121562306a36Sopenharmony_ci#define RX_CONTEXT_DESC3_TSA_WIDTH		1
121662306a36Sopenharmony_ci#define RX_CONTEXT_DESC3_TSD_INDEX		6
121762306a36Sopenharmony_ci#define RX_CONTEXT_DESC3_TSD_WIDTH		1
121862306a36Sopenharmony_ci
121962306a36Sopenharmony_ci#define TX_PACKET_ATTRIBUTES_CSUM_ENABLE_INDEX	0
122062306a36Sopenharmony_ci#define TX_PACKET_ATTRIBUTES_CSUM_ENABLE_WIDTH	1
122162306a36Sopenharmony_ci#define TX_PACKET_ATTRIBUTES_TSO_ENABLE_INDEX	1
122262306a36Sopenharmony_ci#define TX_PACKET_ATTRIBUTES_TSO_ENABLE_WIDTH	1
122362306a36Sopenharmony_ci#define TX_PACKET_ATTRIBUTES_VLAN_CTAG_INDEX	2
122462306a36Sopenharmony_ci#define TX_PACKET_ATTRIBUTES_VLAN_CTAG_WIDTH	1
122562306a36Sopenharmony_ci#define TX_PACKET_ATTRIBUTES_PTP_INDEX		3
122662306a36Sopenharmony_ci#define TX_PACKET_ATTRIBUTES_PTP_WIDTH		1
122762306a36Sopenharmony_ci#define TX_PACKET_ATTRIBUTES_VXLAN_INDEX	4
122862306a36Sopenharmony_ci#define TX_PACKET_ATTRIBUTES_VXLAN_WIDTH	1
122962306a36Sopenharmony_ci
123062306a36Sopenharmony_ci#define TX_CONTEXT_DESC2_MSS_INDEX		0
123162306a36Sopenharmony_ci#define TX_CONTEXT_DESC2_MSS_WIDTH		15
123262306a36Sopenharmony_ci#define TX_CONTEXT_DESC3_CTXT_INDEX		30
123362306a36Sopenharmony_ci#define TX_CONTEXT_DESC3_CTXT_WIDTH		1
123462306a36Sopenharmony_ci#define TX_CONTEXT_DESC3_TCMSSV_INDEX		26
123562306a36Sopenharmony_ci#define TX_CONTEXT_DESC3_TCMSSV_WIDTH		1
123662306a36Sopenharmony_ci#define TX_CONTEXT_DESC3_VLTV_INDEX		16
123762306a36Sopenharmony_ci#define TX_CONTEXT_DESC3_VLTV_WIDTH		1
123862306a36Sopenharmony_ci#define TX_CONTEXT_DESC3_VT_INDEX		0
123962306a36Sopenharmony_ci#define TX_CONTEXT_DESC3_VT_WIDTH		16
124062306a36Sopenharmony_ci
124162306a36Sopenharmony_ci#define TX_NORMAL_DESC2_HL_B1L_INDEX		0
124262306a36Sopenharmony_ci#define TX_NORMAL_DESC2_HL_B1L_WIDTH		14
124362306a36Sopenharmony_ci#define TX_NORMAL_DESC2_IC_INDEX		31
124462306a36Sopenharmony_ci#define TX_NORMAL_DESC2_IC_WIDTH		1
124562306a36Sopenharmony_ci#define TX_NORMAL_DESC2_TTSE_INDEX		30
124662306a36Sopenharmony_ci#define TX_NORMAL_DESC2_TTSE_WIDTH		1
124762306a36Sopenharmony_ci#define TX_NORMAL_DESC2_VTIR_INDEX		14
124862306a36Sopenharmony_ci#define TX_NORMAL_DESC2_VTIR_WIDTH		2
124962306a36Sopenharmony_ci#define TX_NORMAL_DESC3_CIC_INDEX		16
125062306a36Sopenharmony_ci#define TX_NORMAL_DESC3_CIC_WIDTH		2
125162306a36Sopenharmony_ci#define TX_NORMAL_DESC3_CPC_INDEX		26
125262306a36Sopenharmony_ci#define TX_NORMAL_DESC3_CPC_WIDTH		2
125362306a36Sopenharmony_ci#define TX_NORMAL_DESC3_CTXT_INDEX		30
125462306a36Sopenharmony_ci#define TX_NORMAL_DESC3_CTXT_WIDTH		1
125562306a36Sopenharmony_ci#define TX_NORMAL_DESC3_FD_INDEX		29
125662306a36Sopenharmony_ci#define TX_NORMAL_DESC3_FD_WIDTH		1
125762306a36Sopenharmony_ci#define TX_NORMAL_DESC3_FL_INDEX		0
125862306a36Sopenharmony_ci#define TX_NORMAL_DESC3_FL_WIDTH		15
125962306a36Sopenharmony_ci#define TX_NORMAL_DESC3_LD_INDEX		28
126062306a36Sopenharmony_ci#define TX_NORMAL_DESC3_LD_WIDTH		1
126162306a36Sopenharmony_ci#define TX_NORMAL_DESC3_OWN_INDEX		31
126262306a36Sopenharmony_ci#define TX_NORMAL_DESC3_OWN_WIDTH		1
126362306a36Sopenharmony_ci#define TX_NORMAL_DESC3_TCPHDRLEN_INDEX		19
126462306a36Sopenharmony_ci#define TX_NORMAL_DESC3_TCPHDRLEN_WIDTH		4
126562306a36Sopenharmony_ci#define TX_NORMAL_DESC3_TCPPL_INDEX		0
126662306a36Sopenharmony_ci#define TX_NORMAL_DESC3_TCPPL_WIDTH		18
126762306a36Sopenharmony_ci#define TX_NORMAL_DESC3_TSE_INDEX		18
126862306a36Sopenharmony_ci#define TX_NORMAL_DESC3_TSE_WIDTH		1
126962306a36Sopenharmony_ci#define TX_NORMAL_DESC3_VNP_INDEX		23
127062306a36Sopenharmony_ci#define TX_NORMAL_DESC3_VNP_WIDTH		3
127162306a36Sopenharmony_ci
127262306a36Sopenharmony_ci#define TX_NORMAL_DESC2_VLAN_INSERT		0x2
127362306a36Sopenharmony_ci#define TX_NORMAL_DESC3_VXLAN_PACKET		0x3
127462306a36Sopenharmony_ci
127562306a36Sopenharmony_ci/* MDIO undefined or vendor specific registers */
127662306a36Sopenharmony_ci#ifndef MDIO_PMA_10GBR_PMD_CTRL
127762306a36Sopenharmony_ci#define MDIO_PMA_10GBR_PMD_CTRL		0x0096
127862306a36Sopenharmony_ci#endif
127962306a36Sopenharmony_ci
128062306a36Sopenharmony_ci#ifndef MDIO_PMA_10GBR_FECCTRL
128162306a36Sopenharmony_ci#define MDIO_PMA_10GBR_FECCTRL		0x00ab
128262306a36Sopenharmony_ci#endif
128362306a36Sopenharmony_ci
128462306a36Sopenharmony_ci#ifndef MDIO_PMA_RX_CTRL1
128562306a36Sopenharmony_ci#define MDIO_PMA_RX_CTRL1		0x8051
128662306a36Sopenharmony_ci#endif
128762306a36Sopenharmony_ci
128862306a36Sopenharmony_ci#ifndef MDIO_PMA_RX_LSTS
128962306a36Sopenharmony_ci#define MDIO_PMA_RX_LSTS		0x018020
129062306a36Sopenharmony_ci#endif
129162306a36Sopenharmony_ci
129262306a36Sopenharmony_ci#ifndef MDIO_PMA_RX_EQ_CTRL4
129362306a36Sopenharmony_ci#define MDIO_PMA_RX_EQ_CTRL4		0x0001805C
129462306a36Sopenharmony_ci#endif
129562306a36Sopenharmony_ci
129662306a36Sopenharmony_ci#ifndef MDIO_PMA_MP_MISC_STS
129762306a36Sopenharmony_ci#define MDIO_PMA_MP_MISC_STS		0x0078
129862306a36Sopenharmony_ci#endif
129962306a36Sopenharmony_ci
130062306a36Sopenharmony_ci#ifndef MDIO_PMA_PHY_RX_EQ_CEU
130162306a36Sopenharmony_ci#define MDIO_PMA_PHY_RX_EQ_CEU		0x1800E
130262306a36Sopenharmony_ci#endif
130362306a36Sopenharmony_ci
130462306a36Sopenharmony_ci#ifndef MDIO_PCS_DIG_CTRL
130562306a36Sopenharmony_ci#define MDIO_PCS_DIG_CTRL		0x8000
130662306a36Sopenharmony_ci#endif
130762306a36Sopenharmony_ci
130862306a36Sopenharmony_ci#ifndef MDIO_PCS_DIGITAL_STAT
130962306a36Sopenharmony_ci#define MDIO_PCS_DIGITAL_STAT		0x8010
131062306a36Sopenharmony_ci#endif
131162306a36Sopenharmony_ci
131262306a36Sopenharmony_ci#ifndef MDIO_AN_XNP
131362306a36Sopenharmony_ci#define MDIO_AN_XNP			0x0016
131462306a36Sopenharmony_ci#endif
131562306a36Sopenharmony_ci
131662306a36Sopenharmony_ci#ifndef MDIO_AN_LPX
131762306a36Sopenharmony_ci#define MDIO_AN_LPX			0x0019
131862306a36Sopenharmony_ci#endif
131962306a36Sopenharmony_ci
132062306a36Sopenharmony_ci#ifndef MDIO_AN_COMP_STAT
132162306a36Sopenharmony_ci#define MDIO_AN_COMP_STAT		0x0030
132262306a36Sopenharmony_ci#endif
132362306a36Sopenharmony_ci
132462306a36Sopenharmony_ci#ifndef MDIO_AN_INTMASK
132562306a36Sopenharmony_ci#define MDIO_AN_INTMASK			0x8001
132662306a36Sopenharmony_ci#endif
132762306a36Sopenharmony_ci
132862306a36Sopenharmony_ci#ifndef MDIO_AN_INT
132962306a36Sopenharmony_ci#define MDIO_AN_INT			0x8002
133062306a36Sopenharmony_ci#endif
133162306a36Sopenharmony_ci
133262306a36Sopenharmony_ci#ifndef MDIO_VEND2_AN_ADVERTISE
133362306a36Sopenharmony_ci#define MDIO_VEND2_AN_ADVERTISE		0x0004
133462306a36Sopenharmony_ci#endif
133562306a36Sopenharmony_ci
133662306a36Sopenharmony_ci#ifndef MDIO_VEND2_AN_LP_ABILITY
133762306a36Sopenharmony_ci#define MDIO_VEND2_AN_LP_ABILITY	0x0005
133862306a36Sopenharmony_ci#endif
133962306a36Sopenharmony_ci
134062306a36Sopenharmony_ci#ifndef MDIO_VEND2_AN_CTRL
134162306a36Sopenharmony_ci#define MDIO_VEND2_AN_CTRL		0x8001
134262306a36Sopenharmony_ci#endif
134362306a36Sopenharmony_ci
134462306a36Sopenharmony_ci#ifndef MDIO_VEND2_AN_STAT
134562306a36Sopenharmony_ci#define MDIO_VEND2_AN_STAT		0x8002
134662306a36Sopenharmony_ci#endif
134762306a36Sopenharmony_ci
134862306a36Sopenharmony_ci#ifndef MDIO_VEND2_PMA_CDR_CONTROL
134962306a36Sopenharmony_ci#define MDIO_VEND2_PMA_CDR_CONTROL	0x8056
135062306a36Sopenharmony_ci#endif
135162306a36Sopenharmony_ci
135262306a36Sopenharmony_ci#ifndef MDIO_VEND2_PMA_MISC_CTRL0
135362306a36Sopenharmony_ci#define MDIO_VEND2_PMA_MISC_CTRL0	0x8090
135462306a36Sopenharmony_ci#endif
135562306a36Sopenharmony_ci
135662306a36Sopenharmony_ci#ifndef MDIO_CTRL1_SPEED1G
135762306a36Sopenharmony_ci#define MDIO_CTRL1_SPEED1G		(MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100)
135862306a36Sopenharmony_ci#endif
135962306a36Sopenharmony_ci
136062306a36Sopenharmony_ci#ifndef MDIO_VEND2_CTRL1_AN_ENABLE
136162306a36Sopenharmony_ci#define MDIO_VEND2_CTRL1_AN_ENABLE	BIT(12)
136262306a36Sopenharmony_ci#endif
136362306a36Sopenharmony_ci
136462306a36Sopenharmony_ci#ifndef MDIO_VEND2_CTRL1_AN_RESTART
136562306a36Sopenharmony_ci#define MDIO_VEND2_CTRL1_AN_RESTART	BIT(9)
136662306a36Sopenharmony_ci#endif
136762306a36Sopenharmony_ci
136862306a36Sopenharmony_ci#ifndef MDIO_VEND2_CTRL1_SS6
136962306a36Sopenharmony_ci#define MDIO_VEND2_CTRL1_SS6		BIT(6)
137062306a36Sopenharmony_ci#endif
137162306a36Sopenharmony_ci
137262306a36Sopenharmony_ci#ifndef MDIO_VEND2_CTRL1_SS13
137362306a36Sopenharmony_ci#define MDIO_VEND2_CTRL1_SS13		BIT(13)
137462306a36Sopenharmony_ci#endif
137562306a36Sopenharmony_ci
137662306a36Sopenharmony_ci/* MDIO mask values */
137762306a36Sopenharmony_ci#define XGBE_AN_CL73_INT_CMPLT		BIT(0)
137862306a36Sopenharmony_ci#define XGBE_AN_CL73_INC_LINK		BIT(1)
137962306a36Sopenharmony_ci#define XGBE_AN_CL73_PG_RCV		BIT(2)
138062306a36Sopenharmony_ci#define XGBE_AN_CL73_INT_MASK		0x07
138162306a36Sopenharmony_ci
138262306a36Sopenharmony_ci#define XGBE_XNP_MCF_NULL_MESSAGE	0x001
138362306a36Sopenharmony_ci#define XGBE_XNP_ACK_PROCESSED		BIT(12)
138462306a36Sopenharmony_ci#define XGBE_XNP_MP_FORMATTED		BIT(13)
138562306a36Sopenharmony_ci#define XGBE_XNP_NP_EXCHANGE		BIT(15)
138662306a36Sopenharmony_ci
138762306a36Sopenharmony_ci#define XGBE_KR_TRAINING_START		BIT(0)
138862306a36Sopenharmony_ci#define XGBE_KR_TRAINING_ENABLE		BIT(1)
138962306a36Sopenharmony_ci
139062306a36Sopenharmony_ci#define XGBE_PCS_CL37_BP		BIT(12)
139162306a36Sopenharmony_ci#define XGBE_PCS_PSEQ_STATE_MASK	0x1c
139262306a36Sopenharmony_ci#define XGBE_PCS_PSEQ_STATE_POWER_GOOD	0x10
139362306a36Sopenharmony_ci
139462306a36Sopenharmony_ci#define XGBE_AN_CL37_INT_CMPLT		BIT(0)
139562306a36Sopenharmony_ci#define XGBE_AN_CL37_INT_MASK		0x01
139662306a36Sopenharmony_ci
139762306a36Sopenharmony_ci#define XGBE_AN_CL37_HD_MASK		0x40
139862306a36Sopenharmony_ci#define XGBE_AN_CL37_FD_MASK		0x20
139962306a36Sopenharmony_ci
140062306a36Sopenharmony_ci#define XGBE_AN_CL37_PCS_MODE_MASK	0x06
140162306a36Sopenharmony_ci#define XGBE_AN_CL37_PCS_MODE_BASEX	0x00
140262306a36Sopenharmony_ci#define XGBE_AN_CL37_PCS_MODE_SGMII	0x04
140362306a36Sopenharmony_ci#define XGBE_AN_CL37_TX_CONFIG_MASK	0x08
140462306a36Sopenharmony_ci#define XGBE_AN_CL37_MII_CTRL_8BIT	0x0100
140562306a36Sopenharmony_ci
140662306a36Sopenharmony_ci#define XGBE_PMA_CDR_TRACK_EN_MASK	0x01
140762306a36Sopenharmony_ci#define XGBE_PMA_CDR_TRACK_EN_OFF	0x00
140862306a36Sopenharmony_ci#define XGBE_PMA_CDR_TRACK_EN_ON	0x01
140962306a36Sopenharmony_ci
141062306a36Sopenharmony_ci#define XGBE_PMA_RX_RST_0_MASK		BIT(4)
141162306a36Sopenharmony_ci#define XGBE_PMA_RX_RST_0_RESET_ON	0x10
141262306a36Sopenharmony_ci#define XGBE_PMA_RX_RST_0_RESET_OFF	0x00
141362306a36Sopenharmony_ci
141462306a36Sopenharmony_ci#define XGBE_PMA_RX_SIG_DET_0_MASK	BIT(4)
141562306a36Sopenharmony_ci#define XGBE_PMA_RX_SIG_DET_0_ENABLE	BIT(4)
141662306a36Sopenharmony_ci#define XGBE_PMA_RX_SIG_DET_0_DISABLE	0x0000
141762306a36Sopenharmony_ci
141862306a36Sopenharmony_ci#define XGBE_PMA_RX_VALID_0_MASK	BIT(12)
141962306a36Sopenharmony_ci#define XGBE_PMA_RX_VALID_0_ENABLE	BIT(12)
142062306a36Sopenharmony_ci#define XGBE_PMA_RX_VALID_0_DISABLE	0x0000
142162306a36Sopenharmony_ci
142262306a36Sopenharmony_ci#define XGBE_PMA_RX_AD_REQ_MASK		BIT(12)
142362306a36Sopenharmony_ci#define XGBE_PMA_RX_AD_REQ_ENABLE	BIT(12)
142462306a36Sopenharmony_ci#define XGBE_PMA_RX_AD_REQ_DISABLE	0x0000
142562306a36Sopenharmony_ci
142662306a36Sopenharmony_ci#define XGBE_PMA_RX_ADPT_ACK_MASK	BIT(12)
142762306a36Sopenharmony_ci#define XGBE_PMA_RX_ADPT_ACK		BIT(12)
142862306a36Sopenharmony_ci
142962306a36Sopenharmony_ci#define XGBE_PMA_CFF_UPDTM1_VLD		BIT(8)
143062306a36Sopenharmony_ci#define XGBE_PMA_CFF_UPDT0_VLD		BIT(9)
143162306a36Sopenharmony_ci#define XGBE_PMA_CFF_UPDT1_VLD		BIT(10)
143262306a36Sopenharmony_ci#define XGBE_PMA_CFF_UPDT_MASK		(XGBE_PMA_CFF_UPDTM1_VLD |\
143362306a36Sopenharmony_ci					 XGBE_PMA_CFF_UPDT0_VLD | \
143462306a36Sopenharmony_ci					 XGBE_PMA_CFF_UPDT1_VLD)
143562306a36Sopenharmony_ci
143662306a36Sopenharmony_ci#define XGBE_PMA_PLL_CTRL_MASK		BIT(15)
143762306a36Sopenharmony_ci#define XGBE_PMA_PLL_CTRL_ENABLE	BIT(15)
143862306a36Sopenharmony_ci#define XGBE_PMA_PLL_CTRL_DISABLE	0x0000
143962306a36Sopenharmony_ci
144062306a36Sopenharmony_ci/* Bit setting and getting macros
144162306a36Sopenharmony_ci *  The get macro will extract the current bit field value from within
144262306a36Sopenharmony_ci *  the variable
144362306a36Sopenharmony_ci *
144462306a36Sopenharmony_ci *  The set macro will clear the current bit field value within the
144562306a36Sopenharmony_ci *  variable and then set the bit field of the variable to the
144662306a36Sopenharmony_ci *  specified value
144762306a36Sopenharmony_ci */
144862306a36Sopenharmony_ci#define GET_BITS(_var, _index, _width)					\
144962306a36Sopenharmony_ci	(((_var) >> (_index)) & ((0x1 << (_width)) - 1))
145062306a36Sopenharmony_ci
145162306a36Sopenharmony_ci#define SET_BITS(_var, _index, _width, _val)				\
145262306a36Sopenharmony_cido {									\
145362306a36Sopenharmony_ci	(_var) &= ~(((0x1 << (_width)) - 1) << (_index));		\
145462306a36Sopenharmony_ci	(_var) |= (((_val) & ((0x1 << (_width)) - 1)) << (_index));	\
145562306a36Sopenharmony_ci} while (0)
145662306a36Sopenharmony_ci
145762306a36Sopenharmony_ci#define GET_BITS_LE(_var, _index, _width)				\
145862306a36Sopenharmony_ci	((le32_to_cpu((_var)) >> (_index)) & ((0x1 << (_width)) - 1))
145962306a36Sopenharmony_ci
146062306a36Sopenharmony_ci#define SET_BITS_LE(_var, _index, _width, _val)				\
146162306a36Sopenharmony_cido {									\
146262306a36Sopenharmony_ci	(_var) &= cpu_to_le32(~(((0x1 << (_width)) - 1) << (_index)));	\
146362306a36Sopenharmony_ci	(_var) |= cpu_to_le32((((_val) &				\
146462306a36Sopenharmony_ci			      ((0x1 << (_width)) - 1)) << (_index)));	\
146562306a36Sopenharmony_ci} while (0)
146662306a36Sopenharmony_ci
146762306a36Sopenharmony_ci/* Bit setting and getting macros based on register fields
146862306a36Sopenharmony_ci *  The get macro uses the bit field definitions formed using the input
146962306a36Sopenharmony_ci *  names to extract the current bit field value from within the
147062306a36Sopenharmony_ci *  variable
147162306a36Sopenharmony_ci *
147262306a36Sopenharmony_ci *  The set macro uses the bit field definitions formed using the input
147362306a36Sopenharmony_ci *  names to set the bit field of the variable to the specified value
147462306a36Sopenharmony_ci */
147562306a36Sopenharmony_ci#define XGMAC_GET_BITS(_var, _prefix, _field)				\
147662306a36Sopenharmony_ci	GET_BITS((_var),						\
147762306a36Sopenharmony_ci		 _prefix##_##_field##_INDEX,				\
147862306a36Sopenharmony_ci		 _prefix##_##_field##_WIDTH)
147962306a36Sopenharmony_ci
148062306a36Sopenharmony_ci#define XGMAC_SET_BITS(_var, _prefix, _field, _val)			\
148162306a36Sopenharmony_ci	SET_BITS((_var),						\
148262306a36Sopenharmony_ci		 _prefix##_##_field##_INDEX,				\
148362306a36Sopenharmony_ci		 _prefix##_##_field##_WIDTH, (_val))
148462306a36Sopenharmony_ci
148562306a36Sopenharmony_ci#define XGMAC_GET_BITS_LE(_var, _prefix, _field)			\
148662306a36Sopenharmony_ci	GET_BITS_LE((_var),						\
148762306a36Sopenharmony_ci		 _prefix##_##_field##_INDEX,				\
148862306a36Sopenharmony_ci		 _prefix##_##_field##_WIDTH)
148962306a36Sopenharmony_ci
149062306a36Sopenharmony_ci#define XGMAC_SET_BITS_LE(_var, _prefix, _field, _val)			\
149162306a36Sopenharmony_ci	SET_BITS_LE((_var),						\
149262306a36Sopenharmony_ci		 _prefix##_##_field##_INDEX,				\
149362306a36Sopenharmony_ci		 _prefix##_##_field##_WIDTH, (_val))
149462306a36Sopenharmony_ci
149562306a36Sopenharmony_ci/* Macros for reading or writing registers
149662306a36Sopenharmony_ci *  The ioread macros will get bit fields or full values using the
149762306a36Sopenharmony_ci *  register definitions formed using the input names
149862306a36Sopenharmony_ci *
149962306a36Sopenharmony_ci *  The iowrite macros will set bit fields or full values using the
150062306a36Sopenharmony_ci *  register definitions formed using the input names
150162306a36Sopenharmony_ci */
150262306a36Sopenharmony_ci#define XGMAC_IOREAD(_pdata, _reg)					\
150362306a36Sopenharmony_ci	ioread32((_pdata)->xgmac_regs + _reg)
150462306a36Sopenharmony_ci
150562306a36Sopenharmony_ci#define XGMAC_IOREAD_BITS(_pdata, _reg, _field)				\
150662306a36Sopenharmony_ci	GET_BITS(XGMAC_IOREAD((_pdata), _reg),				\
150762306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
150862306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH)
150962306a36Sopenharmony_ci
151062306a36Sopenharmony_ci#define XGMAC_IOWRITE(_pdata, _reg, _val)				\
151162306a36Sopenharmony_ci	iowrite32((_val), (_pdata)->xgmac_regs + _reg)
151262306a36Sopenharmony_ci
151362306a36Sopenharmony_ci#define XGMAC_IOWRITE_BITS(_pdata, _reg, _field, _val)			\
151462306a36Sopenharmony_cido {									\
151562306a36Sopenharmony_ci	u32 reg_val = XGMAC_IOREAD((_pdata), _reg);			\
151662306a36Sopenharmony_ci	SET_BITS(reg_val,						\
151762306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
151862306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH, (_val));			\
151962306a36Sopenharmony_ci	XGMAC_IOWRITE((_pdata), _reg, reg_val);				\
152062306a36Sopenharmony_ci} while (0)
152162306a36Sopenharmony_ci
152262306a36Sopenharmony_ci/* Macros for reading or writing MTL queue or traffic class registers
152362306a36Sopenharmony_ci *  Similar to the standard read and write macros except that the
152462306a36Sopenharmony_ci *  base register value is calculated by the queue or traffic class number
152562306a36Sopenharmony_ci */
152662306a36Sopenharmony_ci#define XGMAC_MTL_IOREAD(_pdata, _n, _reg)				\
152762306a36Sopenharmony_ci	ioread32((_pdata)->xgmac_regs +					\
152862306a36Sopenharmony_ci		 MTL_Q_BASE + ((_n) * MTL_Q_INC) + _reg)
152962306a36Sopenharmony_ci
153062306a36Sopenharmony_ci#define XGMAC_MTL_IOREAD_BITS(_pdata, _n, _reg, _field)			\
153162306a36Sopenharmony_ci	GET_BITS(XGMAC_MTL_IOREAD((_pdata), (_n), _reg),		\
153262306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
153362306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH)
153462306a36Sopenharmony_ci
153562306a36Sopenharmony_ci#define XGMAC_MTL_IOWRITE(_pdata, _n, _reg, _val)			\
153662306a36Sopenharmony_ci	iowrite32((_val), (_pdata)->xgmac_regs +			\
153762306a36Sopenharmony_ci		  MTL_Q_BASE + ((_n) * MTL_Q_INC) + _reg)
153862306a36Sopenharmony_ci
153962306a36Sopenharmony_ci#define XGMAC_MTL_IOWRITE_BITS(_pdata, _n, _reg, _field, _val)		\
154062306a36Sopenharmony_cido {									\
154162306a36Sopenharmony_ci	u32 reg_val = XGMAC_MTL_IOREAD((_pdata), (_n), _reg);		\
154262306a36Sopenharmony_ci	SET_BITS(reg_val,						\
154362306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
154462306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH, (_val));			\
154562306a36Sopenharmony_ci	XGMAC_MTL_IOWRITE((_pdata), (_n), _reg, reg_val);		\
154662306a36Sopenharmony_ci} while (0)
154762306a36Sopenharmony_ci
154862306a36Sopenharmony_ci/* Macros for reading or writing DMA channel registers
154962306a36Sopenharmony_ci *  Similar to the standard read and write macros except that the
155062306a36Sopenharmony_ci *  base register value is obtained from the ring
155162306a36Sopenharmony_ci */
155262306a36Sopenharmony_ci#define XGMAC_DMA_IOREAD(_channel, _reg)				\
155362306a36Sopenharmony_ci	ioread32((_channel)->dma_regs + _reg)
155462306a36Sopenharmony_ci
155562306a36Sopenharmony_ci#define XGMAC_DMA_IOREAD_BITS(_channel, _reg, _field)			\
155662306a36Sopenharmony_ci	GET_BITS(XGMAC_DMA_IOREAD((_channel), _reg),			\
155762306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
155862306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH)
155962306a36Sopenharmony_ci
156062306a36Sopenharmony_ci#define XGMAC_DMA_IOWRITE(_channel, _reg, _val)				\
156162306a36Sopenharmony_ci	iowrite32((_val), (_channel)->dma_regs + _reg)
156262306a36Sopenharmony_ci
156362306a36Sopenharmony_ci#define XGMAC_DMA_IOWRITE_BITS(_channel, _reg, _field, _val)		\
156462306a36Sopenharmony_cido {									\
156562306a36Sopenharmony_ci	u32 reg_val = XGMAC_DMA_IOREAD((_channel), _reg);		\
156662306a36Sopenharmony_ci	SET_BITS(reg_val,						\
156762306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
156862306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH, (_val));			\
156962306a36Sopenharmony_ci	XGMAC_DMA_IOWRITE((_channel), _reg, reg_val);			\
157062306a36Sopenharmony_ci} while (0)
157162306a36Sopenharmony_ci
157262306a36Sopenharmony_ci/* Macros for building, reading or writing register values or bits
157362306a36Sopenharmony_ci * within the register values of XPCS registers.
157462306a36Sopenharmony_ci */
157562306a36Sopenharmony_ci#define XPCS_GET_BITS(_var, _prefix, _field)				\
157662306a36Sopenharmony_ci	GET_BITS((_var),                                                \
157762306a36Sopenharmony_ci		 _prefix##_##_field##_INDEX,                            \
157862306a36Sopenharmony_ci		 _prefix##_##_field##_WIDTH)
157962306a36Sopenharmony_ci
158062306a36Sopenharmony_ci#define XPCS_SET_BITS(_var, _prefix, _field, _val)                      \
158162306a36Sopenharmony_ci	SET_BITS((_var),                                                \
158262306a36Sopenharmony_ci		 _prefix##_##_field##_INDEX,                            \
158362306a36Sopenharmony_ci		 _prefix##_##_field##_WIDTH, (_val))
158462306a36Sopenharmony_ci
158562306a36Sopenharmony_ci#define XPCS32_IOWRITE(_pdata, _off, _val)				\
158662306a36Sopenharmony_ci	iowrite32(_val, (_pdata)->xpcs_regs + (_off))
158762306a36Sopenharmony_ci
158862306a36Sopenharmony_ci#define XPCS32_IOREAD(_pdata, _off)					\
158962306a36Sopenharmony_ci	ioread32((_pdata)->xpcs_regs + (_off))
159062306a36Sopenharmony_ci
159162306a36Sopenharmony_ci#define XPCS16_IOWRITE(_pdata, _off, _val)				\
159262306a36Sopenharmony_ci	iowrite16(_val, (_pdata)->xpcs_regs + (_off))
159362306a36Sopenharmony_ci
159462306a36Sopenharmony_ci#define XPCS16_IOREAD(_pdata, _off)					\
159562306a36Sopenharmony_ci	ioread16((_pdata)->xpcs_regs + (_off))
159662306a36Sopenharmony_ci
159762306a36Sopenharmony_ci/* Macros for building, reading or writing register values or bits
159862306a36Sopenharmony_ci * within the register values of SerDes integration registers.
159962306a36Sopenharmony_ci */
160062306a36Sopenharmony_ci#define XSIR_GET_BITS(_var, _prefix, _field)                            \
160162306a36Sopenharmony_ci	GET_BITS((_var),                                                \
160262306a36Sopenharmony_ci		 _prefix##_##_field##_INDEX,                            \
160362306a36Sopenharmony_ci		 _prefix##_##_field##_WIDTH)
160462306a36Sopenharmony_ci
160562306a36Sopenharmony_ci#define XSIR_SET_BITS(_var, _prefix, _field, _val)                      \
160662306a36Sopenharmony_ci	SET_BITS((_var),                                                \
160762306a36Sopenharmony_ci		 _prefix##_##_field##_INDEX,                            \
160862306a36Sopenharmony_ci		 _prefix##_##_field##_WIDTH, (_val))
160962306a36Sopenharmony_ci
161062306a36Sopenharmony_ci#define XSIR0_IOREAD(_pdata, _reg)					\
161162306a36Sopenharmony_ci	ioread16((_pdata)->sir0_regs + _reg)
161262306a36Sopenharmony_ci
161362306a36Sopenharmony_ci#define XSIR0_IOREAD_BITS(_pdata, _reg, _field)				\
161462306a36Sopenharmony_ci	GET_BITS(XSIR0_IOREAD((_pdata), _reg),				\
161562306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
161662306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH)
161762306a36Sopenharmony_ci
161862306a36Sopenharmony_ci#define XSIR0_IOWRITE(_pdata, _reg, _val)				\
161962306a36Sopenharmony_ci	iowrite16((_val), (_pdata)->sir0_regs + _reg)
162062306a36Sopenharmony_ci
162162306a36Sopenharmony_ci#define XSIR0_IOWRITE_BITS(_pdata, _reg, _field, _val)			\
162262306a36Sopenharmony_cido {									\
162362306a36Sopenharmony_ci	u16 reg_val = XSIR0_IOREAD((_pdata), _reg);			\
162462306a36Sopenharmony_ci	SET_BITS(reg_val,						\
162562306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
162662306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH, (_val));			\
162762306a36Sopenharmony_ci	XSIR0_IOWRITE((_pdata), _reg, reg_val);				\
162862306a36Sopenharmony_ci} while (0)
162962306a36Sopenharmony_ci
163062306a36Sopenharmony_ci#define XSIR1_IOREAD(_pdata, _reg)					\
163162306a36Sopenharmony_ci	ioread16((_pdata)->sir1_regs + _reg)
163262306a36Sopenharmony_ci
163362306a36Sopenharmony_ci#define XSIR1_IOREAD_BITS(_pdata, _reg, _field)				\
163462306a36Sopenharmony_ci	GET_BITS(XSIR1_IOREAD((_pdata), _reg),				\
163562306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
163662306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH)
163762306a36Sopenharmony_ci
163862306a36Sopenharmony_ci#define XSIR1_IOWRITE(_pdata, _reg, _val)				\
163962306a36Sopenharmony_ci	iowrite16((_val), (_pdata)->sir1_regs + _reg)
164062306a36Sopenharmony_ci
164162306a36Sopenharmony_ci#define XSIR1_IOWRITE_BITS(_pdata, _reg, _field, _val)			\
164262306a36Sopenharmony_cido {									\
164362306a36Sopenharmony_ci	u16 reg_val = XSIR1_IOREAD((_pdata), _reg);			\
164462306a36Sopenharmony_ci	SET_BITS(reg_val,						\
164562306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
164662306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH, (_val));			\
164762306a36Sopenharmony_ci	XSIR1_IOWRITE((_pdata), _reg, reg_val);				\
164862306a36Sopenharmony_ci} while (0)
164962306a36Sopenharmony_ci
165062306a36Sopenharmony_ci/* Macros for building, reading or writing register values or bits
165162306a36Sopenharmony_ci * within the register values of SerDes RxTx registers.
165262306a36Sopenharmony_ci */
165362306a36Sopenharmony_ci#define XRXTX_IOREAD(_pdata, _reg)					\
165462306a36Sopenharmony_ci	ioread16((_pdata)->rxtx_regs + _reg)
165562306a36Sopenharmony_ci
165662306a36Sopenharmony_ci#define XRXTX_IOREAD_BITS(_pdata, _reg, _field)				\
165762306a36Sopenharmony_ci	GET_BITS(XRXTX_IOREAD((_pdata), _reg),				\
165862306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
165962306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH)
166062306a36Sopenharmony_ci
166162306a36Sopenharmony_ci#define XRXTX_IOWRITE(_pdata, _reg, _val)				\
166262306a36Sopenharmony_ci	iowrite16((_val), (_pdata)->rxtx_regs + _reg)
166362306a36Sopenharmony_ci
166462306a36Sopenharmony_ci#define XRXTX_IOWRITE_BITS(_pdata, _reg, _field, _val)			\
166562306a36Sopenharmony_cido {									\
166662306a36Sopenharmony_ci	u16 reg_val = XRXTX_IOREAD((_pdata), _reg);			\
166762306a36Sopenharmony_ci	SET_BITS(reg_val,						\
166862306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
166962306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH, (_val));			\
167062306a36Sopenharmony_ci	XRXTX_IOWRITE((_pdata), _reg, reg_val);				\
167162306a36Sopenharmony_ci} while (0)
167262306a36Sopenharmony_ci
167362306a36Sopenharmony_ci/* Macros for building, reading or writing register values or bits
167462306a36Sopenharmony_ci * within the register values of MAC Control registers.
167562306a36Sopenharmony_ci */
167662306a36Sopenharmony_ci#define XP_GET_BITS(_var, _prefix, _field)				\
167762306a36Sopenharmony_ci	GET_BITS((_var),						\
167862306a36Sopenharmony_ci		 _prefix##_##_field##_INDEX,				\
167962306a36Sopenharmony_ci		 _prefix##_##_field##_WIDTH)
168062306a36Sopenharmony_ci
168162306a36Sopenharmony_ci#define XP_SET_BITS(_var, _prefix, _field, _val)			\
168262306a36Sopenharmony_ci	SET_BITS((_var),						\
168362306a36Sopenharmony_ci		 _prefix##_##_field##_INDEX,				\
168462306a36Sopenharmony_ci		 _prefix##_##_field##_WIDTH, (_val))
168562306a36Sopenharmony_ci
168662306a36Sopenharmony_ci#define XP_IOREAD(_pdata, _reg)						\
168762306a36Sopenharmony_ci	ioread32((_pdata)->xprop_regs + (_reg))
168862306a36Sopenharmony_ci
168962306a36Sopenharmony_ci#define XP_IOREAD_BITS(_pdata, _reg, _field)				\
169062306a36Sopenharmony_ci	GET_BITS(XP_IOREAD((_pdata), (_reg)),				\
169162306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
169262306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH)
169362306a36Sopenharmony_ci
169462306a36Sopenharmony_ci#define XP_IOWRITE(_pdata, _reg, _val)					\
169562306a36Sopenharmony_ci	iowrite32((_val), (_pdata)->xprop_regs + (_reg))
169662306a36Sopenharmony_ci
169762306a36Sopenharmony_ci#define XP_IOWRITE_BITS(_pdata, _reg, _field, _val)			\
169862306a36Sopenharmony_cido {									\
169962306a36Sopenharmony_ci	u32 reg_val = XP_IOREAD((_pdata), (_reg));			\
170062306a36Sopenharmony_ci	SET_BITS(reg_val,						\
170162306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
170262306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH, (_val));			\
170362306a36Sopenharmony_ci	XP_IOWRITE((_pdata), (_reg), reg_val);				\
170462306a36Sopenharmony_ci} while (0)
170562306a36Sopenharmony_ci
170662306a36Sopenharmony_ci/* Macros for building, reading or writing register values or bits
170762306a36Sopenharmony_ci * within the register values of I2C Control registers.
170862306a36Sopenharmony_ci */
170962306a36Sopenharmony_ci#define XI2C_GET_BITS(_var, _prefix, _field)				\
171062306a36Sopenharmony_ci	GET_BITS((_var),						\
171162306a36Sopenharmony_ci		 _prefix##_##_field##_INDEX,				\
171262306a36Sopenharmony_ci		 _prefix##_##_field##_WIDTH)
171362306a36Sopenharmony_ci
171462306a36Sopenharmony_ci#define XI2C_SET_BITS(_var, _prefix, _field, _val)			\
171562306a36Sopenharmony_ci	SET_BITS((_var),						\
171662306a36Sopenharmony_ci		 _prefix##_##_field##_INDEX,				\
171762306a36Sopenharmony_ci		 _prefix##_##_field##_WIDTH, (_val))
171862306a36Sopenharmony_ci
171962306a36Sopenharmony_ci#define XI2C_IOREAD(_pdata, _reg)					\
172062306a36Sopenharmony_ci	ioread32((_pdata)->xi2c_regs + (_reg))
172162306a36Sopenharmony_ci
172262306a36Sopenharmony_ci#define XI2C_IOREAD_BITS(_pdata, _reg, _field)				\
172362306a36Sopenharmony_ci	GET_BITS(XI2C_IOREAD((_pdata), (_reg)),				\
172462306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
172562306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH)
172662306a36Sopenharmony_ci
172762306a36Sopenharmony_ci#define XI2C_IOWRITE(_pdata, _reg, _val)				\
172862306a36Sopenharmony_ci	iowrite32((_val), (_pdata)->xi2c_regs + (_reg))
172962306a36Sopenharmony_ci
173062306a36Sopenharmony_ci#define XI2C_IOWRITE_BITS(_pdata, _reg, _field, _val)			\
173162306a36Sopenharmony_cido {									\
173262306a36Sopenharmony_ci	u32 reg_val = XI2C_IOREAD((_pdata), (_reg));			\
173362306a36Sopenharmony_ci	SET_BITS(reg_val,						\
173462306a36Sopenharmony_ci		 _reg##_##_field##_INDEX,				\
173562306a36Sopenharmony_ci		 _reg##_##_field##_WIDTH, (_val));			\
173662306a36Sopenharmony_ci	XI2C_IOWRITE((_pdata), (_reg), reg_val);			\
173762306a36Sopenharmony_ci} while (0)
173862306a36Sopenharmony_ci
173962306a36Sopenharmony_ci/* Macros for building, reading or writing register values or bits
174062306a36Sopenharmony_ci * using MDIO.
174162306a36Sopenharmony_ci */
174262306a36Sopenharmony_ci
174362306a36Sopenharmony_ci#define XGBE_ADDR_C45 BIT(30)
174462306a36Sopenharmony_ci
174562306a36Sopenharmony_ci#define XMDIO_READ(_pdata, _mmd, _reg)					\
174662306a36Sopenharmony_ci	((_pdata)->hw_if.read_mmd_regs((_pdata), 0,			\
174762306a36Sopenharmony_ci		XGBE_ADDR_C45 | (_mmd << 16) | ((_reg) & 0xffff)))
174862306a36Sopenharmony_ci
174962306a36Sopenharmony_ci#define XMDIO_READ_BITS(_pdata, _mmd, _reg, _mask)			\
175062306a36Sopenharmony_ci	(XMDIO_READ((_pdata), _mmd, _reg) & _mask)
175162306a36Sopenharmony_ci
175262306a36Sopenharmony_ci#define XMDIO_WRITE(_pdata, _mmd, _reg, _val)				\
175362306a36Sopenharmony_ci	((_pdata)->hw_if.write_mmd_regs((_pdata), 0,			\
175462306a36Sopenharmony_ci		XGBE_ADDR_C45 | (_mmd << 16) | ((_reg) & 0xffff), (_val)))
175562306a36Sopenharmony_ci
175662306a36Sopenharmony_ci#define XMDIO_WRITE_BITS(_pdata, _mmd, _reg, _mask, _val)		\
175762306a36Sopenharmony_cido {									\
175862306a36Sopenharmony_ci	u32 mmd_val = XMDIO_READ((_pdata), _mmd, _reg);			\
175962306a36Sopenharmony_ci	mmd_val &= ~_mask;						\
176062306a36Sopenharmony_ci	mmd_val |= (_val);						\
176162306a36Sopenharmony_ci	XMDIO_WRITE((_pdata), _mmd, _reg, mmd_val);			\
176262306a36Sopenharmony_ci} while (0)
176362306a36Sopenharmony_ci
176462306a36Sopenharmony_ci#endif
1765