2 * This file is based on code from OCTEON SDK by Cavium Networks.
4 * Copyright (c) 2003-2010 Cavium Networks
6 * This file is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, Version 2, as
8 * published by the Free Software Foundation.
12 * External interface for the Cavium Octeon ethernet driver.
14 #ifndef OCTEON_ETHERNET_H
15 #define OCTEON_ETHERNET_H
19 #include <asm/octeon/cvmx-helper-board.h>
22 * This is the definition of the Ethernet driver's private
23 * driver state stored in netdev_priv(dev).
25 struct octeon_ethernet {
26 /* PKO hardware output port */
28 /* PKO hardware queue for the port */
30 /* Hardware fetch and add to count outstanding tx buffers */
33 struct net_device *netdev;
35 * Type of port. This is one of the enums in
36 * cvmx_helper_interface_mode_t
39 /* List of outstanding tx buffers per queue */
40 struct sk_buff_head tx_free_list[16];
41 /* Device statistics */
42 struct net_device_stats stats;
43 struct phy_device *phydev;
44 unsigned int last_link;
45 /* Last negotiated link state */
47 /* Called periodically to check link status */
48 void (*poll)(struct net_device *dev);
49 struct delayed_work port_periodic_work;
50 struct work_struct port_work; /* may be unused. */
51 struct device_node *of_node;
54 int cvm_oct_free_work(void *work_queue_entry);
56 int cvm_oct_rgmii_init(struct net_device *dev);
57 void cvm_oct_rgmii_uninit(struct net_device *dev);
58 int cvm_oct_rgmii_open(struct net_device *dev);
60 int cvm_oct_sgmii_init(struct net_device *dev);
61 int cvm_oct_sgmii_open(struct net_device *dev);
63 int cvm_oct_spi_init(struct net_device *dev);
64 void cvm_oct_spi_uninit(struct net_device *dev);
66 int cvm_oct_common_init(struct net_device *dev);
67 void cvm_oct_common_uninit(struct net_device *dev);
68 void cvm_oct_adjust_link(struct net_device *dev);
69 int cvm_oct_common_stop(struct net_device *dev);
70 int cvm_oct_common_open(struct net_device *dev,
71 void (*link_poll)(struct net_device *));
72 void cvm_oct_note_carrier(struct octeon_ethernet *priv,
73 cvmx_helper_link_info_t li);
74 void cvm_oct_link_poll(struct net_device *dev);
76 extern int always_use_pow;
77 extern int pow_send_group;
78 extern int pow_receive_group;
79 extern char pow_send_list[];
80 extern struct net_device *cvm_oct_device[];
81 extern struct workqueue_struct *cvm_oct_poll_queue;
82 extern atomic_t cvm_oct_poll_queue_stopping;
83 extern u64 cvm_oct_tx_poll_interval;
85 extern int rx_napi_weight;