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