Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 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 | * |
| 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, Thomas | 801c62d | 2014-06-24 16:19:24 -0500 | [diff] [blame] | 124 | #include <linux/if_vlan.h> |
| 125 | #include <linux/bitops.h> |
Lendacky, Thomas | 23e4eef | 2014-07-29 08:57:19 -0500 | [diff] [blame] | 126 | #include <linux/ptp_clock_kernel.h> |
| 127 | #include <linux/clocksource.h> |
| 128 | #include <linux/net_tstamp.h> |
Lendacky, Thomas | fca2d99 | 2014-07-29 08:57:55 -0500 | [diff] [blame] | 129 | #include <net/dcbnl.h> |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 130 | |
| 131 | |
| 132 | #define XGBE_DRV_NAME "amd-xgbe" |
| 133 | #define XGBE_DRV_VERSION "1.0.0-a" |
| 134 | #define XGBE_DRV_DESC "AMD 10 Gigabit Ethernet Driver" |
| 135 | |
| 136 | /* Descriptor related defines */ |
Lendacky, Thomas | d0a8ba6 | 2014-06-24 16:19:06 -0500 | [diff] [blame] | 137 | #define XGBE_TX_DESC_CNT 512 |
| 138 | #define XGBE_TX_DESC_MIN_FREE (XGBE_TX_DESC_CNT >> 3) |
| 139 | #define XGBE_TX_DESC_MAX_PROC (XGBE_TX_DESC_CNT >> 1) |
| 140 | #define XGBE_RX_DESC_CNT 512 |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 141 | |
Lendacky, Thomas | d0a8ba6 | 2014-06-24 16:19:06 -0500 | [diff] [blame] | 142 | #define XGBE_TX_MAX_BUF_SIZE (0x3fff & ~(64 - 1)) |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 143 | |
Lendacky, Thomas | d0a8ba6 | 2014-06-24 16:19:06 -0500 | [diff] [blame] | 144 | #define XGBE_RX_MIN_BUF_SIZE (ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN) |
| 145 | #define XGBE_RX_BUF_ALIGN 64 |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 146 | |
Lendacky, Thomas | d5c4858 | 2014-06-09 09:19:32 -0500 | [diff] [blame] | 147 | #define XGBE_MAX_DMA_CHANNELS 16 |
Lendacky, Thomas | fca2d99 | 2014-07-29 08:57:55 -0500 | [diff] [blame] | 148 | #define XGBE_MAX_QUEUES 16 |
Lendacky, Thomas | d0a8ba6 | 2014-06-24 16:19:06 -0500 | [diff] [blame] | 149 | |
| 150 | /* DMA cache settings - Outer sharable, write-back, write-allocate */ |
Lendacky, Thomas | cfa50c7 | 2014-07-02 13:04:57 -0500 | [diff] [blame] | 151 | #define XGBE_DMA_OS_AXDOMAIN 0x2 |
| 152 | #define XGBE_DMA_OS_ARCACHE 0xb |
| 153 | #define XGBE_DMA_OS_AWCACHE 0xf |
| 154 | |
| 155 | /* DMA cache settings - System, no caches used */ |
| 156 | #define XGBE_DMA_SYS_AXDOMAIN 0x3 |
| 157 | #define XGBE_DMA_SYS_ARCACHE 0x0 |
| 158 | #define XGBE_DMA_SYS_AWCACHE 0x0 |
Lendacky, Thomas | d0a8ba6 | 2014-06-24 16:19:06 -0500 | [diff] [blame] | 159 | |
| 160 | #define XGBE_DMA_INTERRUPT_MASK 0x31c7 |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 161 | |
| 162 | #define XGMAC_MIN_PACKET 60 |
| 163 | #define XGMAC_STD_PACKET_MTU 1500 |
| 164 | #define XGMAC_MAX_STD_PACKET 1518 |
| 165 | #define XGMAC_JUMBO_PACKET_MTU 9000 |
| 166 | #define XGMAC_MAX_JUMBO_PACKET 9018 |
| 167 | |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 168 | /* MDIO bus phy name */ |
| 169 | #define XGBE_PHY_NAME "amd_xgbe_phy" |
| 170 | #define XGBE_PRTAD 0 |
| 171 | |
Lendacky, Thomas | 23e4eef | 2014-07-29 08:57:19 -0500 | [diff] [blame] | 172 | /* Device-tree clock names */ |
| 173 | #define XGBE_DMA_CLOCK "dma_clk" |
| 174 | #define XGBE_PTP_CLOCK "ptp_clk" |
| 175 | |
| 176 | /* Timestamp support - values based on 50MHz PTP clock |
| 177 | * 50MHz => 20 nsec |
| 178 | */ |
| 179 | #define XGBE_TSTAMP_SSINC 20 |
| 180 | #define XGBE_TSTAMP_SNSINC 0 |
| 181 | |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 182 | /* Driver PMT macros */ |
| 183 | #define XGMAC_DRIVER_CONTEXT 1 |
| 184 | #define XGMAC_IOCTL_CONTEXT 2 |
| 185 | |
Lendacky, Thomas | d0a8ba6 | 2014-06-24 16:19:06 -0500 | [diff] [blame] | 186 | #define XGBE_FIFO_SIZE_B(x) (x) |
| 187 | #define XGBE_FIFO_SIZE_KB(x) (x * 1024) |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 188 | |
Lendacky, Thomas | fca2d99 | 2014-07-29 08:57:55 -0500 | [diff] [blame] | 189 | #define XGBE_TC_MIN_QUANTUM 10 |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 190 | |
| 191 | /* Helper macro for descriptor handling |
Lendacky, Thomas | d0a8ba6 | 2014-06-24 16:19:06 -0500 | [diff] [blame] | 192 | * Always use XGBE_GET_DESC_DATA to access the descriptor data |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 193 | * since the index is free-running and needs to be and-ed |
| 194 | * with the descriptor count value of the ring to index to |
| 195 | * the proper descriptor data. |
| 196 | */ |
Lendacky, Thomas | d0a8ba6 | 2014-06-24 16:19:06 -0500 | [diff] [blame] | 197 | #define XGBE_GET_DESC_DATA(_ring, _idx) \ |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 198 | ((_ring)->rdata + \ |
| 199 | ((_idx) & ((_ring)->rdesc_count - 1))) |
| 200 | |
| 201 | |
| 202 | /* Default coalescing parameters */ |
Lendacky, Thomas | 9867e8f | 2014-07-02 13:04:46 -0500 | [diff] [blame] | 203 | #define XGMAC_INIT_DMA_TX_USECS 50 |
| 204 | #define XGMAC_INIT_DMA_TX_FRAMES 25 |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 205 | |
| 206 | #define XGMAC_MAX_DMA_RIWT 0xff |
Lendacky, Thomas | 9867e8f | 2014-07-02 13:04:46 -0500 | [diff] [blame] | 207 | #define XGMAC_INIT_DMA_RX_USECS 30 |
| 208 | #define XGMAC_INIT_DMA_RX_FRAMES 25 |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 209 | |
| 210 | /* Flow control queue count */ |
| 211 | #define XGMAC_MAX_FLOW_CONTROL_QUEUES 8 |
| 212 | |
Lendacky, Thomas | b85e4d8 | 2014-06-24 16:19:29 -0500 | [diff] [blame] | 213 | /* Maximum MAC address hash table size (256 bits = 8 bytes) */ |
| 214 | #define XGBE_MAC_HASH_TABLE_SIZE 8 |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 215 | |
| 216 | struct xgbe_prv_data; |
| 217 | |
| 218 | struct xgbe_packet_data { |
| 219 | unsigned int attributes; |
| 220 | |
| 221 | unsigned int errors; |
| 222 | |
| 223 | unsigned int rdesc_count; |
| 224 | unsigned int length; |
| 225 | |
| 226 | unsigned int header_len; |
| 227 | unsigned int tcp_header_len; |
| 228 | unsigned int tcp_payload_len; |
| 229 | unsigned short mss; |
| 230 | |
| 231 | unsigned short vlan_ctag; |
Lendacky, Thomas | 23e4eef | 2014-07-29 08:57:19 -0500 | [diff] [blame] | 232 | |
| 233 | u64 rx_tstamp; |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 234 | }; |
| 235 | |
| 236 | /* Common Rx and Tx descriptor mapping */ |
| 237 | struct xgbe_ring_desc { |
| 238 | unsigned int desc0; |
| 239 | unsigned int desc1; |
| 240 | unsigned int desc2; |
| 241 | unsigned int desc3; |
| 242 | }; |
| 243 | |
| 244 | /* Structure used to hold information related to the descriptor |
| 245 | * and the packet associated with the descriptor (always use |
Lendacky, Thomas | d0a8ba6 | 2014-06-24 16:19:06 -0500 | [diff] [blame] | 246 | * use the XGBE_GET_DESC_DATA macro to access this data from the ring) |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 247 | */ |
| 248 | struct xgbe_ring_data { |
| 249 | struct xgbe_ring_desc *rdesc; /* Virtual address of descriptor */ |
| 250 | dma_addr_t rdesc_dma; /* DMA address of descriptor */ |
| 251 | |
| 252 | struct sk_buff *skb; /* Virtual address of SKB */ |
| 253 | dma_addr_t skb_dma; /* DMA address of SKB data */ |
| 254 | unsigned int skb_dma_len; /* Length of SKB DMA area */ |
| 255 | unsigned int tso_header; /* TSO header indicator */ |
| 256 | |
| 257 | unsigned short len; /* Length of received Rx packet */ |
| 258 | |
| 259 | unsigned int interrupt; /* Interrupt indicator */ |
| 260 | |
| 261 | unsigned int mapped_as_page; |
Lendacky, Thomas | 23e4eef | 2014-07-29 08:57:19 -0500 | [diff] [blame] | 262 | |
| 263 | /* Incomplete receive save location. If the budget is exhausted |
| 264 | * or the last descriptor (last normal descriptor or a following |
| 265 | * context descriptor) has not been DMA'd yet the current state |
| 266 | * of the receive processing needs to be saved. |
| 267 | */ |
| 268 | unsigned int state_saved; |
| 269 | struct { |
| 270 | unsigned int incomplete; |
| 271 | unsigned int context_next; |
| 272 | struct sk_buff *skb; |
| 273 | unsigned int len; |
| 274 | unsigned int error; |
| 275 | } state; |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 276 | }; |
| 277 | |
| 278 | struct xgbe_ring { |
| 279 | /* Ring lock - used just for TX rings at the moment */ |
| 280 | spinlock_t lock; |
| 281 | |
| 282 | /* Per packet related information */ |
| 283 | struct xgbe_packet_data packet_data; |
| 284 | |
| 285 | /* Virtual/DMA addresses and count of allocated descriptor memory */ |
| 286 | struct xgbe_ring_desc *rdesc; |
| 287 | dma_addr_t rdesc_dma; |
| 288 | unsigned int rdesc_count; |
| 289 | |
| 290 | /* Array of descriptor data corresponding the descriptor memory |
Lendacky, Thomas | d0a8ba6 | 2014-06-24 16:19:06 -0500 | [diff] [blame] | 291 | * (always use the XGBE_GET_DESC_DATA macro to access this data) |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 292 | */ |
| 293 | struct xgbe_ring_data *rdata; |
| 294 | |
| 295 | /* Ring index values |
| 296 | * cur - Tx: index of descriptor to be used for current transfer |
| 297 | * Rx: index of descriptor to check for packet availability |
| 298 | * dirty - Tx: index of descriptor to check for transfer complete |
| 299 | * Rx: count of descriptors in which a packet has been received |
| 300 | * (used with skb_realloc_index to refresh the ring) |
| 301 | */ |
| 302 | unsigned int cur; |
| 303 | unsigned int dirty; |
| 304 | |
| 305 | /* Coalesce frame count used for interrupt bit setting */ |
| 306 | unsigned int coalesce_count; |
| 307 | |
| 308 | union { |
| 309 | struct { |
| 310 | unsigned int queue_stopped; |
| 311 | unsigned short cur_mss; |
| 312 | unsigned short cur_vlan_ctag; |
| 313 | } tx; |
| 314 | |
| 315 | struct { |
| 316 | unsigned int realloc_index; |
| 317 | unsigned int realloc_threshold; |
| 318 | } rx; |
| 319 | }; |
| 320 | } ____cacheline_aligned; |
| 321 | |
| 322 | /* Structure used to describe the descriptor rings associated with |
| 323 | * a DMA channel. |
| 324 | */ |
| 325 | struct xgbe_channel { |
| 326 | char name[16]; |
| 327 | |
| 328 | /* Address of private data area for device */ |
| 329 | struct xgbe_prv_data *pdata; |
| 330 | |
| 331 | /* Queue index and base address of queue's DMA registers */ |
| 332 | unsigned int queue_index; |
| 333 | void __iomem *dma_regs; |
| 334 | |
| 335 | unsigned int saved_ier; |
| 336 | |
| 337 | unsigned int tx_timer_active; |
| 338 | struct hrtimer tx_timer; |
| 339 | |
| 340 | struct xgbe_ring *tx_ring; |
| 341 | struct xgbe_ring *rx_ring; |
| 342 | } ____cacheline_aligned; |
| 343 | |
| 344 | enum xgbe_int { |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 345 | XGMAC_INT_DMA_CH_SR_TI, |
| 346 | XGMAC_INT_DMA_CH_SR_TPS, |
| 347 | XGMAC_INT_DMA_CH_SR_TBU, |
| 348 | XGMAC_INT_DMA_CH_SR_RI, |
| 349 | XGMAC_INT_DMA_CH_SR_RBU, |
| 350 | XGMAC_INT_DMA_CH_SR_RPS, |
Lendacky, Thomas | 9867e8f | 2014-07-02 13:04:46 -0500 | [diff] [blame] | 351 | XGMAC_INT_DMA_CH_SR_TI_RI, |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 352 | XGMAC_INT_DMA_CH_SR_FBE, |
| 353 | XGMAC_INT_DMA_ALL, |
| 354 | }; |
| 355 | |
| 356 | enum xgbe_int_state { |
| 357 | XGMAC_INT_STATE_SAVE, |
| 358 | XGMAC_INT_STATE_RESTORE, |
| 359 | }; |
| 360 | |
| 361 | enum xgbe_mtl_fifo_size { |
| 362 | XGMAC_MTL_FIFO_SIZE_256 = 0x00, |
| 363 | XGMAC_MTL_FIFO_SIZE_512 = 0x01, |
| 364 | XGMAC_MTL_FIFO_SIZE_1K = 0x03, |
| 365 | XGMAC_MTL_FIFO_SIZE_2K = 0x07, |
| 366 | XGMAC_MTL_FIFO_SIZE_4K = 0x0f, |
| 367 | XGMAC_MTL_FIFO_SIZE_8K = 0x1f, |
| 368 | XGMAC_MTL_FIFO_SIZE_16K = 0x3f, |
| 369 | XGMAC_MTL_FIFO_SIZE_32K = 0x7f, |
| 370 | XGMAC_MTL_FIFO_SIZE_64K = 0xff, |
| 371 | XGMAC_MTL_FIFO_SIZE_128K = 0x1ff, |
| 372 | XGMAC_MTL_FIFO_SIZE_256K = 0x3ff, |
| 373 | }; |
| 374 | |
| 375 | struct xgbe_mmc_stats { |
| 376 | /* Tx Stats */ |
| 377 | u64 txoctetcount_gb; |
| 378 | u64 txframecount_gb; |
| 379 | u64 txbroadcastframes_g; |
| 380 | u64 txmulticastframes_g; |
| 381 | u64 tx64octets_gb; |
| 382 | u64 tx65to127octets_gb; |
| 383 | u64 tx128to255octets_gb; |
| 384 | u64 tx256to511octets_gb; |
| 385 | u64 tx512to1023octets_gb; |
| 386 | u64 tx1024tomaxoctets_gb; |
| 387 | u64 txunicastframes_gb; |
| 388 | u64 txmulticastframes_gb; |
| 389 | u64 txbroadcastframes_gb; |
| 390 | u64 txunderflowerror; |
| 391 | u64 txoctetcount_g; |
| 392 | u64 txframecount_g; |
| 393 | u64 txpauseframes; |
| 394 | u64 txvlanframes_g; |
| 395 | |
| 396 | /* Rx Stats */ |
| 397 | u64 rxframecount_gb; |
| 398 | u64 rxoctetcount_gb; |
| 399 | u64 rxoctetcount_g; |
| 400 | u64 rxbroadcastframes_g; |
| 401 | u64 rxmulticastframes_g; |
| 402 | u64 rxcrcerror; |
| 403 | u64 rxrunterror; |
| 404 | u64 rxjabbererror; |
| 405 | u64 rxundersize_g; |
| 406 | u64 rxoversize_g; |
| 407 | u64 rx64octets_gb; |
| 408 | u64 rx65to127octets_gb; |
| 409 | u64 rx128to255octets_gb; |
| 410 | u64 rx256to511octets_gb; |
| 411 | u64 rx512to1023octets_gb; |
| 412 | u64 rx1024tomaxoctets_gb; |
| 413 | u64 rxunicastframes_g; |
| 414 | u64 rxlengtherror; |
| 415 | u64 rxoutofrangetype; |
| 416 | u64 rxpauseframes; |
| 417 | u64 rxfifooverflow; |
| 418 | u64 rxvlanframes_gb; |
| 419 | u64 rxwatchdogerror; |
| 420 | }; |
| 421 | |
| 422 | struct xgbe_hw_if { |
| 423 | int (*tx_complete)(struct xgbe_ring_desc *); |
| 424 | |
| 425 | int (*set_promiscuous_mode)(struct xgbe_prv_data *, unsigned int); |
| 426 | int (*set_all_multicast_mode)(struct xgbe_prv_data *, unsigned int); |
Lendacky, Thomas | b85e4d8 | 2014-06-24 16:19:29 -0500 | [diff] [blame] | 427 | int (*add_mac_addresses)(struct xgbe_prv_data *); |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 428 | int (*set_mac_address)(struct xgbe_prv_data *, u8 *addr); |
| 429 | |
| 430 | int (*enable_rx_csum)(struct xgbe_prv_data *); |
| 431 | int (*disable_rx_csum)(struct xgbe_prv_data *); |
| 432 | |
| 433 | int (*enable_rx_vlan_stripping)(struct xgbe_prv_data *); |
| 434 | int (*disable_rx_vlan_stripping)(struct xgbe_prv_data *); |
Lendacky, Thomas | 801c62d | 2014-06-24 16:19:24 -0500 | [diff] [blame] | 435 | int (*enable_rx_vlan_filtering)(struct xgbe_prv_data *); |
| 436 | int (*disable_rx_vlan_filtering)(struct xgbe_prv_data *); |
| 437 | int (*update_vlan_hash_table)(struct xgbe_prv_data *); |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 438 | |
| 439 | int (*read_mmd_regs)(struct xgbe_prv_data *, int, int); |
| 440 | void (*write_mmd_regs)(struct xgbe_prv_data *, int, int, int); |
| 441 | int (*set_gmii_speed)(struct xgbe_prv_data *); |
| 442 | int (*set_gmii_2500_speed)(struct xgbe_prv_data *); |
| 443 | int (*set_xgmii_speed)(struct xgbe_prv_data *); |
| 444 | |
| 445 | void (*enable_tx)(struct xgbe_prv_data *); |
| 446 | void (*disable_tx)(struct xgbe_prv_data *); |
| 447 | void (*enable_rx)(struct xgbe_prv_data *); |
| 448 | void (*disable_rx)(struct xgbe_prv_data *); |
| 449 | |
| 450 | void (*powerup_tx)(struct xgbe_prv_data *); |
| 451 | void (*powerdown_tx)(struct xgbe_prv_data *); |
| 452 | void (*powerup_rx)(struct xgbe_prv_data *); |
| 453 | void (*powerdown_rx)(struct xgbe_prv_data *); |
| 454 | |
| 455 | int (*init)(struct xgbe_prv_data *); |
| 456 | int (*exit)(struct xgbe_prv_data *); |
| 457 | |
| 458 | int (*enable_int)(struct xgbe_channel *, enum xgbe_int); |
| 459 | int (*disable_int)(struct xgbe_channel *, enum xgbe_int); |
| 460 | void (*pre_xmit)(struct xgbe_channel *); |
| 461 | int (*dev_read)(struct xgbe_channel *); |
| 462 | void (*tx_desc_init)(struct xgbe_channel *); |
| 463 | void (*rx_desc_init)(struct xgbe_channel *); |
| 464 | void (*rx_desc_reset)(struct xgbe_ring_data *); |
| 465 | void (*tx_desc_reset)(struct xgbe_ring_data *); |
| 466 | int (*is_last_desc)(struct xgbe_ring_desc *); |
| 467 | int (*is_context_desc)(struct xgbe_ring_desc *); |
| 468 | |
| 469 | /* For FLOW ctrl */ |
| 470 | int (*config_tx_flow_control)(struct xgbe_prv_data *); |
| 471 | int (*config_rx_flow_control)(struct xgbe_prv_data *); |
| 472 | |
| 473 | /* For RX coalescing */ |
| 474 | int (*config_rx_coalesce)(struct xgbe_prv_data *); |
| 475 | int (*config_tx_coalesce)(struct xgbe_prv_data *); |
| 476 | unsigned int (*usec_to_riwt)(struct xgbe_prv_data *, unsigned int); |
| 477 | unsigned int (*riwt_to_usec)(struct xgbe_prv_data *, unsigned int); |
| 478 | |
| 479 | /* For RX and TX threshold config */ |
| 480 | int (*config_rx_threshold)(struct xgbe_prv_data *, unsigned int); |
| 481 | int (*config_tx_threshold)(struct xgbe_prv_data *, unsigned int); |
| 482 | |
| 483 | /* For RX and TX Store and Forward Mode config */ |
| 484 | int (*config_rsf_mode)(struct xgbe_prv_data *, unsigned int); |
| 485 | int (*config_tsf_mode)(struct xgbe_prv_data *, unsigned int); |
| 486 | |
| 487 | /* For TX DMA Operate on Second Frame config */ |
| 488 | int (*config_osp_mode)(struct xgbe_prv_data *); |
| 489 | |
| 490 | /* For RX and TX PBL config */ |
| 491 | int (*config_rx_pbl_val)(struct xgbe_prv_data *); |
| 492 | int (*get_rx_pbl_val)(struct xgbe_prv_data *); |
| 493 | int (*config_tx_pbl_val)(struct xgbe_prv_data *); |
| 494 | int (*get_tx_pbl_val)(struct xgbe_prv_data *); |
| 495 | int (*config_pblx8)(struct xgbe_prv_data *); |
| 496 | |
| 497 | /* For MMC statistics */ |
| 498 | void (*rx_mmc_int)(struct xgbe_prv_data *); |
| 499 | void (*tx_mmc_int)(struct xgbe_prv_data *); |
| 500 | void (*read_mmc_stats)(struct xgbe_prv_data *); |
Lendacky, Thomas | 23e4eef | 2014-07-29 08:57:19 -0500 | [diff] [blame] | 501 | |
| 502 | /* For Timestamp config */ |
| 503 | int (*config_tstamp)(struct xgbe_prv_data *, unsigned int); |
| 504 | void (*update_tstamp_addend)(struct xgbe_prv_data *, unsigned int); |
| 505 | void (*set_tstamp_time)(struct xgbe_prv_data *, unsigned int sec, |
| 506 | unsigned int nsec); |
| 507 | u64 (*get_tstamp_time)(struct xgbe_prv_data *); |
| 508 | u64 (*get_tx_tstamp)(struct xgbe_prv_data *); |
Lendacky, Thomas | fca2d99 | 2014-07-29 08:57:55 -0500 | [diff] [blame] | 509 | |
| 510 | /* For Data Center Bridging config */ |
| 511 | void (*config_dcb_tc)(struct xgbe_prv_data *); |
| 512 | void (*config_dcb_pfc)(struct xgbe_prv_data *); |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 513 | }; |
| 514 | |
| 515 | struct xgbe_desc_if { |
| 516 | int (*alloc_ring_resources)(struct xgbe_prv_data *); |
| 517 | void (*free_ring_resources)(struct xgbe_prv_data *); |
| 518 | int (*map_tx_skb)(struct xgbe_channel *, struct sk_buff *); |
| 519 | void (*realloc_skb)(struct xgbe_channel *); |
| 520 | void (*unmap_skb)(struct xgbe_prv_data *, struct xgbe_ring_data *); |
| 521 | void (*wrapper_tx_desc_init)(struct xgbe_prv_data *); |
| 522 | void (*wrapper_rx_desc_init)(struct xgbe_prv_data *); |
| 523 | }; |
| 524 | |
| 525 | /* This structure contains flags that indicate what hardware features |
| 526 | * or configurations are present in the device. |
| 527 | */ |
| 528 | struct xgbe_hw_features { |
Lendacky, Thomas | a9a4a2d | 2014-08-29 13:16:50 -0500 | [diff] [blame^] | 529 | /* HW Version */ |
| 530 | unsigned int version; |
| 531 | |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 532 | /* HW Feature Register0 */ |
| 533 | unsigned int gmii; /* 1000 Mbps support */ |
| 534 | unsigned int vlhash; /* VLAN Hash Filter */ |
| 535 | unsigned int sma; /* SMA(MDIO) Interface */ |
| 536 | unsigned int rwk; /* PMT remote wake-up packet */ |
| 537 | unsigned int mgk; /* PMT magic packet */ |
| 538 | unsigned int mmc; /* RMON module */ |
| 539 | unsigned int aoe; /* ARP Offload */ |
| 540 | unsigned int ts; /* IEEE 1588-2008 Adavanced Timestamp */ |
| 541 | unsigned int eee; /* Energy Efficient Ethernet */ |
| 542 | unsigned int tx_coe; /* Tx Checksum Offload */ |
| 543 | unsigned int rx_coe; /* Rx Checksum Offload */ |
| 544 | unsigned int addn_mac; /* Additional MAC Addresses */ |
| 545 | unsigned int ts_src; /* Timestamp Source */ |
| 546 | unsigned int sa_vlan_ins; /* Source Address or VLAN Insertion */ |
| 547 | |
| 548 | /* HW Feature Register1 */ |
| 549 | unsigned int rx_fifo_size; /* MTL Receive FIFO Size */ |
| 550 | unsigned int tx_fifo_size; /* MTL Transmit FIFO Size */ |
| 551 | unsigned int adv_ts_hi; /* Advance Timestamping High Word */ |
| 552 | unsigned int dcb; /* DCB Feature */ |
| 553 | unsigned int sph; /* Split Header Feature */ |
| 554 | unsigned int tso; /* TCP Segmentation Offload */ |
| 555 | unsigned int dma_debug; /* DMA Debug Registers */ |
| 556 | unsigned int rss; /* Receive Side Scaling */ |
Lendacky, Thomas | fca2d99 | 2014-07-29 08:57:55 -0500 | [diff] [blame] | 557 | unsigned int tc_cnt; /* Number of Traffic Classes */ |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 558 | unsigned int hash_table_size; /* Hash Table Size */ |
| 559 | unsigned int l3l4_filter_num; /* Number of L3-L4 Filters */ |
| 560 | |
| 561 | /* HW Feature Register2 */ |
| 562 | unsigned int rx_q_cnt; /* Number of MTL Receive Queues */ |
| 563 | unsigned int tx_q_cnt; /* Number of MTL Transmit Queues */ |
| 564 | unsigned int rx_ch_cnt; /* Number of DMA Receive Channels */ |
| 565 | unsigned int tx_ch_cnt; /* Number of DMA Transmit Channels */ |
| 566 | unsigned int pps_out_num; /* Number of PPS outputs */ |
| 567 | unsigned int aux_snap_num; /* Number of Aux snapshot inputs */ |
| 568 | }; |
| 569 | |
| 570 | struct xgbe_prv_data { |
| 571 | struct net_device *netdev; |
| 572 | struct platform_device *pdev; |
| 573 | struct device *dev; |
| 574 | |
| 575 | /* XGMAC/XPCS related mmio registers */ |
| 576 | void __iomem *xgmac_regs; /* XGMAC CSRs */ |
| 577 | void __iomem *xpcs_regs; /* XPCS MMD registers */ |
| 578 | |
| 579 | /* Overall device lock */ |
| 580 | spinlock_t lock; |
| 581 | |
| 582 | /* XPCS indirect addressing mutex */ |
| 583 | struct mutex xpcs_mutex; |
| 584 | |
| 585 | int irq_number; |
| 586 | |
| 587 | struct xgbe_hw_if hw_if; |
| 588 | struct xgbe_desc_if desc_if; |
| 589 | |
Lendacky, Thomas | cfa50c7 | 2014-07-02 13:04:57 -0500 | [diff] [blame] | 590 | /* AXI DMA settings */ |
| 591 | unsigned int axdomain; |
| 592 | unsigned int arcache; |
| 593 | unsigned int awcache; |
| 594 | |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 595 | /* Rings for Tx/Rx on a DMA channel */ |
| 596 | struct xgbe_channel *channel; |
| 597 | unsigned int channel_count; |
| 598 | unsigned int tx_ring_count; |
| 599 | unsigned int tx_desc_count; |
| 600 | unsigned int rx_ring_count; |
| 601 | unsigned int rx_desc_count; |
| 602 | |
Lendacky, Thomas | 853eb16 | 2014-07-29 08:57:31 -0500 | [diff] [blame] | 603 | unsigned int tx_q_count; |
| 604 | unsigned int rx_q_count; |
| 605 | |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 606 | /* Tx/Rx common settings */ |
| 607 | unsigned int pblx8; |
| 608 | |
| 609 | /* Tx settings */ |
| 610 | unsigned int tx_sf_mode; |
| 611 | unsigned int tx_threshold; |
| 612 | unsigned int tx_pbl; |
| 613 | unsigned int tx_osp_mode; |
| 614 | |
| 615 | /* Rx settings */ |
| 616 | unsigned int rx_sf_mode; |
| 617 | unsigned int rx_threshold; |
| 618 | unsigned int rx_pbl; |
| 619 | |
| 620 | /* Tx coalescing settings */ |
| 621 | unsigned int tx_usecs; |
| 622 | unsigned int tx_frames; |
| 623 | |
| 624 | /* Rx coalescing settings */ |
| 625 | unsigned int rx_riwt; |
| 626 | unsigned int rx_frames; |
| 627 | |
| 628 | /* Current MTU */ |
| 629 | unsigned int rx_buf_size; |
| 630 | |
| 631 | /* Flow control settings */ |
| 632 | unsigned int pause_autoneg; |
| 633 | unsigned int tx_pause; |
| 634 | unsigned int rx_pause; |
| 635 | |
| 636 | /* MDIO settings */ |
| 637 | struct module *phy_module; |
| 638 | char *mii_bus_id; |
| 639 | struct mii_bus *mii; |
| 640 | int mdio_mmd; |
| 641 | struct phy_device *phydev; |
| 642 | int default_autoneg; |
| 643 | int default_speed; |
| 644 | |
| 645 | /* Current PHY settings */ |
| 646 | phy_interface_t phy_mode; |
| 647 | int phy_link; |
| 648 | int phy_speed; |
| 649 | unsigned int phy_tx_pause; |
| 650 | unsigned int phy_rx_pause; |
| 651 | |
| 652 | /* Netdev related settings */ |
| 653 | netdev_features_t netdev_features; |
| 654 | struct napi_struct napi; |
| 655 | struct xgbe_mmc_stats mmc_stats; |
| 656 | |
Lendacky, Thomas | 801c62d | 2014-06-24 16:19:24 -0500 | [diff] [blame] | 657 | /* Filtering support */ |
| 658 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; |
| 659 | |
Lendacky, Thomas | 23e4eef | 2014-07-29 08:57:19 -0500 | [diff] [blame] | 660 | /* Device clocks */ |
| 661 | struct clk *sysclk; |
| 662 | struct clk *ptpclk; |
| 663 | |
| 664 | /* Timestamp support */ |
| 665 | spinlock_t tstamp_lock; |
| 666 | struct ptp_clock_info ptp_clock_info; |
| 667 | struct ptp_clock *ptp_clock; |
| 668 | struct hwtstamp_config tstamp_config; |
| 669 | struct cyclecounter tstamp_cc; |
| 670 | struct timecounter tstamp_tc; |
| 671 | unsigned int tstamp_addend; |
| 672 | struct work_struct tx_tstamp_work; |
| 673 | struct sk_buff *tx_tstamp_skb; |
| 674 | u64 tx_tstamp; |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 675 | |
Lendacky, Thomas | fca2d99 | 2014-07-29 08:57:55 -0500 | [diff] [blame] | 676 | /* DCB support */ |
| 677 | struct ieee_ets *ets; |
| 678 | struct ieee_pfc *pfc; |
| 679 | unsigned int q2tc_map[XGBE_MAX_QUEUES]; |
| 680 | unsigned int prio2q_map[IEEE_8021QAZ_MAX_TCS]; |
| 681 | |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 682 | /* Hardware features of the device */ |
| 683 | struct xgbe_hw_features hw_feat; |
| 684 | |
| 685 | /* Device restart work structure */ |
| 686 | struct work_struct restart_work; |
| 687 | |
| 688 | /* Keeps track of power mode */ |
| 689 | unsigned int power_down; |
| 690 | |
| 691 | #ifdef CONFIG_DEBUG_FS |
| 692 | struct dentry *xgbe_debugfs; |
| 693 | |
| 694 | unsigned int debugfs_xgmac_reg; |
| 695 | |
| 696 | unsigned int debugfs_xpcs_mmd; |
| 697 | unsigned int debugfs_xpcs_reg; |
| 698 | #endif |
| 699 | }; |
| 700 | |
| 701 | /* Function prototypes*/ |
| 702 | |
| 703 | void xgbe_init_function_ptrs_dev(struct xgbe_hw_if *); |
| 704 | void xgbe_init_function_ptrs_desc(struct xgbe_desc_if *); |
| 705 | struct net_device_ops *xgbe_get_netdev_ops(void); |
| 706 | struct ethtool_ops *xgbe_get_ethtool_ops(void); |
Lendacky, Thomas | fca2d99 | 2014-07-29 08:57:55 -0500 | [diff] [blame] | 707 | #ifdef CONFIG_AMD_XGBE_DCB |
| 708 | const struct dcbnl_rtnl_ops *xgbe_get_dcbnl_ops(void); |
| 709 | #endif |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 710 | |
| 711 | int xgbe_mdio_register(struct xgbe_prv_data *); |
| 712 | void xgbe_mdio_unregister(struct xgbe_prv_data *); |
| 713 | void xgbe_dump_phy_registers(struct xgbe_prv_data *); |
Lendacky, Thomas | 23e4eef | 2014-07-29 08:57:19 -0500 | [diff] [blame] | 714 | void xgbe_ptp_register(struct xgbe_prv_data *); |
| 715 | void xgbe_ptp_unregister(struct xgbe_prv_data *); |
Lendacky, Thomas | c5aa9e3 | 2014-06-05 09:15:06 -0500 | [diff] [blame] | 716 | void xgbe_dump_tx_desc(struct xgbe_ring *, unsigned int, unsigned int, |
| 717 | unsigned int); |
| 718 | void xgbe_dump_rx_desc(struct xgbe_ring *, struct xgbe_ring_desc *, |
| 719 | unsigned int); |
| 720 | void xgbe_print_pkt(struct net_device *, struct sk_buff *, bool); |
| 721 | void xgbe_get_all_hw_features(struct xgbe_prv_data *); |
| 722 | int xgbe_powerup(struct net_device *, unsigned int); |
| 723 | int xgbe_powerdown(struct net_device *, unsigned int); |
| 724 | void xgbe_init_rx_coalesce(struct xgbe_prv_data *); |
| 725 | void xgbe_init_tx_coalesce(struct xgbe_prv_data *); |
| 726 | |
| 727 | #ifdef CONFIG_DEBUG_FS |
| 728 | void xgbe_debugfs_init(struct xgbe_prv_data *); |
| 729 | void xgbe_debugfs_exit(struct xgbe_prv_data *); |
| 730 | #else |
| 731 | static inline void xgbe_debugfs_init(struct xgbe_prv_data *pdata) {} |
| 732 | static inline void xgbe_debugfs_exit(struct xgbe_prv_data *pdata) {} |
| 733 | #endif /* CONFIG_DEBUG_FS */ |
| 734 | |
| 735 | /* NOTE: Uncomment for TX and RX DESCRIPTOR DUMP in KERNEL LOG */ |
| 736 | #if 0 |
| 737 | #define XGMAC_ENABLE_TX_DESC_DUMP |
| 738 | #define XGMAC_ENABLE_RX_DESC_DUMP |
| 739 | #endif |
| 740 | |
| 741 | /* NOTE: Uncomment for TX and RX PACKET DUMP in KERNEL LOG */ |
| 742 | #if 0 |
| 743 | #define XGMAC_ENABLE_TX_PKT_DUMP |
| 744 | #define XGMAC_ENABLE_RX_PKT_DUMP |
| 745 | #endif |
| 746 | |
| 747 | /* NOTE: Uncomment for function trace log messages in KERNEL LOG */ |
| 748 | #if 0 |
| 749 | #define YDEBUG |
| 750 | #define YDEBUG_MDIO |
| 751 | #endif |
| 752 | |
| 753 | /* For debug prints */ |
| 754 | #ifdef YDEBUG |
| 755 | #define DBGPR(x...) pr_alert(x) |
| 756 | #define DBGPHY_REGS(x...) xgbe_dump_phy_registers(x) |
| 757 | #else |
| 758 | #define DBGPR(x...) do { } while (0) |
| 759 | #define DBGPHY_REGS(x...) do { } while (0) |
| 760 | #endif |
| 761 | |
| 762 | #ifdef YDEBUG_MDIO |
| 763 | #define DBGPR_MDIO(x...) pr_alert(x) |
| 764 | #else |
| 765 | #define DBGPR_MDIO(x...) do { } while (0) |
| 766 | #endif |
| 767 | |
| 768 | #endif |