GNU Linux-libre 4.19.264-gnu1
[releases.git] / drivers / staging / octeon / octeon-ethernet.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * This file is based on code from OCTEON SDK by Cavium Networks.
4  *
5  * Copyright (c) 2003-2010 Cavium Networks
6  */
7
8 /*
9  * External interface for the Cavium Octeon ethernet driver.
10  */
11 #ifndef OCTEON_ETHERNET_H
12 #define OCTEON_ETHERNET_H
13
14 #include <linux/of.h>
15
16 #include <asm/octeon/cvmx-helper-board.h>
17
18 /**
19  * This is the definition of the Ethernet driver's private
20  * driver state stored in netdev_priv(dev).
21  */
22 struct octeon_ethernet {
23         /* PKO hardware output port */
24         int port;
25         /* PKO hardware queue for the port */
26         int queue;
27         /* Hardware fetch and add to count outstanding tx buffers */
28         int fau;
29         /* My netdev. */
30         struct net_device *netdev;
31         /*
32          * Type of port. This is one of the enums in
33          * cvmx_helper_interface_mode_t
34          */
35         int imode;
36         /* List of outstanding tx buffers per queue */
37         struct sk_buff_head tx_free_list[16];
38         unsigned int last_speed;
39         unsigned int last_link;
40         /* Last negotiated link state */
41         u64 link_info;
42         /* Called periodically to check link status */
43         void (*poll)(struct net_device *dev);
44         struct delayed_work     port_periodic_work;
45         struct device_node      *of_node;
46 };
47
48 int cvm_oct_free_work(void *work_queue_entry);
49
50 int cvm_oct_rgmii_open(struct net_device *dev);
51
52 int cvm_oct_sgmii_init(struct net_device *dev);
53 int cvm_oct_sgmii_open(struct net_device *dev);
54
55 int cvm_oct_spi_init(struct net_device *dev);
56 void cvm_oct_spi_uninit(struct net_device *dev);
57
58 int cvm_oct_common_init(struct net_device *dev);
59 void cvm_oct_common_uninit(struct net_device *dev);
60 void cvm_oct_adjust_link(struct net_device *dev);
61 int cvm_oct_common_stop(struct net_device *dev);
62 int cvm_oct_common_open(struct net_device *dev,
63                         void (*link_poll)(struct net_device *));
64 void cvm_oct_note_carrier(struct octeon_ethernet *priv,
65                           cvmx_helper_link_info_t li);
66 void cvm_oct_link_poll(struct net_device *dev);
67
68 extern int always_use_pow;
69 extern int pow_send_group;
70 extern int pow_receive_groups;
71 extern char pow_send_list[];
72 extern struct net_device *cvm_oct_device[];
73 extern atomic_t cvm_oct_poll_queue_stopping;
74 extern u64 cvm_oct_tx_poll_interval;
75
76 extern int rx_napi_weight;
77
78 #endif