linux/drivers/net/ethernet/broadcom/asp2/bcmasp.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __BCMASP_H
#define __BCMASP_H

#include <linux/netdevice.h>
#include <linux/phy.h>
#include <linux/io-64-nonatomic-hi-lo.h>
#include <uapi/linux/ethtool.h>

#define ASP_INTR2_OFFSET
#define ASP_INTR2_STATUS
#define ASP_INTR2_SET
#define ASP_INTR2_CLEAR
#define ASP_INTR2_MASK_STATUS
#define ASP_INTR2_MASK_SET
#define ASP_INTR2_MASK_CLEAR

#define ASP_INTR2_RX_ECH(intr)
#define ASP_INTR2_TX_DESC(intr)
#define ASP_INTR2_UMC0_WAKE
#define ASP_INTR2_UMC1_WAKE
#define ASP_INTR2_PHY_EVENT(intr)

#define ASP_WAKEUP_INTR2_OFFSET
#define ASP_WAKEUP_INTR2_STATUS
#define ASP_WAKEUP_INTR2_SET
#define ASP_WAKEUP_INTR2_CLEAR
#define ASP_WAKEUP_INTR2_MASK_STATUS
#define ASP_WAKEUP_INTR2_MASK_SET
#define ASP_WAKEUP_INTR2_MASK_CLEAR
#define ASP_WAKEUP_INTR2_MPD_0
#define ASP_WAKEUP_INTR2_MPD_1
#define ASP_WAKEUP_INTR2_FILT_0
#define ASP_WAKEUP_INTR2_FILT_1
#define ASP_WAKEUP_INTR2_FW

#define ASP_CTRL2_OFFSET
#define ASP_CTRL2_CORE_CLOCK_SELECT
#define ASP_CTRL2_CORE_CLOCK_SELECT_MAIN
#define ASP_CTRL2_CPU_CLOCK_SELECT
#define ASP_CTRL2_CPU_CLOCK_SELECT_MAIN

#define ASP_TX_ANALYTICS_OFFSET
#define ASP_TX_ANALYTICS_CTRL

#define ASP_RX_ANALYTICS_OFFSET
#define ASP_RX_ANALYTICS_CTRL

#define ASP_RX_CTRL_OFFSET
#define ASP_RX_CTRL_UMAC_0_FRAME_COUNT
#define ASP_RX_CTRL_UMAC_1_FRAME_COUNT
#define ASP_RX_CTRL_FB_0_FRAME_COUNT
#define ASP_RX_CTRL_FB_1_FRAME_COUNT
#define ASP_RX_CTRL_FB_8_FRAME_COUNT
/* asp2.1 diverges offsets here */
/* ASP2.0 */
#define ASP_RX_CTRL_FB_OUT_FRAME_COUNT
#define ASP_RX_CTRL_FB_FILT_OUT_FRAME_COUNT
#define ASP_RX_CTRL_FLUSH
#define ASP_CTRL_UMAC0_FLUSH_MASK
#define ASP_CTRL_UMAC1_FLUSH_MASK
#define ASP_CTRL_SPB_FLUSH_MASK
#define ASP_RX_CTRL_FB_RX_FIFO_DEPTH
/* ASP2.1 */
#define ASP_RX_CTRL_FB_9_FRAME_COUNT_2_1
#define ASP_RX_CTRL_FB_10_FRAME_COUNT_2_1
#define ASP_RX_CTRL_FB_OUT_FRAME_COUNT_2_1
#define ASP_RX_CTRL_FB_FILT_OUT_FRAME_COUNT_2_1
#define ASP_RX_CTRL_FLUSH_2_1
#define ASP_RX_CTRL_FB_RX_FIFO_DEPTH_2_1

#define ASP_RX_FILTER_OFFSET
#define ASP_RX_FILTER_BLK_CTRL
#define ASP_RX_FILTER_OPUT_EN
#define ASP_RX_FILTER_MDA_EN
#define ASP_RX_FILTER_LNR_MD
#define ASP_RX_FILTER_GEN_WK_EN
#define ASP_RX_FILTER_GEN_WK_CLR
#define ASP_RX_FILTER_NT_FLT_EN
#define ASP_RX_FILTER_MDA_CFG(sel)
#define ASP_RX_FILTER_MDA_CFG_EN_SHIFT
#define ASP_RX_FILTER_MDA_CFG_UMC_SEL(sel)
#define ASP_RX_FILTER_MDA_PAT_H(sel)
#define ASP_RX_FILTER_MDA_PAT_L(sel)
#define ASP_RX_FILTER_MDA_MSK_H(sel)
#define ASP_RX_FILTER_MDA_MSK_L(sel)
#define ASP_RX_FILTER_MDA_CFG(sel)
#define ASP_RX_FILTER_MDA_PAT_H(sel)
#define ASP_RX_FILTER_MDA_PAT_L(sel)
#define ASP_RX_FILTER_MDA_MSK_H(sel)
#define ASP_RX_FILTER_MDA_MSK_L(sel)
#define ASP_RX_FILTER_NET_CFG(sel)
#define ASP_RX_FILTER_NET_CFG_CH(sel)
#define ASP_RX_FILTER_NET_CFG_EN
#define ASP_RX_FILTER_NET_CFG_L2_EN
#define ASP_RX_FILTER_NET_CFG_L3_EN
#define ASP_RX_FILTER_NET_CFG_L4_EN
#define ASP_RX_FILTER_NET_CFG_L3_FRM(sel)
#define ASP_RX_FILTER_NET_CFG_L4_FRM(sel)
#define ASP_RX_FILTER_NET_CFG_UMC(sel)
#define ASP_RX_FILTER_NET_CFG_DMA_EN

#define ASP_RX_FILTER_NET_OFFSET_MAX
#define ASP_RX_FILTER_NET_PAT(sel, block, off)
#define ASP_RX_FILTER_NET_MASK(sel, block, off)

#define ASP_RX_FILTER_NET_OFFSET(sel)
#define ASP_RX_FILTER_NET_OFFSET_L2(val)
#define ASP_RX_FILTER_NET_OFFSET_L3_0(val)
#define ASP_RX_FILTER_NET_OFFSET_L3_1(val)
#define ASP_RX_FILTER_NET_OFFSET_L4(val)

enum asp_rx_net_filter_block {};

#define ASP_EDPKT_OFFSET
#define ASP_EDPKT_ENABLE
#define ASP_EDPKT_ENABLE_EN
#define ASP_EDPKT_HDR_CFG
#define ASP_EDPKT_HDR_SZ_SHIFT
#define ASP_EDPKT_HDR_SZ_32
#define ASP_EDPKT_HDR_SZ_64
#define ASP_EDPKT_HDR_SZ_96
#define ASP_EDPKT_HDR_SZ_128
#define ASP_EDPKT_BURST_BUF_PSCAL_TOUT
#define ASP_EDPKT_BURST_BUF_WRITE_TOUT
#define ASP_EDPKT_BURST_BUF_READ_TOUT
#define ASP_EDPKT_RX_TS_COUNTER
#define ASP_EDPKT_ENDI
#define ASP_EDPKT_ENDI_DESC_SHIFT
#define ASP_EDPKT_ENDI_NO_BT_SWP
#define ASP_EDPKT_ENDI_BT_SWP_WD
#define ASP_EDPKT_RX_PKT_CNT
#define ASP_EDPKT_HDR_EXTR_CNT
#define ASP_EDPKT_HDR_OUT_CNT
#define ASP_EDPKT_SPARE_REG
#define ASP_EDPKT_SPARE_REG_EPHY_LPI
#define ASP_EDPKT_SPARE_REG_GPHY_LPI

#define ASP_CTRL_OFFSET
#define ASP_CTRL_ASP_SW_INIT
#define ASP_CTRL_ASP_SW_INIT_ACPUSS_CORE
#define ASP_CTRL_ASP_SW_INIT_ASP_TX
#define ASP_CTRL_ASP_SW_INIT_AS_RX
#define ASP_CTRL_ASP_SW_INIT_ASP_RGMII_UMAC0
#define ASP_CTRL_ASP_SW_INIT_ASP_RGMII_UMAC1
#define ASP_CTRL_ASP_SW_INIT_ASP_XMEMIF
#define ASP_CTRL_CLOCK_CTRL
#define ASP_CTRL_CLOCK_CTRL_ASP_TX_DISABLE
#define ASP_CTRL_CLOCK_CTRL_ASP_RX_DISABLE
#define ASP_CTRL_CLOCK_CTRL_ASP_RGMII_SHIFT
#define ASP_CTRL_CLOCK_CTRL_ASP_RGMII_MASK
#define ASP_CTRL_CLOCK_CTRL_ASP_RGMII_DIS(x)
#define ASP_CTRL_CLOCK_CTRL_ASP_ALL_DISABLE
#define ASP_CTRL_CORE_CLOCK_SELECT
#define ASP_CTRL_CORE_CLOCK_SELECT_MAIN
#define ASP_CTRL_SCRATCH_0

struct bcmasp_tx_cb {};

struct bcmasp_res {};

#define DESC_ADDR(x)
#define DESC_FLAGS(x)

struct bcmasp_desc {};

struct bcmasp_intf;

struct bcmasp_intf_stats64 {};

struct bcmasp_mib_counters {};

struct bcmasp_intf_ops {};

struct bcmasp_priv;

struct bcmasp_intf {};

#define NUM_NET_FILTERS
struct bcmasp_net_filter {};

#define NUM_MDA_FILTERS
struct bcmasp_mda_filter {};

struct bcmasp_hw_info {};

struct bcmasp_plat_data {};

struct bcmasp_priv {};

static inline unsigned long bcmasp_intf_rx_desc_read(struct bcmasp_intf *intf)
{}

static inline void bcmasp_intf_rx_buffer_write(struct bcmasp_intf *intf,
					       dma_addr_t addr)
{}

static inline void bcmasp_intf_rx_desc_write(struct bcmasp_intf *intf,
					     dma_addr_t addr)
{}

static inline unsigned long bcmasp_intf_tx_read(struct bcmasp_intf *intf)
{}

static inline void bcmasp_intf_tx_write(struct bcmasp_intf *intf,
					dma_addr_t addr)
{}

#define __BCMASP_IO_MACRO(name, m)

#define BCMASP_IO_MACRO(name)
#define BCMASP_FP_IO_MACRO(name)

BCMASP_IO_MACRO(umac);
BCMASP_IO_MACRO(umac2fb);
BCMASP_IO_MACRO(rgmii);
BCMASP_FP_IO_MACRO(tx_spb_dma);
BCMASP_IO_MACRO(tx_spb_ctrl);
BCMASP_IO_MACRO(tx_spb_top);
BCMASP_IO_MACRO(tx_epkt_core);
BCMASP_IO_MACRO(tx_pause_ctrl);
BCMASP_FP_IO_MACRO(rx_edpkt_dma);
BCMASP_FP_IO_MACRO(rx_edpkt_cfg);

#define __BCMASP_FP_IO_MACRO_Q(name, m)

#define BCMASP_FP_IO_MACRO_Q(name)

BCMASP_FP_IO_MACRO_Q(tx_spb_dma);
BCMASP_FP_IO_MACRO_Q(rx_edpkt_dma);
BCMASP_FP_IO_MACRO_Q(rx_edpkt_cfg);

#define PKT_OFFLOAD_NOP
#define PKT_OFFLOAD_HDR_OP
#define PKT_OFFLOAD_HDR_WRBACK
#define PKT_OFFLOAD_HDR_COUNT(x)
#define PKT_OFFLOAD_HDR_SIZE_1(x)
#define PKT_OFFLOAD_HDR_SIZE_2(x)
#define PKT_OFFLOAD_HDR2_SIZE_2(x)
#define PKT_OFFLOAD_HDR2_SIZE_3(x)
#define PKT_OFFLOAD_HDR2_SIZE_4(x)
#define PKT_OFFLOAD_EPKT_OP
#define PKT_OFFLOAD_EPKT_WRBACK
#define PKT_OFFLOAD_EPKT_IP(x)
#define PKT_OFFLOAD_EPKT_TP(x)
#define PKT_OFFLOAD_EPKT_LEN(x)
#define PKT_OFFLOAD_EPKT_CSUM_L3
#define PKT_OFFLOAD_EPKT_CSUM_L2
#define PKT_OFFLOAD_EPKT_ID(x)
#define PKT_OFFLOAD_EPKT_SEQ(x)
#define PKT_OFFLOAD_EPKT_TS(x)
#define PKT_OFFLOAD_EPKT_BLOC(x)
#define PKT_OFFLOAD_END_OP

struct bcmasp_pkt_offload {};

#define BCMASP_CORE_IO_MACRO(name, offset)

BCMASP_CORE_IO_MACRO(intr2, ASP_INTR2_OFFSET);
BCMASP_CORE_IO_MACRO(wakeup_intr2, ASP_WAKEUP_INTR2_OFFSET);
BCMASP_CORE_IO_MACRO(tx_analytics, ASP_TX_ANALYTICS_OFFSET);
BCMASP_CORE_IO_MACRO(rx_analytics, ASP_RX_ANALYTICS_OFFSET);
BCMASP_CORE_IO_MACRO(rx_ctrl, ASP_RX_CTRL_OFFSET);
BCMASP_CORE_IO_MACRO(rx_filter, ASP_RX_FILTER_OFFSET);
BCMASP_CORE_IO_MACRO(rx_edpkt, ASP_EDPKT_OFFSET);
BCMASP_CORE_IO_MACRO(ctrl, ASP_CTRL_OFFSET);
BCMASP_CORE_IO_MACRO(ctrl2, ASP_CTRL2_OFFSET);

struct bcmasp_intf *bcmasp_interface_create(struct bcmasp_priv *priv,
					    struct device_node *ndev_dn, int i);

void bcmasp_interface_destroy(struct bcmasp_intf *intf);

void bcmasp_enable_tx_irq(struct bcmasp_intf *intf, int en);

void bcmasp_enable_rx_irq(struct bcmasp_intf *intf, int en);

void bcmasp_enable_phy_irq(struct bcmasp_intf *intf, int en);

void bcmasp_flush_rx_port(struct bcmasp_intf *intf);

extern const struct ethtool_ops bcmasp_ethtool_ops;

int bcmasp_interface_suspend(struct bcmasp_intf *intf);

int bcmasp_interface_resume(struct bcmasp_intf *intf);

void bcmasp_set_promisc(struct bcmasp_intf *intf, bool en);

void bcmasp_set_allmulti(struct bcmasp_intf *intf, bool en);

void bcmasp_set_broad(struct bcmasp_intf *intf, bool en);

void bcmasp_set_oaddr(struct bcmasp_intf *intf, const unsigned char *addr,
		      bool en);

int bcmasp_set_en_mda_filter(struct bcmasp_intf *intf, unsigned char *addr,
			     unsigned char *mask);

void bcmasp_disable_all_filters(struct bcmasp_intf *intf);

void bcmasp_core_clock_set_intf(struct bcmasp_intf *intf, bool en);

struct bcmasp_net_filter *bcmasp_netfilt_get_init(struct bcmasp_intf *intf,
						  u32 loc, bool wake_filter,
						  bool init);

bool bcmasp_netfilt_check_dup(struct bcmasp_intf *intf,
			      struct ethtool_rx_flow_spec *fs);

void bcmasp_netfilt_release(struct bcmasp_intf *intf,
			    struct bcmasp_net_filter *nfilt);

int bcmasp_netfilt_get_active(struct bcmasp_intf *intf);

int bcmasp_netfilt_get_all_active(struct bcmasp_intf *intf, u32 *rule_locs,
				  u32 *rule_cnt);

void bcmasp_netfilt_suspend(struct bcmasp_intf *intf);

void bcmasp_eee_enable_set(struct bcmasp_intf *intf, bool enable);
#endif