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 #include <linux/phy.h> 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 /* PHY mode */ 37 phy_interface_t phy_mode; 38 /* List of outstanding tx buffers per queue */ 39 struct sk_buff_head tx_free_list[16]; 40 unsigned int last_speed; 41 unsigned int last_link; 42 /* Last negotiated link state */ 43 u64 link_info; 44 /* Called periodically to check link status */ 45 void (*poll)(struct net_device *dev); 46 struct delayed_work port_periodic_work; 47 struct device_node *of_node; 48 }; 49 50 int cvm_oct_free_work(void *work_queue_entry); 51 52 int cvm_oct_rgmii_open(struct net_device *dev); 53 54 int cvm_oct_sgmii_init(struct net_device *dev); 55 int cvm_oct_sgmii_open(struct net_device *dev); 56 57 int cvm_oct_spi_init(struct net_device *dev); 58 void cvm_oct_spi_uninit(struct net_device *dev); 59 60 int cvm_oct_common_init(struct net_device *dev); 61 void cvm_oct_common_uninit(struct net_device *dev); 62 void cvm_oct_adjust_link(struct net_device *dev); 63 int cvm_oct_common_stop(struct net_device *dev); 64 int cvm_oct_common_open(struct net_device *dev, 65 void (*link_poll)(struct net_device *)); 66 void cvm_oct_note_carrier(struct octeon_ethernet *priv, 67 cvmx_helper_link_info_t li); 68 void cvm_oct_link_poll(struct net_device *dev); 69 70 extern int always_use_pow; 71 extern int pow_send_group; 72 extern int pow_receive_groups; 73 extern char pow_send_list[]; 74 extern struct net_device *cvm_oct_device[]; 75 extern atomic_t cvm_oct_poll_queue_stopping; 76 extern u64 cvm_oct_tx_poll_interval; 77 78 extern int rx_napi_weight; 79 80 #endif 81