blob: dd742426eb0425e9c4a7b041ee4cf3764694515e [file] [log] [blame]
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -05001/*
2 * AMD 10Gb Ethernet driver
3 *
4 * This file is available to you under your choice of the following two
5 * licenses:
6 *
7 * License 1: GPLv2
8 *
9 * Copyright (c) 2014 Advanced Micro Devices, Inc.
10 *
11 * This file is free software; you may copy, redistribute and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 2 of the License, or (at
14 * your option) any later version.
15 *
16 * This file is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 *
24 * This file incorporates work covered by the following copyright and
25 * permission notice:
26 * The Synopsys DWC ETHER XGMAC Software Driver and documentation
27 * (hereinafter "Software") is an unsupported proprietary work of Synopsys,
28 * Inc. unless otherwise expressly agreed to in writing between Synopsys
29 * and you.
30 *
31 * The Software IS NOT an item of Licensed Software or Licensed Product
32 * under any End User Software License Agreement or Agreement for Licensed
33 * Product with Synopsys or any supplement thereto. Permission is hereby
34 * granted, free of charge, to any person obtaining a copy of this software
35 * annotated with this license and the Software, to deal in the Software
36 * without restriction, including without limitation the rights to use,
37 * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
38 * of the Software, and to permit persons to whom the Software is furnished
39 * to do so, subject to the following conditions:
40 *
41 * The above copyright notice and this permission notice shall be included
42 * in all copies or substantial portions of the Software.
43 *
44 * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
45 * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
46 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
47 * PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
48 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
49 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
50 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
51 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
52 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
54 * THE POSSIBILITY OF SUCH DAMAGE.
55 *
56 *
57 * License 2: Modified BSD
58 *
59 * Copyright (c) 2014 Advanced Micro Devices, Inc.
60 * All rights reserved.
61 *
62 * Redistribution and use in source and binary forms, with or without
63 * modification, are permitted provided that the following conditions are met:
64 * * Redistributions of source code must retain the above copyright
65 * notice, this list of conditions and the following disclaimer.
66 * * Redistributions in binary form must reproduce the above copyright
67 * notice, this list of conditions and the following disclaimer in the
68 * documentation and/or other materials provided with the distribution.
69 * * Neither the name of Advanced Micro Devices, Inc. nor the
70 * names of its contributors may be used to endorse or promote products
71 * derived from this software without specific prior written permission.
72 *
73 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
74 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
75 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
76 * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
77 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
78 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
79 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
80 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
81 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
82 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
83 *
84 * This file incorporates work covered by the following copyright and
85 * permission notice:
86 * The Synopsys DWC ETHER XGMAC Software Driver and documentation
87 * (hereinafter "Software") is an unsupported proprietary work of Synopsys,
88 * Inc. unless otherwise expressly agreed to in writing between Synopsys
89 * and you.
90 *
91 * The Software IS NOT an item of Licensed Software or Licensed Product
92 * under any End User Software License Agreement or Agreement for Licensed
93 * Product with Synopsys or any supplement thereto. Permission is hereby
94 * granted, free of charge, to any person obtaining a copy of this software
95 * annotated with this license and the Software, to deal in the Software
96 * without restriction, including without limitation the rights to use,
97 * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
98 * of the Software, and to permit persons to whom the Software is furnished
99 * to do so, subject to the following conditions:
100 *
101 * The above copyright notice and this permission notice shall be included
102 * in all copies or substantial portions of the Software.
103 *
104 * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
105 * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
106 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
107 * PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
108 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
109 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
110 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
111 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
112 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
113 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
114 * THE POSSIBILITY OF SUCH DAMAGE.
115 */
116
117#ifndef __XGBE_H__
118#define __XGBE_H__
119
120#include <linux/dma-mapping.h>
121#include <linux/netdevice.h>
122#include <linux/workqueue.h>
123#include <linux/phy.h>
Lendacky, Thomas801c62d2014-06-24 16:19:24 -0500124#include <linux/if_vlan.h>
125#include <linux/bitops.h>
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500126#include <linux/ptp_clock_kernel.h>
Richard Cochran74d23cc2014-12-21 19:46:56 +0100127#include <linux/timecounter.h>
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500128#include <linux/net_tstamp.h>
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500129#include <net/dcbnl.h>
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500130
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500131#define XGBE_DRV_NAME "amd-xgbe"
132#define XGBE_DRV_VERSION "1.0.0-a"
133#define XGBE_DRV_DESC "AMD 10 Gigabit Ethernet Driver"
134
135/* Descriptor related defines */
Lendacky, Thomasd0a8ba62014-06-24 16:19:06 -0500136#define XGBE_TX_DESC_CNT 512
137#define XGBE_TX_DESC_MIN_FREE (XGBE_TX_DESC_CNT >> 3)
138#define XGBE_TX_DESC_MAX_PROC (XGBE_TX_DESC_CNT >> 1)
139#define XGBE_RX_DESC_CNT 512
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500140
Lendacky, Thomasd0a8ba62014-06-24 16:19:06 -0500141#define XGBE_TX_MAX_BUF_SIZE (0x3fff & ~(64 - 1))
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500142
Lendacky, Thomas16958a22014-11-20 11:04:08 -0600143/* Descriptors required for maximum contigous TSO/GSO packet */
144#define XGBE_TX_MAX_SPLIT ((GSO_MAX_SIZE / XGBE_TX_MAX_BUF_SIZE) + 1)
145
146/* Maximum possible descriptors needed for an SKB:
147 * - Maximum number of SKB frags
148 * - Maximum descriptors for contiguous TSO/GSO packet
149 * - Possible context descriptor
150 * - Possible TSO header descriptor
151 */
152#define XGBE_TX_MAX_DESCS (MAX_SKB_FRAGS + XGBE_TX_MAX_SPLIT + 2)
153
Lendacky, Thomasd0a8ba62014-06-24 16:19:06 -0500154#define XGBE_RX_MIN_BUF_SIZE (ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN)
155#define XGBE_RX_BUF_ALIGN 64
Lendacky, Thomas08dcc472014-11-04 16:06:44 -0600156#define XGBE_SKB_ALLOC_SIZE 256
Lendacky, Thomas174fd252014-11-04 16:06:50 -0600157#define XGBE_SPH_HDSMS_SIZE 2 /* Keep in sync with SKB_ALLOC_SIZE */
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500158
Lendacky, Thomasd5c48582014-06-09 09:19:32 -0500159#define XGBE_MAX_DMA_CHANNELS 16
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500160#define XGBE_MAX_QUEUES 16
Lendacky, Thomas16edd342014-11-20 11:03:32 -0600161#define XGBE_DMA_STOP_TIMEOUT 5
Lendacky, Thomasd0a8ba62014-06-24 16:19:06 -0500162
163/* DMA cache settings - Outer sharable, write-back, write-allocate */
Lendacky, Thomascfa50c72014-07-02 13:04:57 -0500164#define XGBE_DMA_OS_AXDOMAIN 0x2
165#define XGBE_DMA_OS_ARCACHE 0xb
166#define XGBE_DMA_OS_AWCACHE 0xf
167
168/* DMA cache settings - System, no caches used */
169#define XGBE_DMA_SYS_AXDOMAIN 0x3
170#define XGBE_DMA_SYS_ARCACHE 0x0
171#define XGBE_DMA_SYS_AWCACHE 0x0
Lendacky, Thomasd0a8ba62014-06-24 16:19:06 -0500172
173#define XGBE_DMA_INTERRUPT_MASK 0x31c7
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500174
175#define XGMAC_MIN_PACKET 60
176#define XGMAC_STD_PACKET_MTU 1500
177#define XGMAC_MAX_STD_PACKET 1518
178#define XGMAC_JUMBO_PACKET_MTU 9000
179#define XGMAC_MAX_JUMBO_PACKET 9018
180
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500181/* MDIO bus phy name */
182#define XGBE_PHY_NAME "amd_xgbe_phy"
183#define XGBE_PRTAD 0
184
Lendacky, Thomas82a19032015-01-16 12:47:16 -0600185/* Common property names */
186#define XGBE_MAC_ADDR_PROPERTY "mac-address"
187#define XGBE_PHY_MODE_PROPERTY "phy-mode"
188#define XGBE_DMA_IRQS_PROPERTY "amd,per-channel-interrupt"
189
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500190/* Device-tree clock names */
191#define XGBE_DMA_CLOCK "dma_clk"
192#define XGBE_PTP_CLOCK "ptp_clk"
Lendacky, Thomas82a19032015-01-16 12:47:16 -0600193
194/* ACPI property names */
195#define XGBE_ACPI_DMA_FREQ "amd,dma-freq"
196#define XGBE_ACPI_PTP_FREQ "amd,ptp-freq"
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500197
198/* Timestamp support - values based on 50MHz PTP clock
199 * 50MHz => 20 nsec
200 */
201#define XGBE_TSTAMP_SSINC 20
202#define XGBE_TSTAMP_SNSINC 0
203
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500204/* Driver PMT macros */
205#define XGMAC_DRIVER_CONTEXT 1
206#define XGMAC_IOCTL_CONTEXT 2
207
Lendacky, Thomasf076f452014-08-29 13:16:56 -0500208#define XGBE_FIFO_MAX 81920
Lendacky, Thomasd0a8ba62014-06-24 16:19:06 -0500209#define XGBE_FIFO_SIZE_B(x) (x)
210#define XGBE_FIFO_SIZE_KB(x) (x * 1024)
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500211
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500212#define XGBE_TC_MIN_QUANTUM 10
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500213
214/* Helper macro for descriptor handling
Lendacky, Thomasd0a8ba62014-06-24 16:19:06 -0500215 * Always use XGBE_GET_DESC_DATA to access the descriptor data
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500216 * since the index is free-running and needs to be and-ed
217 * with the descriptor count value of the ring to index to
218 * the proper descriptor data.
219 */
Lendacky, Thomasd0a8ba62014-06-24 16:19:06 -0500220#define XGBE_GET_DESC_DATA(_ring, _idx) \
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500221 ((_ring)->rdata + \
222 ((_idx) & ((_ring)->rdesc_count - 1)))
223
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500224/* Default coalescing parameters */
Lendacky, Thomasc635eaa2015-03-20 11:50:28 -0500225#define XGMAC_INIT_DMA_TX_USECS 1000
Lendacky, Thomas9867e8f2014-07-02 13:04:46 -0500226#define XGMAC_INIT_DMA_TX_FRAMES 25
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500227
228#define XGMAC_MAX_DMA_RIWT 0xff
Lendacky, Thomas9867e8f2014-07-02 13:04:46 -0500229#define XGMAC_INIT_DMA_RX_USECS 30
230#define XGMAC_INIT_DMA_RX_FRAMES 25
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500231
232/* Flow control queue count */
233#define XGMAC_MAX_FLOW_CONTROL_QUEUES 8
234
Lendacky, Thomasb85e4d82014-06-24 16:19:29 -0500235/* Maximum MAC address hash table size (256 bits = 8 bytes) */
236#define XGBE_MAC_HASH_TABLE_SIZE 8
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500237
Lendacky, Thomas5b9dfe22014-11-04 16:07:02 -0600238/* Receive Side Scaling */
239#define XGBE_RSS_HASH_KEY_SIZE 40
240#define XGBE_RSS_MAX_TABLE_SIZE 256
241#define XGBE_RSS_LOOKUP_TABLE_TYPE 0
242#define XGBE_RSS_HASH_KEY_TYPE 1
243
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500244struct xgbe_prv_data;
245
246struct xgbe_packet_data {
Lendacky, Thomas16958a22014-11-20 11:04:08 -0600247 struct sk_buff *skb;
248
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500249 unsigned int attributes;
250
251 unsigned int errors;
252
253 unsigned int rdesc_count;
254 unsigned int length;
255
256 unsigned int header_len;
257 unsigned int tcp_header_len;
258 unsigned int tcp_payload_len;
259 unsigned short mss;
260
261 unsigned short vlan_ctag;
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500262
263 u64 rx_tstamp;
Lendacky, Thomas5b9dfe22014-11-04 16:07:02 -0600264
265 u32 rss_hash;
266 enum pkt_hash_types rss_hash_type;
Lendacky, Thomas5fb4b862014-11-20 11:03:50 -0600267
268 unsigned int tx_packets;
269 unsigned int tx_bytes;
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500270};
271
272/* Common Rx and Tx descriptor mapping */
273struct xgbe_ring_desc {
Lendacky, Thomas5226cfc2014-11-12 10:37:49 -0600274 __le32 desc0;
275 __le32 desc1;
276 __le32 desc2;
277 __le32 desc3;
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500278};
279
Lendacky, Thomas08dcc472014-11-04 16:06:44 -0600280/* Page allocation related values */
281struct xgbe_page_alloc {
282 struct page *pages;
283 unsigned int pages_len;
284 unsigned int pages_offset;
285
286 dma_addr_t pages_dma;
287};
288
Lendacky, Thomas174fd252014-11-04 16:06:50 -0600289/* Ring entry buffer data */
290struct xgbe_buffer_data {
291 struct xgbe_page_alloc pa;
292 struct xgbe_page_alloc pa_unmap;
293
294 dma_addr_t dma;
295 unsigned int dma_len;
296};
297
Lendacky, Thomasc9f140e2014-11-20 11:03:44 -0600298/* Tx-related ring data */
299struct xgbe_tx_ring_data {
Lendacky, Thomas5fb4b862014-11-20 11:03:50 -0600300 unsigned int packets; /* BQL packet count */
301 unsigned int bytes; /* BQL byte count */
Lendacky, Thomasc9f140e2014-11-20 11:03:44 -0600302};
303
304/* Rx-related ring data */
305struct xgbe_rx_ring_data {
306 struct xgbe_buffer_data hdr; /* Header locations */
307 struct xgbe_buffer_data buf; /* Payload locations */
308
309 unsigned short hdr_len; /* Length of received header */
310 unsigned short len; /* Length of received packet */
311};
312
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500313/* Structure used to hold information related to the descriptor
314 * and the packet associated with the descriptor (always use
Lendacky, Thomasd0a8ba62014-06-24 16:19:06 -0500315 * use the XGBE_GET_DESC_DATA macro to access this data from the ring)
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500316 */
317struct xgbe_ring_data {
318 struct xgbe_ring_desc *rdesc; /* Virtual address of descriptor */
319 dma_addr_t rdesc_dma; /* DMA address of descriptor */
320
321 struct sk_buff *skb; /* Virtual address of SKB */
322 dma_addr_t skb_dma; /* DMA address of SKB data */
323 unsigned int skb_dma_len; /* Length of SKB DMA area */
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500324
Lendacky, Thomasc9f140e2014-11-20 11:03:44 -0600325 struct xgbe_tx_ring_data tx; /* Tx-related data */
326 struct xgbe_rx_ring_data rx; /* Rx-related data */
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500327
328 unsigned int interrupt; /* Interrupt indicator */
329
330 unsigned int mapped_as_page;
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500331
332 /* Incomplete receive save location. If the budget is exhausted
333 * or the last descriptor (last normal descriptor or a following
334 * context descriptor) has not been DMA'd yet the current state
335 * of the receive processing needs to be saved.
336 */
337 unsigned int state_saved;
338 struct {
339 unsigned int incomplete;
340 unsigned int context_next;
341 struct sk_buff *skb;
342 unsigned int len;
343 unsigned int error;
344 } state;
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500345};
346
347struct xgbe_ring {
348 /* Ring lock - used just for TX rings at the moment */
349 spinlock_t lock;
350
351 /* Per packet related information */
352 struct xgbe_packet_data packet_data;
353
354 /* Virtual/DMA addresses and count of allocated descriptor memory */
355 struct xgbe_ring_desc *rdesc;
356 dma_addr_t rdesc_dma;
357 unsigned int rdesc_count;
358
359 /* Array of descriptor data corresponding the descriptor memory
Lendacky, Thomasd0a8ba62014-06-24 16:19:06 -0500360 * (always use the XGBE_GET_DESC_DATA macro to access this data)
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500361 */
362 struct xgbe_ring_data *rdata;
363
Lendacky, Thomas08dcc472014-11-04 16:06:44 -0600364 /* Page allocation for RX buffers */
Lendacky, Thomas174fd252014-11-04 16:06:50 -0600365 struct xgbe_page_alloc rx_hdr_pa;
366 struct xgbe_page_alloc rx_buf_pa;
Lendacky, Thomas08dcc472014-11-04 16:06:44 -0600367
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500368 /* Ring index values
369 * cur - Tx: index of descriptor to be used for current transfer
370 * Rx: index of descriptor to check for packet availability
371 * dirty - Tx: index of descriptor to check for transfer complete
Lendacky, Thomas270894e2015-01-16 12:46:50 -0600372 * Rx: index of descriptor to check for buffer reallocation
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500373 */
374 unsigned int cur;
375 unsigned int dirty;
376
377 /* Coalesce frame count used for interrupt bit setting */
378 unsigned int coalesce_count;
379
380 union {
381 struct {
382 unsigned int queue_stopped;
Lendacky, Thomas16958a22014-11-20 11:04:08 -0600383 unsigned int xmit_more;
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500384 unsigned short cur_mss;
385 unsigned short cur_vlan_ctag;
386 } tx;
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500387 };
388} ____cacheline_aligned;
389
390/* Structure used to describe the descriptor rings associated with
391 * a DMA channel.
392 */
393struct xgbe_channel {
394 char name[16];
395
396 /* Address of private data area for device */
397 struct xgbe_prv_data *pdata;
398
399 /* Queue index and base address of queue's DMA registers */
400 unsigned int queue_index;
401 void __iomem *dma_regs;
402
Lendacky, Thomas9227dc52014-11-04 16:06:56 -0600403 /* Per channel interrupt irq number */
404 int dma_irq;
Lendacky, Thomas54ceb9e2014-12-02 18:07:18 -0600405 char dma_irq_name[IFNAMSIZ + 32];
Lendacky, Thomas9227dc52014-11-04 16:06:56 -0600406
407 /* Netdev related settings */
408 struct napi_struct napi;
409
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500410 unsigned int saved_ier;
411
412 unsigned int tx_timer_active;
Lendacky, Thomasc635eaa2015-03-20 11:50:28 -0500413 struct timer_list tx_timer;
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500414
415 struct xgbe_ring *tx_ring;
416 struct xgbe_ring *rx_ring;
417} ____cacheline_aligned;
418
419enum xgbe_int {
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500420 XGMAC_INT_DMA_CH_SR_TI,
421 XGMAC_INT_DMA_CH_SR_TPS,
422 XGMAC_INT_DMA_CH_SR_TBU,
423 XGMAC_INT_DMA_CH_SR_RI,
424 XGMAC_INT_DMA_CH_SR_RBU,
425 XGMAC_INT_DMA_CH_SR_RPS,
Lendacky, Thomas9867e8f2014-07-02 13:04:46 -0500426 XGMAC_INT_DMA_CH_SR_TI_RI,
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500427 XGMAC_INT_DMA_CH_SR_FBE,
428 XGMAC_INT_DMA_ALL,
429};
430
431enum xgbe_int_state {
432 XGMAC_INT_STATE_SAVE,
433 XGMAC_INT_STATE_RESTORE,
434};
435
436enum xgbe_mtl_fifo_size {
437 XGMAC_MTL_FIFO_SIZE_256 = 0x00,
438 XGMAC_MTL_FIFO_SIZE_512 = 0x01,
439 XGMAC_MTL_FIFO_SIZE_1K = 0x03,
440 XGMAC_MTL_FIFO_SIZE_2K = 0x07,
441 XGMAC_MTL_FIFO_SIZE_4K = 0x0f,
442 XGMAC_MTL_FIFO_SIZE_8K = 0x1f,
443 XGMAC_MTL_FIFO_SIZE_16K = 0x3f,
444 XGMAC_MTL_FIFO_SIZE_32K = 0x7f,
445 XGMAC_MTL_FIFO_SIZE_64K = 0xff,
446 XGMAC_MTL_FIFO_SIZE_128K = 0x1ff,
447 XGMAC_MTL_FIFO_SIZE_256K = 0x3ff,
448};
449
450struct xgbe_mmc_stats {
451 /* Tx Stats */
452 u64 txoctetcount_gb;
453 u64 txframecount_gb;
454 u64 txbroadcastframes_g;
455 u64 txmulticastframes_g;
456 u64 tx64octets_gb;
457 u64 tx65to127octets_gb;
458 u64 tx128to255octets_gb;
459 u64 tx256to511octets_gb;
460 u64 tx512to1023octets_gb;
461 u64 tx1024tomaxoctets_gb;
462 u64 txunicastframes_gb;
463 u64 txmulticastframes_gb;
464 u64 txbroadcastframes_gb;
465 u64 txunderflowerror;
466 u64 txoctetcount_g;
467 u64 txframecount_g;
468 u64 txpauseframes;
469 u64 txvlanframes_g;
470
471 /* Rx Stats */
472 u64 rxframecount_gb;
473 u64 rxoctetcount_gb;
474 u64 rxoctetcount_g;
475 u64 rxbroadcastframes_g;
476 u64 rxmulticastframes_g;
477 u64 rxcrcerror;
478 u64 rxrunterror;
479 u64 rxjabbererror;
480 u64 rxundersize_g;
481 u64 rxoversize_g;
482 u64 rx64octets_gb;
483 u64 rx65to127octets_gb;
484 u64 rx128to255octets_gb;
485 u64 rx256to511octets_gb;
486 u64 rx512to1023octets_gb;
487 u64 rx1024tomaxoctets_gb;
488 u64 rxunicastframes_g;
489 u64 rxlengtherror;
490 u64 rxoutofrangetype;
491 u64 rxpauseframes;
492 u64 rxfifooverflow;
493 u64 rxvlanframes_gb;
494 u64 rxwatchdogerror;
495};
496
497struct xgbe_hw_if {
498 int (*tx_complete)(struct xgbe_ring_desc *);
499
500 int (*set_promiscuous_mode)(struct xgbe_prv_data *, unsigned int);
501 int (*set_all_multicast_mode)(struct xgbe_prv_data *, unsigned int);
Lendacky, Thomasb85e4d82014-06-24 16:19:29 -0500502 int (*add_mac_addresses)(struct xgbe_prv_data *);
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500503 int (*set_mac_address)(struct xgbe_prv_data *, u8 *addr);
504
505 int (*enable_rx_csum)(struct xgbe_prv_data *);
506 int (*disable_rx_csum)(struct xgbe_prv_data *);
507
508 int (*enable_rx_vlan_stripping)(struct xgbe_prv_data *);
509 int (*disable_rx_vlan_stripping)(struct xgbe_prv_data *);
Lendacky, Thomas801c62d2014-06-24 16:19:24 -0500510 int (*enable_rx_vlan_filtering)(struct xgbe_prv_data *);
511 int (*disable_rx_vlan_filtering)(struct xgbe_prv_data *);
512 int (*update_vlan_hash_table)(struct xgbe_prv_data *);
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500513
514 int (*read_mmd_regs)(struct xgbe_prv_data *, int, int);
515 void (*write_mmd_regs)(struct xgbe_prv_data *, int, int, int);
516 int (*set_gmii_speed)(struct xgbe_prv_data *);
517 int (*set_gmii_2500_speed)(struct xgbe_prv_data *);
518 int (*set_xgmii_speed)(struct xgbe_prv_data *);
519
520 void (*enable_tx)(struct xgbe_prv_data *);
521 void (*disable_tx)(struct xgbe_prv_data *);
522 void (*enable_rx)(struct xgbe_prv_data *);
523 void (*disable_rx)(struct xgbe_prv_data *);
524
525 void (*powerup_tx)(struct xgbe_prv_data *);
526 void (*powerdown_tx)(struct xgbe_prv_data *);
527 void (*powerup_rx)(struct xgbe_prv_data *);
528 void (*powerdown_rx)(struct xgbe_prv_data *);
529
530 int (*init)(struct xgbe_prv_data *);
531 int (*exit)(struct xgbe_prv_data *);
532
533 int (*enable_int)(struct xgbe_channel *, enum xgbe_int);
534 int (*disable_int)(struct xgbe_channel *, enum xgbe_int);
Lendacky, Thomasa9d41982014-11-04 16:06:32 -0600535 void (*dev_xmit)(struct xgbe_channel *);
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500536 int (*dev_read)(struct xgbe_channel *);
537 void (*tx_desc_init)(struct xgbe_channel *);
538 void (*rx_desc_init)(struct xgbe_channel *);
539 void (*rx_desc_reset)(struct xgbe_ring_data *);
540 void (*tx_desc_reset)(struct xgbe_ring_data *);
541 int (*is_last_desc)(struct xgbe_ring_desc *);
542 int (*is_context_desc)(struct xgbe_ring_desc *);
Lendacky, Thomas16958a22014-11-20 11:04:08 -0600543 void (*tx_start_xmit)(struct xgbe_channel *, struct xgbe_ring *);
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500544
545 /* For FLOW ctrl */
546 int (*config_tx_flow_control)(struct xgbe_prv_data *);
547 int (*config_rx_flow_control)(struct xgbe_prv_data *);
548
549 /* For RX coalescing */
550 int (*config_rx_coalesce)(struct xgbe_prv_data *);
551 int (*config_tx_coalesce)(struct xgbe_prv_data *);
552 unsigned int (*usec_to_riwt)(struct xgbe_prv_data *, unsigned int);
553 unsigned int (*riwt_to_usec)(struct xgbe_prv_data *, unsigned int);
554
555 /* For RX and TX threshold config */
556 int (*config_rx_threshold)(struct xgbe_prv_data *, unsigned int);
557 int (*config_tx_threshold)(struct xgbe_prv_data *, unsigned int);
558
559 /* For RX and TX Store and Forward Mode config */
560 int (*config_rsf_mode)(struct xgbe_prv_data *, unsigned int);
561 int (*config_tsf_mode)(struct xgbe_prv_data *, unsigned int);
562
563 /* For TX DMA Operate on Second Frame config */
564 int (*config_osp_mode)(struct xgbe_prv_data *);
565
566 /* For RX and TX PBL config */
567 int (*config_rx_pbl_val)(struct xgbe_prv_data *);
568 int (*get_rx_pbl_val)(struct xgbe_prv_data *);
569 int (*config_tx_pbl_val)(struct xgbe_prv_data *);
570 int (*get_tx_pbl_val)(struct xgbe_prv_data *);
571 int (*config_pblx8)(struct xgbe_prv_data *);
572
573 /* For MMC statistics */
574 void (*rx_mmc_int)(struct xgbe_prv_data *);
575 void (*tx_mmc_int)(struct xgbe_prv_data *);
576 void (*read_mmc_stats)(struct xgbe_prv_data *);
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500577
578 /* For Timestamp config */
579 int (*config_tstamp)(struct xgbe_prv_data *, unsigned int);
580 void (*update_tstamp_addend)(struct xgbe_prv_data *, unsigned int);
581 void (*set_tstamp_time)(struct xgbe_prv_data *, unsigned int sec,
582 unsigned int nsec);
583 u64 (*get_tstamp_time)(struct xgbe_prv_data *);
584 u64 (*get_tx_tstamp)(struct xgbe_prv_data *);
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500585
586 /* For Data Center Bridging config */
587 void (*config_dcb_tc)(struct xgbe_prv_data *);
588 void (*config_dcb_pfc)(struct xgbe_prv_data *);
Lendacky, Thomas5b9dfe22014-11-04 16:07:02 -0600589
590 /* For Receive Side Scaling */
591 int (*enable_rss)(struct xgbe_prv_data *);
592 int (*disable_rss)(struct xgbe_prv_data *);
Lendacky, Thomasf6ac8622014-11-04 16:07:23 -0600593 int (*set_rss_hash_key)(struct xgbe_prv_data *, const u8 *);
594 int (*set_rss_lookup_table)(struct xgbe_prv_data *, const u32 *);
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500595};
596
597struct xgbe_desc_if {
598 int (*alloc_ring_resources)(struct xgbe_prv_data *);
599 void (*free_ring_resources)(struct xgbe_prv_data *);
600 int (*map_tx_skb)(struct xgbe_channel *, struct sk_buff *);
Lendacky, Thomas270894e2015-01-16 12:46:50 -0600601 int (*map_rx_buffer)(struct xgbe_prv_data *, struct xgbe_ring *,
602 struct xgbe_ring_data *);
Lendacky, Thomas08dcc472014-11-04 16:06:44 -0600603 void (*unmap_rdata)(struct xgbe_prv_data *, struct xgbe_ring_data *);
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500604 void (*wrapper_tx_desc_init)(struct xgbe_prv_data *);
605 void (*wrapper_rx_desc_init)(struct xgbe_prv_data *);
606};
607
608/* This structure contains flags that indicate what hardware features
609 * or configurations are present in the device.
610 */
611struct xgbe_hw_features {
Lendacky, Thomasa9a4a2d2014-08-29 13:16:50 -0500612 /* HW Version */
613 unsigned int version;
614
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500615 /* HW Feature Register0 */
616 unsigned int gmii; /* 1000 Mbps support */
617 unsigned int vlhash; /* VLAN Hash Filter */
618 unsigned int sma; /* SMA(MDIO) Interface */
619 unsigned int rwk; /* PMT remote wake-up packet */
620 unsigned int mgk; /* PMT magic packet */
621 unsigned int mmc; /* RMON module */
622 unsigned int aoe; /* ARP Offload */
Joe Perchesdbedd442015-03-06 20:49:12 -0800623 unsigned int ts; /* IEEE 1588-2008 Advanced Timestamp */
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500624 unsigned int eee; /* Energy Efficient Ethernet */
625 unsigned int tx_coe; /* Tx Checksum Offload */
626 unsigned int rx_coe; /* Rx Checksum Offload */
627 unsigned int addn_mac; /* Additional MAC Addresses */
628 unsigned int ts_src; /* Timestamp Source */
629 unsigned int sa_vlan_ins; /* Source Address or VLAN Insertion */
630
631 /* HW Feature Register1 */
632 unsigned int rx_fifo_size; /* MTL Receive FIFO Size */
633 unsigned int tx_fifo_size; /* MTL Transmit FIFO Size */
634 unsigned int adv_ts_hi; /* Advance Timestamping High Word */
Lendacky, Thomas386d3252015-03-20 11:50:22 -0500635 unsigned int dma_width; /* DMA width */
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500636 unsigned int dcb; /* DCB Feature */
637 unsigned int sph; /* Split Header Feature */
638 unsigned int tso; /* TCP Segmentation Offload */
639 unsigned int dma_debug; /* DMA Debug Registers */
640 unsigned int rss; /* Receive Side Scaling */
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500641 unsigned int tc_cnt; /* Number of Traffic Classes */
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500642 unsigned int hash_table_size; /* Hash Table Size */
643 unsigned int l3l4_filter_num; /* Number of L3-L4 Filters */
644
645 /* HW Feature Register2 */
646 unsigned int rx_q_cnt; /* Number of MTL Receive Queues */
647 unsigned int tx_q_cnt; /* Number of MTL Transmit Queues */
648 unsigned int rx_ch_cnt; /* Number of DMA Receive Channels */
649 unsigned int tx_ch_cnt; /* Number of DMA Transmit Channels */
650 unsigned int pps_out_num; /* Number of PPS outputs */
651 unsigned int aux_snap_num; /* Number of Aux snapshot inputs */
652};
653
654struct xgbe_prv_data {
655 struct net_device *netdev;
656 struct platform_device *pdev;
Lendacky, Thomas82a19032015-01-16 12:47:16 -0600657 struct acpi_device *adev;
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500658 struct device *dev;
659
Lendacky, Thomas82a19032015-01-16 12:47:16 -0600660 /* ACPI or DT flag */
661 unsigned int use_acpi;
662
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500663 /* XGMAC/XPCS related mmio registers */
664 void __iomem *xgmac_regs; /* XGMAC CSRs */
665 void __iomem *xpcs_regs; /* XPCS MMD registers */
666
667 /* Overall device lock */
668 spinlock_t lock;
669
670 /* XPCS indirect addressing mutex */
671 struct mutex xpcs_mutex;
672
Lendacky, Thomas5b9dfe22014-11-04 16:07:02 -0600673 /* RSS addressing mutex */
674 struct mutex rss_mutex;
675
Lendacky, Thomas9227dc52014-11-04 16:06:56 -0600676 int dev_irq;
677 unsigned int per_channel_irq;
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500678
679 struct xgbe_hw_if hw_if;
680 struct xgbe_desc_if desc_if;
681
Lendacky, Thomascfa50c72014-07-02 13:04:57 -0500682 /* AXI DMA settings */
Lendacky, Thomas82a19032015-01-16 12:47:16 -0600683 unsigned int coherent;
Lendacky, Thomascfa50c72014-07-02 13:04:57 -0500684 unsigned int axdomain;
685 unsigned int arcache;
686 unsigned int awcache;
687
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500688 /* Rings for Tx/Rx on a DMA channel */
689 struct xgbe_channel *channel;
690 unsigned int channel_count;
691 unsigned int tx_ring_count;
692 unsigned int tx_desc_count;
693 unsigned int rx_ring_count;
694 unsigned int rx_desc_count;
695
Lendacky, Thomas853eb162014-07-29 08:57:31 -0500696 unsigned int tx_q_count;
697 unsigned int rx_q_count;
698
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500699 /* Tx/Rx common settings */
700 unsigned int pblx8;
701
702 /* Tx settings */
703 unsigned int tx_sf_mode;
704 unsigned int tx_threshold;
705 unsigned int tx_pbl;
706 unsigned int tx_osp_mode;
707
708 /* Rx settings */
709 unsigned int rx_sf_mode;
710 unsigned int rx_threshold;
711 unsigned int rx_pbl;
712
713 /* Tx coalescing settings */
714 unsigned int tx_usecs;
715 unsigned int tx_frames;
716
717 /* Rx coalescing settings */
718 unsigned int rx_riwt;
Lendacky, Thomas4a57ebc2015-03-20 11:50:34 -0500719 unsigned int rx_usecs;
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500720 unsigned int rx_frames;
721
Lendacky, Thomas08dcc472014-11-04 16:06:44 -0600722 /* Current Rx buffer size */
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500723 unsigned int rx_buf_size;
724
725 /* Flow control settings */
726 unsigned int pause_autoneg;
727 unsigned int tx_pause;
728 unsigned int rx_pause;
729
Lendacky, Thomas5b9dfe22014-11-04 16:07:02 -0600730 /* Receive Side Scaling settings */
731 u8 rss_key[XGBE_RSS_HASH_KEY_SIZE];
732 u32 rss_table[XGBE_RSS_MAX_TABLE_SIZE];
733 u32 rss_options;
734
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500735 /* MDIO settings */
736 struct module *phy_module;
737 char *mii_bus_id;
738 struct mii_bus *mii;
739 int mdio_mmd;
740 struct phy_device *phydev;
741 int default_autoneg;
742 int default_speed;
743
744 /* Current PHY settings */
745 phy_interface_t phy_mode;
746 int phy_link;
747 int phy_speed;
748 unsigned int phy_tx_pause;
749 unsigned int phy_rx_pause;
750
751 /* Netdev related settings */
Lendacky, Thomas82a19032015-01-16 12:47:16 -0600752 unsigned char mac_addr[ETH_ALEN];
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500753 netdev_features_t netdev_features;
754 struct napi_struct napi;
755 struct xgbe_mmc_stats mmc_stats;
756
Lendacky, Thomas801c62d2014-06-24 16:19:24 -0500757 /* Filtering support */
758 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
759
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500760 /* Device clocks */
761 struct clk *sysclk;
Lendacky, Thomas82a19032015-01-16 12:47:16 -0600762 unsigned long sysclk_rate;
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500763 struct clk *ptpclk;
Lendacky, Thomas82a19032015-01-16 12:47:16 -0600764 unsigned long ptpclk_rate;
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500765
766 /* Timestamp support */
767 spinlock_t tstamp_lock;
768 struct ptp_clock_info ptp_clock_info;
769 struct ptp_clock *ptp_clock;
770 struct hwtstamp_config tstamp_config;
771 struct cyclecounter tstamp_cc;
772 struct timecounter tstamp_tc;
773 unsigned int tstamp_addend;
774 struct work_struct tx_tstamp_work;
775 struct sk_buff *tx_tstamp_skb;
776 u64 tx_tstamp;
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500777
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500778 /* DCB support */
779 struct ieee_ets *ets;
780 struct ieee_pfc *pfc;
781 unsigned int q2tc_map[XGBE_MAX_QUEUES];
782 unsigned int prio2q_map[IEEE_8021QAZ_MAX_TCS];
783
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500784 /* Hardware features of the device */
785 struct xgbe_hw_features hw_feat;
786
787 /* Device restart work structure */
788 struct work_struct restart_work;
789
790 /* Keeps track of power mode */
791 unsigned int power_down;
792
793#ifdef CONFIG_DEBUG_FS
794 struct dentry *xgbe_debugfs;
795
796 unsigned int debugfs_xgmac_reg;
797
798 unsigned int debugfs_xpcs_mmd;
799 unsigned int debugfs_xpcs_reg;
800#endif
801};
802
803/* Function prototypes*/
804
805void xgbe_init_function_ptrs_dev(struct xgbe_hw_if *);
806void xgbe_init_function_ptrs_desc(struct xgbe_desc_if *);
807struct net_device_ops *xgbe_get_netdev_ops(void);
808struct ethtool_ops *xgbe_get_ethtool_ops(void);
Lendacky, Thomasfca2d992014-07-29 08:57:55 -0500809#ifdef CONFIG_AMD_XGBE_DCB
810const struct dcbnl_rtnl_ops *xgbe_get_dcbnl_ops(void);
811#endif
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500812
813int xgbe_mdio_register(struct xgbe_prv_data *);
814void xgbe_mdio_unregister(struct xgbe_prv_data *);
815void xgbe_dump_phy_registers(struct xgbe_prv_data *);
Lendacky, Thomas23e4eef2014-07-29 08:57:19 -0500816void xgbe_ptp_register(struct xgbe_prv_data *);
817void xgbe_ptp_unregister(struct xgbe_prv_data *);
Lendacky, Thomasc5aa9e32014-06-05 09:15:06 -0500818void xgbe_dump_tx_desc(struct xgbe_ring *, unsigned int, unsigned int,
819 unsigned int);
820void xgbe_dump_rx_desc(struct xgbe_ring *, struct xgbe_ring_desc *,
821 unsigned int);
822void xgbe_print_pkt(struct net_device *, struct sk_buff *, bool);
823void xgbe_get_all_hw_features(struct xgbe_prv_data *);
824int xgbe_powerup(struct net_device *, unsigned int);
825int xgbe_powerdown(struct net_device *, unsigned int);
826void xgbe_init_rx_coalesce(struct xgbe_prv_data *);
827void xgbe_init_tx_coalesce(struct xgbe_prv_data *);
828
829#ifdef CONFIG_DEBUG_FS
830void xgbe_debugfs_init(struct xgbe_prv_data *);
831void xgbe_debugfs_exit(struct xgbe_prv_data *);
832#else
833static inline void xgbe_debugfs_init(struct xgbe_prv_data *pdata) {}
834static inline void xgbe_debugfs_exit(struct xgbe_prv_data *pdata) {}
835#endif /* CONFIG_DEBUG_FS */
836
837/* NOTE: Uncomment for TX and RX DESCRIPTOR DUMP in KERNEL LOG */
838#if 0
839#define XGMAC_ENABLE_TX_DESC_DUMP
840#define XGMAC_ENABLE_RX_DESC_DUMP
841#endif
842
843/* NOTE: Uncomment for TX and RX PACKET DUMP in KERNEL LOG */
844#if 0
845#define XGMAC_ENABLE_TX_PKT_DUMP
846#define XGMAC_ENABLE_RX_PKT_DUMP
847#endif
848
849/* NOTE: Uncomment for function trace log messages in KERNEL LOG */
850#if 0
851#define YDEBUG
852#define YDEBUG_MDIO
853#endif
854
855/* For debug prints */
856#ifdef YDEBUG
857#define DBGPR(x...) pr_alert(x)
858#define DBGPHY_REGS(x...) xgbe_dump_phy_registers(x)
859#else
860#define DBGPR(x...) do { } while (0)
861#define DBGPHY_REGS(x...) do { } while (0)
862#endif
863
864#ifdef YDEBUG_MDIO
865#define DBGPR_MDIO(x...) pr_alert(x)
866#else
867#define DBGPR_MDIO(x...) do { } while (0)
868#endif
869
870#endif