linux/drivers/net/ethernet/cavium/thunder/thunder_bgx.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (C) 2015 Cavium, Inc.
 */

#ifndef THUNDER_BGX_H
#define THUNDER_BGX_H

/* PCI device ID */
#define PCI_DEVICE_ID_THUNDER_BGX
#define PCI_DEVICE_ID_THUNDER_RGX

/* Subsystem device IDs */
#define PCI_SUBSYS_DEVID_88XX_BGX
#define PCI_SUBSYS_DEVID_81XX_BGX
#define PCI_SUBSYS_DEVID_81XX_RGX
#define PCI_SUBSYS_DEVID_83XX_BGX

#define MAX_BGX_THUNDER
#define MAX_BGX_PER_CN88XX
#define MAX_BGX_PER_CN81XX
#define MAX_BGX_PER_CN83XX
#define MAX_LMAC_PER_BGX
#define MAX_BGX_CHANS_PER_LMAC
#define MAX_DMAC_PER_LMAC
#define MAX_FRAME_SIZE
#define DEFAULT_PAUSE_TIME

#define BGX_ID_MASK
#define LMAC_ID_MASK

#define MAX_DMAC_PER_LMAC_TNS_BYPASS_MODE

/* Registers */
#define BGX_CMRX_CFG
#define CMR_PKT_TX_EN
#define CMR_PKT_RX_EN
#define CMR_EN
#define BGX_CMR_GLOBAL_CFG
#define CMR_GLOBAL_CFG_FCS_STRIP
#define BGX_CMRX_RX_ID_MAP
#define BGX_CMRX_RX_STAT0
#define BGX_CMRX_RX_STAT1
#define BGX_CMRX_RX_STAT2
#define BGX_CMRX_RX_STAT3
#define BGX_CMRX_RX_STAT4
#define BGX_CMRX_RX_STAT5
#define BGX_CMRX_RX_STAT6
#define BGX_CMRX_RX_STAT7
#define BGX_CMRX_RX_STAT8
#define BGX_CMRX_RX_STAT9
#define BGX_CMRX_RX_STAT10
#define BGX_CMRX_RX_BP_DROP
#define BGX_CMRX_RX_DMAC_CTL
#define BGX_CMRX_RX_FIFO_LEN
#define BGX_CMR_RX_DMACX_CAM
#define RX_DMACX_CAM_EN
#define RX_DMACX_CAM_LMACID(x)
#define RX_DMAC_COUNT
#define BGX_CMR_RX_STEERING
#define RX_TRAFFIC_STEER_RULE_COUNT
#define BGX_CMR_CHAN_MSK_AND
#define BGX_CMR_BIST_STATUS
#define BGX_CMR_RX_LMACS
#define BGX_CMRX_TX_FIFO_LEN
#define BGX_CMRX_TX_STAT0
#define BGX_CMRX_TX_STAT1
#define BGX_CMRX_TX_STAT2
#define BGX_CMRX_TX_STAT3
#define BGX_CMRX_TX_STAT4
#define BGX_CMRX_TX_STAT5
#define BGX_CMRX_TX_STAT6
#define BGX_CMRX_TX_STAT7
#define BGX_CMRX_TX_STAT8
#define BGX_CMRX_TX_STAT9
#define BGX_CMRX_TX_STAT10
#define BGX_CMRX_TX_STAT11
#define BGX_CMRX_TX_STAT12
#define BGX_CMRX_TX_STAT13
#define BGX_CMRX_TX_STAT14
#define BGX_CMRX_TX_STAT15
#define BGX_CMRX_TX_STAT16
#define BGX_CMRX_TX_STAT17
#define BGX_CMR_TX_LMACS

#define BGX_SPUX_CONTROL1
#define SPU_CTL_LOW_POWER
#define SPU_CTL_LOOPBACK
#define SPU_CTL_RESET
#define BGX_SPUX_STATUS1
#define SPU_STATUS1_RCV_LNK
#define BGX_SPUX_STATUS2
#define SPU_STATUS2_RCVFLT
#define BGX_SPUX_BX_STATUS
#define SPU_BX_STATUS_RX_ALIGN
#define BGX_SPUX_BR_STATUS1
#define SPU_BR_STATUS_BLK_LOCK
#define SPU_BR_STATUS_RCV_LNK
#define BGX_SPUX_BR_PMD_CRTL
#define SPU_PMD_CRTL_TRAIN_EN
#define BGX_SPUX_BR_PMD_LP_CUP
#define BGX_SPUX_BR_PMD_LD_CUP
#define BGX_SPUX_BR_PMD_LD_REP
#define BGX_SPUX_FEC_CONTROL
#define SPU_FEC_CTL_FEC_EN
#define SPU_FEC_CTL_ERR_EN
#define BGX_SPUX_AN_CONTROL
#define SPU_AN_CTL_AN_EN
#define SPU_AN_CTL_XNP_EN
#define BGX_SPUX_AN_ADV
#define BGX_SPUX_MISC_CONTROL
#define SPU_MISC_CTL_INTLV_RDISP
#define SPU_MISC_CTL_RX_DIS
#define BGX_SPUX_INT
#define BGX_SPUX_INT_W1S
#define BGX_SPUX_INT_ENA_W1C
#define BGX_SPUX_INT_ENA_W1S
#define BGX_SPU_DBG_CONTROL
#define SPU_DBG_CTL_AN_ARB_LINK_CHK_EN
#define SPU_DBG_CTL_AN_NONCE_MCT_DIS

#define BGX_SMUX_RX_INT
#define BGX_SMUX_RX_FRM_CTL
#define BGX_PKT_RX_PTP_EN
#define BGX_SMUX_RX_JABBER
#define BGX_SMUX_RX_CTL
#define SMU_RX_CTL_STATUS
#define BGX_SMUX_TX_APPEND
#define SMU_TX_APPEND_FCS_D
#define BGX_SMUX_TX_PAUSE_PKT_TIME
#define BGX_SMUX_TX_MIN_PKT
#define BGX_SMUX_TX_PAUSE_PKT_INTERVAL
#define BGX_SMUX_TX_PAUSE_ZERO
#define BGX_SMUX_TX_INT
#define BGX_SMUX_TX_CTL
#define SMU_TX_CTL_DIC_EN
#define SMU_TX_CTL_UNI_EN
#define SMU_TX_CTL_LNK_STATUS
#define BGX_SMUX_TX_THRESH
#define BGX_SMUX_CTL
#define SMU_CTL_RX_IDLE
#define SMU_CTL_TX_IDLE
#define BGX_SMUX_CBFC_CTL
#define RX_EN
#define TX_EN
#define BCK_EN
#define DRP_EN

#define BGX_GMP_PCS_MRX_CTL
#define PCS_MRX_CTL_RST_AN
#define PCS_MRX_CTL_PWR_DN
#define PCS_MRX_CTL_AN_EN
#define PCS_MRX_CTL_LOOPBACK1
#define PCS_MRX_CTL_RESET
#define BGX_GMP_PCS_MRX_STATUS
#define PCS_MRX_STATUS_LINK
#define PCS_MRX_STATUS_AN_CPT
#define BGX_GMP_PCS_ANX_ADV
#define BGX_GMP_PCS_ANX_AN_RESULTS
#define BGX_GMP_PCS_LINKX_TIMER
#define PCS_LINKX_TIMER_COUNT
#define BGX_GMP_PCS_SGM_AN_ADV
#define BGX_GMP_PCS_MISCX_CTL
#define PCS_MISC_CTL_MODE
#define PCS_MISC_CTL_DISP_EN
#define PCS_MISC_CTL_GMX_ENO
#define PCS_MISC_CTL_SAMP_PT_MASK
#define BGX_GMP_GMI_PRTX_CFG
#define GMI_PORT_CFG_SPEED
#define GMI_PORT_CFG_DUPLEX
#define GMI_PORT_CFG_SLOT_TIME
#define GMI_PORT_CFG_SPEED_MSB
#define GMI_PORT_CFG_RX_IDLE
#define GMI_PORT_CFG_TX_IDLE
#define BGX_GMP_GMI_RXX_FRM_CTL
#define BGX_GMP_GMI_RXX_JABBER
#define BGX_GMP_GMI_TXX_THRESH
#define BGX_GMP_GMI_TXX_APPEND
#define BGX_GMP_GMI_TXX_SLOT
#define BGX_GMP_GMI_TXX_BURST
#define BGX_GMP_GMI_TXX_MIN_PKT
#define BGX_GMP_GMI_TXX_SGMII_CTL
#define BGX_GMP_GMI_TXX_INT
#define BGX_GMP_GMI_TXX_INT_W1S
#define BGX_GMP_GMI_TXX_INT_ENA_W1C
#define BGX_GMP_GMI_TXX_INT_ENA_W1S
#define GMI_TXX_INT_PTP_LOST
#define GMI_TXX_INT_LATE_COL
#define GMI_TXX_INT_XSDEF
#define GMI_TXX_INT_XSCOL
#define GMI_TXX_INT_UNDFLW

#define BGX_MSIX_VEC_0_29_ADDR
#define BGX_MSIX_VEC_0_29_CTL
#define BGX_MSIX_PBA_0

/* MSI-X interrupts */
#define BGX_MSIX_VECTORS
#define BGX_LMAC_VEC_OFFSET
#define BGX_MSIX_VEC_SHIFT

#define CMRX_INT
#define SPUX_INT
#define SMUX_RX_INT
#define SMUX_TX_INT
#define GMPX_PCS_INT
#define GMPX_GMI_RX_INT
#define GMPX_GMI_TX_INT
#define CMR_MEM_INT
#define SPU_MEM_INT

#define LMAC_INTR_LINK_UP
#define LMAC_INTR_LINK_DOWN

#define BGX_XCAST_BCAST_ACCEPT
#define BGX_XCAST_MCAST_ACCEPT
#define BGX_XCAST_MCAST_FILTER

void bgx_set_dmac_cam_filter(int node, int bgx_idx, int lmacid, u64 mac, u8 vf);
void bgx_reset_xcast_mode(int node, int bgx_idx, int lmacid, u8 vf);
void bgx_set_xcast_mode(int node, int bgx_idx, int lmacid, u8 mode);
void octeon_mdiobus_force_mod_depencency(void);
void bgx_lmac_rx_tx_enable(int node, int bgx_idx, int lmacid, bool enable);
void bgx_add_dmac_addr(u64 dmac, int node, int bgx_idx, int lmac);
unsigned bgx_get_map(int node);
int bgx_get_lmac_count(int node, int bgx);
const u8 *bgx_get_lmac_mac(int node, int bgx_idx, int lmacid);
void bgx_set_lmac_mac(int node, int bgx_idx, int lmacid, const u8 *mac);
void bgx_get_lmac_link_state(int node, int bgx_idx, int lmacid, void *status);
void bgx_lmac_internal_loopback(int node, int bgx_idx,
				int lmac_idx, bool enable);
void bgx_config_timestamping(int node, int bgx_idx, int lmacid, bool enable);
void bgx_lmac_get_pfc(int node, int bgx_idx, int lmacid, void *pause);
void bgx_lmac_set_pfc(int node, int bgx_idx, int lmacid, void *pause);

void xcv_init_hw(void);
void xcv_setup_link(bool link_up, int link_speed);

u64 bgx_get_rx_stats(int node, int bgx_idx, int lmac, int idx);
u64 bgx_get_tx_stats(int node, int bgx_idx, int lmac, int idx);
#define BGX_RX_STATS_COUNT
#define BGX_TX_STATS_COUNT

struct bgx_stats {};

enum LMAC_TYPE {};

#endif /* THUNDER_BGX_H */