Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * This file is based on code from OCTEON SDK by Cavium Networks.
0004  *
0005  * Copyright (c) 2003-2010 Cavium Networks
0006  */
0007 
0008 /*
0009  * External interface for the Cavium Octeon ethernet driver.
0010  */
0011 #ifndef OCTEON_ETHERNET_H
0012 #define OCTEON_ETHERNET_H
0013 
0014 #include <linux/of.h>
0015 #include <linux/phy.h>
0016 
0017 #ifdef CONFIG_CAVIUM_OCTEON_SOC
0018 
0019 #include <asm/octeon/octeon.h>
0020 
0021 #include <asm/octeon/cvmx-asxx-defs.h>
0022 #include <asm/octeon/cvmx-config.h>
0023 #include <asm/octeon/cvmx-fau.h>
0024 #include <asm/octeon/cvmx-gmxx-defs.h>
0025 #include <asm/octeon/cvmx-helper.h>
0026 #include <asm/octeon/cvmx-helper-util.h>
0027 #include <asm/octeon/cvmx-ipd.h>
0028 #include <asm/octeon/cvmx-ipd-defs.h>
0029 #include <asm/octeon/cvmx-npi-defs.h>
0030 #include <asm/octeon/cvmx-pip.h>
0031 #include <asm/octeon/cvmx-pko.h>
0032 #include <asm/octeon/cvmx-pow.h>
0033 #include <asm/octeon/cvmx-scratch.h>
0034 #include <asm/octeon/cvmx-spi.h>
0035 #include <asm/octeon/cvmx-spxx-defs.h>
0036 #include <asm/octeon/cvmx-stxx-defs.h>
0037 #include <asm/octeon/cvmx-wqe.h>
0038 
0039 #else
0040 
0041 #include "octeon-stubs.h"
0042 
0043 #endif
0044 
0045 /**
0046  * This is the definition of the Ethernet driver's private
0047  * driver state stored in netdev_priv(dev).
0048  */
0049 struct octeon_ethernet {
0050     /* PKO hardware output port */
0051     int port;
0052     /* PKO hardware queue for the port */
0053     int queue;
0054     /* Hardware fetch and add to count outstanding tx buffers */
0055     int fau;
0056     /* My netdev. */
0057     struct net_device *netdev;
0058     /*
0059      * Type of port. This is one of the enums in
0060      * cvmx_helper_interface_mode_t
0061      */
0062     int imode;
0063     /* PHY mode */
0064     phy_interface_t phy_mode;
0065     /* List of outstanding tx buffers per queue */
0066     struct sk_buff_head tx_free_list[16];
0067     unsigned int last_speed;
0068     unsigned int last_link;
0069     /* Last negotiated link state */
0070     u64 link_info;
0071     /* Called periodically to check link status */
0072     void (*poll)(struct net_device *dev);
0073     struct delayed_work port_periodic_work;
0074     struct device_node  *of_node;
0075 };
0076 
0077 int cvm_oct_free_work(void *work_queue_entry);
0078 
0079 int cvm_oct_rgmii_open(struct net_device *dev);
0080 
0081 int cvm_oct_sgmii_init(struct net_device *dev);
0082 int cvm_oct_sgmii_open(struct net_device *dev);
0083 
0084 int cvm_oct_spi_init(struct net_device *dev);
0085 void cvm_oct_spi_uninit(struct net_device *dev);
0086 
0087 int cvm_oct_common_init(struct net_device *dev);
0088 void cvm_oct_common_uninit(struct net_device *dev);
0089 void cvm_oct_adjust_link(struct net_device *dev);
0090 int cvm_oct_common_stop(struct net_device *dev);
0091 int cvm_oct_common_open(struct net_device *dev,
0092             void (*link_poll)(struct net_device *));
0093 void cvm_oct_note_carrier(struct octeon_ethernet *priv,
0094               union cvmx_helper_link_info li);
0095 void cvm_oct_link_poll(struct net_device *dev);
0096 
0097 extern int always_use_pow;
0098 extern int pow_send_group;
0099 extern int pow_receive_groups;
0100 extern char pow_send_list[];
0101 extern struct net_device *cvm_oct_device[];
0102 extern atomic_t cvm_oct_poll_queue_stopping;
0103 extern u64 cvm_oct_tx_poll_interval;
0104 
0105 extern int rx_napi_weight;
0106 
0107 #endif