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

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * encx24j600_hw.h: Register definitions
 *
 */

#ifndef _ENCX24J600_HW_H
#define _ENCX24J600_HW_H

struct encx24j600_context {};

int devm_regmap_init_encx24j600(struct device *dev,
				struct encx24j600_context *ctx);

/* Single-byte instructions */
#define BANK_SELECT(bank)
#define B0SEL
#define B1SEL
#define B2SEL
#define B3SEL
#define SETETHRST
#define FCDISABLE
#define FCSINGLE
#define FCMULTIPLE
#define FCCLEAR
#define SETPKTDEC
#define DMASTOP
#define DMACKSUM
#define DMACKSUMS
#define DMACOPY
#define DMACOPYS
#define SETTXRTS
#define ENABLERX
#define DISABLERX
#define SETEIE
#define CLREIE

/* Two byte instructions */
#define RBSEL

/* Three byte instructions */
#define WGPRDPT
#define RGPRDPT
#define WRXRDPT
#define RRXRDPT
#define WUDARDPT
#define RUDARDPT
#define WGPWRPT
#define RGPWRPT
#define WRXWRPT
#define RRXWRPT
#define WUDAWRPT
#define RUDAWRPT

/* n byte instructions */
#define RCRCODE
#define WCRCODE
#define BFSCODE
#define BFCCODE
#define RCR(addr)
#define WCR(addr)
#define RCRU
#define WCRU
#define BFS(addr)
#define BFC(addr)
#define BFSU
#define BFCU
#define RGPDATA
#define WGPDATA
#define RRXDATA
#define WRXDATA
#define RUDADATA
#define WUDADATA

#define SFR_REG_COUNT

/* ENC424J600 Control Registers
 * Control register definitions are a combination of address
 * and bank number
 * - Register address (bits 0-4)
 * - Bank number (bits 5-6)
 */
#define ADDR_MASK
#define BANK_MASK
#define BANK_SHIFT

/* All-bank registers */
#define EUDAST
#define EUDAND
#define ESTAT
#define EIR
#define ECON1

/* Bank 0 registers */
#define ETXST
#define ETXLEN
#define ERXST
#define ERXTAIL
#define ERXHEAD
#define EDMAST
#define EDMALEN
#define EDMADST
#define EDMACS
#define ETXSTAT
#define ETXWIRE

/* Bank 1 registers */
#define EHT1
#define EHT2
#define EHT3
#define EHT4
#define EPMM1
#define EPMM2
#define EPMM3
#define EPMM4
#define EPMCS
#define EPMO
#define ERXFCON

/* Bank 2 registers */
#define MACON1
#define MACON2
#define MABBIPG
#define MAIPG
#define MACLCON
#define MAMXFL
#define MICMD
#define MIREGADR

/* Bank 3 registers */
#define MAADR3
#define MAADR2
#define MAADR1
#define MIWR
#define MIRD
#define MISTAT
#define EPAUS
#define ECON2
#define ERXWM
#define EIE
#define EIDLED

/* Unbanked registers */
#define EGPDATA
#define ERXDATA
#define EUDADATA
#define EGPRDPT
#define EGPWRPT
#define ERXRDPT
#define ERXWRPT
#define EUDARDPT
#define EUDAWRPT


/* Register bit definitions */
/* ESTAT */
#define INT
#define FCIDLE
#define RXBUSY
#define CLKRDY
#define PHYDPX
#define PHYLNK

/* EIR */
#define CRYPTEN
#define MODEXIF
#define HASHIF
#define AESIF
#define LINKIF
#define PKTIF
#define DMAIF
#define TXIF
#define TXABTIF
#define RXABTIF
#define PCFULIF

/* ECON1 */
#define MODEXST
#define HASHEN
#define HASHOP
#define HASHLST
#define AESST
#define AESOP1
#define AESOP0
#define PKTDEC
#define FCOP1
#define FCOP0
#define DMAST
#define DMACPY
#define DMACSSD
#define DMANOCS
#define TXRTS
#define RXEN

/* ETXSTAT */
#define LATECOL
#define MAXCOL
#define EXDEFER
#define ETXSTATL_DEFER
#define CRCBAD
#define COLCNT_MASK

/* ERXFCON */
#define HTEN
#define MPEN
#define NOTPM
#define PMEN3
#define PMEN2
#define PMEN1
#define PMEN0
#define CRCEEN
#define CRCEN
#define RUNTEEN
#define RUNTEN
#define UCEN
#define NOTMEEN
#define MCEN
#define BCEN

/* MACON1 */
#define LOOPBK
#define RXPAUS
#define PASSALL

/* MACON2 */
#define MACON2_DEFER
#define BPEN
#define NOBKOFF
#define PADCFG2
#define PADCFG1
#define PADCFG0
#define TXCRCEN
#define PHDREN
#define HFRMEN
#define MACON2_RSV1
#define FULDPX

/* MAIPG */
/* value of the high byte is given by the reserved bits,
 * value of the low byte is recommended setting of the
 * IPG parameter.
 */
#define MAIPGH_VAL
#define MAIPGL_VAL

/* MIREGADRH */
#define MIREGADR_VAL

/* MIREGADRL */
#define PHREG_MASK

/* MICMD */
#define MIISCAN
#define MIIRD

/* MISTAT */
#define NVALID
#define SCAN
#define BUSY

/* ECON2 */
#define ETHEN
#define STRCH
#define TXMAC
#define SHA1MD5
#define COCON3
#define COCON2
#define COCON1
#define COCON0
#define AUTOFC
#define TXRST
#define RXRST
#define ETHRST
#define MODLEN1
#define MODLEN0
#define AESLEN1
#define AESLEN0

/* EIE */
#define INTIE
#define MODEXIE
#define HASHIE
#define AESIE
#define LINKIE
#define PKTIE
#define DMAIE
#define TXIE
#define TXABTIE
#define RXABTIE
#define PCFULIE

/* EIDLED */
#define LACFG3
#define LACFG2
#define LACFG1
#define LACFG0
#define LBCFG3
#define LBCFG2
#define LBCFG1
#define LBCFG0
#define DEVID_SHIFT
#define DEVID_MASK
#define REVID_SHIFT
#define REVID_MASK

/* PHY registers */
#define PHCON1
#define PHSTAT1
#define PHANA
#define PHANLPA
#define PHANE
#define PHCON2
#define PHSTAT2
#define PHSTAT3

/* PHCON1 */
#define PRST
#define PLOOPBK
#define SPD100
#define ANEN
#define PSLEEP
#define RENEG
#define PFULDPX

/* PHSTAT1 */
#define FULL100
#define HALF100
#define FULL10
#define HALF10
#define ANDONE
#define LRFAULT
#define ANABLE
#define LLSTAT
#define EXTREGS

/* PHSTAT2 */
#define PLRITY

/* PHSTAT3 */
#define PHY3SPD100
#define PHY3DPX
#define SPDDPX_SHIFT
#define SPDDPX_MASK

/* PHANA */
/* Default value for PHY initialization*/
#define PHANA_DEFAULT

/* PHANE */
#define PDFLT
#define LPARCD
#define LPANABL

#define EUDAST_TEST_VAL

#define TSV_SIZE

#define ENCX24J600_DEV_ID

/* Configuration */

/* Led is on when the link is present and driven low
 * temporarily when packet is TX'd or RX'd
 */
#define LED_A_SETTINGS

/* Led is on if the link is in 100 Mbps mode */
#define LED_B_SETTINGS

/* maximum ethernet frame length
 * Currently not used as a limit anywhere
 * (we're using the "huge frame enable" feature of
 * enc424j600).
 */
#define MAX_FRAMELEN

/* Size in bytes of the receive buffer in enc424j600.
 * Must be word aligned (even).
 */
#define RX_BUFFER_SIZE

/* Start of the general purpose area in sram */
#define SRAM_GP_START

/* SRAM size */
#define SRAM_SIZE

/* Start of the receive buffer */
#define ERXST_VAL

#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_RUNTFILTERMATCH
#define RSV_NOTMEFILTERMATCH
#define RSV_HASHFILTERMATCH
#define RSV_MAGICPKTFILTERMATCH
#define RSV_PTRNMTCHFILTERMATCH
#define RSV_UNICASTFILTERMATCH

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

struct rsv {};

/* Put RX buffer at 0 as suggested by the Errata datasheet */

#define RXSTART_INIT
#define RXEND_INIT

int regmap_encx24j600_spi_write(void *context, u8 reg, const u8 *data,
				size_t count);
int regmap_encx24j600_spi_read(void *context, u8 reg, u8 *data, size_t count);


#endif