linux/drivers/net/ethernet/amd/xgbe/xgbe-dev.c

/*
 * AMD 10Gb Ethernet driver
 *
 * This file is available to you under your choice of the following two
 * licenses:
 *
 * License 1: GPLv2
 *
 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
 *
 * This file is free software; you may copy, redistribute and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or (at
 * your option) any later version.
 *
 * This file is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * This file incorporates work covered by the following copyright and
 * permission notice:
 *     The Synopsys DWC ETHER XGMAC Software Driver and documentation
 *     (hereinafter "Software") is an unsupported proprietary work of Synopsys,
 *     Inc. unless otherwise expressly agreed to in writing between Synopsys
 *     and you.
 *
 *     The Software IS NOT an item of Licensed Software or Licensed Product
 *     under any End User Software License Agreement or Agreement for Licensed
 *     Product with Synopsys or any supplement thereto.  Permission is hereby
 *     granted, free of charge, to any person obtaining a copy of this software
 *     annotated with this license and the Software, to deal in the Software
 *     without restriction, including without limitation the rights to use,
 *     copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 *     of the Software, and to permit persons to whom the Software is furnished
 *     to do so, subject to the following conditions:
 *
 *     The above copyright notice and this permission notice shall be included
 *     in all copies or substantial portions of the Software.
 *
 *     THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
 *     BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 *     TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 *     PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
 *     BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 *     CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 *     SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 *     INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 *     ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 *     THE POSSIBILITY OF SUCH DAMAGE.
 *
 *
 * License 2: Modified BSD
 *
 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of Advanced Micro Devices, Inc. nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This file incorporates work covered by the following copyright and
 * permission notice:
 *     The Synopsys DWC ETHER XGMAC Software Driver and documentation
 *     (hereinafter "Software") is an unsupported proprietary work of Synopsys,
 *     Inc. unless otherwise expressly agreed to in writing between Synopsys
 *     and you.
 *
 *     The Software IS NOT an item of Licensed Software or Licensed Product
 *     under any End User Software License Agreement or Agreement for Licensed
 *     Product with Synopsys or any supplement thereto.  Permission is hereby
 *     granted, free of charge, to any person obtaining a copy of this software
 *     annotated with this license and the Software, to deal in the Software
 *     without restriction, including without limitation the rights to use,
 *     copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 *     of the Software, and to permit persons to whom the Software is furnished
 *     to do so, subject to the following conditions:
 *
 *     The above copyright notice and this permission notice shall be included
 *     in all copies or substantial portions of the Software.
 *
 *     THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
 *     BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 *     TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 *     PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
 *     BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 *     CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 *     SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 *     INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 *     ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 *     THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <linux/phy.h>
#include <linux/mdio.h>
#include <linux/clk.h>
#include <linux/bitrev.h>
#include <linux/crc32.h>
#include <linux/crc32poly.h>

#include "xgbe.h"
#include "xgbe-common.h"

static inline unsigned int xgbe_get_max_frame(struct xgbe_prv_data *pdata)
{}

static unsigned int xgbe_usec_to_riwt(struct xgbe_prv_data *pdata,
				      unsigned int usec)
{}

static unsigned int xgbe_riwt_to_usec(struct xgbe_prv_data *pdata,
				      unsigned int riwt)
{}

static int xgbe_config_pbl_val(struct xgbe_prv_data *pdata)
{}

static int xgbe_config_osp_mode(struct xgbe_prv_data *pdata)
{}

static int xgbe_config_rsf_mode(struct xgbe_prv_data *pdata, unsigned int val)
{}

static int xgbe_config_tsf_mode(struct xgbe_prv_data *pdata, unsigned int val)
{}

static int xgbe_config_rx_threshold(struct xgbe_prv_data *pdata,
				    unsigned int val)
{}

static int xgbe_config_tx_threshold(struct xgbe_prv_data *pdata,
				    unsigned int val)
{}

static int xgbe_config_rx_coalesce(struct xgbe_prv_data *pdata)
{}

static int xgbe_config_tx_coalesce(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_rx_buffer_size(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_tso_mode(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_sph_mode(struct xgbe_prv_data *pdata)
{}

static int xgbe_write_rss_reg(struct xgbe_prv_data *pdata, unsigned int type,
			      unsigned int index, unsigned int val)
{}

static int xgbe_write_rss_hash_key(struct xgbe_prv_data *pdata)
{}

static int xgbe_write_rss_lookup_table(struct xgbe_prv_data *pdata)
{}

static int xgbe_set_rss_hash_key(struct xgbe_prv_data *pdata, const u8 *key)
{}

static int xgbe_set_rss_lookup_table(struct xgbe_prv_data *pdata,
				     const u32 *table)
{}

static int xgbe_enable_rss(struct xgbe_prv_data *pdata)
{}

static int xgbe_disable_rss(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_rss(struct xgbe_prv_data *pdata)
{}

static bool xgbe_is_pfc_queue(struct xgbe_prv_data *pdata,
			      unsigned int queue)
{}

static void xgbe_set_vxlan_id(struct xgbe_prv_data *pdata)
{}

static void xgbe_enable_vxlan(struct xgbe_prv_data *pdata)
{}

static void xgbe_disable_vxlan(struct xgbe_prv_data *pdata)
{}

static unsigned int xgbe_get_fc_queue_count(struct xgbe_prv_data *pdata)
{}

static int xgbe_disable_tx_flow_control(struct xgbe_prv_data *pdata)
{}

static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata)
{}

static int xgbe_disable_rx_flow_control(struct xgbe_prv_data *pdata)
{}

static int xgbe_enable_rx_flow_control(struct xgbe_prv_data *pdata)
{}

static int xgbe_config_tx_flow_control(struct xgbe_prv_data *pdata)
{}

static int xgbe_config_rx_flow_control(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_flow_control(struct xgbe_prv_data *pdata)
{}

static void xgbe_enable_dma_interrupts(struct xgbe_prv_data *pdata)
{}

static void xgbe_enable_mtl_interrupts(struct xgbe_prv_data *pdata)
{}

static void xgbe_enable_mac_interrupts(struct xgbe_prv_data *pdata)
{}

static void xgbe_enable_ecc_interrupts(struct xgbe_prv_data *pdata)
{}

static void xgbe_disable_ecc_ded(struct xgbe_prv_data *pdata)
{}

static void xgbe_disable_ecc_sec(struct xgbe_prv_data *pdata,
				 enum xgbe_ecc_sec sec)
{}

static int xgbe_set_speed(struct xgbe_prv_data *pdata, int speed)
{}

static int xgbe_enable_rx_vlan_stripping(struct xgbe_prv_data *pdata)
{}

static int xgbe_disable_rx_vlan_stripping(struct xgbe_prv_data *pdata)
{}

static int xgbe_enable_rx_vlan_filtering(struct xgbe_prv_data *pdata)
{}

static int xgbe_disable_rx_vlan_filtering(struct xgbe_prv_data *pdata)
{}

static u32 xgbe_vid_crc32_le(__le16 vid_le)
{}

static int xgbe_update_vlan_hash_table(struct xgbe_prv_data *pdata)
{}

static int xgbe_set_promiscuous_mode(struct xgbe_prv_data *pdata,
				     unsigned int enable)
{}

static int xgbe_set_all_multicast_mode(struct xgbe_prv_data *pdata,
				       unsigned int enable)
{}

static void xgbe_set_mac_reg(struct xgbe_prv_data *pdata,
			     struct netdev_hw_addr *ha, unsigned int *mac_reg)
{}

static void xgbe_set_mac_addn_addrs(struct xgbe_prv_data *pdata)
{}

static void xgbe_set_mac_hash_table(struct xgbe_prv_data *pdata)
{}

static int xgbe_add_mac_addresses(struct xgbe_prv_data *pdata)
{}

static int xgbe_set_mac_address(struct xgbe_prv_data *pdata, const u8 *addr)
{}

static int xgbe_config_rx_mode(struct xgbe_prv_data *pdata)
{}

static int xgbe_clr_gpio(struct xgbe_prv_data *pdata, unsigned int gpio)
{}

static int xgbe_set_gpio(struct xgbe_prv_data *pdata, unsigned int gpio)
{}

static int xgbe_read_mmd_regs_v2(struct xgbe_prv_data *pdata, int prtad,
				 int mmd_reg)
{}

static void xgbe_write_mmd_regs_v2(struct xgbe_prv_data *pdata, int prtad,
				   int mmd_reg, int mmd_data)
{}

static int xgbe_read_mmd_regs_v1(struct xgbe_prv_data *pdata, int prtad,
				 int mmd_reg)
{}

static void xgbe_write_mmd_regs_v1(struct xgbe_prv_data *pdata, int prtad,
				   int mmd_reg, int mmd_data)
{}

static int xgbe_read_mmd_regs(struct xgbe_prv_data *pdata, int prtad,
			      int mmd_reg)
{}

static void xgbe_write_mmd_regs(struct xgbe_prv_data *pdata, int prtad,
				int mmd_reg, int mmd_data)
{}

static unsigned int xgbe_create_mdio_sca_c22(int port, int reg)
{}

static unsigned int xgbe_create_mdio_sca_c45(int port, unsigned int da, int reg)
{}

static int xgbe_write_ext_mii_regs(struct xgbe_prv_data *pdata,
				   unsigned int mdio_sca, u16 val)
{}

static int xgbe_write_ext_mii_regs_c22(struct xgbe_prv_data *pdata, int addr,
				       int reg, u16 val)
{}

static int xgbe_write_ext_mii_regs_c45(struct xgbe_prv_data *pdata, int addr,
				       int devad, int reg, u16 val)
{}

static int xgbe_read_ext_mii_regs(struct xgbe_prv_data *pdata,
				  unsigned int mdio_sca)
{}

static int xgbe_read_ext_mii_regs_c22(struct xgbe_prv_data *pdata, int addr,
				      int reg)
{}

static int xgbe_read_ext_mii_regs_c45(struct xgbe_prv_data *pdata, int addr,
				      int devad, int reg)
{}

static int xgbe_set_ext_mii_mode(struct xgbe_prv_data *pdata, unsigned int port,
				 enum xgbe_mdio_mode mode)
{}

static int xgbe_tx_complete(struct xgbe_ring_desc *rdesc)
{}

static int xgbe_disable_rx_csum(struct xgbe_prv_data *pdata)
{}

static int xgbe_enable_rx_csum(struct xgbe_prv_data *pdata)
{}

static void xgbe_tx_desc_reset(struct xgbe_ring_data *rdata)
{}

static void xgbe_tx_desc_init(struct xgbe_channel *channel)
{}

static void xgbe_rx_desc_reset(struct xgbe_prv_data *pdata,
			       struct xgbe_ring_data *rdata, unsigned int index)
{}

static void xgbe_rx_desc_init(struct xgbe_channel *channel)
{}

static void xgbe_update_tstamp_addend(struct xgbe_prv_data *pdata,
				      unsigned int addend)
{}

static void xgbe_set_tstamp_time(struct xgbe_prv_data *pdata, unsigned int sec,
				 unsigned int nsec)
{}

static u64 xgbe_get_tstamp_time(struct xgbe_prv_data *pdata)
{}

static u64 xgbe_get_tx_tstamp(struct xgbe_prv_data *pdata)
{}

static void xgbe_get_rx_tstamp(struct xgbe_packet_data *packet,
			       struct xgbe_ring_desc *rdesc)
{}

static int xgbe_config_tstamp(struct xgbe_prv_data *pdata,
			      unsigned int mac_tscr)
{}

static void xgbe_tx_start_xmit(struct xgbe_channel *channel,
			       struct xgbe_ring *ring)
{}

static void xgbe_dev_xmit(struct xgbe_channel *channel)
{}

static int xgbe_dev_read(struct xgbe_channel *channel)
{}

static int xgbe_is_context_desc(struct xgbe_ring_desc *rdesc)
{}

static int xgbe_is_last_desc(struct xgbe_ring_desc *rdesc)
{}

static int xgbe_enable_int(struct xgbe_channel *channel,
			   enum xgbe_int int_id)
{}

static int xgbe_disable_int(struct xgbe_channel *channel,
			    enum xgbe_int int_id)
{}

static int __xgbe_exit(struct xgbe_prv_data *pdata)
{}

static int xgbe_exit(struct xgbe_prv_data *pdata)
{}

static int xgbe_flush_tx_queues(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_dma_bus(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_dma_cache(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_mtl_mode(struct xgbe_prv_data *pdata)
{}

static void xgbe_queue_flow_control_threshold(struct xgbe_prv_data *pdata,
					      unsigned int queue,
					      unsigned int q_fifo_size)
{}

static void xgbe_calculate_flow_control_threshold(struct xgbe_prv_data *pdata,
						  unsigned int *fifo)
{}

static void xgbe_config_flow_control_threshold(struct xgbe_prv_data *pdata)
{}

static unsigned int xgbe_get_tx_fifo_size(struct xgbe_prv_data *pdata)
{}

static unsigned int xgbe_get_rx_fifo_size(struct xgbe_prv_data *pdata)
{}

static void xgbe_calculate_equal_fifo(unsigned int fifo_size,
				      unsigned int queue_count,
				      unsigned int *fifo)
{}

static unsigned int xgbe_set_nonprio_fifos(unsigned int fifo_size,
					   unsigned int queue_count,
					   unsigned int *fifo)
{}

static unsigned int xgbe_get_pfc_delay(struct xgbe_prv_data *pdata)
{}

static unsigned int xgbe_get_pfc_queues(struct xgbe_prv_data *pdata)
{}

static void xgbe_calculate_dcb_fifo(struct xgbe_prv_data *pdata,
				    unsigned int fifo_size,
				    unsigned int *fifo)
{}

static void xgbe_config_tx_fifo_size(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_rx_fifo_size(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_queue_mapping(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_tc(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_dcb_tc(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_dcb_pfc(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_mac_address(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_jumbo_enable(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_mac_speed(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_checksum_offload(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_vlan_support(struct xgbe_prv_data *pdata)
{}

static u64 xgbe_mmc_read(struct xgbe_prv_data *pdata, unsigned int reg_lo)
{}

static void xgbe_tx_mmc_int(struct xgbe_prv_data *pdata)
{}

static void xgbe_rx_mmc_int(struct xgbe_prv_data *pdata)
{}

static void xgbe_read_mmc_stats(struct xgbe_prv_data *pdata)
{}

static void xgbe_config_mmc(struct xgbe_prv_data *pdata)
{}

static void xgbe_txq_prepare_tx_stop(struct xgbe_prv_data *pdata,
				     unsigned int queue)
{}

static void xgbe_prepare_tx_stop(struct xgbe_prv_data *pdata,
				 unsigned int queue)
{}

static void xgbe_enable_tx(struct xgbe_prv_data *pdata)
{}

static void xgbe_disable_tx(struct xgbe_prv_data *pdata)
{}

static void xgbe_prepare_rx_stop(struct xgbe_prv_data *pdata,
				 unsigned int queue)
{}

static void xgbe_enable_rx(struct xgbe_prv_data *pdata)
{}

static void xgbe_disable_rx(struct xgbe_prv_data *pdata)
{}

static void xgbe_powerup_tx(struct xgbe_prv_data *pdata)
{}

static void xgbe_powerdown_tx(struct xgbe_prv_data *pdata)
{}

static void xgbe_powerup_rx(struct xgbe_prv_data *pdata)
{}

static void xgbe_powerdown_rx(struct xgbe_prv_data *pdata)
{}

static int xgbe_init(struct xgbe_prv_data *pdata)
{}

void xgbe_init_function_ptrs_dev(struct xgbe_hw_if *hw_if)
{}