162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * mace.h - definitions for the registers in the "Big Mac"
462306a36Sopenharmony_ci *  Ethernet controller found in PowerMac G3 models.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Copyright (C) 1998 Randy Gobbel.
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/* The "Big MAC" appears to have some parts in common with the Sun "Happy Meal"
1062306a36Sopenharmony_ci * (HME) controller.  See sunhme.h
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/* register offsets */
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/* global status and control */
1762306a36Sopenharmony_ci#define	XIFC		0x000   /* low-level interface control */
1862306a36Sopenharmony_ci#	define	TxOutputEnable	0x0001 /* output driver enable */
1962306a36Sopenharmony_ci#	define	XIFLoopback	0x0002 /* Loopback-mode XIF enable */
2062306a36Sopenharmony_ci#	define	MIILoopback	0x0004 /* Loopback-mode MII enable */
2162306a36Sopenharmony_ci#	define	MIILoopbackBits	0x0006
2262306a36Sopenharmony_ci#	define	MIIBuffDisable	0x0008 /* MII receive buffer disable */
2362306a36Sopenharmony_ci#	define	SQETestEnable	0x0010 /* SQE test enable */
2462306a36Sopenharmony_ci#	define	SQETimeWindow	0x03e0 /* SQE time window */
2562306a36Sopenharmony_ci#	define	XIFLanceMode	0x0010 /* Lance mode enable */
2662306a36Sopenharmony_ci#	define	XIFLanceIPG0	0x03e0 /* Lance mode IPG0 */
2762306a36Sopenharmony_ci#define	TXFIFOCSR	0x100   /* transmit FIFO control */
2862306a36Sopenharmony_ci#	define	TxFIFOEnable	0x0001
2962306a36Sopenharmony_ci#define	TXTH		0x110   /* transmit threshold */
3062306a36Sopenharmony_ci#	define	TxThreshold	0x0004
3162306a36Sopenharmony_ci#define RXFIFOCSR	0x120   /* receive FIFO control */
3262306a36Sopenharmony_ci#	define	RxFIFOEnable	0x0001
3362306a36Sopenharmony_ci#define MEMADD		0x130   /* memory address, unknown function */
3462306a36Sopenharmony_ci#define MEMDATAHI	0x140   /* memory data high, presently unused in driver */
3562306a36Sopenharmony_ci#define MEMDATALO	0x150   /* memory data low, presently unused in driver */
3662306a36Sopenharmony_ci#define XCVRIF		0x160   /* transceiver interface control */
3762306a36Sopenharmony_ci#	define	COLActiveLow	0x0002
3862306a36Sopenharmony_ci#	define	SerialMode	0x0004
3962306a36Sopenharmony_ci#	define	ClkBit		0x0008
4062306a36Sopenharmony_ci#	define	LinkStatus	0x0100
4162306a36Sopenharmony_ci#define CHIPID          0x170   /* chip ID */
4262306a36Sopenharmony_ci#define	MIFCSR		0x180   /* ??? */
4362306a36Sopenharmony_ci#define	SROMCSR		0x190   /* SROM control */
4462306a36Sopenharmony_ci#	define	ChipSelect	0x0001
4562306a36Sopenharmony_ci#	define	Clk		0x0002
4662306a36Sopenharmony_ci#define TXPNTR		0x1a0   /* transmit pointer */
4762306a36Sopenharmony_ci#define	RXPNTR		0x1b0   /* receive pointer */
4862306a36Sopenharmony_ci#define	STATUS		0x200   /* status--reading this clears it */
4962306a36Sopenharmony_ci#define	INTDISABLE	0x210   /* interrupt enable/disable control */
5062306a36Sopenharmony_ci/* bits below are the same in both STATUS and INTDISABLE registers */
5162306a36Sopenharmony_ci#	define	FrameReceived	0x00000001 /* Received a frame */
5262306a36Sopenharmony_ci#	define	RxFrameCntExp	0x00000002 /* Receive frame counter expired */
5362306a36Sopenharmony_ci#	define	RxAlignCntExp	0x00000004 /* Align-error counter expired */
5462306a36Sopenharmony_ci#	define	RxCRCCntExp	0x00000008 /* CRC-error counter expired */
5562306a36Sopenharmony_ci#	define	RxLenCntExp	0x00000010 /* Length-error counter expired */
5662306a36Sopenharmony_ci#	define	RxOverFlow	0x00000020 /* Receive FIFO overflow */
5762306a36Sopenharmony_ci#	define	RxCodeViolation	0x00000040 /* Code-violation counter expired */
5862306a36Sopenharmony_ci#	define	SQETestError	0x00000080 /* Test error in XIF for SQE */
5962306a36Sopenharmony_ci#	define	FrameSent	0x00000100 /* Transmitted a frame */
6062306a36Sopenharmony_ci#	define	TxUnderrun	0x00000200 /* Transmit FIFO underrun */
6162306a36Sopenharmony_ci#	define	TxMaxSizeError	0x00000400 /* Max-packet size error */
6262306a36Sopenharmony_ci#	define	TxNormalCollExp	0x00000800 /* Normal-collision counter expired */
6362306a36Sopenharmony_ci#	define	TxExcessCollExp	0x00001000 /* Excess-collision counter expired */
6462306a36Sopenharmony_ci#	define	TxLateCollExp	0x00002000 /* Late-collision counter expired */
6562306a36Sopenharmony_ci#	define	TxNetworkCollExp 0x00004000 /* First-collision counter expired */
6662306a36Sopenharmony_ci#	define	TxDeferTimerExp	0x00008000 /* Defer-timer expired */
6762306a36Sopenharmony_ci#	define	RxFIFOToHost	0x00010000 /* Data moved from FIFO to host */
6862306a36Sopenharmony_ci#	define	RxNoDescriptors	0x00020000 /* No more receive descriptors */
6962306a36Sopenharmony_ci#	define	RxDMAError	0x00040000 /* Error during receive DMA */
7062306a36Sopenharmony_ci#	define	RxDMALateErr	0x00080000 /* Receive DMA, data late */
7162306a36Sopenharmony_ci#	define	RxParityErr	0x00100000 /* Parity error during receive DMA */
7262306a36Sopenharmony_ci#	define	RxTagError	0x00200000 /* Tag error during receive DMA */
7362306a36Sopenharmony_ci#	define	TxEOPError	0x00400000 /* Tx descriptor did not have EOP set */
7462306a36Sopenharmony_ci#	define	MIFIntrEvent	0x00800000 /* MIF is signaling an interrupt */
7562306a36Sopenharmony_ci#	define	TxHostToFIFO	0x01000000 /* Data moved from host to FIFO  */
7662306a36Sopenharmony_ci#	define	TxFIFOAllSent	0x02000000 /* Transmitted all packets in FIFO */
7762306a36Sopenharmony_ci#	define	TxDMAError	0x04000000 /* Error during transmit DMA */
7862306a36Sopenharmony_ci#	define	TxDMALateError	0x08000000 /* Late error during transmit DMA */
7962306a36Sopenharmony_ci#	define	TxParityError	0x10000000 /* Parity error during transmit DMA */
8062306a36Sopenharmony_ci#	define	TxTagError	0x20000000 /* Tag error during transmit DMA */
8162306a36Sopenharmony_ci#	define	PIOError	0x40000000 /* PIO access got an error */
8262306a36Sopenharmony_ci#	define	PIOParityError	0x80000000 /* PIO access got a parity error  */
8362306a36Sopenharmony_ci#	define	DisableAll	0xffffffff
8462306a36Sopenharmony_ci#	define	EnableAll	0x00000000
8562306a36Sopenharmony_ci/* #	define	NormalIntEvents	~(FrameReceived | FrameSent | TxUnderrun) */
8662306a36Sopenharmony_ci#	define	EnableNormal	~(FrameReceived | FrameSent)
8762306a36Sopenharmony_ci#	define	EnableErrors	(FrameReceived | FrameSent)
8862306a36Sopenharmony_ci#	define	RxErrorMask	(RxFrameCntExp | RxAlignCntExp | RxCRCCntExp | \
8962306a36Sopenharmony_ci				 RxLenCntExp | RxOverFlow | RxCodeViolation)
9062306a36Sopenharmony_ci#	define	TxErrorMask	(TxUnderrun | TxMaxSizeError | TxExcessCollExp | \
9162306a36Sopenharmony_ci				 TxLateCollExp | TxNetworkCollExp | TxDeferTimerExp)
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci/* transmit control */
9462306a36Sopenharmony_ci#define	TXRST		0x420   /* transmit reset */
9562306a36Sopenharmony_ci#	define	TxResetBit	0x0001
9662306a36Sopenharmony_ci#define	TXCFG		0x430   /* transmit configuration control*/
9762306a36Sopenharmony_ci#	define	TxMACEnable	0x0001 /* output driver enable */
9862306a36Sopenharmony_ci#	define	TxSlowMode	0x0020 /* enable slow mode */
9962306a36Sopenharmony_ci#	define	TxIgnoreColl	0x0040 /* ignore transmit collisions */
10062306a36Sopenharmony_ci#	define	TxNoFCS		0x0080 /* do not emit FCS */
10162306a36Sopenharmony_ci#	define	TxNoBackoff	0x0100 /* no backoff in case of collisions */
10262306a36Sopenharmony_ci#	define	TxFullDuplex	0x0200 /* enable full-duplex */
10362306a36Sopenharmony_ci#	define	TxNeverGiveUp	0x0400 /* don't give up on transmits */
10462306a36Sopenharmony_ci#define IPG1		0x440   /* Inter-packet gap 1 */
10562306a36Sopenharmony_ci#define IPG2		0x450   /* Inter-packet gap 2 */
10662306a36Sopenharmony_ci#define ALIMIT		0x460   /* Transmit attempt limit */
10762306a36Sopenharmony_ci#define SLOT		0x470   /* Transmit slot time */
10862306a36Sopenharmony_ci#define PALEN		0x480   /* Size of transmit preamble */
10962306a36Sopenharmony_ci#define PAPAT		0x490   /* Pattern for transmit preamble */
11062306a36Sopenharmony_ci#define TXSFD		0x4a0   /* Transmit frame delimiter */
11162306a36Sopenharmony_ci#define JAM		0x4b0   /* Jam size */
11262306a36Sopenharmony_ci#define TXMAX		0x4c0   /* Transmit max pkt size */
11362306a36Sopenharmony_ci#define TXMIN		0x4d0   /* Transmit min pkt size */
11462306a36Sopenharmony_ci#define PAREG		0x4e0   /* Count of transmit peak attempts */
11562306a36Sopenharmony_ci#define DCNT		0x4f0   /* Transmit defer timer */
11662306a36Sopenharmony_ci#define NCCNT		0x500   /* Transmit normal-collision counter */
11762306a36Sopenharmony_ci#define NTCNT		0x510   /* Transmit first-collision counter */
11862306a36Sopenharmony_ci#define EXCNT		0x520   /* Transmit excess-collision counter */
11962306a36Sopenharmony_ci#define LTCNT		0x530   /* Transmit late-collision counter */
12062306a36Sopenharmony_ci#define RSEED		0x540   /* Transmit random number seed */
12162306a36Sopenharmony_ci#define TXSM		0x550   /* Transmit state machine */
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci/* receive control */
12462306a36Sopenharmony_ci#define RXRST		0x620   /* receive reset */
12562306a36Sopenharmony_ci#	define	RxResetValue	0x0000
12662306a36Sopenharmony_ci#define RXCFG		0x630   /* receive configuration control */
12762306a36Sopenharmony_ci#	define	RxMACEnable	0x0001 /* receiver overall enable */
12862306a36Sopenharmony_ci#	define	RxCFGReserved	0x0004
12962306a36Sopenharmony_ci#	define	RxPadStripEnab	0x0020 /* enable pad byte stripping */
13062306a36Sopenharmony_ci#	define	RxPromiscEnable	0x0040 /* turn on promiscuous mode */
13162306a36Sopenharmony_ci#	define	RxNoErrCheck	0x0080 /* disable receive error checking */
13262306a36Sopenharmony_ci#	define	RxCRCNoStrip	0x0100 /* disable auto-CRC-stripping */
13362306a36Sopenharmony_ci#	define	RxRejectOwnPackets 0x0200 /* don't receive our own packets */
13462306a36Sopenharmony_ci#	define	RxGrpPromisck	0x0400 /* enable group promiscuous mode */
13562306a36Sopenharmony_ci#	define	RxHashFilterEnable 0x0800 /* enable hash filter */
13662306a36Sopenharmony_ci#	define	RxAddrFilterEnable 0x1000 /* enable address filter */
13762306a36Sopenharmony_ci#define RXMAX		0x640   /* Max receive packet size */
13862306a36Sopenharmony_ci#define RXMIN		0x650   /* Min receive packet size */
13962306a36Sopenharmony_ci#define MADD2		0x660   /* our enet address, high part */
14062306a36Sopenharmony_ci#define MADD1		0x670   /* our enet address, middle part */
14162306a36Sopenharmony_ci#define MADD0		0x680   /* our enet address, low part */
14262306a36Sopenharmony_ci#define FRCNT		0x690   /* receive frame counter */
14362306a36Sopenharmony_ci#define LECNT		0x6a0   /* Receive excess length error counter */
14462306a36Sopenharmony_ci#define AECNT		0x6b0   /* Receive misaligned error counter */
14562306a36Sopenharmony_ci#define FECNT		0x6c0   /* Receive CRC error counter */
14662306a36Sopenharmony_ci#define RXSM		0x6d0   /* Receive state machine */
14762306a36Sopenharmony_ci#define RXCV		0x6e0   /* Receive code violation */
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci#define BHASH3		0x700   /* multicast hash register */
15062306a36Sopenharmony_ci#define BHASH2		0x710   /* multicast hash register */
15162306a36Sopenharmony_ci#define BHASH1		0x720   /* multicast hash register */
15262306a36Sopenharmony_ci#define BHASH0		0x730   /* multicast hash register */
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci#define AFR2		0x740   /* address filtering setup? */
15562306a36Sopenharmony_ci#define AFR1		0x750   /* address filtering setup? */
15662306a36Sopenharmony_ci#define AFR0		0x760   /* address filtering setup? */
15762306a36Sopenharmony_ci#define AFCR		0x770   /* address filter compare register? */
15862306a36Sopenharmony_ci#	define	EnableAllCompares 0x0fff
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci/* bits in XIFC */
161