1c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/*
2c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * AMD 10Gb Ethernet driver
3c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
4c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * This file is available to you under your choice of the following two
5c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * licenses:
6c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
7c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * License 1: GPLv2
8c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
9c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * Copyright (c) 2014 Advanced Micro Devices, Inc.
10c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
11c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * This file is free software; you may copy, redistribute and/or modify
12c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * it under the terms of the GNU General Public License as published by
13c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * the Free Software Foundation, either version 2 of the License, or (at
14c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * your option) any later version.
15c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
16c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * This file is distributed in the hope that it will be useful, but
17c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * WITHOUT ANY WARRANTY; without even the implied warranty of
18c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * General Public License for more details.
20c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
21c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * You should have received a copy of the GNU General Public License
22c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
24c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * This file incorporates work covered by the following copyright and
25c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * permission notice:
26c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     The Synopsys DWC ETHER XGMAC Software Driver and documentation
27c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     (hereinafter "Software") is an unsupported proprietary work of Synopsys,
28c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     Inc. unless otherwise expressly agreed to in writing between Synopsys
29c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     and you.
30c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
31c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     The Software IS NOT an item of Licensed Software or Licensed Product
32c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     under any End User Software License Agreement or Agreement for Licensed
33c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     Product with Synopsys or any supplement thereto.  Permission is hereby
34c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     granted, free of charge, to any person obtaining a copy of this software
35c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     annotated with this license and the Software, to deal in the Software
36c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     without restriction, including without limitation the rights to use,
37c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     copy, modify, merge, publish, distribute, sublicense, and/or sell copies
38c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     of the Software, and to permit persons to whom the Software is furnished
39c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     to do so, subject to the following conditions:
40c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
41c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     The above copyright notice and this permission notice shall be included
42c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     in all copies or substantial portions of the Software.
43c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
44c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
45c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
46c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
47c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
48c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
49c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
50c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
51c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
52c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
54c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     THE POSSIBILITY OF SUCH DAMAGE.
55c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
56c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
57c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * License 2: Modified BSD
58c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
59c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * Copyright (c) 2014 Advanced Micro Devices, Inc.
60c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * All rights reserved.
61c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
62c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * Redistribution and use in source and binary forms, with or without
63c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * modification, are permitted provided that the following conditions are met:
64c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     * Redistributions of source code must retain the above copyright
65c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *       notice, this list of conditions and the following disclaimer.
66c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     * Redistributions in binary form must reproduce the above copyright
67c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *       notice, this list of conditions and the following disclaimer in the
68c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *       documentation and/or other materials provided with the distribution.
69c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     * Neither the name of Advanced Micro Devices, Inc. nor the
70c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *       names of its contributors may be used to endorse or promote products
71c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *       derived from this software without specific prior written permission.
72c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
73c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
74c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
75c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
76c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
77c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
78c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
79c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
80c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
81c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
82c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
83c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
84c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * This file incorporates work covered by the following copyright and
85c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * permission notice:
86c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     The Synopsys DWC ETHER XGMAC Software Driver and documentation
87c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     (hereinafter "Software") is an unsupported proprietary work of Synopsys,
88c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     Inc. unless otherwise expressly agreed to in writing between Synopsys
89c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     and you.
90c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
91c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     The Software IS NOT an item of Licensed Software or Licensed Product
92c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     under any End User Software License Agreement or Agreement for Licensed
93c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     Product with Synopsys or any supplement thereto.  Permission is hereby
94c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     granted, free of charge, to any person obtaining a copy of this software
95c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     annotated with this license and the Software, to deal in the Software
96c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     without restriction, including without limitation the rights to use,
97c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     copy, modify, merge, publish, distribute, sublicense, and/or sell copies
98c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     of the Software, and to permit persons to whom the Software is furnished
99c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     to do so, subject to the following conditions:
100c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
101c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     The above copyright notice and this permission notice shall be included
102c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     in all copies or substantial portions of the Software.
103c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *
104c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
105c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
106c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
107c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
108c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
109c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
110c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
111c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
112c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
113c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
114c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *     THE POSSIBILITY OF SUCH DAMAGE.
115c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas */
116c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
117c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#ifndef __XGBE_H__
118c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define __XGBE_H__
119c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
120c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#include <linux/dma-mapping.h>
121c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#include <linux/netdevice.h>
122c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#include <linux/workqueue.h>
123c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#include <linux/phy.h>
124801c62d945c6121c0262924732e430f0553bfb37Lendacky, Thomas#include <linux/if_vlan.h>
125801c62d945c6121c0262924732e430f0553bfb37Lendacky, Thomas#include <linux/bitops.h>
12623e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas#include <linux/ptp_clock_kernel.h>
12723e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas#include <linux/clocksource.h>
12823e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas#include <linux/net_tstamp.h>
129fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas#include <net/dcbnl.h>
130c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
131c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGBE_DRV_NAME		"amd-xgbe"
132c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGBE_DRV_VERSION	"1.0.0-a"
133c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGBE_DRV_DESC		"AMD 10 Gigabit Ethernet Driver"
134c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
135c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* Descriptor related defines */
136d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas#define XGBE_TX_DESC_CNT	512
137d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas#define XGBE_TX_DESC_MIN_FREE	(XGBE_TX_DESC_CNT >> 3)
138d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas#define XGBE_TX_DESC_MAX_PROC	(XGBE_TX_DESC_CNT >> 1)
139d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas#define XGBE_RX_DESC_CNT	512
140c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
141d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas#define XGBE_TX_MAX_BUF_SIZE	(0x3fff & ~(64 - 1))
142c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
143d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas#define XGBE_RX_MIN_BUF_SIZE	(ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN)
144d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas#define XGBE_RX_BUF_ALIGN	64
145c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
146d5c4858237fe43c30714f4447ccec87d5fb3fcdeLendacky, Thomas#define XGBE_MAX_DMA_CHANNELS	16
147fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas#define XGBE_MAX_QUEUES		16
148d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas
149d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas/* DMA cache settings - Outer sharable, write-back, write-allocate */
150cfa50c7811fe3857fd882be96b2b2f130fa5da6dLendacky, Thomas#define XGBE_DMA_OS_AXDOMAIN	0x2
151cfa50c7811fe3857fd882be96b2b2f130fa5da6dLendacky, Thomas#define XGBE_DMA_OS_ARCACHE	0xb
152cfa50c7811fe3857fd882be96b2b2f130fa5da6dLendacky, Thomas#define XGBE_DMA_OS_AWCACHE	0xf
153cfa50c7811fe3857fd882be96b2b2f130fa5da6dLendacky, Thomas
154cfa50c7811fe3857fd882be96b2b2f130fa5da6dLendacky, Thomas/* DMA cache settings - System, no caches used */
155cfa50c7811fe3857fd882be96b2b2f130fa5da6dLendacky, Thomas#define XGBE_DMA_SYS_AXDOMAIN	0x3
156cfa50c7811fe3857fd882be96b2b2f130fa5da6dLendacky, Thomas#define XGBE_DMA_SYS_ARCACHE	0x0
157cfa50c7811fe3857fd882be96b2b2f130fa5da6dLendacky, Thomas#define XGBE_DMA_SYS_AWCACHE	0x0
158d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas
159d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas#define XGBE_DMA_INTERRUPT_MASK	0x31c7
160c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
161c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGMAC_MIN_PACKET	60
162c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGMAC_STD_PACKET_MTU	1500
163c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGMAC_MAX_STD_PACKET	1518
164c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGMAC_JUMBO_PACKET_MTU	9000
165c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGMAC_MAX_JUMBO_PACKET	9018
166c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
167c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* MDIO bus phy name */
168c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGBE_PHY_NAME		"amd_xgbe_phy"
169c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGBE_PRTAD		0
170c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
17123e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas/* Device-tree clock names */
17223e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas#define XGBE_DMA_CLOCK		"dma_clk"
17323e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas#define XGBE_PTP_CLOCK		"ptp_clk"
17423e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas
17523e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas/* Timestamp support - values based on 50MHz PTP clock
17623e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas *   50MHz => 20 nsec
17723e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas */
17823e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas#define XGBE_TSTAMP_SSINC	20
17923e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas#define XGBE_TSTAMP_SNSINC	0
18023e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas
181c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* Driver PMT macros */
182c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGMAC_DRIVER_CONTEXT	1
183c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGMAC_IOCTL_CONTEXT	2
184c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
185f076f453729bb7dd63a798743ee11dea039c7df3Lendacky, Thomas#define XGBE_FIFO_MAX		81920
186d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas#define XGBE_FIFO_SIZE_B(x)	(x)
187d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas#define XGBE_FIFO_SIZE_KB(x)	(x * 1024)
188c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
189fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas#define XGBE_TC_MIN_QUANTUM	10
190c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
191c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* Helper macro for descriptor handling
192d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas *  Always use XGBE_GET_DESC_DATA to access the descriptor data
193c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *  since the index is free-running and needs to be and-ed
194c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *  with the descriptor count value of the ring to index to
195c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas *  the proper descriptor data.
196c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas */
197d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas#define XGBE_GET_DESC_DATA(_ring, _idx)				\
198c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	((_ring)->rdata +					\
199c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	 ((_idx) & ((_ring)->rdesc_count - 1)))
200c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
201c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* Default coalescing parameters */
2029867e8fb2c45888cc594457914dcbba599f086c8Lendacky, Thomas#define XGMAC_INIT_DMA_TX_USECS		50
2039867e8fb2c45888cc594457914dcbba599f086c8Lendacky, Thomas#define XGMAC_INIT_DMA_TX_FRAMES	25
204c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
205c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGMAC_MAX_DMA_RIWT		0xff
2069867e8fb2c45888cc594457914dcbba599f086c8Lendacky, Thomas#define XGMAC_INIT_DMA_RX_USECS		30
2079867e8fb2c45888cc594457914dcbba599f086c8Lendacky, Thomas#define XGMAC_INIT_DMA_RX_FRAMES	25
208c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
209c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* Flow control queue count */
210c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGMAC_MAX_FLOW_CONTROL_QUEUES	8
211c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
212b85e4d8960f10e4b28613a3e7b76f8889a2089e3Lendacky, Thomas/* Maximum MAC address hash table size (256 bits = 8 bytes) */
213b85e4d8960f10e4b28613a3e7b76f8889a2089e3Lendacky, Thomas#define XGBE_MAC_HASH_TABLE_SIZE	8
214c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
215c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstruct xgbe_prv_data;
216c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
217c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstruct xgbe_packet_data {
218c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int attributes;
219c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
220c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int errors;
221c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
222c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rdesc_count;
223c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int length;
224c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
225c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int header_len;
226c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tcp_header_len;
227c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tcp_payload_len;
228c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned short mss;
229c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
230c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned short vlan_ctag;
23123e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas
23223e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	u64 rx_tstamp;
233c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas};
234c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
235c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* Common Rx and Tx descriptor mapping */
236c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstruct xgbe_ring_desc {
237c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int desc0;
238c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int desc1;
239c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int desc2;
240c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int desc3;
241c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas};
242c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
243c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* Structure used to hold information related to the descriptor
244c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * and the packet associated with the descriptor (always use
245d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas * use the XGBE_GET_DESC_DATA macro to access this data from the ring)
246c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas */
247c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstruct xgbe_ring_data {
248c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct xgbe_ring_desc *rdesc;	/* Virtual address of descriptor */
249c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	dma_addr_t rdesc_dma;		/* DMA address of descriptor */
250c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
251c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct sk_buff *skb;		/* Virtual address of SKB */
252c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	dma_addr_t skb_dma;		/* DMA address of SKB data */
253c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int skb_dma_len;	/* Length of SKB DMA area */
254c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tso_header;        /* TSO header indicator */
255c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
256c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned short len;		/* Length of received Rx packet */
257c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
258c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int interrupt;		/* Interrupt indicator */
259c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
260c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int mapped_as_page;
26123e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas
26223e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	/* Incomplete receive save location.  If the budget is exhausted
26323e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	 * or the last descriptor (last normal descriptor or a following
26423e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	 * context descriptor) has not been DMA'd yet the current state
26523e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	 * of the receive processing needs to be saved.
26623e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	 */
26723e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	unsigned int state_saved;
26823e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	struct {
26923e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas		unsigned int incomplete;
27023e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas		unsigned int context_next;
27123e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas		struct sk_buff *skb;
27223e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas		unsigned int len;
27323e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas		unsigned int error;
27423e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	} state;
275c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas};
276c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
277c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstruct xgbe_ring {
278c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Ring lock - used just for TX rings at the moment */
279c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	spinlock_t lock;
280c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
281c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Per packet related information */
282c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct xgbe_packet_data packet_data;
283c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
284c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Virtual/DMA addresses and count of allocated descriptor memory */
285c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct xgbe_ring_desc *rdesc;
286c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	dma_addr_t rdesc_dma;
287c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rdesc_count;
288c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
289c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Array of descriptor data corresponding the descriptor memory
290d0a8ba6cba0a05ce79df100a3d99502b94117d88Lendacky, Thomas	 * (always use the XGBE_GET_DESC_DATA macro to access this data)
291c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	 */
292c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct xgbe_ring_data *rdata;
293c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
294c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Ring index values
295c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	 *  cur   - Tx: index of descriptor to be used for current transfer
296c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	 *          Rx: index of descriptor to check for packet availability
297c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	 *  dirty - Tx: index of descriptor to check for transfer complete
298c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	 *          Rx: count of descriptors in which a packet has been received
299c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	 *              (used with skb_realloc_index to refresh the ring)
300c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	 */
301c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int cur;
302c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int dirty;
303c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
304c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Coalesce frame count used for interrupt bit setting */
305c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int coalesce_count;
306c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
307c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	union {
308c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas		struct {
309c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas			unsigned int queue_stopped;
310c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas			unsigned short cur_mss;
311c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas			unsigned short cur_vlan_ctag;
312c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas		} tx;
313c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
314c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas		struct {
315c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas			unsigned int realloc_index;
316c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas			unsigned int realloc_threshold;
317c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas		} rx;
318c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	};
319c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas} ____cacheline_aligned;
320c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
321c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* Structure used to describe the descriptor rings associated with
322c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * a DMA channel.
323c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas */
324c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstruct xgbe_channel {
325c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	char name[16];
326c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
327c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Address of private data area for device */
328c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct xgbe_prv_data *pdata;
329c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
330c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Queue index and base address of queue's DMA registers */
331c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int queue_index;
332c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void __iomem *dma_regs;
333c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
334c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int saved_ier;
335c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
336c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tx_timer_active;
337c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct hrtimer tx_timer;
338c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
339c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct xgbe_ring *tx_ring;
340c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct xgbe_ring *rx_ring;
341c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas} ____cacheline_aligned;
342c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
343c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasenum xgbe_int {
344c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_INT_DMA_CH_SR_TI,
345c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_INT_DMA_CH_SR_TPS,
346c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_INT_DMA_CH_SR_TBU,
347c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_INT_DMA_CH_SR_RI,
348c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_INT_DMA_CH_SR_RBU,
349c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_INT_DMA_CH_SR_RPS,
3509867e8fb2c45888cc594457914dcbba599f086c8Lendacky, Thomas	XGMAC_INT_DMA_CH_SR_TI_RI,
351c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_INT_DMA_CH_SR_FBE,
352c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_INT_DMA_ALL,
353c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas};
354c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
355c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasenum xgbe_int_state {
356c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_INT_STATE_SAVE,
357c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_INT_STATE_RESTORE,
358c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas};
359c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
360c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasenum xgbe_mtl_fifo_size {
361c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_MTL_FIFO_SIZE_256  = 0x00,
362c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_MTL_FIFO_SIZE_512  = 0x01,
363c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_MTL_FIFO_SIZE_1K   = 0x03,
364c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_MTL_FIFO_SIZE_2K   = 0x07,
365c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_MTL_FIFO_SIZE_4K   = 0x0f,
366c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_MTL_FIFO_SIZE_8K   = 0x1f,
367c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_MTL_FIFO_SIZE_16K  = 0x3f,
368c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_MTL_FIFO_SIZE_32K  = 0x7f,
369c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_MTL_FIFO_SIZE_64K  = 0xff,
370c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_MTL_FIFO_SIZE_128K = 0x1ff,
371c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	XGMAC_MTL_FIFO_SIZE_256K = 0x3ff,
372c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas};
373c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
374c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstruct xgbe_mmc_stats {
375c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Tx Stats */
376c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 txoctetcount_gb;
377c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 txframecount_gb;
378c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 txbroadcastframes_g;
379c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 txmulticastframes_g;
380c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 tx64octets_gb;
381c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 tx65to127octets_gb;
382c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 tx128to255octets_gb;
383c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 tx256to511octets_gb;
384c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 tx512to1023octets_gb;
385c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 tx1024tomaxoctets_gb;
386c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 txunicastframes_gb;
387c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 txmulticastframes_gb;
388c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 txbroadcastframes_gb;
389c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 txunderflowerror;
390c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 txoctetcount_g;
391c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 txframecount_g;
392c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 txpauseframes;
393c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 txvlanframes_g;
394c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
395c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Rx Stats */
396c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxframecount_gb;
397c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxoctetcount_gb;
398c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxoctetcount_g;
399c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxbroadcastframes_g;
400c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxmulticastframes_g;
401c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxcrcerror;
402c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxrunterror;
403c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxjabbererror;
404c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxundersize_g;
405c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxoversize_g;
406c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rx64octets_gb;
407c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rx65to127octets_gb;
408c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rx128to255octets_gb;
409c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rx256to511octets_gb;
410c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rx512to1023octets_gb;
411c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rx1024tomaxoctets_gb;
412c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxunicastframes_g;
413c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxlengtherror;
414c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxoutofrangetype;
415c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxpauseframes;
416c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxfifooverflow;
417c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxvlanframes_gb;
418c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	u64 rxwatchdogerror;
419c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas};
420c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
421c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstruct xgbe_hw_if {
422c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*tx_complete)(struct xgbe_ring_desc *);
423c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
424c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*set_promiscuous_mode)(struct xgbe_prv_data *, unsigned int);
425c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*set_all_multicast_mode)(struct xgbe_prv_data *, unsigned int);
426b85e4d8960f10e4b28613a3e7b76f8889a2089e3Lendacky, Thomas	int (*add_mac_addresses)(struct xgbe_prv_data *);
427c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*set_mac_address)(struct xgbe_prv_data *, u8 *addr);
428c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
429c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*enable_rx_csum)(struct xgbe_prv_data *);
430c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*disable_rx_csum)(struct xgbe_prv_data *);
431c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
432c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*enable_rx_vlan_stripping)(struct xgbe_prv_data *);
433c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*disable_rx_vlan_stripping)(struct xgbe_prv_data *);
434801c62d945c6121c0262924732e430f0553bfb37Lendacky, Thomas	int (*enable_rx_vlan_filtering)(struct xgbe_prv_data *);
435801c62d945c6121c0262924732e430f0553bfb37Lendacky, Thomas	int (*disable_rx_vlan_filtering)(struct xgbe_prv_data *);
436801c62d945c6121c0262924732e430f0553bfb37Lendacky, Thomas	int (*update_vlan_hash_table)(struct xgbe_prv_data *);
437c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
438c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*read_mmd_regs)(struct xgbe_prv_data *, int, int);
439c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*write_mmd_regs)(struct xgbe_prv_data *, int, int, int);
440c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*set_gmii_speed)(struct xgbe_prv_data *);
441c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*set_gmii_2500_speed)(struct xgbe_prv_data *);
442c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*set_xgmii_speed)(struct xgbe_prv_data *);
443c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
444c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*enable_tx)(struct xgbe_prv_data *);
445c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*disable_tx)(struct xgbe_prv_data *);
446c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*enable_rx)(struct xgbe_prv_data *);
447c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*disable_rx)(struct xgbe_prv_data *);
448c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
449c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*powerup_tx)(struct xgbe_prv_data *);
450c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*powerdown_tx)(struct xgbe_prv_data *);
451c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*powerup_rx)(struct xgbe_prv_data *);
452c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*powerdown_rx)(struct xgbe_prv_data *);
453c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
454c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*init)(struct xgbe_prv_data *);
455c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*exit)(struct xgbe_prv_data *);
456c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
457c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*enable_int)(struct xgbe_channel *, enum xgbe_int);
458c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*disable_int)(struct xgbe_channel *, enum xgbe_int);
459c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*pre_xmit)(struct xgbe_channel *);
460c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*dev_read)(struct xgbe_channel *);
461c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*tx_desc_init)(struct xgbe_channel *);
462c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*rx_desc_init)(struct xgbe_channel *);
463c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*rx_desc_reset)(struct xgbe_ring_data *);
464c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*tx_desc_reset)(struct xgbe_ring_data *);
465c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*is_last_desc)(struct xgbe_ring_desc *);
466c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*is_context_desc)(struct xgbe_ring_desc *);
467c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
468c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* For FLOW ctrl */
469c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*config_tx_flow_control)(struct xgbe_prv_data *);
470c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*config_rx_flow_control)(struct xgbe_prv_data *);
471c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
472c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* For RX coalescing */
473c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*config_rx_coalesce)(struct xgbe_prv_data *);
474c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*config_tx_coalesce)(struct xgbe_prv_data *);
475c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int (*usec_to_riwt)(struct xgbe_prv_data *, unsigned int);
476c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int (*riwt_to_usec)(struct xgbe_prv_data *, unsigned int);
477c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
478c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* For RX and TX threshold config */
479c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*config_rx_threshold)(struct xgbe_prv_data *, unsigned int);
480c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*config_tx_threshold)(struct xgbe_prv_data *, unsigned int);
481c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
482c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* For RX and TX Store and Forward Mode config */
483c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*config_rsf_mode)(struct xgbe_prv_data *, unsigned int);
484c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*config_tsf_mode)(struct xgbe_prv_data *, unsigned int);
485c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
486c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* For TX DMA Operate on Second Frame config */
487c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*config_osp_mode)(struct xgbe_prv_data *);
488c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
489c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* For RX and TX PBL config */
490c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*config_rx_pbl_val)(struct xgbe_prv_data *);
491c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*get_rx_pbl_val)(struct xgbe_prv_data *);
492c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*config_tx_pbl_val)(struct xgbe_prv_data *);
493c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*get_tx_pbl_val)(struct xgbe_prv_data *);
494c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*config_pblx8)(struct xgbe_prv_data *);
495c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
496c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* For MMC statistics */
497c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*rx_mmc_int)(struct xgbe_prv_data *);
498c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*tx_mmc_int)(struct xgbe_prv_data *);
499c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*read_mmc_stats)(struct xgbe_prv_data *);
50023e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas
50123e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	/* For Timestamp config */
50223e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	int (*config_tstamp)(struct xgbe_prv_data *, unsigned int);
50323e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	void (*update_tstamp_addend)(struct xgbe_prv_data *, unsigned int);
50423e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	void (*set_tstamp_time)(struct xgbe_prv_data *, unsigned int sec,
50523e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas				unsigned int nsec);
50623e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	u64 (*get_tstamp_time)(struct xgbe_prv_data *);
50723e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	u64 (*get_tx_tstamp)(struct xgbe_prv_data *);
508fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas
509fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas	/* For Data Center Bridging config */
510fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas	void (*config_dcb_tc)(struct xgbe_prv_data *);
511fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas	void (*config_dcb_pfc)(struct xgbe_prv_data *);
512c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas};
513c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
514c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstruct xgbe_desc_if {
515c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*alloc_ring_resources)(struct xgbe_prv_data *);
516c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*free_ring_resources)(struct xgbe_prv_data *);
517c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int (*map_tx_skb)(struct xgbe_channel *, struct sk_buff *);
518c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*realloc_skb)(struct xgbe_channel *);
519c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*unmap_skb)(struct xgbe_prv_data *, struct xgbe_ring_data *);
520c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*wrapper_tx_desc_init)(struct xgbe_prv_data *);
521c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void (*wrapper_rx_desc_init)(struct xgbe_prv_data *);
522c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas};
523c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
524c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* This structure contains flags that indicate what hardware features
525c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas * or configurations are present in the device.
526c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas */
527c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstruct xgbe_hw_features {
528a9a4a2d9d622e3bde41356aa4e2694cee052d002Lendacky, Thomas	/* HW Version */
529a9a4a2d9d622e3bde41356aa4e2694cee052d002Lendacky, Thomas	unsigned int version;
530a9a4a2d9d622e3bde41356aa4e2694cee052d002Lendacky, Thomas
531c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* HW Feature Register0 */
532c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int gmii;		/* 1000 Mbps support */
533c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int vlhash;		/* VLAN Hash Filter */
534c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int sma;		/* SMA(MDIO) Interface */
535c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rwk;		/* PMT remote wake-up packet */
536c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int mgk;		/* PMT magic packet */
537c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int mmc;		/* RMON module */
538c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int aoe;		/* ARP Offload */
539c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int ts;		/* IEEE 1588-2008 Adavanced Timestamp */
540c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int eee;		/* Energy Efficient Ethernet */
541c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tx_coe;		/* Tx Checksum Offload */
542c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rx_coe;		/* Rx Checksum Offload */
543c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int addn_mac;		/* Additional MAC Addresses */
544c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int ts_src;		/* Timestamp Source */
545c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int sa_vlan_ins;	/* Source Address or VLAN Insertion */
546c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
547c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* HW Feature Register1 */
548c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rx_fifo_size;	/* MTL Receive FIFO Size */
549c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tx_fifo_size;	/* MTL Transmit FIFO Size */
550c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int adv_ts_hi;		/* Advance Timestamping High Word */
551c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int dcb;		/* DCB Feature */
552c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int sph;		/* Split Header Feature */
553c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tso;		/* TCP Segmentation Offload */
554c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int dma_debug;		/* DMA Debug Registers */
555c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rss;		/* Receive Side Scaling */
556fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas	unsigned int tc_cnt;		/* Number of Traffic Classes */
557c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int hash_table_size;	/* Hash Table Size */
558c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int l3l4_filter_num;	/* Number of L3-L4 Filters */
559c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
560c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* HW Feature Register2 */
561c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rx_q_cnt;		/* Number of MTL Receive Queues */
562c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tx_q_cnt;		/* Number of MTL Transmit Queues */
563c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rx_ch_cnt;		/* Number of DMA Receive Channels */
564c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tx_ch_cnt;		/* Number of DMA Transmit Channels */
565c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int pps_out_num;	/* Number of PPS outputs */
566c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int aux_snap_num;	/* Number of Aux snapshot inputs */
567c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas};
568c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
569c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstruct xgbe_prv_data {
570c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct net_device *netdev;
571c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct platform_device *pdev;
572c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct device *dev;
573c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
574c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* XGMAC/XPCS related mmio registers */
575c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void __iomem *xgmac_regs;	/* XGMAC CSRs */
576c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	void __iomem *xpcs_regs;	/* XPCS MMD registers */
577c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
578c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Overall device lock */
579c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	spinlock_t lock;
580c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
581c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* XPCS indirect addressing mutex */
582c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct mutex xpcs_mutex;
583c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
584c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int irq_number;
585c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
586c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct xgbe_hw_if hw_if;
587c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct xgbe_desc_if desc_if;
588c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
589cfa50c7811fe3857fd882be96b2b2f130fa5da6dLendacky, Thomas	/* AXI DMA settings */
590cfa50c7811fe3857fd882be96b2b2f130fa5da6dLendacky, Thomas	unsigned int axdomain;
591cfa50c7811fe3857fd882be96b2b2f130fa5da6dLendacky, Thomas	unsigned int arcache;
592cfa50c7811fe3857fd882be96b2b2f130fa5da6dLendacky, Thomas	unsigned int awcache;
593cfa50c7811fe3857fd882be96b2b2f130fa5da6dLendacky, Thomas
594c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Rings for Tx/Rx on a DMA channel */
595c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct xgbe_channel *channel;
596c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int channel_count;
597c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tx_ring_count;
598c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tx_desc_count;
599c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rx_ring_count;
600c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rx_desc_count;
601c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
602853eb16b8b6a347315443f2ef010e5b97d8c1577Lendacky, Thomas	unsigned int tx_q_count;
603853eb16b8b6a347315443f2ef010e5b97d8c1577Lendacky, Thomas	unsigned int rx_q_count;
604853eb16b8b6a347315443f2ef010e5b97d8c1577Lendacky, Thomas
605c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Tx/Rx common settings */
606c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int pblx8;
607c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
608c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Tx settings */
609c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tx_sf_mode;
610c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tx_threshold;
611c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tx_pbl;
612c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tx_osp_mode;
613c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
614c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Rx settings */
615c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rx_sf_mode;
616c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rx_threshold;
617c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rx_pbl;
618c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
619c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Tx coalescing settings */
620c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tx_usecs;
621c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tx_frames;
622c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
623c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Rx coalescing settings */
624c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rx_riwt;
625c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rx_frames;
626c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
627c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Current MTU */
628c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rx_buf_size;
629c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
630c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Flow control settings */
631c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int pause_autoneg;
632c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int tx_pause;
633c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int rx_pause;
634c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
635c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* MDIO settings */
636c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct module *phy_module;
637c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	char *mii_bus_id;
638c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct mii_bus *mii;
639c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int mdio_mmd;
640c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct phy_device *phydev;
641c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int default_autoneg;
642c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int default_speed;
643c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
644c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Current PHY settings */
645c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	phy_interface_t phy_mode;
646c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int phy_link;
647c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	int phy_speed;
648c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int phy_tx_pause;
649c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int phy_rx_pause;
650c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
651c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Netdev related settings */
652c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	netdev_features_t netdev_features;
653c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct napi_struct napi;
654c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct xgbe_mmc_stats mmc_stats;
655c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
656801c62d945c6121c0262924732e430f0553bfb37Lendacky, Thomas	/* Filtering support */
657801c62d945c6121c0262924732e430f0553bfb37Lendacky, Thomas	unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
658801c62d945c6121c0262924732e430f0553bfb37Lendacky, Thomas
65923e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	/* Device clocks */
66023e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	struct clk *sysclk;
66123e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	struct clk *ptpclk;
66223e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas
66323e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	/* Timestamp support */
66423e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	spinlock_t tstamp_lock;
66523e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	struct ptp_clock_info ptp_clock_info;
66623e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	struct ptp_clock *ptp_clock;
66723e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	struct hwtstamp_config tstamp_config;
66823e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	struct cyclecounter tstamp_cc;
66923e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	struct timecounter tstamp_tc;
67023e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	unsigned int tstamp_addend;
67123e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	struct work_struct tx_tstamp_work;
67223e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	struct sk_buff *tx_tstamp_skb;
67323e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomas	u64 tx_tstamp;
674c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
675fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas	/* DCB support */
676fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas	struct ieee_ets *ets;
677fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas	struct ieee_pfc *pfc;
678fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas	unsigned int q2tc_map[XGBE_MAX_QUEUES];
679fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas	unsigned int prio2q_map[IEEE_8021QAZ_MAX_TCS];
680fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas
681c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Hardware features of the device */
682c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct xgbe_hw_features hw_feat;
683c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
684c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Device restart work structure */
685c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct work_struct restart_work;
686c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
687c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	/* Keeps track of power mode */
688c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int power_down;
689c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
690c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#ifdef CONFIG_DEBUG_FS
691c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	struct dentry *xgbe_debugfs;
692c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
693c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int debugfs_xgmac_reg;
694c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
695c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int debugfs_xpcs_mmd;
696c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas	unsigned int debugfs_xpcs_reg;
697c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#endif
698c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas};
699c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
700c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* Function prototypes*/
701c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
702c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasvoid xgbe_init_function_ptrs_dev(struct xgbe_hw_if *);
703c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasvoid xgbe_init_function_ptrs_desc(struct xgbe_desc_if *);
704c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstruct net_device_ops *xgbe_get_netdev_ops(void);
705c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstruct ethtool_ops *xgbe_get_ethtool_ops(void);
706fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas#ifdef CONFIG_AMD_XGBE_DCB
707fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomasconst struct dcbnl_rtnl_ops *xgbe_get_dcbnl_ops(void);
708fca2d99428473884e67ef8ea1586e58151ed6ac3Lendacky, Thomas#endif
709c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
710c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasint xgbe_mdio_register(struct xgbe_prv_data *);
711c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasvoid xgbe_mdio_unregister(struct xgbe_prv_data *);
712c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasvoid xgbe_dump_phy_registers(struct xgbe_prv_data *);
71323e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomasvoid xgbe_ptp_register(struct xgbe_prv_data *);
71423e4eef7cf56b5e36e76af9078f0012826c86b2fLendacky, Thomasvoid xgbe_ptp_unregister(struct xgbe_prv_data *);
715c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasvoid xgbe_dump_tx_desc(struct xgbe_ring *, unsigned int, unsigned int,
716c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas		       unsigned int);
717c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasvoid xgbe_dump_rx_desc(struct xgbe_ring *, struct xgbe_ring_desc *,
718c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas		       unsigned int);
719c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasvoid xgbe_print_pkt(struct net_device *, struct sk_buff *, bool);
720c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasvoid xgbe_get_all_hw_features(struct xgbe_prv_data *);
721c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasint xgbe_powerup(struct net_device *, unsigned int);
722c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasint xgbe_powerdown(struct net_device *, unsigned int);
723c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasvoid xgbe_init_rx_coalesce(struct xgbe_prv_data *);
724c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasvoid xgbe_init_tx_coalesce(struct xgbe_prv_data *);
725c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
726c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#ifdef CONFIG_DEBUG_FS
727c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasvoid xgbe_debugfs_init(struct xgbe_prv_data *);
728c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasvoid xgbe_debugfs_exit(struct xgbe_prv_data *);
729c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#else
730c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstatic inline void xgbe_debugfs_init(struct xgbe_prv_data *pdata) {}
731c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomasstatic inline void xgbe_debugfs_exit(struct xgbe_prv_data *pdata) {}
732c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#endif /* CONFIG_DEBUG_FS */
733c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
734c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* NOTE: Uncomment for TX and RX DESCRIPTOR DUMP in KERNEL LOG */
735c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#if 0
736c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGMAC_ENABLE_TX_DESC_DUMP
737c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGMAC_ENABLE_RX_DESC_DUMP
738c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#endif
739c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
740c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* NOTE: Uncomment for TX and RX PACKET DUMP in KERNEL LOG */
741c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#if 0
742c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGMAC_ENABLE_TX_PKT_DUMP
743c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define XGMAC_ENABLE_RX_PKT_DUMP
744c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#endif
745c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
746c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* NOTE: Uncomment for function trace log messages in KERNEL LOG */
747c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#if 0
748c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define YDEBUG
749c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define YDEBUG_MDIO
750c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#endif
751c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
752c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas/* For debug prints */
753c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#ifdef YDEBUG
754c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define DBGPR(x...) pr_alert(x)
755c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define DBGPHY_REGS(x...) xgbe_dump_phy_registers(x)
756c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#else
757c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define DBGPR(x...) do { } while (0)
758c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define DBGPHY_REGS(x...) do { } while (0)
759c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#endif
760c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
761c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#ifdef YDEBUG_MDIO
762c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define DBGPR_MDIO(x...) pr_alert(x)
763c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#else
764c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#define DBGPR_MDIO(x...) do { } while (0)
765c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#endif
766c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas
767c5aa9e3b815645e3aad08444c91ca6b237eeea01Lendacky, Thomas#endif
768