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

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * enc28j60_hw.h: EDTP FrameThrower style enc28j60 registers
 *
 * $Id: enc28j60_hw.h,v 1.9 2007/12/14 11:59:16 claudio Exp $
 */

#ifndef _ENC28J60_HW_H
#define _ENC28J60_HW_H

/*
 * ENC28J60 Control Registers
 * Control register definitions are a combination of address,
 * bank number, and Ethernet/MAC/PHY indicator bits.
 * - Register address	(bits 0-4)
 * - Bank number	(bits 5-6)
 * - MAC/MII indicator	(bit 7)
 */
#define ADDR_MASK
#define BANK_MASK
#define SPRD_MASK
/* All-bank registers */
#define EIE
#define EIR
#define ESTAT
#define ECON2
#define ECON1
/* Bank 0 registers */
#define ERDPTL
#define ERDPTH
#define EWRPTL
#define EWRPTH
#define ETXSTL
#define ETXSTH
#define ETXNDL
#define ETXNDH
#define ERXSTL
#define ERXSTH
#define ERXNDL
#define ERXNDH
#define ERXRDPTL
#define ERXRDPTH
#define ERXWRPTL
#define ERXWRPTH
#define EDMASTL
#define EDMASTH
#define EDMANDL
#define EDMANDH
#define EDMADSTL
#define EDMADSTH
#define EDMACSL
#define EDMACSH
/* Bank 1 registers */
#define EHT0
#define EHT1
#define EHT2
#define EHT3
#define EHT4
#define EHT5
#define EHT6
#define EHT7
#define EPMM0
#define EPMM1
#define EPMM2
#define EPMM3
#define EPMM4
#define EPMM5
#define EPMM6
#define EPMM7
#define EPMCSL
#define EPMCSH
#define EPMOL
#define EPMOH
#define EWOLIE
#define EWOLIR
#define ERXFCON
#define EPKTCNT
/* Bank 2 registers */
#define MACON1
/* #define MACON2	(0x01|0x40|SPRD_MASK) */
#define MACON3
#define MACON4
#define MABBIPG
#define MAIPGL
#define MAIPGH
#define MACLCON1
#define MACLCON2
#define MAMXFLL
#define MAMXFLH
#define MAPHSUP
#define MICON
#define MICMD
#define MIREGADR
#define MIWRL
#define MIWRH
#define MIRDL
#define MIRDH
/* Bank 3 registers */
#define MAADR1
#define MAADR0
#define MAADR3
#define MAADR2
#define MAADR5
#define MAADR4
#define EBSTSD
#define EBSTCON
#define EBSTCSL
#define EBSTCSH
#define MISTAT
#define EREVID
#define ECOCON
#define EFLOCON
#define EPAUSL
#define EPAUSH
/* PHY registers */
#define PHCON1
#define PHSTAT1
#define PHHID1
#define PHHID2
#define PHCON2
#define PHSTAT2
#define PHIE
#define PHIR
#define PHLCON

/* ENC28J60 EIE Register Bit Definitions */
#define EIE_INTIE
#define EIE_PKTIE
#define EIE_DMAIE
#define EIE_LINKIE
#define EIE_TXIE
/* #define EIE_WOLIE	0x04 (reserved) */
#define EIE_TXERIE
#define EIE_RXERIE
/* ENC28J60 EIR Register Bit Definitions */
#define EIR_PKTIF
#define EIR_DMAIF
#define EIR_LINKIF
#define EIR_TXIF
/* #define EIR_WOLIF	0x04 (reserved) */
#define EIR_TXERIF
#define EIR_RXERIF
/* ENC28J60 ESTAT Register Bit Definitions */
#define ESTAT_INT
#define ESTAT_LATECOL
#define ESTAT_RXBUSY
#define ESTAT_TXABRT
#define ESTAT_CLKRDY
/* ENC28J60 ECON2 Register Bit Definitions */
#define ECON2_AUTOINC
#define ECON2_PKTDEC
#define ECON2_PWRSV
#define ECON2_VRPS
/* ENC28J60 ECON1 Register Bit Definitions */
#define ECON1_TXRST
#define ECON1_RXRST
#define ECON1_DMAST
#define ECON1_CSUMEN
#define ECON1_TXRTS
#define ECON1_RXEN
#define ECON1_BSEL1
#define ECON1_BSEL0
/* ENC28J60 MACON1 Register Bit Definitions */
#define MACON1_LOOPBK
#define MACON1_TXPAUS
#define MACON1_RXPAUS
#define MACON1_PASSALL
#define MACON1_MARXEN
/* ENC28J60 MACON2 Register Bit Definitions */
#define MACON2_MARST
#define MACON2_RNDRST
#define MACON2_MARXRST
#define MACON2_RFUNRST
#define MACON2_MATXRST
#define MACON2_TFUNRST
/* ENC28J60 MACON3 Register Bit Definitions */
#define MACON3_PADCFG2
#define MACON3_PADCFG1
#define MACON3_PADCFG0
#define MACON3_TXCRCEN
#define MACON3_PHDRLEN
#define MACON3_HFRMLEN
#define MACON3_FRMLNEN
#define MACON3_FULDPX
/* ENC28J60 MICMD Register Bit Definitions */
#define MICMD_MIISCAN
#define MICMD_MIIRD
/* ENC28J60 MISTAT Register Bit Definitions */
#define MISTAT_NVALID
#define MISTAT_SCAN
#define MISTAT_BUSY
/* ENC28J60 ERXFCON Register Bit Definitions */
#define ERXFCON_UCEN
#define ERXFCON_ANDOR
#define ERXFCON_CRCEN
#define ERXFCON_PMEN
#define ERXFCON_MPEN
#define ERXFCON_HTEN
#define ERXFCON_MCEN
#define ERXFCON_BCEN

/* ENC28J60 PHY PHCON1 Register Bit Definitions */
#define PHCON1_PRST
#define PHCON1_PLOOPBK
#define PHCON1_PPWRSV
#define PHCON1_PDPXMD
/* ENC28J60 PHY PHSTAT1 Register Bit Definitions */
#define PHSTAT1_PFDPX
#define PHSTAT1_PHDPX
#define PHSTAT1_LLSTAT
#define PHSTAT1_JBSTAT
/* ENC28J60 PHY PHSTAT2 Register Bit Definitions */
#define PHSTAT2_TXSTAT
#define PHSTAT2_RXSTAT
#define PHSTAT2_COLSTAT
#define PHSTAT2_LSTAT
#define PHSTAT2_DPXSTAT
#define PHSTAT2_PLRITY
/* ENC28J60 PHY PHCON2 Register Bit Definitions */
#define PHCON2_FRCLINK
#define PHCON2_TXDIS
#define PHCON2_JABBER
#define PHCON2_HDLDIS
/* ENC28J60 PHY PHIE Register Bit Definitions */
#define PHIE_PLNKIE
#define PHIE_PGEIE
/* ENC28J60 PHY PHIR Register Bit Definitions */
#define PHIR_PLNKIF
#define PHIR_PGEIF

/* ENC28J60 Packet Control Byte Bit Definitions */
#define PKTCTRL_PHUGEEN
#define PKTCTRL_PPADEN
#define PKTCTRL_PCRCEN
#define PKTCTRL_POVERRIDE

/* ENC28J60 Transmit Status Vector */
#define TSV_TXBYTECNT
#define TSV_TXCOLLISIONCNT
#define TSV_TXCRCERROR
#define TSV_TXLENCHKERROR
#define TSV_TXLENOUTOFRANGE
#define TSV_TXDONE
#define TSV_TXMULTICAST
#define TSV_TXBROADCAST
#define TSV_TXPACKETDEFER
#define TSV_TXEXDEFER
#define TSV_TXEXCOLLISION
#define TSV_TXLATECOLLISION
#define TSV_TXGIANT
#define TSV_TXUNDERRUN
#define TSV_TOTBYTETXONWIRE
#define TSV_TXCONTROLFRAME
#define TSV_TXPAUSEFRAME
#define TSV_BACKPRESSUREAPP
#define TSV_TXVLANTAGFRAME

#define TSV_SIZE
#define TSV_BYTEOF(x)
#define TSV_BITMASK(x)
#define TSV_GETBIT(x, y)

/* ENC28J60 Receive Status Vector */
#define RSV_RXLONGEVDROPEV
#define RSV_CARRIEREV
#define RSV_CRCERROR
#define RSV_LENCHECKERR
#define RSV_LENOUTOFRANGE
#define RSV_RXOK
#define RSV_RXMULTICAST
#define RSV_RXBROADCAST
#define RSV_DRIBBLENIBBLE
#define RSV_RXCONTROLFRAME
#define RSV_RXPAUSEFRAME
#define RSV_RXUNKNOWNOPCODE
#define RSV_RXTYPEVLAN

#define RSV_SIZE
#define RSV_BITMASK(x)
#define RSV_GETBIT(x, y)


/* SPI operation codes */
#define ENC28J60_READ_CTRL_REG
#define ENC28J60_READ_BUF_MEM
#define ENC28J60_WRITE_CTRL_REG
#define ENC28J60_WRITE_BUF_MEM
#define ENC28J60_BIT_FIELD_SET
#define ENC28J60_BIT_FIELD_CLR
#define ENC28J60_SOFT_RESET


/* buffer boundaries applied to internal 8K ram
 * entire available packet buffer space is allocated.
 * Give TX buffer space for one full ethernet frame (~1500 bytes)
 * receive buffer gets the rest */
#define TXSTART_INIT
#define TXEND_INIT

/* Put RX buffer at 0 as suggested by the Errata datasheet */
#define RXSTART_INIT
#define RXEND_INIT

/* maximum ethernet frame length */
#define MAX_FRAMELEN

/* Preferred half duplex: LEDA: Link status LEDB: Rx/Tx activity */
#define ENC28J60_LAMPS_MODE

#endif