linux/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c

// SPDX-License-Identifier: GPL-2.0-or-later
/* Copyright (c) 2014 Linaro Ltd.
 * Copyright (c) 2014 Hisilicon Limited.
 */

#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/etherdevice.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/of.h>
#include <linux/of_net.h>
#include <linux/of_mdio.h>
#include <linux/reset.h>
#include <linux/clk.h>
#include <linux/circ_buf.h>

#define STATION_ADDR_LOW
#define STATION_ADDR_HIGH
#define MAC_DUPLEX_HALF_CTRL
#define MAX_FRM_SIZE
#define PORT_MODE
#define PORT_EN
#define BITS_TX_EN
#define BITS_RX_EN
#define REC_FILT_CONTROL
#define BIT_CRC_ERR_PASS
#define BIT_PAUSE_FRM_PASS
#define BIT_VLAN_DROP_EN
#define BIT_BC_DROP_EN
#define BIT_MC_MATCH_EN
#define BIT_UC_MATCH_EN
#define PORT_MC_ADDR_LOW
#define PORT_MC_ADDR_HIGH
#define CF_CRC_STRIP
#define MODE_CHANGE_EN
#define BIT_MODE_CHANGE_EN
#define COL_SLOT_TIME
#define RECV_CONTROL
#define BIT_STRIP_PAD_EN
#define BIT_RUNT_PKT_EN
#define CONTROL_WORD
#define MDIO_SINGLE_CMD
#define MDIO_SINGLE_DATA
#define MDIO_CTRL
#define MDIO_RDATA_STATUS

#define MDIO_START
#define MDIO_R_VALID
#define MDIO_READ
#define MDIO_WRITE

#define RX_FQ_START_ADDR
#define RX_FQ_DEPTH
#define RX_FQ_WR_ADDR
#define RX_FQ_RD_ADDR
#define RX_FQ_VLDDESC_CNT
#define RX_FQ_ALEMPTY_TH
#define RX_FQ_REG_EN
#define BITS_RX_FQ_START_ADDR_EN
#define BITS_RX_FQ_DEPTH_EN
#define BITS_RX_FQ_RD_ADDR_EN
#define RX_FQ_ALFULL_TH
#define RX_BQ_START_ADDR
#define RX_BQ_DEPTH
#define RX_BQ_WR_ADDR
#define RX_BQ_RD_ADDR
#define RX_BQ_FREE_DESC_CNT
#define RX_BQ_ALEMPTY_TH
#define RX_BQ_REG_EN
#define BITS_RX_BQ_START_ADDR_EN
#define BITS_RX_BQ_DEPTH_EN
#define BITS_RX_BQ_WR_ADDR_EN
#define RX_BQ_ALFULL_TH
#define TX_BQ_START_ADDR
#define TX_BQ_DEPTH
#define TX_BQ_WR_ADDR
#define TX_BQ_RD_ADDR
#define TX_BQ_VLDDESC_CNT
#define TX_BQ_ALEMPTY_TH
#define TX_BQ_REG_EN
#define BITS_TX_BQ_START_ADDR_EN
#define BITS_TX_BQ_DEPTH_EN
#define BITS_TX_BQ_RD_ADDR_EN
#define TX_BQ_ALFULL_TH
#define TX_RQ_START_ADDR
#define TX_RQ_DEPTH
#define TX_RQ_WR_ADDR
#define TX_RQ_RD_ADDR
#define TX_RQ_FREE_DESC_CNT
#define TX_RQ_ALEMPTY_TH
#define TX_RQ_REG_EN
#define BITS_TX_RQ_START_ADDR_EN
#define BITS_TX_RQ_DEPTH_EN
#define BITS_TX_RQ_WR_ADDR_EN
#define TX_RQ_ALFULL_TH
#define RAW_PMU_INT
#define ENA_PMU_INT
#define STATUS_PMU_INT
#define MAC_FIFO_ERR_IN
#define TX_RQ_IN_TIMEOUT_INT
#define RX_BQ_IN_TIMEOUT_INT
#define TXOUTCFF_FULL_INT
#define TXOUTCFF_EMPTY_INT
#define TXCFF_FULL_INT
#define TXCFF_EMPTY_INT
#define RXOUTCFF_FULL_INT
#define RXOUTCFF_EMPTY_INT
#define RXCFF_FULL_INT
#define RXCFF_EMPTY_INT
#define TX_RQ_IN_INT
#define TX_BQ_OUT_INT
#define RX_BQ_IN_INT
#define RX_FQ_OUT_INT
#define TX_RQ_EMPTY_INT
#define TX_RQ_FULL_INT
#define TX_RQ_ALEMPTY_INT
#define TX_RQ_ALFULL_INT
#define TX_BQ_EMPTY_INT
#define TX_BQ_FULL_INT
#define TX_BQ_ALEMPTY_INT
#define TX_BQ_ALFULL_INT
#define RX_BQ_EMPTY_INT
#define RX_BQ_FULL_INT
#define RX_BQ_ALEMPTY_INT
#define RX_BQ_ALFULL_INT
#define RX_FQ_EMPTY_INT
#define RX_FQ_FULL_INT
#define RX_FQ_ALEMPTY_INT
#define RX_FQ_ALFULL_INT

#define DEF_INT_MASK

#define DESC_WR_RD_ENA
#define IN_QUEUE_TH
#define OUT_QUEUE_TH
#define QUEUE_TX_BQ_SHIFT
#define RX_BQ_IN_TIMEOUT_TH
#define TX_RQ_IN_TIMEOUT_TH
#define STOP_CMD
#define BITS_TX_STOP
#define BITS_RX_STOP
#define FLUSH_CMD
#define BITS_TX_FLUSH_CMD
#define BITS_RX_FLUSH_CMD
#define BITS_TX_FLUSH_FLAG_DOWN
#define BITS_TX_FLUSH_FLAG_UP
#define BITS_RX_FLUSH_FLAG_DOWN
#define BITS_RX_FLUSH_FLAG_UP
#define RX_CFF_NUM_REG
#define PMU_FSM_REG
#define RX_FIFO_PKT_IN_NUM
#define RX_FIFO_PKT_OUT_NUM

#define RGMII_SPEED_1000
#define RGMII_SPEED_100
#define RGMII_SPEED_10
#define MII_SPEED_100
#define MII_SPEED_10
#define GMAC_SPEED_1000
#define GMAC_SPEED_100
#define GMAC_SPEED_10
#define GMAC_FULL_DUPLEX

#define RX_BQ_INT_THRESHOLD
#define TX_RQ_INT_THRESHOLD
#define RX_BQ_IN_TIMEOUT
#define TX_RQ_IN_TIMEOUT

#define MAC_MAX_FRAME_SIZE
#define DESC_SIZE
#define RX_DESC_NUM
#define TX_DESC_NUM

#define DESC_VLD_FREE
#define DESC_VLD_BUSY
#define DESC_FL_MID
#define DESC_FL_LAST
#define DESC_FL_FIRST
#define DESC_FL_FULL
#define DESC_DATA_LEN_OFF
#define DESC_BUFF_LEN_OFF
#define DESC_DATA_MASK
#define DESC_SG
#define DESC_FRAGS_NUM_OFF

/* DMA descriptor ring helpers */
#define dma_ring_incr(n, s)
#define dma_cnt(n)
#define dma_byte(n)

#define HW_CAP_TSO
#define GEMAC_V1
#define GEMAC_V2
#define HAS_CAP_TSO(hw_cap)

#define PHY_RESET_DELAYS_PROPERTY

enum phy_reset_delays {};

struct hix5hd2_desc {} __aligned();

struct hix5hd2_desc_sw {};

struct hix5hd2_sg_desc_ring {};

struct frags_info {};

/* hardware supported max skb frags num */
#define SG_MAX_SKB_FRAGS
struct sg_desc {};

#define QUEUE_NUMS
struct hix5hd2_priv {};

static inline void hix5hd2_mac_interface_reset(struct hix5hd2_priv *priv)
{}

static void hix5hd2_config_port(struct net_device *dev, u32 speed, u32 duplex)
{}

static void hix5hd2_set_desc_depth(struct hix5hd2_priv *priv, int rx, int tx)
{}

static void hix5hd2_set_rx_fq(struct hix5hd2_priv *priv, dma_addr_t phy_addr)
{}

static void hix5hd2_set_rx_bq(struct hix5hd2_priv *priv, dma_addr_t phy_addr)
{}

static void hix5hd2_set_tx_bq(struct hix5hd2_priv *priv, dma_addr_t phy_addr)
{}

static void hix5hd2_set_tx_rq(struct hix5hd2_priv *priv, dma_addr_t phy_addr)
{}

static void hix5hd2_set_desc_addr(struct hix5hd2_priv *priv)
{}

static void hix5hd2_hw_init(struct hix5hd2_priv *priv)
{}

static void hix5hd2_irq_enable(struct hix5hd2_priv *priv)
{}

static void hix5hd2_irq_disable(struct hix5hd2_priv *priv)
{}

static void hix5hd2_port_enable(struct hix5hd2_priv *priv)
{}

static void hix5hd2_port_disable(struct hix5hd2_priv *priv)
{}

static void hix5hd2_hw_set_mac_addr(struct net_device *dev)
{}

static int hix5hd2_net_set_mac_address(struct net_device *dev, void *p)
{}

static void hix5hd2_adjust_link(struct net_device *dev)
{}

static void hix5hd2_rx_refill(struct hix5hd2_priv *priv)
{}

static int hix5hd2_rx(struct net_device *dev, int limit)
{}

static void hix5hd2_clean_sg_desc(struct hix5hd2_priv *priv,
				  struct sk_buff *skb, u32 pos)
{}

static void hix5hd2_xmit_reclaim(struct net_device *dev)
{}

static int hix5hd2_poll(struct napi_struct *napi, int budget)
{}

static irqreturn_t hix5hd2_interrupt(int irq, void *dev_id)
{}

static u32 hix5hd2_get_desc_cmd(struct sk_buff *skb, unsigned long hw_cap)
{}

static int hix5hd2_fill_sg_desc(struct hix5hd2_priv *priv,
				struct sk_buff *skb, u32 pos)
{}

static netdev_tx_t hix5hd2_net_xmit(struct sk_buff *skb, struct net_device *dev)
{}

static void hix5hd2_free_dma_desc_rings(struct hix5hd2_priv *priv)
{}

static int hix5hd2_net_open(struct net_device *dev)
{}

static int hix5hd2_net_close(struct net_device *dev)
{}

static void hix5hd2_tx_timeout_task(struct work_struct *work)
{}

static void hix5hd2_net_timeout(struct net_device *dev, unsigned int txqueue)
{}

static const struct net_device_ops hix5hd2_netdev_ops =;

static const struct ethtool_ops hix5hd2_ethtools_ops =;

static int hix5hd2_mdio_wait_ready(struct mii_bus *bus)
{}

static int hix5hd2_mdio_read(struct mii_bus *bus, int phy, int reg)
{}

static int hix5hd2_mdio_write(struct mii_bus *bus, int phy, int reg, u16 val)
{}

static void hix5hd2_destroy_hw_desc_queue(struct hix5hd2_priv *priv)
{}

static int hix5hd2_init_hw_desc_queue(struct hix5hd2_priv *priv)
{}

static int hix5hd2_init_sg_desc_queue(struct hix5hd2_priv *priv)
{}

static void hix5hd2_destroy_sg_desc_queue(struct hix5hd2_priv *priv)
{}

static inline void hix5hd2_mac_core_reset(struct hix5hd2_priv *priv)
{}

static void hix5hd2_sleep_us(u32 time_us)
{}

static void hix5hd2_phy_reset(struct hix5hd2_priv *priv)
{}

static const struct of_device_id hix5hd2_of_match[];

static int hix5hd2_dev_probe(struct platform_device *pdev)
{}

static void hix5hd2_dev_remove(struct platform_device *pdev)
{}

static const struct of_device_id hix5hd2_of_match[] =;

MODULE_DEVICE_TABLE(of, hix5hd2_of_match);

static struct platform_driver hix5hd2_dev_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_ALIAS();