]> git.ipfire.org Git - thirdparty/kernel/stable.git/blame - drivers/net/ethernet/amd/xgbe/xgbe.h
amd-xgbe: Prepare for working with more than one type of phy
[thirdparty/kernel/stable.git] / drivers / net / ethernet / amd / xgbe / xgbe.h
CommitLineData
c5aa9e3b
LT
1/*
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 *
b3b71597 9 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
c5aa9e3b
LT
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 *
b3b71597 59 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
c5aa9e3b
LT
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>
801c62d9
LT
124#include <linux/if_vlan.h>
125#include <linux/bitops.h>
23e4eef7 126#include <linux/ptp_clock_kernel.h>
74d23cc7 127#include <linux/timecounter.h>
23e4eef7 128#include <linux/net_tstamp.h>
fca2d994 129#include <net/dcbnl.h>
c5aa9e3b 130
c5aa9e3b 131#define XGBE_DRV_NAME "amd-xgbe"
e57f7a3f 132#define XGBE_DRV_VERSION "1.0.3"
c5aa9e3b
LT
133#define XGBE_DRV_DESC "AMD 10 Gigabit Ethernet Driver"
134
135/* Descriptor related defines */
d0a8ba6c
LT
136#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
c5aa9e3b 140
d0a8ba6c 141#define XGBE_TX_MAX_BUF_SIZE (0x3fff & ~(64 - 1))
c5aa9e3b 142
e1c05067 143/* Descriptors required for maximum contiguous TSO/GSO packet */
16958a2b
LT
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
d0a8ba6c
LT
154#define XGBE_RX_MIN_BUF_SIZE (ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN)
155#define XGBE_RX_BUF_ALIGN 64
08dcc47c 156#define XGBE_SKB_ALLOC_SIZE 256
174fd259 157#define XGBE_SPH_HDSMS_SIZE 2 /* Keep in sync with SKB_ALLOC_SIZE */
c5aa9e3b 158
d5c48582 159#define XGBE_MAX_DMA_CHANNELS 16
fca2d994 160#define XGBE_MAX_QUEUES 16
43e0dcf7 161#define XGBE_PRIORITY_QUEUES 8
16edd34e 162#define XGBE_DMA_STOP_TIMEOUT 5
d0a8ba6c
LT
163
164/* DMA cache settings - Outer sharable, write-back, write-allocate */
cfa50c78
LT
165#define XGBE_DMA_OS_AXDOMAIN 0x2
166#define XGBE_DMA_OS_ARCACHE 0xb
167#define XGBE_DMA_OS_AWCACHE 0xf
168
169/* DMA cache settings - System, no caches used */
170#define XGBE_DMA_SYS_AXDOMAIN 0x3
171#define XGBE_DMA_SYS_ARCACHE 0x0
172#define XGBE_DMA_SYS_AWCACHE 0x0
d0a8ba6c
LT
173
174#define XGBE_DMA_INTERRUPT_MASK 0x31c7
c5aa9e3b
LT
175
176#define XGMAC_MIN_PACKET 60
177#define XGMAC_STD_PACKET_MTU 1500
178#define XGMAC_MAX_STD_PACKET 1518
179#define XGMAC_JUMBO_PACKET_MTU 9000
180#define XGMAC_MAX_JUMBO_PACKET 9018
43e0dcf7
LT
181#define XGMAC_ETH_PREAMBLE (12 + 8) /* Inter-frame gap + preamble */
182
183#define XGMAC_PFC_DATA_LEN 46
184#define XGMAC_PFC_DELAYS 14000
185
186#define XGMAC_PRIO_QUEUES(_cnt) \
187 min_t(unsigned int, IEEE_8021QAZ_MAX_TCS, (_cnt))
c5aa9e3b 188
82a19035
LT
189/* Common property names */
190#define XGBE_MAC_ADDR_PROPERTY "mac-address"
191#define XGBE_PHY_MODE_PROPERTY "phy-mode"
192#define XGBE_DMA_IRQS_PROPERTY "amd,per-channel-interrupt"
7c12aa08 193#define XGBE_SPEEDSET_PROPERTY "amd,speed-set"
82a19035 194
23e4eef7
LT
195/* Device-tree clock names */
196#define XGBE_DMA_CLOCK "dma_clk"
197#define XGBE_PTP_CLOCK "ptp_clk"
82a19035
LT
198
199/* ACPI property names */
200#define XGBE_ACPI_DMA_FREQ "amd,dma-freq"
201#define XGBE_ACPI_PTP_FREQ "amd,ptp-freq"
23e4eef7
LT
202
203/* Timestamp support - values based on 50MHz PTP clock
204 * 50MHz => 20 nsec
205 */
206#define XGBE_TSTAMP_SSINC 20
207#define XGBE_TSTAMP_SNSINC 0
208
c5aa9e3b
LT
209/* Driver PMT macros */
210#define XGMAC_DRIVER_CONTEXT 1
211#define XGMAC_IOCTL_CONTEXT 2
212
586e3cfb
LT
213#define XGMAC_FIFO_RX_MAX 81920
214#define XGMAC_FIFO_TX_MAX 81920
43e0dcf7
LT
215#define XGMAC_FIFO_MIN_ALLOC 2048
216#define XGMAC_FIFO_UNIT 256
217#define XGMAC_FIFO_ALIGN(_x) \
218 (((_x) + XGMAC_FIFO_UNIT - 1) & ~(XGMAC_FIFO_UNIT - 1))
219#define XGMAC_FIFO_FC_OFF 2048
220#define XGMAC_FIFO_FC_MIN 4096
c5aa9e3b 221
fca2d994 222#define XGBE_TC_MIN_QUANTUM 10
c5aa9e3b
LT
223
224/* Helper macro for descriptor handling
d0a8ba6c 225 * Always use XGBE_GET_DESC_DATA to access the descriptor data
c5aa9e3b
LT
226 * since the index is free-running and needs to be and-ed
227 * with the descriptor count value of the ring to index to
228 * the proper descriptor data.
229 */
d0a8ba6c 230#define XGBE_GET_DESC_DATA(_ring, _idx) \
c5aa9e3b
LT
231 ((_ring)->rdata + \
232 ((_idx) & ((_ring)->rdesc_count - 1)))
233
c5aa9e3b 234/* Default coalescing parameters */
c635eaac 235#define XGMAC_INIT_DMA_TX_USECS 1000
9867e8fb 236#define XGMAC_INIT_DMA_TX_FRAMES 25
c5aa9e3b
LT
237
238#define XGMAC_MAX_DMA_RIWT 0xff
9867e8fb
LT
239#define XGMAC_INIT_DMA_RX_USECS 30
240#define XGMAC_INIT_DMA_RX_FRAMES 25
c5aa9e3b
LT
241
242/* Flow control queue count */
243#define XGMAC_MAX_FLOW_CONTROL_QUEUES 8
244
43e0dcf7
LT
245/* Flow control threshold units */
246#define XGMAC_FLOW_CONTROL_UNIT 512
247#define XGMAC_FLOW_CONTROL_ALIGN(_x) \
248 (((_x) + XGMAC_FLOW_CONTROL_UNIT - 1) & ~(XGMAC_FLOW_CONTROL_UNIT - 1))
249#define XGMAC_FLOW_CONTROL_VALUE(_x) \
250 (((_x) < 1024) ? 0 : ((_x) / XGMAC_FLOW_CONTROL_UNIT) - 2)
251#define XGMAC_FLOW_CONTROL_MAX 33280
252
b85e4d89
LT
253/* Maximum MAC address hash table size (256 bits = 8 bytes) */
254#define XGBE_MAC_HASH_TABLE_SIZE 8
c5aa9e3b 255
5b9dfe29
LT
256/* Receive Side Scaling */
257#define XGBE_RSS_HASH_KEY_SIZE 40
258#define XGBE_RSS_MAX_TABLE_SIZE 256
259#define XGBE_RSS_LOOKUP_TABLE_TYPE 0
260#define XGBE_RSS_HASH_KEY_TYPE 1
261
7c12aa08
LT
262/* Auto-negotiation */
263#define XGBE_AN_MS_TIMEOUT 500
264#define XGBE_LINK_TIMEOUT 10
265
266#define XGBE_AN_INT_CMPLT 0x01
267#define XGBE_AN_INC_LINK 0x02
268#define XGBE_AN_PG_RCV 0x04
269#define XGBE_AN_INT_MASK 0x07
270
c5aa9e3b
LT
271struct xgbe_prv_data;
272
273struct xgbe_packet_data {
16958a2b
LT
274 struct sk_buff *skb;
275
c5aa9e3b
LT
276 unsigned int attributes;
277
278 unsigned int errors;
279
280 unsigned int rdesc_count;
281 unsigned int length;
282
283 unsigned int header_len;
284 unsigned int tcp_header_len;
285 unsigned int tcp_payload_len;
286 unsigned short mss;
287
288 unsigned short vlan_ctag;
23e4eef7
LT
289
290 u64 rx_tstamp;
5b9dfe29
LT
291
292 u32 rss_hash;
293 enum pkt_hash_types rss_hash_type;
5fb4b86a
LT
294
295 unsigned int tx_packets;
296 unsigned int tx_bytes;
c5aa9e3b
LT
297};
298
299/* Common Rx and Tx descriptor mapping */
300struct xgbe_ring_desc {
5226cfc5
LT
301 __le32 desc0;
302 __le32 desc1;
303 __le32 desc2;
304 __le32 desc3;
c5aa9e3b
LT
305};
306
08dcc47c
LT
307/* Page allocation related values */
308struct xgbe_page_alloc {
309 struct page *pages;
310 unsigned int pages_len;
311 unsigned int pages_offset;
312
313 dma_addr_t pages_dma;
314};
315
174fd259
LT
316/* Ring entry buffer data */
317struct xgbe_buffer_data {
318 struct xgbe_page_alloc pa;
319 struct xgbe_page_alloc pa_unmap;
320
cfbfd86b
LT
321 dma_addr_t dma_base;
322 unsigned long dma_off;
174fd259
LT
323 unsigned int dma_len;
324};
325
c9f140eb
LT
326/* Tx-related ring data */
327struct xgbe_tx_ring_data {
5fb4b86a
LT
328 unsigned int packets; /* BQL packet count */
329 unsigned int bytes; /* BQL byte count */
c9f140eb
LT
330};
331
332/* Rx-related ring data */
333struct xgbe_rx_ring_data {
334 struct xgbe_buffer_data hdr; /* Header locations */
335 struct xgbe_buffer_data buf; /* Payload locations */
336
337 unsigned short hdr_len; /* Length of received header */
338 unsigned short len; /* Length of received packet */
339};
340
c5aa9e3b
LT
341/* Structure used to hold information related to the descriptor
342 * and the packet associated with the descriptor (always use
d0a8ba6c 343 * use the XGBE_GET_DESC_DATA macro to access this data from the ring)
c5aa9e3b
LT
344 */
345struct xgbe_ring_data {
346 struct xgbe_ring_desc *rdesc; /* Virtual address of descriptor */
347 dma_addr_t rdesc_dma; /* DMA address of descriptor */
348
349 struct sk_buff *skb; /* Virtual address of SKB */
350 dma_addr_t skb_dma; /* DMA address of SKB data */
351 unsigned int skb_dma_len; /* Length of SKB DMA area */
c5aa9e3b 352
c9f140eb
LT
353 struct xgbe_tx_ring_data tx; /* Tx-related data */
354 struct xgbe_rx_ring_data rx; /* Rx-related data */
c5aa9e3b 355
c5aa9e3b 356 unsigned int mapped_as_page;
23e4eef7
LT
357
358 /* Incomplete receive save location. If the budget is exhausted
359 * or the last descriptor (last normal descriptor or a following
360 * context descriptor) has not been DMA'd yet the current state
361 * of the receive processing needs to be saved.
362 */
363 unsigned int state_saved;
364 struct {
23e4eef7
LT
365 struct sk_buff *skb;
366 unsigned int len;
367 unsigned int error;
368 } state;
c5aa9e3b
LT
369};
370
371struct xgbe_ring {
372 /* Ring lock - used just for TX rings at the moment */
373 spinlock_t lock;
374
375 /* Per packet related information */
376 struct xgbe_packet_data packet_data;
377
378 /* Virtual/DMA addresses and count of allocated descriptor memory */
379 struct xgbe_ring_desc *rdesc;
380 dma_addr_t rdesc_dma;
381 unsigned int rdesc_count;
382
383 /* Array of descriptor data corresponding the descriptor memory
d0a8ba6c 384 * (always use the XGBE_GET_DESC_DATA macro to access this data)
c5aa9e3b
LT
385 */
386 struct xgbe_ring_data *rdata;
387
08dcc47c 388 /* Page allocation for RX buffers */
174fd259
LT
389 struct xgbe_page_alloc rx_hdr_pa;
390 struct xgbe_page_alloc rx_buf_pa;
08dcc47c 391
c5aa9e3b
LT
392 /* Ring index values
393 * cur - Tx: index of descriptor to be used for current transfer
394 * Rx: index of descriptor to check for packet availability
395 * dirty - Tx: index of descriptor to check for transfer complete
270894e7 396 * Rx: index of descriptor to check for buffer reallocation
c5aa9e3b
LT
397 */
398 unsigned int cur;
399 unsigned int dirty;
400
401 /* Coalesce frame count used for interrupt bit setting */
402 unsigned int coalesce_count;
403
404 union {
405 struct {
406 unsigned int queue_stopped;
16958a2b 407 unsigned int xmit_more;
c5aa9e3b
LT
408 unsigned short cur_mss;
409 unsigned short cur_vlan_ctag;
410 } tx;
c5aa9e3b
LT
411 };
412} ____cacheline_aligned;
413
414/* Structure used to describe the descriptor rings associated with
415 * a DMA channel.
416 */
417struct xgbe_channel {
418 char name[16];
419
420 /* Address of private data area for device */
421 struct xgbe_prv_data *pdata;
422
423 /* Queue index and base address of queue's DMA registers */
424 unsigned int queue_index;
425 void __iomem *dma_regs;
426
9227dc5e
LT
427 /* Per channel interrupt irq number */
428 int dma_irq;
54ceb9ec 429 char dma_irq_name[IFNAMSIZ + 32];
9227dc5e
LT
430
431 /* Netdev related settings */
432 struct napi_struct napi;
433
c5aa9e3b
LT
434 unsigned int saved_ier;
435
436 unsigned int tx_timer_active;
c635eaac 437 struct timer_list tx_timer;
c5aa9e3b
LT
438
439 struct xgbe_ring *tx_ring;
440 struct xgbe_ring *rx_ring;
441} ____cacheline_aligned;
442
7c12aa08
LT
443enum xgbe_state {
444 XGBE_DOWN,
7c12aa08
LT
445 XGBE_LINK_INIT,
446 XGBE_LINK_ERR,
447};
448
c5aa9e3b 449enum xgbe_int {
c5aa9e3b
LT
450 XGMAC_INT_DMA_CH_SR_TI,
451 XGMAC_INT_DMA_CH_SR_TPS,
452 XGMAC_INT_DMA_CH_SR_TBU,
453 XGMAC_INT_DMA_CH_SR_RI,
454 XGMAC_INT_DMA_CH_SR_RBU,
455 XGMAC_INT_DMA_CH_SR_RPS,
9867e8fb 456 XGMAC_INT_DMA_CH_SR_TI_RI,
c5aa9e3b
LT
457 XGMAC_INT_DMA_CH_SR_FBE,
458 XGMAC_INT_DMA_ALL,
459};
460
461enum xgbe_int_state {
462 XGMAC_INT_STATE_SAVE,
463 XGMAC_INT_STATE_RESTORE,
464};
465
7c12aa08
LT
466enum xgbe_speed {
467 XGBE_SPEED_1000 = 0,
468 XGBE_SPEED_2500,
469 XGBE_SPEED_10000,
470 XGBE_SPEEDS,
471};
472
473enum xgbe_an {
474 XGBE_AN_READY = 0,
475 XGBE_AN_PAGE_RECEIVED,
476 XGBE_AN_INCOMPAT_LINK,
477 XGBE_AN_COMPLETE,
478 XGBE_AN_NO_LINK,
479 XGBE_AN_ERROR,
480};
481
482enum xgbe_rx {
483 XGBE_RX_BPA = 0,
484 XGBE_RX_XNP,
485 XGBE_RX_COMPLETE,
486 XGBE_RX_ERROR,
487};
488
489enum xgbe_mode {
e57f7a3f
LT
490 XGBE_MODE_KX_1000 = 0,
491 XGBE_MODE_KX_2500,
492 XGBE_MODE_KR,
493 XGBE_MODE_UNKNOWN,
7c12aa08
LT
494};
495
496enum xgbe_speedset {
497 XGBE_SPEEDSET_1000_10000 = 0,
498 XGBE_SPEEDSET_2500_10000,
499};
500
501struct xgbe_phy {
502 u32 supported;
503 u32 advertising;
504 u32 lp_advertising;
505
506 int address;
507
508 int autoneg;
509 int speed;
510 int duplex;
7c12aa08
LT
511
512 int link;
c1ce2f77
LT
513
514 int pause_autoneg;
515 int tx_pause;
516 int rx_pause;
7c12aa08
LT
517};
518
c5aa9e3b
LT
519struct xgbe_mmc_stats {
520 /* Tx Stats */
521 u64 txoctetcount_gb;
522 u64 txframecount_gb;
523 u64 txbroadcastframes_g;
524 u64 txmulticastframes_g;
525 u64 tx64octets_gb;
526 u64 tx65to127octets_gb;
527 u64 tx128to255octets_gb;
528 u64 tx256to511octets_gb;
529 u64 tx512to1023octets_gb;
530 u64 tx1024tomaxoctets_gb;
531 u64 txunicastframes_gb;
532 u64 txmulticastframes_gb;
533 u64 txbroadcastframes_gb;
534 u64 txunderflowerror;
535 u64 txoctetcount_g;
536 u64 txframecount_g;
537 u64 txpauseframes;
538 u64 txvlanframes_g;
539
540 /* Rx Stats */
541 u64 rxframecount_gb;
542 u64 rxoctetcount_gb;
543 u64 rxoctetcount_g;
544 u64 rxbroadcastframes_g;
545 u64 rxmulticastframes_g;
546 u64 rxcrcerror;
547 u64 rxrunterror;
548 u64 rxjabbererror;
549 u64 rxundersize_g;
550 u64 rxoversize_g;
551 u64 rx64octets_gb;
552 u64 rx65to127octets_gb;
553 u64 rx128to255octets_gb;
554 u64 rx256to511octets_gb;
555 u64 rx512to1023octets_gb;
556 u64 rx1024tomaxoctets_gb;
557 u64 rxunicastframes_g;
558 u64 rxlengtherror;
559 u64 rxoutofrangetype;
560 u64 rxpauseframes;
561 u64 rxfifooverflow;
562 u64 rxvlanframes_gb;
563 u64 rxwatchdogerror;
564};
565
5452b2df
LT
566struct xgbe_ext_stats {
567 u64 tx_tso_packets;
568 u64 rx_split_header_packets;
72c9ac4e 569 u64 rx_buffer_unavailable;
5452b2df
LT
570};
571
c5aa9e3b
LT
572struct xgbe_hw_if {
573 int (*tx_complete)(struct xgbe_ring_desc *);
574
c5aa9e3b 575 int (*set_mac_address)(struct xgbe_prv_data *, u8 *addr);
b876382b 576 int (*config_rx_mode)(struct xgbe_prv_data *);
c5aa9e3b
LT
577
578 int (*enable_rx_csum)(struct xgbe_prv_data *);
579 int (*disable_rx_csum)(struct xgbe_prv_data *);
580
581 int (*enable_rx_vlan_stripping)(struct xgbe_prv_data *);
582 int (*disable_rx_vlan_stripping)(struct xgbe_prv_data *);
801c62d9
LT
583 int (*enable_rx_vlan_filtering)(struct xgbe_prv_data *);
584 int (*disable_rx_vlan_filtering)(struct xgbe_prv_data *);
585 int (*update_vlan_hash_table)(struct xgbe_prv_data *);
c5aa9e3b
LT
586
587 int (*read_mmd_regs)(struct xgbe_prv_data *, int, int);
588 void (*write_mmd_regs)(struct xgbe_prv_data *, int, int, int);
e57f7a3f 589 int (*set_speed)(struct xgbe_prv_data *, int);
c5aa9e3b
LT
590
591 void (*enable_tx)(struct xgbe_prv_data *);
592 void (*disable_tx)(struct xgbe_prv_data *);
593 void (*enable_rx)(struct xgbe_prv_data *);
594 void (*disable_rx)(struct xgbe_prv_data *);
595
596 void (*powerup_tx)(struct xgbe_prv_data *);
597 void (*powerdown_tx)(struct xgbe_prv_data *);
598 void (*powerup_rx)(struct xgbe_prv_data *);
599 void (*powerdown_rx)(struct xgbe_prv_data *);
600
601 int (*init)(struct xgbe_prv_data *);
602 int (*exit)(struct xgbe_prv_data *);
603
604 int (*enable_int)(struct xgbe_channel *, enum xgbe_int);
605 int (*disable_int)(struct xgbe_channel *, enum xgbe_int);
a9d41981 606 void (*dev_xmit)(struct xgbe_channel *);
c5aa9e3b
LT
607 int (*dev_read)(struct xgbe_channel *);
608 void (*tx_desc_init)(struct xgbe_channel *);
609 void (*rx_desc_init)(struct xgbe_channel *);
c5aa9e3b 610 void (*tx_desc_reset)(struct xgbe_ring_data *);
8dee19e6
LT
611 void (*rx_desc_reset)(struct xgbe_prv_data *, struct xgbe_ring_data *,
612 unsigned int);
c5aa9e3b
LT
613 int (*is_last_desc)(struct xgbe_ring_desc *);
614 int (*is_context_desc)(struct xgbe_ring_desc *);
16958a2b 615 void (*tx_start_xmit)(struct xgbe_channel *, struct xgbe_ring *);
c5aa9e3b
LT
616
617 /* For FLOW ctrl */
618 int (*config_tx_flow_control)(struct xgbe_prv_data *);
619 int (*config_rx_flow_control)(struct xgbe_prv_data *);
620
621 /* For RX coalescing */
622 int (*config_rx_coalesce)(struct xgbe_prv_data *);
623 int (*config_tx_coalesce)(struct xgbe_prv_data *);
624 unsigned int (*usec_to_riwt)(struct xgbe_prv_data *, unsigned int);
625 unsigned int (*riwt_to_usec)(struct xgbe_prv_data *, unsigned int);
626
627 /* For RX and TX threshold config */
628 int (*config_rx_threshold)(struct xgbe_prv_data *, unsigned int);
629 int (*config_tx_threshold)(struct xgbe_prv_data *, unsigned int);
630
631 /* For RX and TX Store and Forward Mode config */
632 int (*config_rsf_mode)(struct xgbe_prv_data *, unsigned int);
633 int (*config_tsf_mode)(struct xgbe_prv_data *, unsigned int);
634
635 /* For TX DMA Operate on Second Frame config */
636 int (*config_osp_mode)(struct xgbe_prv_data *);
637
638 /* For RX and TX PBL config */
639 int (*config_rx_pbl_val)(struct xgbe_prv_data *);
640 int (*get_rx_pbl_val)(struct xgbe_prv_data *);
641 int (*config_tx_pbl_val)(struct xgbe_prv_data *);
642 int (*get_tx_pbl_val)(struct xgbe_prv_data *);
643 int (*config_pblx8)(struct xgbe_prv_data *);
644
645 /* For MMC statistics */
646 void (*rx_mmc_int)(struct xgbe_prv_data *);
647 void (*tx_mmc_int)(struct xgbe_prv_data *);
648 void (*read_mmc_stats)(struct xgbe_prv_data *);
23e4eef7
LT
649
650 /* For Timestamp config */
651 int (*config_tstamp)(struct xgbe_prv_data *, unsigned int);
652 void (*update_tstamp_addend)(struct xgbe_prv_data *, unsigned int);
653 void (*set_tstamp_time)(struct xgbe_prv_data *, unsigned int sec,
654 unsigned int nsec);
655 u64 (*get_tstamp_time)(struct xgbe_prv_data *);
656 u64 (*get_tx_tstamp)(struct xgbe_prv_data *);
fca2d994
LT
657
658 /* For Data Center Bridging config */
b3b71597 659 void (*config_tc)(struct xgbe_prv_data *);
fca2d994
LT
660 void (*config_dcb_tc)(struct xgbe_prv_data *);
661 void (*config_dcb_pfc)(struct xgbe_prv_data *);
5b9dfe29
LT
662
663 /* For Receive Side Scaling */
664 int (*enable_rss)(struct xgbe_prv_data *);
665 int (*disable_rss)(struct xgbe_prv_data *);
f6ac8628
LT
666 int (*set_rss_hash_key)(struct xgbe_prv_data *, const u8 *);
667 int (*set_rss_lookup_table)(struct xgbe_prv_data *, const u32 *);
c5aa9e3b
LT
668};
669
e57f7a3f
LT
670/* This structure represents implementation specific routines for an
671 * implementation of a PHY. All routines are required unless noted below.
672 * Optional routines:
673 * kr_training_pre, kr_training_post
674 */
675struct xgbe_phy_impl_if {
676 /* Perform Setup/teardown actions */
677 int (*init)(struct xgbe_prv_data *);
678 void (*exit)(struct xgbe_prv_data *);
679
680 /* Perform start/stop specific actions */
681 int (*reset)(struct xgbe_prv_data *);
682 int (*start)(struct xgbe_prv_data *);
683 void (*stop)(struct xgbe_prv_data *);
684
685 /* Return the link status */
686 int (*link_status)(struct xgbe_prv_data *);
687
688 /* Indicate if a particular speed is valid */
689 bool (*valid_speed)(struct xgbe_prv_data *, int);
690
691 /* Check if the specified mode can/should be used */
692 bool (*use_mode)(struct xgbe_prv_data *, enum xgbe_mode);
693 /* Switch the PHY into various modes */
694 void (*set_mode)(struct xgbe_prv_data *, enum xgbe_mode);
695 /* Retrieve mode needed for a specific speed */
696 enum xgbe_mode (*get_mode)(struct xgbe_prv_data *, int);
697 /* Retrieve new/next mode when trying to auto-negotiate */
698 enum xgbe_mode (*switch_mode)(struct xgbe_prv_data *);
699 /* Retrieve current mode */
700 enum xgbe_mode (*cur_mode)(struct xgbe_prv_data *);
701
702 /* Process results of auto-negotiation */
703 enum xgbe_mode (*an_outcome)(struct xgbe_prv_data *);
704
705 /* Pre/Post KR training enablement support */
706 void (*kr_training_pre)(struct xgbe_prv_data *);
707 void (*kr_training_post)(struct xgbe_prv_data *);
708};
709
7c12aa08 710struct xgbe_phy_if {
e57f7a3f
LT
711 /* For PHY setup/teardown */
712 int (*phy_init)(struct xgbe_prv_data *);
713 void (*phy_exit)(struct xgbe_prv_data *);
7c12aa08
LT
714
715 /* For PHY support when setting device up/down */
716 int (*phy_reset)(struct xgbe_prv_data *);
717 int (*phy_start)(struct xgbe_prv_data *);
718 void (*phy_stop)(struct xgbe_prv_data *);
719
720 /* For PHY support while device is up */
721 void (*phy_status)(struct xgbe_prv_data *);
722 int (*phy_config_aneg)(struct xgbe_prv_data *);
e57f7a3f
LT
723
724 /* For PHY settings validation */
725 bool (*phy_valid_speed)(struct xgbe_prv_data *, int);
726
727 /* PHY implementation specific services */
728 struct xgbe_phy_impl_if phy_impl;
7c12aa08
LT
729};
730
c5aa9e3b
LT
731struct xgbe_desc_if {
732 int (*alloc_ring_resources)(struct xgbe_prv_data *);
733 void (*free_ring_resources)(struct xgbe_prv_data *);
734 int (*map_tx_skb)(struct xgbe_channel *, struct sk_buff *);
270894e7
LT
735 int (*map_rx_buffer)(struct xgbe_prv_data *, struct xgbe_ring *,
736 struct xgbe_ring_data *);
08dcc47c 737 void (*unmap_rdata)(struct xgbe_prv_data *, struct xgbe_ring_data *);
c5aa9e3b
LT
738 void (*wrapper_tx_desc_init)(struct xgbe_prv_data *);
739 void (*wrapper_rx_desc_init)(struct xgbe_prv_data *);
740};
741
742/* This structure contains flags that indicate what hardware features
743 * or configurations are present in the device.
744 */
745struct xgbe_hw_features {
a9a4a2d9
LT
746 /* HW Version */
747 unsigned int version;
748
c5aa9e3b
LT
749 /* HW Feature Register0 */
750 unsigned int gmii; /* 1000 Mbps support */
751 unsigned int vlhash; /* VLAN Hash Filter */
752 unsigned int sma; /* SMA(MDIO) Interface */
753 unsigned int rwk; /* PMT remote wake-up packet */
754 unsigned int mgk; /* PMT magic packet */
755 unsigned int mmc; /* RMON module */
756 unsigned int aoe; /* ARP Offload */
dbedd44e 757 unsigned int ts; /* IEEE 1588-2008 Advanced Timestamp */
c5aa9e3b
LT
758 unsigned int eee; /* Energy Efficient Ethernet */
759 unsigned int tx_coe; /* Tx Checksum Offload */
760 unsigned int rx_coe; /* Rx Checksum Offload */
761 unsigned int addn_mac; /* Additional MAC Addresses */
762 unsigned int ts_src; /* Timestamp Source */
763 unsigned int sa_vlan_ins; /* Source Address or VLAN Insertion */
764
765 /* HW Feature Register1 */
766 unsigned int rx_fifo_size; /* MTL Receive FIFO Size */
767 unsigned int tx_fifo_size; /* MTL Transmit FIFO Size */
768 unsigned int adv_ts_hi; /* Advance Timestamping High Word */
386d325d 769 unsigned int dma_width; /* DMA width */
c5aa9e3b
LT
770 unsigned int dcb; /* DCB Feature */
771 unsigned int sph; /* Split Header Feature */
772 unsigned int tso; /* TCP Segmentation Offload */
773 unsigned int dma_debug; /* DMA Debug Registers */
774 unsigned int rss; /* Receive Side Scaling */
fca2d994 775 unsigned int tc_cnt; /* Number of Traffic Classes */
c5aa9e3b
LT
776 unsigned int hash_table_size; /* Hash Table Size */
777 unsigned int l3l4_filter_num; /* Number of L3-L4 Filters */
778
779 /* HW Feature Register2 */
780 unsigned int rx_q_cnt; /* Number of MTL Receive Queues */
781 unsigned int tx_q_cnt; /* Number of MTL Transmit Queues */
782 unsigned int rx_ch_cnt; /* Number of DMA Receive Channels */
783 unsigned int tx_ch_cnt; /* Number of DMA Transmit Channels */
784 unsigned int pps_out_num; /* Number of PPS outputs */
785 unsigned int aux_snap_num; /* Number of Aux snapshot inputs */
786};
787
e57f7a3f
LT
788struct xgbe_version_data {
789 void (*init_function_ptrs_phy_impl)(struct xgbe_phy_if *);
790};
791
c5aa9e3b
LT
792struct xgbe_prv_data {
793 struct net_device *netdev;
794 struct platform_device *pdev;
82a19035 795 struct acpi_device *adev;
c5aa9e3b 796 struct device *dev;
e57f7a3f
LT
797 struct platform_device *phy_pdev;
798 struct device *phy_dev;
799
800 /* Version related data */
801 struct xgbe_version_data *vdata;
c5aa9e3b 802
82a19035
LT
803 /* ACPI or DT flag */
804 unsigned int use_acpi;
805
c5aa9e3b
LT
806 /* XGMAC/XPCS related mmio registers */
807 void __iomem *xgmac_regs; /* XGMAC CSRs */
808 void __iomem *xpcs_regs; /* XPCS MMD registers */
7c12aa08
LT
809 void __iomem *rxtx_regs; /* SerDes Rx/Tx CSRs */
810 void __iomem *sir0_regs; /* SerDes integration registers (1/2) */
811 void __iomem *sir1_regs; /* SerDes integration registers (2/2) */
c5aa9e3b
LT
812
813 /* Overall device lock */
814 spinlock_t lock;
815
ced3fcae
LT
816 /* XPCS indirect addressing lock */
817 spinlock_t xpcs_lock;
c5aa9e3b 818
5b9dfe29
LT
819 /* RSS addressing mutex */
820 struct mutex rss_mutex;
821
7c12aa08
LT
822 /* Flags representing xgbe_state */
823 unsigned long dev_state;
824
9227dc5e
LT
825 int dev_irq;
826 unsigned int per_channel_irq;
c5aa9e3b
LT
827
828 struct xgbe_hw_if hw_if;
7c12aa08 829 struct xgbe_phy_if phy_if;
c5aa9e3b
LT
830 struct xgbe_desc_if desc_if;
831
cfa50c78 832 /* AXI DMA settings */
82a19035 833 unsigned int coherent;
cfa50c78
LT
834 unsigned int axdomain;
835 unsigned int arcache;
836 unsigned int awcache;
837
7c12aa08
LT
838 /* Service routine support */
839 struct workqueue_struct *dev_workqueue;
840 struct work_struct service_work;
841 struct timer_list service_timer;
842
c5aa9e3b
LT
843 /* Rings for Tx/Rx on a DMA channel */
844 struct xgbe_channel *channel;
845 unsigned int channel_count;
846 unsigned int tx_ring_count;
847 unsigned int tx_desc_count;
848 unsigned int rx_ring_count;
849 unsigned int rx_desc_count;
850
853eb16b
LT
851 unsigned int tx_q_count;
852 unsigned int rx_q_count;
853
c5aa9e3b
LT
854 /* Tx/Rx common settings */
855 unsigned int pblx8;
856
857 /* Tx settings */
858 unsigned int tx_sf_mode;
859 unsigned int tx_threshold;
860 unsigned int tx_pbl;
861 unsigned int tx_osp_mode;
862
863 /* Rx settings */
864 unsigned int rx_sf_mode;
865 unsigned int rx_threshold;
866 unsigned int rx_pbl;
867
868 /* Tx coalescing settings */
869 unsigned int tx_usecs;
870 unsigned int tx_frames;
871
872 /* Rx coalescing settings */
873 unsigned int rx_riwt;
4a57ebcc 874 unsigned int rx_usecs;
c5aa9e3b
LT
875 unsigned int rx_frames;
876
08dcc47c 877 /* Current Rx buffer size */
c5aa9e3b
LT
878 unsigned int rx_buf_size;
879
880 /* Flow control settings */
881 unsigned int pause_autoneg;
882 unsigned int tx_pause;
883 unsigned int rx_pause;
43e0dcf7
LT
884 unsigned int rx_rfa[XGBE_MAX_QUEUES];
885 unsigned int rx_rfd[XGBE_MAX_QUEUES];
c5aa9e3b 886
5b9dfe29
LT
887 /* Receive Side Scaling settings */
888 u8 rss_key[XGBE_RSS_HASH_KEY_SIZE];
889 u32 rss_table[XGBE_RSS_MAX_TABLE_SIZE];
890 u32 rss_options;
891
c5aa9e3b 892 /* Netdev related settings */
82a19035 893 unsigned char mac_addr[ETH_ALEN];
c5aa9e3b
LT
894 netdev_features_t netdev_features;
895 struct napi_struct napi;
896 struct xgbe_mmc_stats mmc_stats;
5452b2df 897 struct xgbe_ext_stats ext_stats;
c5aa9e3b 898
801c62d9
LT
899 /* Filtering support */
900 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
901
23e4eef7
LT
902 /* Device clocks */
903 struct clk *sysclk;
82a19035 904 unsigned long sysclk_rate;
23e4eef7 905 struct clk *ptpclk;
82a19035 906 unsigned long ptpclk_rate;
23e4eef7
LT
907
908 /* Timestamp support */
909 spinlock_t tstamp_lock;
910 struct ptp_clock_info ptp_clock_info;
911 struct ptp_clock *ptp_clock;
912 struct hwtstamp_config tstamp_config;
913 struct cyclecounter tstamp_cc;
914 struct timecounter tstamp_tc;
915 unsigned int tstamp_addend;
916 struct work_struct tx_tstamp_work;
917 struct sk_buff *tx_tstamp_skb;
918 u64 tx_tstamp;
c5aa9e3b 919
fca2d994
LT
920 /* DCB support */
921 struct ieee_ets *ets;
922 struct ieee_pfc *pfc;
923 unsigned int q2tc_map[XGBE_MAX_QUEUES];
924 unsigned int prio2q_map[IEEE_8021QAZ_MAX_TCS];
43e0dcf7
LT
925 unsigned int pfcq[XGBE_MAX_QUEUES];
926 unsigned int pfc_rfa;
b3b71597 927 u8 num_tcs;
fca2d994 928
c5aa9e3b
LT
929 /* Hardware features of the device */
930 struct xgbe_hw_features hw_feat;
931
932 /* Device restart work structure */
933 struct work_struct restart_work;
934
935 /* Keeps track of power mode */
936 unsigned int power_down;
937
34bf65df
LT
938 /* Network interface message level setting */
939 u32 msg_enable;
940
7c12aa08
LT
941 /* Current PHY settings */
942 phy_interface_t phy_mode;
943 int phy_link;
944 int phy_speed;
7c12aa08
LT
945
946 /* MDIO/PHY related settings */
e57f7a3f
LT
947 unsigned int phy_started;
948 void *phy_data;
7c12aa08
LT
949 struct xgbe_phy phy;
950 int mdio_mmd;
951 unsigned long link_check;
952
953 char an_name[IFNAMSIZ + 32];
954 struct workqueue_struct *an_workqueue;
955
956 int an_irq;
957 struct work_struct an_irq_work;
958
7c12aa08 959 /* Auto-negotiation state machine support */
ced3fcae 960 unsigned int an_int;
7c12aa08
LT
961 struct mutex an_mutex;
962 enum xgbe_an an_result;
963 enum xgbe_an an_state;
964 enum xgbe_rx kr_state;
965 enum xgbe_rx kx_state;
966 struct work_struct an_work;
967 unsigned int an_supported;
968 unsigned int parallel_detect;
969 unsigned int fec_ability;
970 unsigned long an_start;
971
972 unsigned int lpm_ctrl; /* CTRL1 for resume */
973
c5aa9e3b
LT
974#ifdef CONFIG_DEBUG_FS
975 struct dentry *xgbe_debugfs;
976
977 unsigned int debugfs_xgmac_reg;
978
979 unsigned int debugfs_xpcs_mmd;
980 unsigned int debugfs_xpcs_reg;
981#endif
982};
983
984/* Function prototypes*/
985
986void xgbe_init_function_ptrs_dev(struct xgbe_hw_if *);
7c12aa08 987void xgbe_init_function_ptrs_phy(struct xgbe_phy_if *);
e57f7a3f 988void xgbe_init_function_ptrs_phy_v1(struct xgbe_phy_if *);
c5aa9e3b 989void xgbe_init_function_ptrs_desc(struct xgbe_desc_if *);
ce0b15d1 990const struct net_device_ops *xgbe_get_netdev_ops(void);
991const struct ethtool_ops *xgbe_get_ethtool_ops(void);
992
fca2d994
LT
993#ifdef CONFIG_AMD_XGBE_DCB
994const struct dcbnl_rtnl_ops *xgbe_get_dcbnl_ops(void);
995#endif
c5aa9e3b 996
23e4eef7
LT
997void xgbe_ptp_register(struct xgbe_prv_data *);
998void xgbe_ptp_unregister(struct xgbe_prv_data *);
34bf65df
LT
999void xgbe_dump_tx_desc(struct xgbe_prv_data *, struct xgbe_ring *,
1000 unsigned int, unsigned int, unsigned int);
1001void xgbe_dump_rx_desc(struct xgbe_prv_data *, struct xgbe_ring *,
c5aa9e3b
LT
1002 unsigned int);
1003void xgbe_print_pkt(struct net_device *, struct sk_buff *, bool);
1004void xgbe_get_all_hw_features(struct xgbe_prv_data *);
1005int xgbe_powerup(struct net_device *, unsigned int);
1006int xgbe_powerdown(struct net_device *, unsigned int);
1007void xgbe_init_rx_coalesce(struct xgbe_prv_data *);
1008void xgbe_init_tx_coalesce(struct xgbe_prv_data *);
1009
1010#ifdef CONFIG_DEBUG_FS
1011void xgbe_debugfs_init(struct xgbe_prv_data *);
1012void xgbe_debugfs_exit(struct xgbe_prv_data *);
1013#else
1014static inline void xgbe_debugfs_init(struct xgbe_prv_data *pdata) {}
1015static inline void xgbe_debugfs_exit(struct xgbe_prv_data *pdata) {}
1016#endif /* CONFIG_DEBUG_FS */
1017
c5aa9e3b
LT
1018/* NOTE: Uncomment for function trace log messages in KERNEL LOG */
1019#if 0
1020#define YDEBUG
1021#define YDEBUG_MDIO
1022#endif
1023
1024/* For debug prints */
1025#ifdef YDEBUG
1026#define DBGPR(x...) pr_alert(x)
c5aa9e3b
LT
1027#else
1028#define DBGPR(x...) do { } while (0)
c5aa9e3b
LT
1029#endif
1030
1031#ifdef YDEBUG_MDIO
1032#define DBGPR_MDIO(x...) pr_alert(x)
1033#else
1034#define DBGPR_MDIO(x...) do { } while (0)
1035#endif
1036
1037#endif