linux/drivers/net/ethernet/cadence/macb.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Atmel MACB Ethernet Controller driver
 *
 * Copyright (C) 2004-2006 Atmel Corporation
 */
#ifndef _MACB_H
#define _MACB_H

#include <linux/clk.h>
#include <linux/phylink.h>
#include <linux/ptp_clock_kernel.h>
#include <linux/net_tstamp.h>
#include <linux/interrupt.h>
#include <linux/phy/phy.h>

#if defined(CONFIG_ARCH_DMA_ADDR_T_64BIT) || defined(CONFIG_MACB_USE_HWSTAMP)
#define MACB_EXT_DESC
#endif

#define MACB_GREGS_NBR
#define MACB_GREGS_VERSION
#define MACB_MAX_QUEUES

/* MACB register offsets */
#define MACB_NCR
#define MACB_NCFGR
#define MACB_NSR
#define MACB_TAR
#define MACB_TCR
#define MACB_TSR
#define MACB_RBQP
#define MACB_TBQP
#define MACB_RSR
#define MACB_ISR
#define MACB_IER
#define MACB_IDR
#define MACB_IMR
#define MACB_MAN
#define MACB_PTR
#define MACB_PFR
#define MACB_FTO
#define MACB_SCF
#define MACB_MCF
#define MACB_FRO
#define MACB_FCSE
#define MACB_ALE
#define MACB_DTF
#define MACB_LCOL
#define MACB_EXCOL
#define MACB_TUND
#define MACB_CSE
#define MACB_RRE
#define MACB_ROVR
#define MACB_RSE
#define MACB_ELE
#define MACB_RJA
#define MACB_USF
#define MACB_STE
#define MACB_RLE
#define MACB_TPF
#define MACB_HRB
#define MACB_HRT
#define MACB_SA1B
#define MACB_SA1T
#define MACB_SA2B
#define MACB_SA2T
#define MACB_SA3B
#define MACB_SA3T
#define MACB_SA4B
#define MACB_SA4T
#define MACB_TID
#define MACB_TPQ
#define MACB_USRIO
#define MACB_WOL
#define MACB_MID
#define MACB_TBQPH
#define MACB_RBQPH

/* GEM register offsets. */
#define GEM_NCR
#define GEM_NCFGR
#define GEM_USRIO
#define GEM_DMACFG
#define GEM_PBUFRXCUT
#define GEM_JML
#define GEM_HS_MAC_CONFIG
#define GEM_HRB
#define GEM_HRT
#define GEM_SA1B
#define GEM_SA1T
#define GEM_SA2B
#define GEM_SA2T
#define GEM_SA3B
#define GEM_SA3T
#define GEM_SA4B
#define GEM_SA4T
#define GEM_WOL
#define GEM_RXPTPUNI
#define GEM_TXPTPUNI
#define GEM_EFTSH
#define GEM_EFRSH
#define GEM_PEFTSH
#define GEM_PEFRSH
#define GEM_OTX
#define GEM_OCTTXL
#define GEM_OCTTXH
#define GEM_TXCNT
#define GEM_TXBCCNT
#define GEM_TXMCCNT
#define GEM_TXPAUSECNT
#define GEM_TX64CNT
#define GEM_TX65CNT
#define GEM_TX128CNT
#define GEM_TX256CNT
#define GEM_TX512CNT
#define GEM_TX1024CNT
#define GEM_TX1519CNT
#define GEM_TXURUNCNT
#define GEM_SNGLCOLLCNT
#define GEM_MULTICOLLCNT
#define GEM_EXCESSCOLLCNT
#define GEM_LATECOLLCNT
#define GEM_TXDEFERCNT
#define GEM_TXCSENSECNT
#define GEM_ORX
#define GEM_OCTRXL
#define GEM_OCTRXH
#define GEM_RXCNT
#define GEM_RXBROADCNT
#define GEM_RXMULTICNT
#define GEM_RXPAUSECNT
#define GEM_RX64CNT
#define GEM_RX65CNT
#define GEM_RX128CNT
#define GEM_RX256CNT
#define GEM_RX512CNT
#define GEM_RX1024CNT
#define GEM_RX1519CNT
#define GEM_RXUNDRCNT
#define GEM_RXOVRCNT
#define GEM_RXJABCNT
#define GEM_RXFCSCNT
#define GEM_RXLENGTHCNT
#define GEM_RXSYMBCNT
#define GEM_RXALIGNCNT
#define GEM_RXRESERRCNT
#define GEM_RXORCNT
#define GEM_RXIPCCNT
#define GEM_RXTCPCCNT
#define GEM_RXUDPCCNT
#define GEM_TISUBN
#define GEM_TSH
#define GEM_TSL
#define GEM_TN
#define GEM_TA
#define GEM_TI
#define GEM_EFTSL
#define GEM_EFTN
#define GEM_EFRSL
#define GEM_EFRN
#define GEM_PEFTSL
#define GEM_PEFTN
#define GEM_PEFRSL
#define GEM_PEFRN
#define GEM_PCSCNTRL
#define GEM_PCSSTS
#define GEM_PCSPHYTOPID
#define GEM_PCSPHYBOTID
#define GEM_PCSANADV
#define GEM_PCSANLPBASE
#define GEM_PCSANEXP
#define GEM_PCSANNPTX
#define GEM_PCSANNPLP
#define GEM_PCSANEXTSTS
#define GEM_DCFG1
#define GEM_DCFG2
#define GEM_DCFG3
#define GEM_DCFG4
#define GEM_DCFG5
#define GEM_DCFG6
#define GEM_DCFG7
#define GEM_DCFG8
#define GEM_DCFG10
#define GEM_DCFG12
#define GEM_USX_CONTROL
#define GEM_USX_STATUS

#define GEM_TXBDCTRL
#define GEM_RXBDCTRL

/* Screener Type 2 match registers */
#define GEM_SCRT2

/* EtherType registers */
#define GEM_ETHT

/* Type 2 compare registers */
#define GEM_T2CMPW0
#define GEM_T2CMPW1
#define T2CMP_OFST(t2idx)

/* type 2 compare registers
 * each location requires 3 compare regs
 */
#define GEM_IP4SRC_CMP(idx)
#define GEM_IP4DST_CMP(idx)
#define GEM_PORT_CMP(idx)

/* Which screening type 2 EtherType register will be used (0 - 7) */
#define SCRT2_ETHT

#define GEM_ISR(hw_q)
#define GEM_TBQP(hw_q)
#define GEM_TBQPH(hw_q)
#define GEM_RBQP(hw_q)
#define GEM_RBQS(hw_q)
#define GEM_RBQPH(hw_q)
#define GEM_IER(hw_q)
#define GEM_IDR(hw_q)
#define GEM_IMR(hw_q)

/* Bitfields in NCR */
#define MACB_LB_OFFSET
#define MACB_LB_SIZE
#define MACB_LLB_OFFSET
#define MACB_LLB_SIZE
#define MACB_RE_OFFSET
#define MACB_RE_SIZE
#define MACB_TE_OFFSET
#define MACB_TE_SIZE
#define MACB_MPE_OFFSET
#define MACB_MPE_SIZE
#define MACB_CLRSTAT_OFFSET
#define MACB_CLRSTAT_SIZE
#define MACB_INCSTAT_OFFSET
#define MACB_INCSTAT_SIZE
#define MACB_WESTAT_OFFSET
#define MACB_WESTAT_SIZE
#define MACB_BP_OFFSET
#define MACB_BP_SIZE
#define MACB_TSTART_OFFSET
#define MACB_TSTART_SIZE
#define MACB_THALT_OFFSET
#define MACB_THALT_SIZE
#define MACB_NCR_TPF_OFFSET
#define MACB_NCR_TPF_SIZE
#define MACB_TZQ_OFFSET
#define MACB_TZQ_SIZE
#define MACB_SRTSM_OFFSET
#define MACB_PTPUNI_OFFSET
#define MACB_PTPUNI_SIZE
#define MACB_OSSMODE_OFFSET
#define MACB_OSSMODE_SIZE
#define MACB_MIIONRGMII_OFFSET
#define MACB_MIIONRGMII_SIZE

/* Bitfields in NCFGR */
#define MACB_SPD_OFFSET
#define MACB_SPD_SIZE
#define MACB_FD_OFFSET
#define MACB_FD_SIZE
#define MACB_BIT_RATE_OFFSET
#define MACB_BIT_RATE_SIZE
#define MACB_JFRAME_OFFSET
#define MACB_JFRAME_SIZE
#define MACB_CAF_OFFSET
#define MACB_CAF_SIZE
#define MACB_NBC_OFFSET
#define MACB_NBC_SIZE
#define MACB_NCFGR_MTI_OFFSET
#define MACB_NCFGR_MTI_SIZE
#define MACB_UNI_OFFSET
#define MACB_UNI_SIZE
#define MACB_BIG_OFFSET
#define MACB_BIG_SIZE
#define MACB_EAE_OFFSET
#define MACB_EAE_SIZE
#define MACB_CLK_OFFSET
#define MACB_CLK_SIZE
#define MACB_RTY_OFFSET
#define MACB_RTY_SIZE
#define MACB_PAE_OFFSET
#define MACB_PAE_SIZE
#define MACB_RM9200_RMII_OFFSET
#define MACB_RM9200_RMII_SIZE
#define MACB_RBOF_OFFSET
#define MACB_RBOF_SIZE
#define MACB_RLCE_OFFSET
#define MACB_RLCE_SIZE
#define MACB_DRFCS_OFFSET
#define MACB_DRFCS_SIZE
#define MACB_EFRHD_OFFSET
#define MACB_EFRHD_SIZE
#define MACB_IRXFCS_OFFSET
#define MACB_IRXFCS_SIZE

/* GEM specific NCR bitfields. */
#define GEM_ENABLE_HS_MAC_OFFSET
#define GEM_ENABLE_HS_MAC_SIZE

/* GEM specific NCFGR bitfields. */
#define GEM_FD_OFFSET
#define GEM_FD_SIZE
#define GEM_GBE_OFFSET
#define GEM_GBE_SIZE
#define GEM_PCSSEL_OFFSET
#define GEM_PCSSEL_SIZE
#define GEM_PAE_OFFSET
#define GEM_PAE_SIZE
#define GEM_CLK_OFFSET
#define GEM_CLK_SIZE
#define GEM_DBW_OFFSET
#define GEM_DBW_SIZE
#define GEM_RXCOEN_OFFSET
#define GEM_RXCOEN_SIZE
#define GEM_SGMIIEN_OFFSET
#define GEM_SGMIIEN_SIZE


/* Constants for data bus width. */
#define GEM_DBW32
#define GEM_DBW64
#define GEM_DBW128

/* Bitfields in DMACFG. */
#define GEM_FBLDO_OFFSET
#define GEM_FBLDO_SIZE
#define GEM_ENDIA_DESC_OFFSET
#define GEM_ENDIA_DESC_SIZE
#define GEM_ENDIA_PKT_OFFSET
#define GEM_ENDIA_PKT_SIZE
#define GEM_RXBMS_OFFSET
#define GEM_RXBMS_SIZE
#define GEM_TXPBMS_OFFSET
#define GEM_TXPBMS_SIZE
#define GEM_TXCOEN_OFFSET
#define GEM_TXCOEN_SIZE
#define GEM_RXBS_OFFSET
#define GEM_RXBS_SIZE
#define GEM_DDRP_OFFSET
#define GEM_DDRP_SIZE
#define GEM_RXEXT_OFFSET
#define GEM_RXEXT_SIZE
#define GEM_TXEXT_OFFSET
#define GEM_TXEXT_SIZE
#define GEM_ADDR64_OFFSET
#define GEM_ADDR64_SIZE


/* Bitfields in PBUFRXCUT */
#define GEM_ENCUTTHRU_OFFSET
#define GEM_ENCUTTHRU_SIZE

/* Bitfields in NSR */
#define MACB_NSR_LINK_OFFSET
#define MACB_NSR_LINK_SIZE
#define MACB_MDIO_OFFSET
#define MACB_MDIO_SIZE
#define MACB_IDLE_OFFSET
#define MACB_IDLE_SIZE

/* Bitfields in TSR */
#define MACB_UBR_OFFSET
#define MACB_UBR_SIZE
#define MACB_COL_OFFSET
#define MACB_COL_SIZE
#define MACB_TSR_RLE_OFFSET
#define MACB_TSR_RLE_SIZE
#define MACB_TGO_OFFSET
#define MACB_TGO_SIZE
#define MACB_BEX_OFFSET
#define MACB_BEX_SIZE
#define MACB_RM9200_BNQ_OFFSET
#define MACB_RM9200_BNQ_SIZE
#define MACB_COMP_OFFSET
#define MACB_COMP_SIZE
#define MACB_UND_OFFSET
#define MACB_UND_SIZE

/* Bitfields in RSR */
#define MACB_BNA_OFFSET
#define MACB_BNA_SIZE
#define MACB_REC_OFFSET
#define MACB_REC_SIZE
#define MACB_OVR_OFFSET
#define MACB_OVR_SIZE

/* Bitfields in ISR/IER/IDR/IMR */
#define MACB_MFD_OFFSET
#define MACB_MFD_SIZE
#define MACB_RCOMP_OFFSET
#define MACB_RCOMP_SIZE
#define MACB_RXUBR_OFFSET
#define MACB_RXUBR_SIZE
#define MACB_TXUBR_OFFSET
#define MACB_TXUBR_SIZE
#define MACB_ISR_TUND_OFFSET
#define MACB_ISR_TUND_SIZE
#define MACB_ISR_RLE_OFFSET
#define MACB_ISR_RLE_SIZE
#define MACB_TXERR_OFFSET
#define MACB_TXERR_SIZE
#define MACB_RM9200_TBRE_OFFSET
#define MACB_RM9200_TBRE_SIZE
#define MACB_TCOMP_OFFSET
#define MACB_TCOMP_SIZE
#define MACB_ISR_LINK_OFFSET
#define MACB_ISR_LINK_SIZE
#define MACB_ISR_ROVR_OFFSET
#define MACB_ISR_ROVR_SIZE
#define MACB_HRESP_OFFSET
#define MACB_HRESP_SIZE
#define MACB_PFR_OFFSET
#define MACB_PFR_SIZE
#define MACB_PTZ_OFFSET
#define MACB_PTZ_SIZE
#define MACB_WOL_OFFSET
#define MACB_WOL_SIZE
#define MACB_DRQFR_OFFSET
#define MACB_DRQFR_SIZE
#define MACB_SFR_OFFSET
#define MACB_SFR_SIZE
#define MACB_DRQFT_OFFSET
#define MACB_DRQFT_SIZE
#define MACB_SFT_OFFSET
#define MACB_SFT_SIZE
#define MACB_PDRQFR_OFFSET
#define MACB_PDRQFR_SIZE
#define MACB_PDRSFR_OFFSET
#define MACB_PDRSFR_SIZE
#define MACB_PDRQFT_OFFSET
#define MACB_PDRQFT_SIZE
#define MACB_PDRSFT_OFFSET
#define MACB_PDRSFT_SIZE
#define MACB_SRI_OFFSET
#define MACB_SRI_SIZE
#define GEM_WOL_OFFSET
#define GEM_WOL_SIZE

/* Timer increment fields */
#define MACB_TI_CNS_OFFSET
#define MACB_TI_CNS_SIZE
#define MACB_TI_ACNS_OFFSET
#define MACB_TI_ACNS_SIZE
#define MACB_TI_NIT_OFFSET
#define MACB_TI_NIT_SIZE

/* Bitfields in MAN */
#define MACB_DATA_OFFSET
#define MACB_DATA_SIZE
#define MACB_CODE_OFFSET
#define MACB_CODE_SIZE
#define MACB_REGA_OFFSET
#define MACB_REGA_SIZE
#define MACB_PHYA_OFFSET
#define MACB_PHYA_SIZE
#define MACB_RW_OFFSET
#define MACB_RW_SIZE
#define MACB_SOF_OFFSET
#define MACB_SOF_SIZE

/* Bitfields in USRIO (AVR32) */
#define MACB_MII_OFFSET
#define MACB_MII_SIZE
#define MACB_EAM_OFFSET
#define MACB_EAM_SIZE
#define MACB_TX_PAUSE_OFFSET
#define MACB_TX_PAUSE_SIZE
#define MACB_TX_PAUSE_ZERO_OFFSET
#define MACB_TX_PAUSE_ZERO_SIZE

/* Bitfields in USRIO (AT91) */
#define MACB_RMII_OFFSET
#define MACB_RMII_SIZE
#define GEM_RGMII_OFFSET
#define GEM_RGMII_SIZE
#define MACB_CLKEN_OFFSET
#define MACB_CLKEN_SIZE

/* Bitfields in WOL */
#define MACB_IP_OFFSET
#define MACB_IP_SIZE
#define MACB_MAG_OFFSET
#define MACB_MAG_SIZE
#define MACB_ARP_OFFSET
#define MACB_ARP_SIZE
#define MACB_SA1_OFFSET
#define MACB_SA1_SIZE
#define MACB_WOL_MTI_OFFSET
#define MACB_WOL_MTI_SIZE

/* Bitfields in MID */
#define MACB_IDNUM_OFFSET
#define MACB_IDNUM_SIZE
#define MACB_REV_OFFSET
#define MACB_REV_SIZE

/* Bitfield in HS_MAC_CONFIG */
#define GEM_HS_MAC_SPEED_OFFSET
#define GEM_HS_MAC_SPEED_SIZE

/* Bitfields in PCSCNTRL */
#define GEM_PCSAUTONEG_OFFSET
#define GEM_PCSAUTONEG_SIZE

/* Bitfields in DCFG1. */
#define GEM_IRQCOR_OFFSET
#define GEM_IRQCOR_SIZE
#define GEM_DBWDEF_OFFSET
#define GEM_DBWDEF_SIZE
#define GEM_NO_PCS_OFFSET
#define GEM_NO_PCS_SIZE

/* Bitfields in DCFG2. */
#define GEM_RX_PKT_BUFF_OFFSET
#define GEM_RX_PKT_BUFF_SIZE
#define GEM_TX_PKT_BUFF_OFFSET
#define GEM_TX_PKT_BUFF_SIZE

#define GEM_RX_PBUF_ADDR_OFFSET
#define GEM_RX_PBUF_ADDR_SIZE

/* Bitfields in DCFG5. */
#define GEM_TSU_OFFSET
#define GEM_TSU_SIZE

/* Bitfields in DCFG6. */
#define GEM_PBUF_LSO_OFFSET
#define GEM_PBUF_LSO_SIZE
#define GEM_PBUF_CUTTHRU_OFFSET
#define GEM_PBUF_CUTTHRU_SIZE
#define GEM_DAW64_OFFSET
#define GEM_DAW64_SIZE

/* Bitfields in DCFG8. */
#define GEM_T1SCR_OFFSET
#define GEM_T1SCR_SIZE
#define GEM_T2SCR_OFFSET
#define GEM_T2SCR_SIZE
#define GEM_SCR2ETH_OFFSET
#define GEM_SCR2ETH_SIZE
#define GEM_SCR2CMP_OFFSET
#define GEM_SCR2CMP_SIZE

/* Bitfields in DCFG10 */
#define GEM_TXBD_RDBUFF_OFFSET
#define GEM_TXBD_RDBUFF_SIZE
#define GEM_RXBD_RDBUFF_OFFSET
#define GEM_RXBD_RDBUFF_SIZE

/* Bitfields in DCFG12. */
#define GEM_HIGH_SPEED_OFFSET
#define GEM_HIGH_SPEED_SIZE

/* Bitfields in USX_CONTROL. */
#define GEM_USX_CTRL_SPEED_OFFSET
#define GEM_USX_CTRL_SPEED_SIZE
#define GEM_SERDES_RATE_OFFSET
#define GEM_SERDES_RATE_SIZE
#define GEM_RX_SCR_BYPASS_OFFSET
#define GEM_RX_SCR_BYPASS_SIZE
#define GEM_TX_SCR_BYPASS_OFFSET
#define GEM_TX_SCR_BYPASS_SIZE
#define GEM_TX_EN_OFFSET
#define GEM_TX_EN_SIZE
#define GEM_SIGNAL_OK_OFFSET
#define GEM_SIGNAL_OK_SIZE

/* Bitfields in USX_STATUS. */
#define GEM_USX_BLOCK_LOCK_OFFSET
#define GEM_USX_BLOCK_LOCK_SIZE

/* Bitfields in TISUBN */
#define GEM_SUBNSINCR_OFFSET
#define GEM_SUBNSINCRL_OFFSET
#define GEM_SUBNSINCRL_SIZE
#define GEM_SUBNSINCRH_OFFSET
#define GEM_SUBNSINCRH_SIZE
#define GEM_SUBNSINCR_SIZE

/* Bitfields in TI */
#define GEM_NSINCR_OFFSET
#define GEM_NSINCR_SIZE

/* Bitfields in TSH */
#define GEM_TSH_OFFSET
#define GEM_TSH_SIZE

/* Bitfields in TSL */
#define GEM_TSL_OFFSET
#define GEM_TSL_SIZE

/* Bitfields in TN */
#define GEM_TN_OFFSET
#define GEM_TN_SIZE

/* Bitfields in TXBDCTRL */
#define GEM_TXTSMODE_OFFSET
#define GEM_TXTSMODE_SIZE

/* Bitfields in RXBDCTRL */
#define GEM_RXTSMODE_OFFSET
#define GEM_RXTSMODE_SIZE

/* Bitfields in SCRT2 */
#define GEM_QUEUE_OFFSET
#define GEM_QUEUE_SIZE
#define GEM_VLANPR_OFFSET
#define GEM_VLANPR_SIZE
#define GEM_VLANEN_OFFSET
#define GEM_VLANEN_SIZE
#define GEM_ETHT2IDX_OFFSET
#define GEM_ETHT2IDX_SIZE
#define GEM_ETHTEN_OFFSET
#define GEM_ETHTEN_SIZE
#define GEM_CMPA_OFFSET
#define GEM_CMPA_SIZE
#define GEM_CMPAEN_OFFSET
#define GEM_CMPAEN_SIZE
#define GEM_CMPB_OFFSET
#define GEM_CMPB_SIZE
#define GEM_CMPBEN_OFFSET
#define GEM_CMPBEN_SIZE
#define GEM_CMPC_OFFSET
#define GEM_CMPC_SIZE
#define GEM_CMPCEN_OFFSET
#define GEM_CMPCEN_SIZE

/* Bitfields in ETHT */
#define GEM_ETHTCMP_OFFSET
#define GEM_ETHTCMP_SIZE

/* Bitfields in T2CMPW0 */
#define GEM_T2CMP_OFFSET
#define GEM_T2CMP_SIZE
#define GEM_T2MASK_OFFSET
#define GEM_T2MASK_SIZE

/* Bitfields in T2CMPW1 */
#define GEM_T2DISMSK_OFFSET
#define GEM_T2DISMSK_SIZE
#define GEM_T2CMPOFST_OFFSET
#define GEM_T2CMPOFST_SIZE
#define GEM_T2OFST_OFFSET
#define GEM_T2OFST_SIZE

/* Bitfields in queue pointer registers */
#define MACB_QUEUE_DISABLE_OFFSET
#define MACB_QUEUE_DISABLE_SIZE

/* Offset for screener type 2 compare values (T2CMPOFST).
 * Note the offset is applied after the specified point,
 * e.g. GEM_T2COMPOFST_ETYPE denotes the EtherType field, so an offset
 * of 12 bytes from this would be the source IP address in an IP header
 */
#define GEM_T2COMPOFST_SOF
#define GEM_T2COMPOFST_ETYPE
#define GEM_T2COMPOFST_IPHDR
#define GEM_T2COMPOFST_TCPUDP

/* offset from EtherType to IP address */
#define ETYPE_SRCIP_OFFSET
#define ETYPE_DSTIP_OFFSET

/* offset from IP header to port */
#define IPHDR_SRCPORT_OFFSET
#define IPHDR_DSTPORT_OFFSET

/* Transmit DMA buffer descriptor Word 1 */
#define GEM_DMA_TXVALID_OFFSET
#define GEM_DMA_TXVALID_SIZE

/* Receive DMA buffer descriptor Word 0 */
#define GEM_DMA_RXVALID_OFFSET
#define GEM_DMA_RXVALID_SIZE

/* DMA buffer descriptor Word 2 (32 bit addressing) or Word 4 (64 bit addressing) */
#define GEM_DMA_SECL_OFFSET
#define GEM_DMA_SECL_SIZE
#define GEM_DMA_NSEC_OFFSET
#define GEM_DMA_NSEC_SIZE

/* DMA buffer descriptor Word 3 (32 bit addressing) or Word 5 (64 bit addressing) */

/* New hardware supports 12 bit precision of timestamp in DMA buffer descriptor.
 * Old hardware supports only 6 bit precision but it is enough for PTP.
 * Less accuracy is used always instead of checking hardware version.
 */
#define GEM_DMA_SECH_OFFSET
#define GEM_DMA_SECH_SIZE
#define GEM_DMA_SEC_WIDTH
#define GEM_DMA_SEC_TOP
#define GEM_DMA_SEC_MASK

/* Bitfields in ADJ */
#define GEM_ADDSUB_OFFSET
#define GEM_ADDSUB_SIZE
/* Constants for CLK */
#define MACB_CLK_DIV8
#define MACB_CLK_DIV16
#define MACB_CLK_DIV32
#define MACB_CLK_DIV64

/* GEM specific constants for CLK. */
#define GEM_CLK_DIV8
#define GEM_CLK_DIV16
#define GEM_CLK_DIV32
#define GEM_CLK_DIV48
#define GEM_CLK_DIV64
#define GEM_CLK_DIV96
#define GEM_CLK_DIV128
#define GEM_CLK_DIV224

/* Constants for MAN register */
#define MACB_MAN_C22_SOF
#define MACB_MAN_C22_WRITE
#define MACB_MAN_C22_READ
#define MACB_MAN_C22_CODE

#define MACB_MAN_C45_SOF
#define MACB_MAN_C45_ADDR
#define MACB_MAN_C45_WRITE
#define MACB_MAN_C45_POST_READ_INCR
#define MACB_MAN_C45_READ
#define MACB_MAN_C45_CODE

/* Capability mask bits */
#define MACB_CAPS_ISR_CLEAR_ON_WRITE
#define MACB_CAPS_USRIO_HAS_CLKEN
#define MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII
#define MACB_CAPS_NO_GIGABIT_HALF
#define MACB_CAPS_USRIO_DISABLED
#define MACB_CAPS_JUMBO
#define MACB_CAPS_GEM_HAS_PTP
#define MACB_CAPS_BD_RD_PREFETCH
#define MACB_CAPS_NEEDS_RSTONUBR
#define MACB_CAPS_MIIONRGMII
#define MACB_CAPS_NEED_TSUCLK
#define MACB_CAPS_QUEUE_DISABLE
#define MACB_CAPS_PCS
#define MACB_CAPS_HIGH_SPEED
#define MACB_CAPS_CLK_HW_CHG
#define MACB_CAPS_MACB_IS_EMAC
#define MACB_CAPS_FIFO_MODE
#define MACB_CAPS_GIGABIT_MODE_AVAILABLE
#define MACB_CAPS_SG_DISABLED
#define MACB_CAPS_MACB_IS_GEM

/* LSO settings */
#define MACB_LSO_UFO_ENABLE
#define MACB_LSO_TSO_ENABLE

/* Bit manipulation macros */
#define MACB_BIT(name)
#define MACB_BF(name,value)
#define MACB_BFEXT(name,value)
#define MACB_BFINS(name,value,old)

#define GEM_BIT(name)
#define GEM_BF(name, value)
#define GEM_BFEXT(name, value)
#define GEM_BFINS(name, value, old)

/* Register access macros */
#define macb_readl(port, reg)
#define macb_writel(port, reg, value)
#define gem_readl(port, reg)
#define gem_writel(port, reg, value)
#define queue_readl(queue, reg)
#define queue_writel(queue, reg, value)
#define gem_readl_n(port, reg, idx)
#define gem_writel_n(port, reg, idx, value)

/* Conditional GEM/MACB macros.  These perform the operation to the correct
 * register dependent on whether the device is a GEM or a MACB.  For registers
 * and bitfields that are common across both devices, use macb_{read,write}l
 * to avoid the cost of the conditional.
 */
#define macb_or_gem_writel(__bp, __reg, __value)

#define macb_or_gem_readl(__bp, __reg)

#define MACB_READ_NSR(bp)

/* struct macb_dma_desc - Hardware DMA descriptor
 * @addr: DMA address of data buffer
 * @ctrl: Control and status bits
 */
struct macb_dma_desc {};

#ifdef MACB_EXT_DESC
#define HW_DMA_CAP_32B
#define HW_DMA_CAP_64B
#define HW_DMA_CAP_PTP
#define HW_DMA_CAP_64B_PTP

struct macb_dma_desc_64 {};

struct macb_dma_desc_ptp {};
#endif

/* DMA descriptor bitfields */
#define MACB_RX_USED_OFFSET
#define MACB_RX_USED_SIZE
#define MACB_RX_WRAP_OFFSET
#define MACB_RX_WRAP_SIZE
#define MACB_RX_WADDR_OFFSET
#define MACB_RX_WADDR_SIZE

#define MACB_RX_FRMLEN_OFFSET
#define MACB_RX_FRMLEN_SIZE
#define MACB_RX_OFFSET_OFFSET
#define MACB_RX_OFFSET_SIZE
#define MACB_RX_SOF_OFFSET
#define MACB_RX_SOF_SIZE
#define MACB_RX_EOF_OFFSET
#define MACB_RX_EOF_SIZE
#define MACB_RX_CFI_OFFSET
#define MACB_RX_CFI_SIZE
#define MACB_RX_VLAN_PRI_OFFSET
#define MACB_RX_VLAN_PRI_SIZE
#define MACB_RX_PRI_TAG_OFFSET
#define MACB_RX_PRI_TAG_SIZE
#define MACB_RX_VLAN_TAG_OFFSET
#define MACB_RX_VLAN_TAG_SIZE
#define MACB_RX_TYPEID_MATCH_OFFSET
#define MACB_RX_TYPEID_MATCH_SIZE
#define MACB_RX_SA4_MATCH_OFFSET
#define MACB_RX_SA4_MATCH_SIZE
#define MACB_RX_SA3_MATCH_OFFSET
#define MACB_RX_SA3_MATCH_SIZE
#define MACB_RX_SA2_MATCH_OFFSET
#define MACB_RX_SA2_MATCH_SIZE
#define MACB_RX_SA1_MATCH_OFFSET
#define MACB_RX_SA1_MATCH_SIZE
#define MACB_RX_EXT_MATCH_OFFSET
#define MACB_RX_EXT_MATCH_SIZE
#define MACB_RX_UHASH_MATCH_OFFSET
#define MACB_RX_UHASH_MATCH_SIZE
#define MACB_RX_MHASH_MATCH_OFFSET
#define MACB_RX_MHASH_MATCH_SIZE
#define MACB_RX_BROADCAST_OFFSET
#define MACB_RX_BROADCAST_SIZE

#define MACB_RX_FRMLEN_MASK
#define MACB_RX_JFRMLEN_MASK

/* RX checksum offload disabled: bit 24 clear in NCFGR */
#define GEM_RX_TYPEID_MATCH_OFFSET
#define GEM_RX_TYPEID_MATCH_SIZE

/* RX checksum offload enabled: bit 24 set in NCFGR */
#define GEM_RX_CSUM_OFFSET
#define GEM_RX_CSUM_SIZE

#define MACB_TX_FRMLEN_OFFSET
#define MACB_TX_FRMLEN_SIZE
#define MACB_TX_LAST_OFFSET
#define MACB_TX_LAST_SIZE
#define MACB_TX_NOCRC_OFFSET
#define MACB_TX_NOCRC_SIZE
#define MACB_MSS_MFS_OFFSET
#define MACB_MSS_MFS_SIZE
#define MACB_TX_LSO_OFFSET
#define MACB_TX_LSO_SIZE
#define MACB_TX_TCP_SEQ_SRC_OFFSET
#define MACB_TX_TCP_SEQ_SRC_SIZE
#define MACB_TX_BUF_EXHAUSTED_OFFSET
#define MACB_TX_BUF_EXHAUSTED_SIZE
#define MACB_TX_UNDERRUN_OFFSET
#define MACB_TX_UNDERRUN_SIZE
#define MACB_TX_ERROR_OFFSET
#define MACB_TX_ERROR_SIZE
#define MACB_TX_WRAP_OFFSET
#define MACB_TX_WRAP_SIZE
#define MACB_TX_USED_OFFSET
#define MACB_TX_USED_SIZE

#define GEM_TX_FRMLEN_OFFSET
#define GEM_TX_FRMLEN_SIZE

/* Buffer descriptor constants */
#define GEM_RX_CSUM_NONE
#define GEM_RX_CSUM_IP_ONLY
#define GEM_RX_CSUM_IP_TCP
#define GEM_RX_CSUM_IP_UDP

/* limit RX checksum offload to TCP and UDP packets */
#define GEM_RX_CSUM_CHECKED_MASK

/* Scaled PPM fraction */
#define PPM_FRACTION

/* struct macb_tx_skb - data about an skb which is being transmitted
 * @skb: skb currently being transmitted, only set for the last buffer
 *       of the frame
 * @mapping: DMA address of the skb's fragment buffer
 * @size: size of the DMA mapped buffer
 * @mapped_as_page: true when buffer was mapped with skb_frag_dma_map(),
 *                  false when buffer was mapped with dma_map_single()
 */
struct macb_tx_skb {};

/* Hardware-collected statistics. Used when updating the network
 * device stats by a periodic timer.
 */
struct macb_stats {};

struct gem_stats {};

/* Describes the name and offset of an individual statistic register, as
 * returned by `ethtool -S`. Also describes which net_device_stats statistics
 * this register should contribute to.
 */
struct gem_statistic {};

/* Bitfield defs for net_device_stat statistics */
#define GEM_NDS_RXERR_OFFSET
#define GEM_NDS_RXLENERR_OFFSET
#define GEM_NDS_RXOVERERR_OFFSET
#define GEM_NDS_RXCRCERR_OFFSET
#define GEM_NDS_RXFRAMEERR_OFFSET
#define GEM_NDS_RXFIFOERR_OFFSET
#define GEM_NDS_TXERR_OFFSET
#define GEM_NDS_TXABORTEDERR_OFFSET
#define GEM_NDS_TXCARRIERERR_OFFSET
#define GEM_NDS_TXFIFOERR_OFFSET
#define GEM_NDS_COLLISIONS_OFFSET

#define GEM_STAT_TITLE(name, title)
#define GEM_STAT_TITLE_BITS(name, title, bits)

/* list of gem statistic registers. The names MUST match the
 * corresponding GEM_* definitions.
 */
static const struct gem_statistic gem_statistics[] =;

#define GEM_STATS_LEN

#define QUEUE_STAT_TITLE(title)

/* per queue statistics, each should be unsigned long type */
struct queue_stats {};

static const struct gem_statistic queue_statistics[] =;

#define QUEUE_STATS_LEN

struct macb;
struct macb_queue;

struct macb_or_gem_ops {};

/* MACB-PTP interface: adapt to platform needs. */
struct macb_ptp_info {};

struct macb_pm_data {};

struct macb_usrio_config {};

struct macb_config {};

struct tsu_incr {};

struct macb_queue {};

struct ethtool_rx_fs_item {};

struct ethtool_rx_fs_list {};

struct macb {};

#ifdef CONFIG_MACB_USE_HWSTAMP
#define GEM_TSEC_SIZE
#define TSU_SEC_MAX_VAL
#define TSU_NSEC_MAX_VAL

enum macb_bd_control {};

void gem_ptp_init(struct net_device *ndev);
void gem_ptp_remove(struct net_device *ndev);
void gem_ptp_txstamp(struct macb *bp, struct sk_buff *skb, struct macb_dma_desc *desc);
void gem_ptp_rxstamp(struct macb *bp, struct sk_buff *skb, struct macb_dma_desc *desc);
static inline void gem_ptp_do_txstamp(struct macb *bp, struct sk_buff *skb, struct macb_dma_desc *desc)
{}

static inline void gem_ptp_do_rxstamp(struct macb *bp, struct sk_buff *skb, struct macb_dma_desc *desc)
{}

int gem_get_hwtst(struct net_device *dev,
		  struct kernel_hwtstamp_config *tstamp_config);
int gem_set_hwtst(struct net_device *dev,
		  struct kernel_hwtstamp_config *tstamp_config,
		  struct netlink_ext_ack *extack);
#else
static inline void gem_ptp_init(struct net_device *ndev) { }
static inline void gem_ptp_remove(struct net_device *ndev) { }

static inline void gem_ptp_do_txstamp(struct macb *bp, struct sk_buff *skb, struct macb_dma_desc *desc) { }
static inline void gem_ptp_do_rxstamp(struct macb *bp, struct sk_buff *skb, struct macb_dma_desc *desc) { }
#endif

static inline bool macb_is_gem(struct macb *bp)
{}

static inline bool gem_has_ptp(struct macb *bp)
{}

/**
 * struct macb_platform_data - platform data for MACB Ethernet used for PCI registration
 * @pclk:		platform clock
 * @hclk:		AHB clock
 */
struct macb_platform_data {};

#endif /* _MACB_H */