linux/drivers/net/ethernet/qualcomm/emac/emac.h

/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 */

#ifndef _EMAC_H_
#define _EMAC_H_

#include <linux/irqreturn.h>
#include <linux/netdevice.h>
#include <linux/clk.h>
#include <linux/platform_device.h>
#include "emac-mac.h"
#include "emac-phy.h"
#include "emac-sgmii.h"

/* EMAC base register offsets */
#define EMAC_DMA_MAS_CTRL
#define EMAC_IRQ_MOD_TIM_INIT
#define EMAC_BLK_IDLE_STS
#define EMAC_PHY_LINK_DELAY
#define EMAC_SYS_ALIV_CTRL
#define EMAC_MAC_CTRL
#define EMAC_MAC_IPGIFG_CTRL
#define EMAC_MAC_STA_ADDR0
#define EMAC_MAC_STA_ADDR1
#define EMAC_HASH_TAB_REG0
#define EMAC_HASH_TAB_REG1
#define EMAC_MAC_HALF_DPLX_CTRL
#define EMAC_MAX_FRAM_LEN_CTRL
#define EMAC_WOL_CTRL0
#define EMAC_RSS_KEY0
#define EMAC_H1TPD_BASE_ADDR_LO
#define EMAC_H2TPD_BASE_ADDR_LO
#define EMAC_H3TPD_BASE_ADDR_LO
#define EMAC_INTER_SRAM_PART9
#define EMAC_DESC_CTRL_0
#define EMAC_DESC_CTRL_1
#define EMAC_DESC_CTRL_2
#define EMAC_DESC_CTRL_10
#define EMAC_DESC_CTRL_12
#define EMAC_DESC_CTRL_13
#define EMAC_DESC_CTRL_3
#define EMAC_DESC_CTRL_4
#define EMAC_DESC_CTRL_5
#define EMAC_DESC_CTRL_14
#define EMAC_DESC_CTRL_15
#define EMAC_DESC_CTRL_16
#define EMAC_DESC_CTRL_6
#define EMAC_DESC_CTRL_8
#define EMAC_DESC_CTRL_9
#define EMAC_DESC_CTRL_11
#define EMAC_TXQ_CTRL_0
#define EMAC_TXQ_CTRL_1
#define EMAC_TXQ_CTRL_2
#define EMAC_RXQ_CTRL_0
#define EMAC_RXQ_CTRL_1
#define EMAC_RXQ_CTRL_2
#define EMAC_RXQ_CTRL_3
#define EMAC_BASE_CPU_NUMBER
#define EMAC_DMA_CTRL
#define EMAC_MAILBOX_0
#define EMAC_MAILBOX_5
#define EMAC_MAILBOX_6
#define EMAC_MAILBOX_13
#define EMAC_MAILBOX_2
#define EMAC_MAILBOX_3
#define EMAC_INT_STATUS
#define EMAC_INT_MASK
#define EMAC_MAILBOX_11
#define EMAC_AXI_MAST_CTRL
#define EMAC_MAILBOX_12
#define EMAC_MAILBOX_9
#define EMAC_MAILBOX_10
#define EMAC_ATHR_HEADER_CTRL
#define EMAC_RXMAC_STATC_REG0
#define EMAC_RXMAC_STATC_REG22
#define EMAC_TXMAC_STATC_REG0
#define EMAC_TXMAC_STATC_REG24
#define EMAC_CLK_GATE_CTRL
#define EMAC_CORE_HW_VERSION
#define EMAC_MISC_CTRL
#define EMAC_MAILBOX_7
#define EMAC_MAILBOX_8
#define EMAC_IDT_TABLE0
#define EMAC_RXMAC_STATC_REG23
#define EMAC_RXMAC_STATC_REG24
#define EMAC_TXMAC_STATC_REG25
#define EMAC_MAILBOX_15
#define EMAC_MAILBOX_16
#define EMAC_INT1_MASK
#define EMAC_INT1_STATUS
#define EMAC_INT2_MASK
#define EMAC_INT2_STATUS
#define EMAC_INT3_MASK
#define EMAC_INT3_STATUS

/* EMAC_DMA_MAS_CTRL */
#define DEV_ID_NUM_BMSK
#define DEV_ID_NUM_SHFT
#define DEV_REV_NUM_BMSK
#define DEV_REV_NUM_SHFT
#define INT_RD_CLR_EN
#define IRQ_MODERATOR2_EN
#define IRQ_MODERATOR_EN
#define LPW_CLK_SEL
#define LPW_STATE
#define LPW_MODE
#define SOFT_RST

/* EMAC_IRQ_MOD_TIM_INIT */
#define IRQ_MODERATOR2_INIT_BMSK
#define IRQ_MODERATOR2_INIT_SHFT
#define IRQ_MODERATOR_INIT_BMSK
#define IRQ_MODERATOR_INIT_SHFT

/* EMAC_INT_STATUS */
#define DIS_INT
#define PTP_INT
#define RFD4_UR_INT
#define TX_PKT_INT3
#define TX_PKT_INT2
#define TX_PKT_INT1
#define RX_PKT_INT3
#define RX_PKT_INT2
#define RX_PKT_INT1
#define RX_PKT_INT0
#define TX_PKT_INT
#define TXQ_TO_INT
#define GPHY_WAKEUP_INT
#define GPHY_LINK_DOWN_INT
#define GPHY_LINK_UP_INT
#define DMAW_TO_INT
#define DMAR_TO_INT
#define TXF_UR_INT
#define RFD3_UR_INT
#define RFD2_UR_INT
#define RFD1_UR_INT
#define RFD0_UR_INT
#define RXF_OF_INT
#define SW_MAN_INT

/* EMAC_MAILBOX_6 */
#define RFD2_PROC_IDX_BMSK
#define RFD2_PROC_IDX_SHFT
#define RFD2_PROD_IDX_BMSK
#define RFD2_PROD_IDX_SHFT

/* EMAC_CORE_HW_VERSION */
#define MAJOR_BMSK
#define MAJOR_SHFT
#define MINOR_BMSK
#define MINOR_SHFT
#define STEP_BMSK
#define STEP_SHFT

/* EMAC_EMAC_WRAPPER_CSR1 */
#define TX_INDX_FIFO_SYNC_RST
#define TX_TS_FIFO_SYNC_RST
#define RX_TS_FIFO2_SYNC_RST
#define RX_TS_FIFO1_SYNC_RST
#define TX_TS_ENABLE
#define DIS_1588_CLKS
#define FREQ_MODE
#define ENABLE_RRD_TIMESTAMP

/* EMAC_EMAC_WRAPPER_CSR2 */
#define HDRIVE_BMSK
#define HDRIVE_SHFT
#define SLB_EN
#define PLB_EN
#define WOL_EN
#define PHY_RESET

#define EMAC_DEV_ID

/* SGMII v2 per lane registers */
#define SGMII_LN_RSM_START

/* SGMII v2 PHY common registers */
#define SGMII_PHY_CMN_CTRL
#define SGMII_PHY_CMN_RESET_CTRL

/* SGMII v2 PHY registers per lane */
#define SGMII_PHY_LN_OFFSET
#define SGMII_PHY_LN_LANE_STATUS
#define SGMII_PHY_LN_BIST_GEN0
#define SGMII_PHY_LN_BIST_GEN1
#define SGMII_PHY_LN_BIST_GEN2
#define SGMII_PHY_LN_BIST_GEN3
#define SGMII_PHY_LN_CDR_CTRL1

enum emac_clk_id {};

#define EMAC_LINK_SPEED_UNKNOWN
#define EMAC_LINK_SPEED_10_HALF
#define EMAC_LINK_SPEED_10_FULL
#define EMAC_LINK_SPEED_100_HALF
#define EMAC_LINK_SPEED_100_FULL
#define EMAC_LINK_SPEED_1GB_FULL

#define EMAC_MAX_SETUP_LNK_CYCLE

struct emac_stats {};

/* RSS hstype Definitions */
#define EMAC_RSS_HSTYP_IPV4_EN
#define EMAC_RSS_HSTYP_TCP4_EN
#define EMAC_RSS_HSTYP_IPV6_EN
#define EMAC_RSS_HSTYP_TCP6_EN
#define EMAC_RSS_HSTYP_ALL_EN

#define EMAC_VLAN_TO_TAG(_vlan, _tag)

#define EMAC_TAG_TO_VLAN(_tag, _vlan)

#define EMAC_DEF_RX_BUF_SIZE
#define EMAC_MAX_JUMBO_PKT_SIZE
#define EMAC_MAX_TX_OFFLOAD_THRESH

#define EMAC_MAX_ETH_FRAME_SIZE
#define EMAC_MIN_ETH_FRAME_SIZE

#define EMAC_DEF_TX_QUEUES
#define EMAC_DEF_RX_QUEUES

#define EMAC_MIN_TX_DESCS
#define EMAC_MIN_RX_DESCS

#define EMAC_MAX_TX_DESCS
#define EMAC_MAX_RX_DESCS

#define EMAC_DEF_TX_DESCS
#define EMAC_DEF_RX_DESCS

#define EMAC_DEF_RX_IRQ_MOD
#define EMAC_DEF_TX_IRQ_MOD

#define EMAC_WATCHDOG_TIME

/* by default check link every 4 seconds */
#define EMAC_TRY_LINK_TIMEOUT

/* emac_irq per-device (per-adapter) irq properties.
 * @irq:	irq number.
 * @mask	mask to use over status register.
 */
struct emac_irq {};

/* The device's main data structure */
struct emac_adapter {};

int emac_reinit_locked(struct emac_adapter *adpt);
void emac_reg_update32(void __iomem *addr, u32 mask, u32 val);

void emac_set_ethtool_ops(struct net_device *netdev);
void emac_update_hw_stats(struct emac_adapter *adpt);

#endif /* _EMAC_H_ */