linux/drivers/net/ethernet/microchip/lan743x_main.h

/* SPDX-License-Identifier: GPL-2.0+ */
/* Copyright (C) 2018 Microchip Technology Inc. */

#ifndef _LAN743X_H
#define _LAN743X_H

#include <linux/phy.h>
#include "lan743x_ptp.h"

#define DRIVER_AUTHOR
#define DRIVER_DESC
#define DRIVER_NAME

/* Register Definitions */
#define ID_REV
#define ID_REV_ID_MASK_
#define ID_REV_ID_LAN7430_
#define ID_REV_ID_LAN7431_
#define ID_REV_ID_LAN743X_
#define ID_REV_ID_A011_
#define ID_REV_ID_A041_
#define ID_REV_ID_A0X1_
#define ID_REV_IS_VALID_CHIP_ID_(id_rev)
#define ID_REV_CHIP_REV_MASK_
#define ID_REV_CHIP_REV_A0_
#define ID_REV_CHIP_REV_B0_
#define ID_REV_CHIP_REV_PCI11X1X_B0_

#define FPGA_REV
#define FPGA_REV_GET_MINOR_(fpga_rev)
#define FPGA_REV_GET_MAJOR_(fpga_rev)
#define FPGA_SGMII_OP

#define STRAP_READ
#define STRAP_READ_USE_SGMII_EN_
#define STRAP_READ_SGMII_EN_
#define STRAP_READ_SGMII_REFCLK_
#define STRAP_READ_SGMII_2_5G_
#define STRAP_READ_BASE_X_
#define STRAP_READ_RGMII_TXC_DELAY_EN_
#define STRAP_READ_RGMII_RXC_DELAY_EN_
#define STRAP_READ_ADV_PM_DISABLE_

#define HW_CFG
#define HW_CFG_RST_PROTECT_PCIE_
#define HW_CFG_HOT_RESET_DIS_
#define HW_CFG_D3_VAUX_OVR_
#define HW_CFG_D3_RESET_DIS_
#define HW_CFG_RST_PROTECT_
#define HW_CFG_RELOAD_TYPE_ALL_
#define HW_CFG_EE_OTP_RELOAD_
#define HW_CFG_LRST_

#define PMT_CTL
#define PMT_CTL_ETH_PHY_D3_COLD_OVR_
#define PMT_CTL_MAC_D3_RX_CLK_OVR_
#define PMT_CTL_ETH_PHY_EDPD_PLL_CTL_
#define PMT_CTL_ETH_PHY_D3_OVR_
#define PMT_CTL_RX_FCT_RFE_D3_CLK_OVR_
#define PMT_CTL_GPIO_WAKEUP_EN_
#define PMT_CTL_EEE_WAKEUP_EN_
#define PMT_CTL_RES_CLR_WKP_MASK_
#define PMT_CTL_READY_
#define PMT_CTL_ETH_PHY_RST_
#define PMT_CTL_WOL_EN_
#define PMT_CTL_ETH_PHY_WAKE_EN_
#define PMT_CTL_WUPS_MASK_

#define DP_SEL
#define DP_SEL_DPRDY_
#define DP_SEL_MASK_
#define DP_SEL_RFE_RAM

#define DP_SEL_VHF_HASH_LEN
#define DP_SEL_VHF_VLAN_LEN

#define DP_CMD
#define DP_CMD_WRITE_

#define DP_ADDR

#define DP_DATA_0

#define E2P_CMD
#define E2P_CMD_EPC_BUSY_
#define E2P_CMD_EPC_CMD_WRITE_
#define E2P_CMD_EPC_CMD_EWEN_
#define E2P_CMD_EPC_CMD_READ_
#define E2P_CMD_EPC_TIMEOUT_
#define E2P_CMD_EPC_ADDR_MASK_

#define E2P_DATA

/* Hearthstone top level & System Reg Addresses */
#define ETH_CTRL_REG_ADDR_BASE
#define ETH_SYS_REG_ADDR_BASE
#define CONFIG_REG_ADDR_BASE
#define ETH_EEPROM_REG_ADDR_BASE
#define ETH_OTP_REG_ADDR_BASE
#define GEN_SYS_CONFIG_LOAD_STARTED_REG
#define ETH_SYS_CONFIG_LOAD_STARTED_REG
#define GEN_SYS_LOAD_STARTED_REG_ETH_
#define SYS_LOCK_REG
#define SYS_LOCK_REG_MAIN_LOCK_
#define SYS_LOCK_REG_GEN_PERI_LOCK_
#define SYS_LOCK_REG_SPI_PERI_LOCK_
#define SYS_LOCK_REG_SMBUS_PERI_LOCK_
#define SYS_LOCK_REG_UART_SS_LOCK_
#define SYS_LOCK_REG_ENET_SS_LOCK_
#define SYS_LOCK_REG_USB_SS_LOCK_
#define ETH_SYSTEM_SYS_LOCK_REG
#define HS_EEPROM_REG_ADDR_BASE
#define HS_E2P_CMD
#define HS_E2P_CMD_EPC_BUSY_
#define HS_E2P_CMD_EPC_CMD_WRITE_
#define HS_E2P_CMD_EPC_CMD_READ_
#define HS_E2P_CMD_EPC_TIMEOUT_
#define HS_E2P_CMD_EPC_ADDR_MASK_
#define HS_E2P_DATA
#define HS_E2P_DATA_MASK_
#define HS_E2P_CFG
#define HS_E2P_CFG_I2C_PULSE_MASK_
#define HS_E2P_CFG_EEPROM_SIZE_SEL_
#define HS_E2P_CFG_I2C_BAUD_RATE_MASK_
#define HS_E2P_CFG_TEST_EEPR_TO_BYP_
#define HS_E2P_PAD_CTL

#define GPIO_CFG0
#define GPIO_CFG0_GPIO_DIR_BIT_(bit)
#define GPIO_CFG0_GPIO_DATA_BIT_(bit)

#define GPIO_CFG1
#define GPIO_CFG1_GPIOEN_BIT_(bit)
#define GPIO_CFG1_GPIOBUF_BIT_(bit)

#define GPIO_CFG2
#define GPIO_CFG2_1588_POL_BIT_(bit)

#define GPIO_CFG3
#define GPIO_CFG3_1588_CH_SEL_BIT_(bit)
#define GPIO_CFG3_1588_OE_BIT_(bit)

#define FCT_RX_CTL
#define FCT_RX_CTL_EN_(channel)
#define FCT_RX_CTL_DIS_(channel)
#define FCT_RX_CTL_RESET_(channel)

#define FCT_TX_CTL
#define FCT_TX_CTL_EN_(channel)
#define FCT_TX_CTL_DIS_(channel)
#define FCT_TX_CTL_RESET_(channel)

#define FCT_FLOW(rx_channel)
#define FCT_FLOW_CTL_OFF_THRESHOLD_
#define FCT_FLOW_CTL_OFF_THRESHOLD_SET_(value)
#define FCT_FLOW_CTL_REQ_EN_
#define FCT_FLOW_CTL_ON_THRESHOLD_
#define FCT_FLOW_CTL_ON_THRESHOLD_SET_(value)

#define MAC_CR
#define MAC_CR_MII_EN_
#define MAC_CR_EEE_EN_
#define MAC_CR_ADD_
#define MAC_CR_ASD_
#define MAC_CR_CNTR_RST_
#define MAC_CR_DPX_
#define MAC_CR_CFG_H_
#define MAC_CR_CFG_L_
#define MAC_CR_RST_

#define MAC_RX
#define MAC_RX_MAX_SIZE_SHIFT_
#define MAC_RX_MAX_SIZE_MASK_
#define MAC_RX_RXD_
#define MAC_RX_RXEN_

#define MAC_TX
#define MAC_TX_TXD_
#define MAC_TX_TXEN_

#define MAC_FLOW
#define MAC_FLOW_CR_TX_FCEN_
#define MAC_FLOW_CR_RX_FCEN_
#define MAC_FLOW_CR_FCPT_MASK_

#define MAC_RX_ADDRH

#define MAC_RX_ADDRL

#define MAC_MII_ACC
#define MAC_MII_ACC_MDC_CYCLE_SHIFT_
#define MAC_MII_ACC_MDC_CYCLE_MASK_
#define MAC_MII_ACC_MDC_CYCLE_2_5MHZ_
#define MAC_MII_ACC_MDC_CYCLE_5MHZ_
#define MAC_MII_ACC_MDC_CYCLE_12_5MHZ_
#define MAC_MII_ACC_MDC_CYCLE_25MHZ_
#define MAC_MII_ACC_MDC_CYCLE_1_25MHZ_
#define MAC_MII_ACC_PHY_ADDR_SHIFT_
#define MAC_MII_ACC_PHY_ADDR_MASK_
#define MAC_MII_ACC_MIIRINDA_SHIFT_
#define MAC_MII_ACC_MIIRINDA_MASK_
#define MAC_MII_ACC_MII_READ_
#define MAC_MII_ACC_MII_WRITE_
#define MAC_MII_ACC_MII_BUSY_

#define MAC_MII_ACC_MIIMMD_SHIFT_
#define MAC_MII_ACC_MIIMMD_MASK_
#define MAC_MII_ACC_MIICL45_
#define MAC_MII_ACC_MIICMD_MASK_
#define MAC_MII_ACC_MIICMD_ADDR_
#define MAC_MII_ACC_MIICMD_WRITE_
#define MAC_MII_ACC_MIICMD_READ_
#define MAC_MII_ACC_MIICMD_READ_INC_

#define MAC_MII_DATA

#define MAC_EEE_TX_LPI_REQ_DLY_CNT

#define MAC_WUCSR
#define MAC_MP_SO_EN_
#define MAC_WUCSR_RFE_WAKE_EN_
#define MAC_WUCSR_EEE_TX_WAKE_
#define MAC_WUCSR_EEE_RX_WAKE_
#define MAC_WUCSR_RFE_WAKE_FR_
#define MAC_WUCSR_PFDA_FR_
#define MAC_WUCSR_WUFR_
#define MAC_WUCSR_MPR_
#define MAC_WUCSR_BCAST_FR_
#define MAC_WUCSR_PFDA_EN_
#define MAC_WUCSR_WAKE_EN_
#define MAC_WUCSR_MPEN_
#define MAC_WUCSR_BCST_EN_

#define MAC_WK_SRC
#define MAC_WK_SRC_ETH_PHY_WK_
#define MAC_WK_SRC_IPV6_TCPSYN_RCD_WK_
#define MAC_WK_SRC_IPV4_TCPSYN_RCD_WK_
#define MAC_WK_SRC_EEE_TX_WK_
#define MAC_WK_SRC_EEE_RX_WK_
#define MAC_WK_SRC_RFE_FR_WK_
#define MAC_WK_SRC_PFDA_FR_WK_
#define MAC_WK_SRC_MP_FR_WK_
#define MAC_WK_SRC_BCAST_FR_WK_
#define MAC_WK_SRC_WU_FR_WK_
#define MAC_WK_SRC_WK_FR_SAVED_

#define MAC_MP_SO_HI
#define MAC_MP_SO_LO

#define MAC_WUF_CFG0
#define MAC_NUM_OF_WUF_CFG
#define MAC_WUF_CFG_BEGIN
#define MAC_WUF_CFG(index)
#define MAC_WUF_CFG_EN_
#define MAC_WUF_CFG_TYPE_MCAST_
#define MAC_WUF_CFG_TYPE_ALL_
#define MAC_WUF_CFG_OFFSET_SHIFT_
#define MAC_WUF_CFG_CRC16_MASK_

#define MAC_WUF_MASK0_0
#define MAC_WUF_MASK0_1
#define MAC_WUF_MASK0_2
#define MAC_WUF_MASK0_3
#define MAC_WUF_MASK0_BEGIN
#define MAC_WUF_MASK1_BEGIN
#define MAC_WUF_MASK2_BEGIN
#define MAC_WUF_MASK3_BEGIN
#define MAC_WUF_MASK0(index)
#define MAC_WUF_MASK1(index)
#define MAC_WUF_MASK2(index)
#define MAC_WUF_MASK3(index)

/* offset 0x400 - 0x500, x may range from 0 to 32, for a total of 33 entries */
#define RFE_ADDR_FILT_HI(x)
#define RFE_ADDR_FILT_HI_VALID_

/* offset 0x404 - 0x504, x may range from 0 to 32, for a total of 33 entries */
#define RFE_ADDR_FILT_LO(x)

#define RFE_CTL
#define RFE_CTL_TCP_UDP_COE_
#define RFE_CTL_IP_COE_
#define RFE_CTL_AB_
#define RFE_CTL_AM_
#define RFE_CTL_AU_
#define RFE_CTL_MCAST_HASH_
#define RFE_CTL_DA_PERFECT_

#define RFE_RSS_CFG
#define RFE_RSS_CFG_UDP_IPV6_EX_
#define RFE_RSS_CFG_TCP_IPV6_EX_
#define RFE_RSS_CFG_IPV6_EX_
#define RFE_RSS_CFG_UDP_IPV6_
#define RFE_RSS_CFG_TCP_IPV6_
#define RFE_RSS_CFG_IPV6_
#define RFE_RSS_CFG_UDP_IPV4_
#define RFE_RSS_CFG_TCP_IPV4_
#define RFE_RSS_CFG_IPV4_
#define RFE_RSS_CFG_VALID_HASH_BITS_
#define RFE_RSS_CFG_RSS_QUEUE_ENABLE_
#define RFE_RSS_CFG_RSS_HASH_STORE_
#define RFE_RSS_CFG_RSS_ENABLE_

#define RFE_HASH_KEY(index)

#define RFE_INDX(index)

#define MAC_WUCSR2
#define MAC_WUCSR2_NS_RCD_
#define MAC_WUCSR2_ARP_RCD_
#define MAC_WUCSR2_IPV6_TCPSYN_RCD_
#define MAC_WUCSR2_IPV4_TCPSYN_RCD_

#define SGMII_ACC
#define SGMII_ACC_SGMII_BZY_
#define SGMII_ACC_SGMII_WR_
#define SGMII_ACC_SGMII_MMD_SHIFT_
#define SGMII_ACC_SGMII_MMD_MASK_
#define SGMII_ACC_SGMII_MMD_VSR_
#define SGMII_ACC_SGMII_ADDR_SHIFT_
#define SGMII_ACC_SGMII_ADDR_MASK_
#define SGMII_DATA
#define SGMII_DATA_SHIFT_
#define SGMII_DATA_MASK_
#define SGMII_CTL
#define SGMII_CTL_SGMII_ENABLE_
#define SGMII_CTL_LINK_STATUS_SOURCE_
#define SGMII_CTL_SGMII_POWER_DN_

#define MISC_CTL_0
#define MISC_CTL_0_RFE_READ_FIFO_MASK_

/* Vendor Specific SGMII MMD details */
#define SR_VSMMD_PCS_ID1
#define SR_VSMMD_PCS_ID2
#define SR_VSMMD_STS
#define SR_VSMMD_CTRL

#define VR_MII_DIG_CTRL1
#define VR_MII_DIG_CTRL1_VR_RST_
#define VR_MII_DIG_CTRL1_R2TLBE_
#define VR_MII_DIG_CTRL1_EN_VSMMD1_
#define VR_MII_DIG_CTRL1_CS_EN_
#define VR_MII_DIG_CTRL1_MAC_AUTO_SW_
#define VR_MII_DIG_CTRL1_INIT_
#define VR_MII_DIG_CTRL1_DTXLANED_0_
#define VR_MII_DIG_CTRL1_CL37_TMR_OVR_RIDE_
#define VR_MII_DIG_CTRL1_EN_2_5G_MODE_
#define VR_MII_DIG_CTRL1_BYP_PWRUP_
#define VR_MII_DIG_CTRL1_PHY_MODE_CTRL_
#define VR_MII_AN_CTRL
#define VR_MII_AN_CTRL_MII_CTRL_
#define VR_MII_AN_CTRL_SGMII_LINK_STS_
#define VR_MII_AN_CTRL_TX_CONFIG_
#define VR_MII_AN_CTRL_1000BASE_X_
#define VR_MII_AN_CTRL_SGMII_MODE_
#define VR_MII_AN_CTRL_QSGMII_MODE_
#define VR_MII_AN_CTRL_PCS_MODE_SHIFT_
#define VR_MII_AN_CTRL_PCS_MODE_MASK_
#define VR_MII_AN_CTRL_MII_AN_INTR_EN_
#define VR_MII_AN_INTR_STS
#define VR_MII_AN_INTR_STS_LINK_UP_
#define VR_MII_AN_INTR_STS_SPEED_MASK_
#define VR_MII_AN_INTR_STS_1000_MBPS_
#define VR_MII_AN_INTR_STS_100_MBPS_
#define VR_MII_AN_INTR_STS_10_MBPS_
#define VR_MII_AN_INTR_STS_FDX_
#define VR_MII_AN_INTR_STS_CL37_ANCMPLT_INTR_

#define VR_MII_LINK_TIMER_CTRL
#define VR_MII_DIG_STS
#define VR_MII_DIG_STS_PSEQ_STATE_MASK_
#define VR_MII_DIG_STS_PSEQ_STATE_POS_
#define VR_MII_GEN2_4_MPLL_CTRL0
#define VR_MII_MPLL_CTRL0_REF_CLK_DIV2_
#define VR_MII_MPLL_CTRL0_USE_REFCLK_PAD_
#define VR_MII_GEN2_4_MPLL_CTRL1
#define VR_MII_MPLL_CTRL1_MPLL_MULTIPLIER_
#define VR_MII_BAUD_RATE_3P125GBPS
#define VR_MII_BAUD_RATE_1P25GBPS
#define VR_MII_MPLL_MULTIPLIER_125
#define VR_MII_MPLL_MULTIPLIER_100
#define VR_MII_MPLL_MULTIPLIER_50
#define VR_MII_MPLL_MULTIPLIER_40
#define VR_MII_GEN2_4_MISC_CTRL1
#define VR_MII_CTRL1_RX_RATE_0_MASK_
#define VR_MII_CTRL1_RX_RATE_0_SHIFT_
#define VR_MII_CTRL1_TX_RATE_0_MASK_
#define VR_MII_MPLL_BAUD_CLK
#define VR_MII_MPLL_BAUD_CLK_DIV_2
#define VR_MII_MPLL_BAUD_CLK_DIV_4

#define INT_STS
#define INT_BIT_DMA_RX_(channel)
#define INT_BIT_ALL_RX_
#define INT_BIT_DMA_TX_(channel)
#define INT_BIT_ALL_TX_
#define INT_BIT_SW_GP_
#define INT_BIT_1588_
#define INT_BIT_ALL_OTHER_
#define INT_BIT_MAS_

#define INT_SET

#define INT_EN_SET

#define INT_EN_CLR

#define INT_STS_R2C

#define INT_VEC_EN_SET
#define INT_VEC_EN_CLR
#define INT_VEC_EN_AUTO_CLR
#define INT_VEC_EN_(vector_index)

#define INT_VEC_MAP0
#define INT_VEC_MAP0_RX_VEC_(channel, vector)

#define INT_VEC_MAP1
#define INT_VEC_MAP1_TX_VEC_(channel, vector)

#define INT_VEC_MAP2

#define INT_MOD_MAP0

#define INT_MOD_MAP1

#define INT_MOD_MAP2

#define INT_MOD_CFG0
#define INT_MOD_CFG1
#define INT_MOD_CFG2
#define INT_MOD_CFG3
#define INT_MOD_CFG4
#define INT_MOD_CFG5
#define INT_MOD_CFG6
#define INT_MOD_CFG7
#define INT_MOD_CFG8
#define INT_MOD_CFG9

#define PTP_CMD_CTL
#define PTP_CMD_CTL_PTP_LTC_TARGET_READ_
#define PTP_CMD_CTL_PTP_CLK_STP_NSEC_
#define PTP_CMD_CTL_PTP_CLOCK_STEP_SEC_
#define PTP_CMD_CTL_PTP_CLOCK_LOAD_
#define PTP_CMD_CTL_PTP_CLOCK_READ_
#define PTP_CMD_CTL_PTP_ENABLE_
#define PTP_CMD_CTL_PTP_DISABLE_
#define PTP_CMD_CTL_PTP_RESET_
#define PTP_GENERAL_CONFIG
#define PTP_GENERAL_CONFIG_CLOCK_EVENT_X_MASK_(channel)
#define PTP_GENERAL_CONFIG_CLOCK_EVENT_100NS_
#define PTP_GENERAL_CONFIG_CLOCK_EVENT_10US_
#define PTP_GENERAL_CONFIG_CLOCK_EVENT_100US_
#define PTP_GENERAL_CONFIG_CLOCK_EVENT_1MS_
#define PTP_GENERAL_CONFIG_CLOCK_EVENT_10MS_
#define PTP_GENERAL_CONFIG_CLOCK_EVENT_200MS_
#define PTP_GENERAL_CONFIG_CLOCK_EVENT_TOGGLE_
#define PTP_GENERAL_CONFIG_CLOCK_EVENT_X_SET_(channel, value)
#define PTP_GENERAL_CONFIG_RELOAD_ADD_X_(channel)

#define HS_PTP_GENERAL_CONFIG
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_X_MASK_(channel)
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_100NS_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_500NS_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_1US_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_5US_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_10US_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_50US_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_100US_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_500US_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_1MS_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_5MS_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_10MS_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_50MS_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_100MS_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_200MS_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_TOGG_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_INT_
#define HS_PTP_GENERAL_CONFIG_CLOCK_EVENT_X_SET_(channel, value)
#define HS_PTP_GENERAL_CONFIG_EVENT_POL_X_(channel)
#define HS_PTP_GENERAL_CONFIG_RELOAD_ADD_X_(channel)

#define PTP_INT_STS
#define PTP_INT_IO_FE_MASK_
#define PTP_INT_IO_FE_SHIFT_
#define PTP_INT_IO_FE_SET_(channel)
#define PTP_INT_IO_RE_MASK_
#define PTP_INT_IO_RE_SHIFT_
#define PTP_INT_IO_RE_SET_(channel)
#define PTP_INT_TX_TS_OVRFL_INT_
#define PTP_INT_TX_SWTS_ERR_INT_
#define PTP_INT_TX_TS_INT_
#define PTP_INT_RX_TS_OVRFL_INT_
#define PTP_INT_RX_TS_INT_
#define PTP_INT_TIMER_INT_B_
#define PTP_INT_TIMER_INT_A_
#define PTP_INT_EN_SET
#define PTP_INT_EN_FE_EN_SET_(channel)
#define PTP_INT_EN_RE_EN_SET_(channel)
#define PTP_INT_EN_TIMER_SET_(channel)
#define PTP_INT_EN_CLR
#define PTP_INT_EN_FE_EN_CLR_(channel)
#define PTP_INT_EN_RE_EN_CLR_(channel)
#define PTP_INT_BIT_TX_SWTS_ERR_
#define PTP_INT_BIT_TX_TS_
#define PTP_INT_BIT_TIMER_B_
#define PTP_INT_BIT_TIMER_A_

#define PTP_CLOCK_SEC
#define PTP_CLOCK_NS
#define PTP_CLOCK_SUBNS
#define PTP_CLOCK_RATE_ADJ
#define PTP_CLOCK_RATE_ADJ_DIR_
#define PTP_CLOCK_STEP_ADJ
#define PTP_CLOCK_STEP_ADJ_DIR_
#define PTP_CLOCK_STEP_ADJ_VALUE_MASK_
#define PTP_CLOCK_TARGET_SEC_X(channel)
#define PTP_CLOCK_TARGET_NS_X(channel)
#define PTP_CLOCK_TARGET_RELOAD_SEC_X(channel)
#define PTP_CLOCK_TARGET_RELOAD_NS_X(channel)
#define PTP_LTC_SET_SEC_HI
#define PTP_LTC_SET_SEC_HI_SEC_47_32_MASK_
#define PTP_VERSION
#define PTP_VERSION_TX_UP_MASK_
#define PTP_VERSION_TX_LO_MASK_
#define PTP_VERSION_RX_UP_MASK_
#define PTP_VERSION_RX_LO_MASK_
#define PTP_IO_SEL
#define PTP_IO_SEL_MASK_
#define PTP_IO_SEL_SHIFT_
#define PTP_LATENCY
#define PTP_LATENCY_TX_SET_(tx_latency)
#define PTP_LATENCY_RX_SET_(rx_latency)
#define PTP_CAP_INFO
#define PTP_CAP_INFO_TX_TS_CNT_GET_(reg_val)
#define PTP_RX_TS_CFG
#define PTP_RX_TS_CFG_EVENT_MSGS_

#define PTP_TX_MOD
#define PTP_TX_MOD_TX_PTP_SYNC_TS_INSERT_

#define PTP_TX_MOD2
#define PTP_TX_MOD2_TX_PTP_CLR_UDPV4_CHKSUM_

#define PTP_TX_EGRESS_SEC
#define PTP_TX_EGRESS_NS
#define PTP_TX_EGRESS_NS_CAPTURE_CAUSE_MASK_
#define PTP_TX_EGRESS_NS_CAPTURE_CAUSE_AUTO_
#define PTP_TX_EGRESS_NS_CAPTURE_CAUSE_SW_
#define PTP_TX_EGRESS_NS_TS_NS_MASK_

#define PTP_TX_MSG_HEADER
#define PTP_TX_MSG_HEADER_MSG_TYPE_
#define PTP_TX_MSG_HEADER_MSG_TYPE_SYNC_

#define PTP_TX_CAP_INFO
#define PTP_TX_CAP_INFO_TX_CH_MASK_
#define PTP_TX_DOMAIN
#define PTP_TX_DOMAIN_MASK_
#define PTP_TX_DOMAIN_RANGE_EN_
#define PTP_TX_DOMAIN_RANGE_MASK_
#define PTP_TX_SDOID
#define PTP_TX_SDOID_MASK_
#define PTP_TX_SDOID_RANGE_EN_
#define PTP_TX_SDOID_11_0_MASK_
#define PTP_IO_CAP_CONFIG
#define PTP_IO_CAP_CONFIG_LOCK_FE_(channel)
#define PTP_IO_CAP_CONFIG_LOCK_RE_(channel)
#define PTP_IO_CAP_CONFIG_FE_CAP_EN_(channel)
#define PTP_IO_CAP_CONFIG_RE_CAP_EN_(channel)
#define PTP_IO_RE_LTC_SEC_CAP_X
#define PTP_IO_RE_LTC_NS_CAP_X
#define PTP_IO_FE_LTC_SEC_CAP_X
#define PTP_IO_FE_LTC_NS_CAP_X
#define PTP_IO_EVENT_OUTPUT_CFG
#define PTP_IO_EVENT_OUTPUT_CFG_SEL_(channel)
#define PTP_IO_EVENT_OUTPUT_CFG_EN_(channel)
#define PTP_IO_PIN_CFG
#define PTP_IO_PIN_CFG_OBUF_TYPE_(channel)
#define PTP_LTC_RD_SEC_HI
#define PTP_LTC_RD_SEC_HI_SEC_47_32_MASK_
#define PTP_LTC_RD_SEC_LO
#define PTP_LTC_RD_NS
#define PTP_LTC_RD_NS_29_0_MASK_
#define PTP_LTC_RD_SUBNS
#define PTP_RX_USER_MAC_HI
#define PTP_RX_USER_MAC_HI_47_32_MASK_
#define PTP_RX_USER_MAC_LO
#define PTP_RX_USER_IP_ADDR_0
#define PTP_RX_USER_IP_ADDR_1
#define PTP_RX_USER_IP_ADDR_2
#define PTP_RX_USER_IP_ADDR_3
#define PTP_RX_USER_IP_MASK_0
#define PTP_RX_USER_IP_MASK_1
#define PTP_RX_USER_IP_MASK_2
#define PTP_RX_USER_IP_MASK_3
#define PTP_TX_USER_MAC_HI
#define PTP_TX_USER_MAC_HI_47_32_MASK_
#define PTP_TX_USER_MAC_LO
#define PTP_TX_USER_IP_ADDR_0
#define PTP_TX_USER_IP_ADDR_1
#define PTP_TX_USER_IP_ADDR_2
#define PTP_TX_USER_IP_ADDR_3
#define PTP_TX_USER_IP_MASK_0
#define PTP_TX_USER_IP_MASK_1
#define PTP_TX_USER_IP_MASK_2
#define PTP_TX_USER_IP_MASK_3

#define DMAC_CFG
#define DMAC_CFG_COAL_EN_
#define DMAC_CFG_CH_ARB_SEL_RX_HIGH_
#define DMAC_CFG_MAX_READ_REQ_MASK_
#define DMAC_CFG_MAX_READ_REQ_SET_(val)
#define DMAC_CFG_MAX_DSPACE_16_
#define DMAC_CFG_MAX_DSPACE_32_
#define DMAC_CFG_MAX_DSPACE_64_
#define DMAC_CFG_MAX_DSPACE_128_

#define DMAC_COAL_CFG
#define DMAC_COAL_CFG_TIMER_LIMIT_MASK_
#define DMAC_COAL_CFG_TIMER_LIMIT_SET_(val)
#define DMAC_COAL_CFG_TIMER_TX_START_
#define DMAC_COAL_CFG_FLUSH_INTS_
#define DMAC_COAL_CFG_INT_EXIT_COAL_
#define DMAC_COAL_CFG_CSR_EXIT_COAL_
#define DMAC_COAL_CFG_TX_THRES_MASK_
#define DMAC_COAL_CFG_TX_THRES_SET_(val)
#define DMAC_COAL_CFG_RX_THRES_MASK_
#define DMAC_COAL_CFG_RX_THRES_SET_(val)

#define DMAC_OBFF_CFG
#define DMAC_OBFF_TX_THRES_MASK_
#define DMAC_OBFF_TX_THRES_SET_(val)
#define DMAC_OBFF_RX_THRES_MASK_
#define DMAC_OBFF_RX_THRES_SET_(val)

#define DMAC_CMD
#define DMAC_CMD_SWR_
#define DMAC_CMD_TX_SWR_(channel)
#define DMAC_CMD_START_T_(channel)
#define DMAC_CMD_STOP_T_(channel)
#define DMAC_CMD_RX_SWR_(channel)
#define DMAC_CMD_START_R_(channel)
#define DMAC_CMD_STOP_R_(channel)

#define DMAC_INT_STS
#define DMAC_INT_EN_SET
#define DMAC_INT_EN_CLR
#define DMAC_INT_BIT_RXFRM_(channel)
#define DMAC_INT_BIT_TX_IOC_(channel)

#define RX_CFG_A(channel)
#define RX_CFG_A_RX_WB_ON_INT_TMR_
#define RX_CFG_A_RX_WB_THRES_MASK_
#define RX_CFG_A_RX_WB_THRES_SET_(val)
#define RX_CFG_A_RX_PF_THRES_MASK_
#define RX_CFG_A_RX_PF_THRES_SET_(val)
#define RX_CFG_A_RX_PF_PRI_THRES_MASK_
#define RX_CFG_A_RX_PF_PRI_THRES_SET_(val)
#define RX_CFG_A_RX_HP_WB_EN_

#define RX_CFG_B(channel)
#define RX_CFG_B_TS_ALL_RX_
#define RX_CFG_B_TS_DESCR_EN_
#define RX_CFG_B_TS_NONE_
#define RX_CFG_B_TS_MASK_
#define RX_CFG_B_RX_PAD_MASK_
#define RX_CFG_B_RX_PAD_0_
#define RX_CFG_B_RX_PAD_2_
#define RX_CFG_B_RDMABL_512_
#define RX_CFG_B_RX_RING_LEN_MASK_

#define RX_BASE_ADDRH(channel)

#define RX_BASE_ADDRL(channel)

#define RX_HEAD_WRITEBACK_ADDRH(channel)

#define RX_HEAD_WRITEBACK_ADDRL(channel)

#define RX_HEAD(channel)

#define RX_TAIL(channel)
#define RX_TAIL_SET_TOP_INT_EN_
#define RX_TAIL_SET_TOP_INT_VEC_EN_

#define RX_CFG_C(channel)
#define RX_CFG_C_RX_TOP_INT_EN_AUTO_CLR_
#define RX_CFG_C_RX_INT_EN_R2C_
#define RX_CFG_C_RX_DMA_INT_STS_AUTO_CLR_
#define RX_CFG_C_RX_INT_STS_R2C_MODE_MASK_

#define TX_CFG_A(channel)
#define TX_CFG_A_TX_HP_WB_ON_INT_TMR_
#define TX_CFG_A_TX_TMR_HPWB_SEL_IOC_
#define TX_CFG_A_TX_PF_THRES_MASK_
#define TX_CFG_A_TX_PF_THRES_SET_(value)
#define TX_CFG_A_TX_PF_PRI_THRES_MASK_
#define TX_CFG_A_TX_PF_PRI_THRES_SET_(value)
#define TX_CFG_A_TX_HP_WB_EN_
#define TX_CFG_A_TX_HP_WB_THRES_MASK_
#define TX_CFG_A_TX_HP_WB_THRES_SET_(value)

#define TX_CFG_B(channel)
#define TX_CFG_B_TDMABL_512_
#define TX_CFG_B_TX_RING_LEN_MASK_

#define TX_BASE_ADDRH(channel)

#define TX_BASE_ADDRL(channel)

#define TX_HEAD_WRITEBACK_ADDRH(channel)

#define TX_HEAD_WRITEBACK_ADDRL(channel)

#define TX_HEAD(channel)

#define TX_TAIL(channel)
#define TX_TAIL_SET_DMAC_INT_EN_
#define TX_TAIL_SET_TOP_INT_EN_
#define TX_TAIL_SET_TOP_INT_VEC_EN_

#define TX_CFG_C(channel)
#define TX_CFG_C_TX_TOP_INT_EN_AUTO_CLR_
#define TX_CFG_C_TX_DMA_INT_EN_AUTO_CLR_
#define TX_CFG_C_TX_INT_EN_R2C_
#define TX_CFG_C_TX_DMA_INT_STS_AUTO_CLR_
#define TX_CFG_C_TX_INT_STS_R2C_MODE_MASK_

#define OTP_PWR_DN
#define OTP_PWR_DN_PWRDN_N_

#define OTP_ADDR_HIGH
#define OTP_ADDR_LOW

#define OTP_PRGM_DATA

#define OTP_PRGM_MODE
#define OTP_PRGM_MODE_BYTE_

#define OTP_READ_DATA

#define OTP_FUNC_CMD
#define OTP_FUNC_CMD_READ_

#define OTP_TST_CMD
#define OTP_TST_CMD_PRGVRFY_

#define OTP_CMD_GO
#define OTP_CMD_GO_GO_

#define OTP_STATUS
#define OTP_STATUS_BUSY_

/* Hearthstone OTP block registers */
#define HS_OTP_BLOCK_BASE
#define HS_OTP_PWR_DN
#define HS_OTP_ADDR_HIGH
#define HS_OTP_ADDR_LOW
#define HS_OTP_PRGM_DATA
#define HS_OTP_PRGM_MODE
#define HS_OTP_READ_DATA
#define HS_OTP_FUNC_CMD
#define HS_OTP_TST_CMD
#define HS_OTP_CMD_GO
#define HS_OTP_STATUS

/* MAC statistics registers */
#define STAT_RX_FCS_ERRORS
#define STAT_RX_ALIGNMENT_ERRORS
#define STAT_RX_FRAGMENT_ERRORS
#define STAT_RX_JABBER_ERRORS
#define STAT_RX_UNDERSIZE_FRAME_ERRORS
#define STAT_RX_OVERSIZE_FRAME_ERRORS
#define STAT_RX_DROPPED_FRAMES
#define STAT_RX_UNICAST_BYTE_COUNT
#define STAT_RX_BROADCAST_BYTE_COUNT
#define STAT_RX_MULTICAST_BYTE_COUNT
#define STAT_RX_UNICAST_FRAMES
#define STAT_RX_BROADCAST_FRAMES
#define STAT_RX_MULTICAST_FRAMES
#define STAT_RX_PAUSE_FRAMES
#define STAT_RX_64_BYTE_FRAMES
#define STAT_RX_65_127_BYTE_FRAMES
#define STAT_RX_128_255_BYTE_FRAMES
#define STAT_RX_256_511_BYTES_FRAMES
#define STAT_RX_512_1023_BYTE_FRAMES
#define STAT_RX_1024_1518_BYTE_FRAMES
#define STAT_RX_GREATER_1518_BYTE_FRAMES
#define STAT_RX_TOTAL_FRAMES
#define STAT_EEE_RX_LPI_TRANSITIONS
#define STAT_EEE_RX_LPI_TIME
#define STAT_RX_COUNTER_ROLLOVER_STATUS

#define STAT_TX_FCS_ERRORS
#define STAT_TX_EXCESS_DEFERRAL_ERRORS
#define STAT_TX_CARRIER_ERRORS
#define STAT_TX_BAD_BYTE_COUNT
#define STAT_TX_SINGLE_COLLISIONS
#define STAT_TX_MULTIPLE_COLLISIONS
#define STAT_TX_EXCESSIVE_COLLISION
#define STAT_TX_LATE_COLLISIONS
#define STAT_TX_UNICAST_BYTE_COUNT
#define STAT_TX_BROADCAST_BYTE_COUNT
#define STAT_TX_MULTICAST_BYTE_COUNT
#define STAT_TX_UNICAST_FRAMES
#define STAT_TX_BROADCAST_FRAMES
#define STAT_TX_MULTICAST_FRAMES
#define STAT_TX_PAUSE_FRAMES
#define STAT_TX_64_BYTE_FRAMES
#define STAT_TX_65_127_BYTE_FRAMES
#define STAT_TX_128_255_BYTE_FRAMES
#define STAT_TX_256_511_BYTES_FRAMES
#define STAT_TX_512_1023_BYTE_FRAMES
#define STAT_TX_1024_1518_BYTE_FRAMES
#define STAT_TX_GREATER_1518_BYTE_FRAMES
#define STAT_TX_TOTAL_FRAMES
#define STAT_EEE_TX_LPI_TRANSITIONS
#define STAT_EEE_TX_LPI_TIME
#define STAT_TX_COUNTER_ROLLOVER_STATUS

/* End of Register definitions */

#define LAN743X_MAX_RX_CHANNELS
#define LAN743X_MAX_TX_CHANNELS
#define PCI11X1X_MAX_TX_CHANNELS
struct lan743x_adapter;

#define LAN743X_USED_RX_CHANNELS
#define LAN743X_USED_TX_CHANNELS
#define PCI11X1X_USED_TX_CHANNELS
#define LAN743X_INT_MOD

#if (LAN743X_USED_RX_CHANNELS > LAN743X_MAX_RX_CHANNELS)
#error Invalid LAN743X_USED_RX_CHANNELS
#endif
#if (LAN743X_USED_TX_CHANNELS > LAN743X_MAX_TX_CHANNELS)
#error Invalid LAN743X_USED_TX_CHANNELS
#endif
#if (PCI11X1X_USED_TX_CHANNELS > PCI11X1X_MAX_TX_CHANNELS)
#error Invalid PCI11X1X_USED_TX_CHANNELS
#endif

/* PCI */
/* SMSC acquired EFAR late 1990's, MCHP acquired SMSC 2012 */
#define PCI_VENDOR_ID_SMSC
#define PCI_DEVICE_ID_SMSC_LAN7430
#define PCI_DEVICE_ID_SMSC_LAN7431
#define PCI_DEVICE_ID_SMSC_A011
#define PCI_DEVICE_ID_SMSC_A041

#define PCI_CONFIG_LENGTH

/* CSR */
#define CSR_LENGTH

#define LAN743X_CSR_FLAG_IS_A0
#define LAN743X_CSR_FLAG_IS_B0
#define LAN743X_CSR_FLAG_SUPPORTS_INTR_AUTO_SET_CLR

struct lan743x_csr {};

/* INTERRUPTS */
lan743x_vector_handler;

#define LAN743X_VECTOR_FLAG_IRQ_SHARED
#define LAN743X_VECTOR_FLAG_SOURCE_STATUS_READ
#define LAN743X_VECTOR_FLAG_SOURCE_STATUS_R2C
#define LAN743X_VECTOR_FLAG_SOURCE_STATUS_W2C
#define LAN743X_VECTOR_FLAG_SOURCE_ENABLE_CHECK
#define LAN743X_VECTOR_FLAG_SOURCE_ENABLE_CLEAR
#define LAN743X_VECTOR_FLAG_SOURCE_ENABLE_R2C
#define LAN743X_VECTOR_FLAG_MASTER_ENABLE_CLEAR
#define LAN743X_VECTOR_FLAG_MASTER_ENABLE_SET
#define LAN743X_VECTOR_FLAG_VECTOR_ENABLE_ISR_CLEAR
#define LAN743X_VECTOR_FLAG_VECTOR_ENABLE_ISR_SET
#define LAN743X_VECTOR_FLAG_VECTOR_ENABLE_AUTO_CLEAR
#define LAN743X_VECTOR_FLAG_VECTOR_ENABLE_AUTO_SET
#define LAN743X_VECTOR_FLAG_SOURCE_ENABLE_AUTO_CLEAR
#define LAN743X_VECTOR_FLAG_SOURCE_ENABLE_AUTO_SET
#define LAN743X_VECTOR_FLAG_SOURCE_STATUS_AUTO_CLEAR

struct lan743x_vector {};

#define LAN743X_MAX_VECTOR_COUNT
#define PCI11X1X_MAX_VECTOR_COUNT

struct lan743x_intr {};

#define LAN743X_MAX_FRAME_SIZE

/* PHY */
struct lan743x_phy {};

/* TX */
struct lan743x_tx_descriptor;
struct lan743x_tx_buffer_info;

#define GPIO_QUEUE_STARTED
#define GPIO_TX_FUNCTION
#define GPIO_TX_COMPLETION
#define GPIO_TX_FRAGMENT

#define TX_FRAME_FLAG_IN_PROGRESS

#define TX_TS_FLAG_TIMESTAMPING_ENABLED
#define TX_TS_FLAG_ONE_STEP_SYNC

struct lan743x_tx {};

void lan743x_tx_set_timestamping_mode(struct lan743x_tx *tx,
				      bool enable_timestamping,
				      bool enable_onestep_sync);

/* RX */
struct lan743x_rx_descriptor;
struct lan743x_rx_buffer_info;

struct lan743x_rx {};

int lan743x_rx_set_tstamp_mode(struct lan743x_adapter *adapter,
			       int rx_filter);

/* SGMII Link Speed Duplex status */
enum lan743x_sgmii_lsd {};

#define MAC_SUPPORTED_WAKES
struct lan743x_adapter {};

#define LAN743X_COMPONENT_FLAG_RX(channel)

#define INTR_FLAG_IRQ_REQUESTED(vector_index)
#define INTR_FLAG_MSI_ENABLED
#define INTR_FLAG_MSIX_ENABLED

#define MAC_MII_READ
#define MAC_MII_WRITE

#define PHY_FLAG_OPENED
#define PHY_FLAG_ATTACHED

#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
#define DMA_ADDR_HIGH32(dma_addr)
#else
#define DMA_ADDR_HIGH32
#endif
#define DMA_ADDR_LOW32(dma_addr)
#define DMA_DESCRIPTOR_SPACING_16
#define DMA_DESCRIPTOR_SPACING_32
#define DMA_DESCRIPTOR_SPACING_64
#define DMA_DESCRIPTOR_SPACING_128
#define DEFAULT_DMA_DESCRIPTOR_SPACING

#define DMAC_CHANNEL_STATE_SET(start_bit, stop_bit)
#define DMAC_CHANNEL_STATE_INITIAL
#define DMAC_CHANNEL_STATE_STARTED
#define DMAC_CHANNEL_STATE_STOP_PENDING
#define DMAC_CHANNEL_STATE_STOPPED

/* TX Descriptor bits */
#define TX_DESC_DATA0_DTYPE_MASK_
#define TX_DESC_DATA0_DTYPE_DATA_
#define TX_DESC_DATA0_DTYPE_EXT_
#define TX_DESC_DATA0_FS_
#define TX_DESC_DATA0_LS_
#define TX_DESC_DATA0_EXT_
#define TX_DESC_DATA0_IOC_
#define TX_DESC_DATA0_ICE_
#define TX_DESC_DATA0_IPE_
#define TX_DESC_DATA0_TPE_
#define TX_DESC_DATA0_FCS_
#define TX_DESC_DATA0_TSE_
#define TX_DESC_DATA0_BUF_LENGTH_MASK_
#define TX_DESC_DATA0_EXT_LSO_
#define TX_DESC_DATA0_EXT_PAY_LENGTH_MASK_
#define TX_DESC_DATA3_FRAME_LENGTH_MSS_MASK_

struct lan743x_tx_descriptor {} __aligned();

#define TX_BUFFER_INFO_FLAG_ACTIVE
#define TX_BUFFER_INFO_FLAG_TIMESTAMP_REQUESTED
#define TX_BUFFER_INFO_FLAG_IGNORE_SYNC
#define TX_BUFFER_INFO_FLAG_SKB_FRAGMENT
struct lan743x_tx_buffer_info {};

#define LAN743X_TX_RING_SIZE

/* OWN bit is set. ie, Descs are owned by RX DMAC */
#define RX_DESC_DATA0_OWN_
/* OWN bit is clear. ie, Descs are owned by host */
#define RX_DESC_DATA0_FS_
#define RX_DESC_DATA0_LS_
#define RX_DESC_DATA0_FRAME_LENGTH_MASK_
#define RX_DESC_DATA0_FRAME_LENGTH_GET_(data0)
#define RX_DESC_DATA0_EXT_
#define RX_DESC_DATA0_BUF_LENGTH_MASK_
#define RX_DESC_DATA1_STATUS_ICE_
#define RX_DESC_DATA1_STATUS_TCE_
#define RX_DESC_DATA1_STATUS_ICSM_
#define RX_DESC_DATA2_TS_NS_MASK_

#if ((NET_IP_ALIGN != 0) && (NET_IP_ALIGN != 2))
#error NET_IP_ALIGN must be 0 or 2
#endif

#define RX_HEAD_PADDING

struct lan743x_rx_descriptor {} __aligned();

#define RX_BUFFER_INFO_FLAG_ACTIVE
struct lan743x_rx_buffer_info {};

#define LAN743X_RX_RING_SIZE

#define RX_PROCESS_RESULT_NOTHING_TO_DO
#define RX_PROCESS_RESULT_BUFFER_RECEIVED

u32 lan743x_csr_read(struct lan743x_adapter *adapter, int offset);
void lan743x_csr_write(struct lan743x_adapter *adapter, int offset, u32 data);
int lan743x_hs_syslock_acquire(struct lan743x_adapter *adapter, u16 timeout);
void lan743x_hs_syslock_release(struct lan743x_adapter *adapter);
void lan743x_mac_flow_ctrl_set_enables(struct lan743x_adapter *adapter,
				       bool tx_enable, bool rx_enable);
int lan743x_sgmii_read(struct lan743x_adapter *adapter, u8 mmd, u16 addr);

#endif /* _LAN743X_H */