David Daney | 80ff0fd | 2009-05-05 17:35:21 -0700 | [diff] [blame] | 1 | /********************************************************************** |
| 2 | * Author: Cavium Networks |
| 3 | * |
| 4 | * Contact: support@caviumnetworks.com |
| 5 | * This file is part of the OCTEON SDK |
| 6 | * |
David Daney | 4898c56 | 2010-02-15 15:06:47 -0800 | [diff] [blame] | 7 | * Copyright (c) 2003-2010 Cavium Networks |
David Daney | 80ff0fd | 2009-05-05 17:35:21 -0700 | [diff] [blame] | 8 | * |
| 9 | * This file is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License, Version 2, as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | * This file is distributed in the hope that it will be useful, but |
| 14 | * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty |
| 15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or |
| 16 | * NONINFRINGEMENT. See the GNU General Public License for more |
| 17 | * details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this file; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 22 | * or visit http://www.gnu.org/licenses/. |
| 23 | * |
| 24 | * This file may also be available under a different license from Cavium. |
| 25 | * Contact Cavium Networks for more information |
| 26 | **********************************************************************/ |
| 27 | |
| 28 | /* |
| 29 | * External interface for the Cavium Octeon ethernet driver. |
| 30 | */ |
| 31 | #ifndef OCTEON_ETHERNET_H |
| 32 | #define OCTEON_ETHERNET_H |
| 33 | |
David Daney | df9244c | 2012-07-05 18:12:40 +0200 | [diff] [blame] | 34 | #include <linux/of.h> |
| 35 | |
David Daney | 80ff0fd | 2009-05-05 17:35:21 -0700 | [diff] [blame] | 36 | /** |
| 37 | * This is the definition of the Ethernet driver's private |
| 38 | * driver state stored in netdev_priv(dev). |
| 39 | */ |
| 40 | struct octeon_ethernet { |
| 41 | /* PKO hardware output port */ |
| 42 | int port; |
| 43 | /* PKO hardware queue for the port */ |
| 44 | int queue; |
| 45 | /* Hardware fetch and add to count outstanding tx buffers */ |
| 46 | int fau; |
| 47 | /* |
| 48 | * Type of port. This is one of the enums in |
| 49 | * cvmx_helper_interface_mode_t |
| 50 | */ |
| 51 | int imode; |
| 52 | /* List of outstanding tx buffers per queue */ |
| 53 | struct sk_buff_head tx_free_list[16]; |
| 54 | /* Device statistics */ |
David Daney | f6ed1b3 | 2009-10-14 12:04:42 -0700 | [diff] [blame] | 55 | struct net_device_stats stats; |
| 56 | struct phy_device *phydev; |
| 57 | unsigned int last_link; |
David Daney | 80ff0fd | 2009-05-05 17:35:21 -0700 | [diff] [blame] | 58 | /* Last negotiated link state */ |
| 59 | uint64_t link_info; |
| 60 | /* Called periodically to check link status */ |
| 61 | void (*poll) (struct net_device *dev); |
David Daney | 4898c56 | 2010-02-15 15:06:47 -0800 | [diff] [blame] | 62 | struct delayed_work port_periodic_work; |
David Daney | f8c2648 | 2010-02-15 12:13:17 -0800 | [diff] [blame] | 63 | struct work_struct port_work; /* may be unused. */ |
David Daney | df9244c | 2012-07-05 18:12:40 +0200 | [diff] [blame] | 64 | struct device_node *of_node; |
David Daney | 80ff0fd | 2009-05-05 17:35:21 -0700 | [diff] [blame] | 65 | }; |
| 66 | |
David Daney | 80ff0fd | 2009-05-05 17:35:21 -0700 | [diff] [blame] | 67 | int cvm_oct_free_work(void *work_queue_entry); |
| 68 | |
David Daney | 80ff0fd | 2009-05-05 17:35:21 -0700 | [diff] [blame] | 69 | extern int cvm_oct_rgmii_init(struct net_device *dev); |
| 70 | extern void cvm_oct_rgmii_uninit(struct net_device *dev); |
David Daney | f696a10 | 2009-06-23 11:34:08 -0700 | [diff] [blame] | 71 | extern int cvm_oct_rgmii_open(struct net_device *dev); |
| 72 | extern int cvm_oct_rgmii_stop(struct net_device *dev); |
| 73 | |
David Daney | 80ff0fd | 2009-05-05 17:35:21 -0700 | [diff] [blame] | 74 | extern int cvm_oct_sgmii_init(struct net_device *dev); |
| 75 | extern void cvm_oct_sgmii_uninit(struct net_device *dev); |
David Daney | f696a10 | 2009-06-23 11:34:08 -0700 | [diff] [blame] | 76 | extern int cvm_oct_sgmii_open(struct net_device *dev); |
| 77 | extern int cvm_oct_sgmii_stop(struct net_device *dev); |
| 78 | |
David Daney | 80ff0fd | 2009-05-05 17:35:21 -0700 | [diff] [blame] | 79 | extern int cvm_oct_spi_init(struct net_device *dev); |
| 80 | extern void cvm_oct_spi_uninit(struct net_device *dev); |
| 81 | extern int cvm_oct_xaui_init(struct net_device *dev); |
| 82 | extern void cvm_oct_xaui_uninit(struct net_device *dev); |
David Daney | f696a10 | 2009-06-23 11:34:08 -0700 | [diff] [blame] | 83 | extern int cvm_oct_xaui_open(struct net_device *dev); |
| 84 | extern int cvm_oct_xaui_stop(struct net_device *dev); |
| 85 | |
| 86 | extern int cvm_oct_common_init(struct net_device *dev); |
| 87 | extern void cvm_oct_common_uninit(struct net_device *dev); |
David Daney | 80ff0fd | 2009-05-05 17:35:21 -0700 | [diff] [blame] | 88 | |
| 89 | extern int always_use_pow; |
| 90 | extern int pow_send_group; |
| 91 | extern int pow_receive_group; |
| 92 | extern char pow_send_list[]; |
| 93 | extern struct net_device *cvm_oct_device[]; |
David Daney | f8c2648 | 2010-02-15 12:13:17 -0800 | [diff] [blame] | 94 | extern struct workqueue_struct *cvm_oct_poll_queue; |
| 95 | extern atomic_t cvm_oct_poll_queue_stopping; |
David Daney | 4898c56 | 2010-02-15 15:06:47 -0800 | [diff] [blame] | 96 | extern u64 cvm_oct_tx_poll_interval; |
David Daney | 80ff0fd | 2009-05-05 17:35:21 -0700 | [diff] [blame] | 97 | |
David Daney | 3368c78 | 2010-01-07 11:05:04 -0800 | [diff] [blame] | 98 | extern int max_rx_cpus; |
| 99 | extern int rx_napi_weight; |
| 100 | |
David Daney | 80ff0fd | 2009-05-05 17:35:21 -0700 | [diff] [blame] | 101 | #endif |