162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* $Id: sunqe.h,v 1.13 2000/02/09 11:15:42 davem Exp $ 362306a36Sopenharmony_ci * sunqe.h: Definitions for the Sun QuadEthernet driver. 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#ifndef _SUNQE_H 962306a36Sopenharmony_ci#define _SUNQE_H 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci/* QEC global registers. */ 1262306a36Sopenharmony_ci#define GLOB_CTRL 0x00UL /* Control */ 1362306a36Sopenharmony_ci#define GLOB_STAT 0x04UL /* Status */ 1462306a36Sopenharmony_ci#define GLOB_PSIZE 0x08UL /* Packet Size */ 1562306a36Sopenharmony_ci#define GLOB_MSIZE 0x0cUL /* Local-memory Size */ 1662306a36Sopenharmony_ci#define GLOB_RSIZE 0x10UL /* Receive partition size */ 1762306a36Sopenharmony_ci#define GLOB_TSIZE 0x14UL /* Transmit partition size */ 1862306a36Sopenharmony_ci#define GLOB_REG_SIZE 0x18UL 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#define GLOB_CTRL_MMODE 0x40000000 /* MACE qec mode */ 2162306a36Sopenharmony_ci#define GLOB_CTRL_BMODE 0x10000000 /* BigMAC qec mode */ 2262306a36Sopenharmony_ci#define GLOB_CTRL_EPAR 0x00000020 /* Enable parity */ 2362306a36Sopenharmony_ci#define GLOB_CTRL_ACNTRL 0x00000018 /* SBUS arbitration control */ 2462306a36Sopenharmony_ci#define GLOB_CTRL_B64 0x00000004 /* 64 byte dvma bursts */ 2562306a36Sopenharmony_ci#define GLOB_CTRL_B32 0x00000002 /* 32 byte dvma bursts */ 2662306a36Sopenharmony_ci#define GLOB_CTRL_B16 0x00000000 /* 16 byte dvma bursts */ 2762306a36Sopenharmony_ci#define GLOB_CTRL_RESET 0x00000001 /* Reset the QEC */ 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci#define GLOB_STAT_TX 0x00000008 /* BigMAC Transmit IRQ */ 3062306a36Sopenharmony_ci#define GLOB_STAT_RX 0x00000004 /* BigMAC Receive IRQ */ 3162306a36Sopenharmony_ci#define GLOB_STAT_BM 0x00000002 /* BigMAC Global IRQ */ 3262306a36Sopenharmony_ci#define GLOB_STAT_ER 0x00000001 /* BigMAC Error IRQ */ 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci#define GLOB_PSIZE_2048 0x00 /* 2k packet size */ 3562306a36Sopenharmony_ci#define GLOB_PSIZE_4096 0x01 /* 4k packet size */ 3662306a36Sopenharmony_ci#define GLOB_PSIZE_6144 0x10 /* 6k packet size */ 3762306a36Sopenharmony_ci#define GLOB_PSIZE_8192 0x11 /* 8k packet size */ 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci/* In MACE mode, there are four qe channels. Each channel has it's own 4062306a36Sopenharmony_ci * status bits in the QEC status register. This macro picks out the 4162306a36Sopenharmony_ci * ones you want. 4262306a36Sopenharmony_ci */ 4362306a36Sopenharmony_ci#define GLOB_STAT_PER_QE(status, channel) (((status) >> ((channel) * 4)) & 0xf) 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci/* The following registers are for per-qe channel information/status. */ 4662306a36Sopenharmony_ci#define CREG_CTRL 0x00UL /* Control */ 4762306a36Sopenharmony_ci#define CREG_STAT 0x04UL /* Status */ 4862306a36Sopenharmony_ci#define CREG_RXDS 0x08UL /* RX descriptor ring ptr */ 4962306a36Sopenharmony_ci#define CREG_TXDS 0x0cUL /* TX descriptor ring ptr */ 5062306a36Sopenharmony_ci#define CREG_RIMASK 0x10UL /* RX Interrupt Mask */ 5162306a36Sopenharmony_ci#define CREG_TIMASK 0x14UL /* TX Interrupt Mask */ 5262306a36Sopenharmony_ci#define CREG_QMASK 0x18UL /* QEC Error Interrupt Mask */ 5362306a36Sopenharmony_ci#define CREG_MMASK 0x1cUL /* MACE Error Interrupt Mask */ 5462306a36Sopenharmony_ci#define CREG_RXWBUFPTR 0x20UL /* Local memory rx write ptr */ 5562306a36Sopenharmony_ci#define CREG_RXRBUFPTR 0x24UL /* Local memory rx read ptr */ 5662306a36Sopenharmony_ci#define CREG_TXWBUFPTR 0x28UL /* Local memory tx write ptr */ 5762306a36Sopenharmony_ci#define CREG_TXRBUFPTR 0x2cUL /* Local memory tx read ptr */ 5862306a36Sopenharmony_ci#define CREG_CCNT 0x30UL /* Collision Counter */ 5962306a36Sopenharmony_ci#define CREG_PIPG 0x34UL /* Inter-Frame Gap */ 6062306a36Sopenharmony_ci#define CREG_REG_SIZE 0x38UL 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci#define CREG_CTRL_RXOFF 0x00000004 /* Disable this qe's receiver*/ 6362306a36Sopenharmony_ci#define CREG_CTRL_RESET 0x00000002 /* Reset this qe channel */ 6462306a36Sopenharmony_ci#define CREG_CTRL_TWAKEUP 0x00000001 /* Transmitter Wakeup, 'go'. */ 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci#define CREG_STAT_EDEFER 0x10000000 /* Excessive Defers */ 6762306a36Sopenharmony_ci#define CREG_STAT_CLOSS 0x08000000 /* Carrier Loss */ 6862306a36Sopenharmony_ci#define CREG_STAT_ERETRIES 0x04000000 /* More than 16 retries */ 6962306a36Sopenharmony_ci#define CREG_STAT_LCOLL 0x02000000 /* Late TX Collision */ 7062306a36Sopenharmony_ci#define CREG_STAT_FUFLOW 0x01000000 /* FIFO Underflow */ 7162306a36Sopenharmony_ci#define CREG_STAT_JERROR 0x00800000 /* Jabber Error */ 7262306a36Sopenharmony_ci#define CREG_STAT_BERROR 0x00400000 /* Babble Error */ 7362306a36Sopenharmony_ci#define CREG_STAT_TXIRQ 0x00200000 /* Transmit Interrupt */ 7462306a36Sopenharmony_ci#define CREG_STAT_CCOFLOW 0x00100000 /* TX Coll-counter Overflow */ 7562306a36Sopenharmony_ci#define CREG_STAT_TXDERROR 0x00080000 /* TX Descriptor is bogus */ 7662306a36Sopenharmony_ci#define CREG_STAT_TXLERR 0x00040000 /* Late Transmit Error */ 7762306a36Sopenharmony_ci#define CREG_STAT_TXPERR 0x00020000 /* Transmit Parity Error */ 7862306a36Sopenharmony_ci#define CREG_STAT_TXSERR 0x00010000 /* Transmit SBUS error ack */ 7962306a36Sopenharmony_ci#define CREG_STAT_RCCOFLOW 0x00001000 /* RX Coll-counter Overflow */ 8062306a36Sopenharmony_ci#define CREG_STAT_RUOFLOW 0x00000800 /* Runt Counter Overflow */ 8162306a36Sopenharmony_ci#define CREG_STAT_MCOFLOW 0x00000400 /* Missed Counter Overflow */ 8262306a36Sopenharmony_ci#define CREG_STAT_RXFOFLOW 0x00000200 /* RX FIFO Overflow */ 8362306a36Sopenharmony_ci#define CREG_STAT_RLCOLL 0x00000100 /* RX Late Collision */ 8462306a36Sopenharmony_ci#define CREG_STAT_FCOFLOW 0x00000080 /* Frame Counter Overflow */ 8562306a36Sopenharmony_ci#define CREG_STAT_CECOFLOW 0x00000040 /* CRC Error-counter Overflow*/ 8662306a36Sopenharmony_ci#define CREG_STAT_RXIRQ 0x00000020 /* Receive Interrupt */ 8762306a36Sopenharmony_ci#define CREG_STAT_RXDROP 0x00000010 /* Dropped a RX'd packet */ 8862306a36Sopenharmony_ci#define CREG_STAT_RXSMALL 0x00000008 /* Receive buffer too small */ 8962306a36Sopenharmony_ci#define CREG_STAT_RXLERR 0x00000004 /* Receive Late Error */ 9062306a36Sopenharmony_ci#define CREG_STAT_RXPERR 0x00000002 /* Receive Parity Error */ 9162306a36Sopenharmony_ci#define CREG_STAT_RXSERR 0x00000001 /* Receive SBUS Error ACK */ 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci#define CREG_STAT_ERRORS (CREG_STAT_EDEFER|CREG_STAT_CLOSS|CREG_STAT_ERETRIES| \ 9462306a36Sopenharmony_ci CREG_STAT_LCOLL|CREG_STAT_FUFLOW|CREG_STAT_JERROR| \ 9562306a36Sopenharmony_ci CREG_STAT_BERROR|CREG_STAT_CCOFLOW|CREG_STAT_TXDERROR| \ 9662306a36Sopenharmony_ci CREG_STAT_TXLERR|CREG_STAT_TXPERR|CREG_STAT_TXSERR| \ 9762306a36Sopenharmony_ci CREG_STAT_RCCOFLOW|CREG_STAT_RUOFLOW|CREG_STAT_MCOFLOW| \ 9862306a36Sopenharmony_ci CREG_STAT_RXFOFLOW|CREG_STAT_RLCOLL|CREG_STAT_FCOFLOW| \ 9962306a36Sopenharmony_ci CREG_STAT_CECOFLOW|CREG_STAT_RXDROP|CREG_STAT_RXSMALL| \ 10062306a36Sopenharmony_ci CREG_STAT_RXLERR|CREG_STAT_RXPERR|CREG_STAT_RXSERR) 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci#define CREG_QMASK_COFLOW 0x00100000 /* CollCntr overflow */ 10362306a36Sopenharmony_ci#define CREG_QMASK_TXDERROR 0x00080000 /* TXD error */ 10462306a36Sopenharmony_ci#define CREG_QMASK_TXLERR 0x00040000 /* TX late error */ 10562306a36Sopenharmony_ci#define CREG_QMASK_TXPERR 0x00020000 /* TX parity error */ 10662306a36Sopenharmony_ci#define CREG_QMASK_TXSERR 0x00010000 /* TX sbus error ack */ 10762306a36Sopenharmony_ci#define CREG_QMASK_RXDROP 0x00000010 /* RX drop */ 10862306a36Sopenharmony_ci#define CREG_QMASK_RXBERROR 0x00000008 /* RX buffer error */ 10962306a36Sopenharmony_ci#define CREG_QMASK_RXLEERR 0x00000004 /* RX late error */ 11062306a36Sopenharmony_ci#define CREG_QMASK_RXPERR 0x00000002 /* RX parity error */ 11162306a36Sopenharmony_ci#define CREG_QMASK_RXSERR 0x00000001 /* RX sbus error ack */ 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ci#define CREG_MMASK_EDEFER 0x10000000 /* Excess defer */ 11462306a36Sopenharmony_ci#define CREG_MMASK_CLOSS 0x08000000 /* Carrier loss */ 11562306a36Sopenharmony_ci#define CREG_MMASK_ERETRY 0x04000000 /* Excess retry */ 11662306a36Sopenharmony_ci#define CREG_MMASK_LCOLL 0x02000000 /* Late collision error */ 11762306a36Sopenharmony_ci#define CREG_MMASK_UFLOW 0x01000000 /* Underflow */ 11862306a36Sopenharmony_ci#define CREG_MMASK_JABBER 0x00800000 /* Jabber error */ 11962306a36Sopenharmony_ci#define CREG_MMASK_BABBLE 0x00400000 /* Babble error */ 12062306a36Sopenharmony_ci#define CREG_MMASK_OFLOW 0x00000800 /* Overflow */ 12162306a36Sopenharmony_ci#define CREG_MMASK_RXCOLL 0x00000400 /* RX Coll-Cntr overflow */ 12262306a36Sopenharmony_ci#define CREG_MMASK_RPKT 0x00000200 /* Runt pkt overflow */ 12362306a36Sopenharmony_ci#define CREG_MMASK_MPKT 0x00000100 /* Missed pkt overflow */ 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci#define CREG_PIPG_TENAB 0x00000020 /* Enable Throttle */ 12662306a36Sopenharmony_ci#define CREG_PIPG_MMODE 0x00000010 /* Manual Mode */ 12762306a36Sopenharmony_ci#define CREG_PIPG_WMASK 0x0000000f /* SBUS Wait Mask */ 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci/* Per-channel AMD 79C940 MACE registers. */ 13062306a36Sopenharmony_ci#define MREGS_RXFIFO 0x00UL /* Receive FIFO */ 13162306a36Sopenharmony_ci#define MREGS_TXFIFO 0x01UL /* Transmit FIFO */ 13262306a36Sopenharmony_ci#define MREGS_TXFCNTL 0x02UL /* Transmit Frame Control */ 13362306a36Sopenharmony_ci#define MREGS_TXFSTAT 0x03UL /* Transmit Frame Status */ 13462306a36Sopenharmony_ci#define MREGS_TXRCNT 0x04UL /* Transmit Retry Count */ 13562306a36Sopenharmony_ci#define MREGS_RXFCNTL 0x05UL /* Receive Frame Control */ 13662306a36Sopenharmony_ci#define MREGS_RXFSTAT 0x06UL /* Receive Frame Status */ 13762306a36Sopenharmony_ci#define MREGS_FFCNT 0x07UL /* FIFO Frame Count */ 13862306a36Sopenharmony_ci#define MREGS_IREG 0x08UL /* Interrupt Register */ 13962306a36Sopenharmony_ci#define MREGS_IMASK 0x09UL /* Interrupt Mask */ 14062306a36Sopenharmony_ci#define MREGS_POLL 0x0aUL /* POLL Register */ 14162306a36Sopenharmony_ci#define MREGS_BCONFIG 0x0bUL /* BIU Config */ 14262306a36Sopenharmony_ci#define MREGS_FCONFIG 0x0cUL /* FIFO Config */ 14362306a36Sopenharmony_ci#define MREGS_MCONFIG 0x0dUL /* MAC Config */ 14462306a36Sopenharmony_ci#define MREGS_PLSCONFIG 0x0eUL /* PLS Config */ 14562306a36Sopenharmony_ci#define MREGS_PHYCONFIG 0x0fUL /* PHY Config */ 14662306a36Sopenharmony_ci#define MREGS_CHIPID1 0x10UL /* Chip-ID, low bits */ 14762306a36Sopenharmony_ci#define MREGS_CHIPID2 0x11UL /* Chip-ID, high bits */ 14862306a36Sopenharmony_ci#define MREGS_IACONFIG 0x12UL /* Internal Address Config */ 14962306a36Sopenharmony_ci /* 0x13UL, reserved */ 15062306a36Sopenharmony_ci#define MREGS_FILTER 0x14UL /* Logical Address Filter */ 15162306a36Sopenharmony_ci#define MREGS_ETHADDR 0x15UL /* Our Ethernet Address */ 15262306a36Sopenharmony_ci /* 0x16UL, reserved */ 15362306a36Sopenharmony_ci /* 0x17UL, reserved */ 15462306a36Sopenharmony_ci#define MREGS_MPCNT 0x18UL /* Missed Packet Count */ 15562306a36Sopenharmony_ci /* 0x19UL, reserved */ 15662306a36Sopenharmony_ci#define MREGS_RPCNT 0x1aUL /* Runt Packet Count */ 15762306a36Sopenharmony_ci#define MREGS_RCCNT 0x1bUL /* RX Collision Count */ 15862306a36Sopenharmony_ci /* 0x1cUL, reserved */ 15962306a36Sopenharmony_ci#define MREGS_UTEST 0x1dUL /* User Test */ 16062306a36Sopenharmony_ci#define MREGS_RTEST1 0x1eUL /* Reserved Test 1 */ 16162306a36Sopenharmony_ci#define MREGS_RTEST2 0x1fUL /* Reserved Test 2 */ 16262306a36Sopenharmony_ci#define MREGS_REG_SIZE 0x20UL 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_ci#define MREGS_TXFCNTL_DRETRY 0x80 /* Retry disable */ 16562306a36Sopenharmony_ci#define MREGS_TXFCNTL_DFCS 0x08 /* Disable TX FCS */ 16662306a36Sopenharmony_ci#define MREGS_TXFCNTL_AUTOPAD 0x01 /* TX auto pad */ 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci#define MREGS_TXFSTAT_VALID 0x80 /* TX valid */ 16962306a36Sopenharmony_ci#define MREGS_TXFSTAT_UNDERFLOW 0x40 /* TX underflow */ 17062306a36Sopenharmony_ci#define MREGS_TXFSTAT_LCOLL 0x20 /* TX late collision */ 17162306a36Sopenharmony_ci#define MREGS_TXFSTAT_MRETRY 0x10 /* TX > 1 retries */ 17262306a36Sopenharmony_ci#define MREGS_TXFSTAT_ORETRY 0x08 /* TX 1 retry */ 17362306a36Sopenharmony_ci#define MREGS_TXFSTAT_PDEFER 0x04 /* TX pkt deferred */ 17462306a36Sopenharmony_ci#define MREGS_TXFSTAT_CLOSS 0x02 /* TX carrier lost */ 17562306a36Sopenharmony_ci#define MREGS_TXFSTAT_RERROR 0x01 /* TX retry error */ 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_ci#define MREGS_TXRCNT_EDEFER 0x80 /* TX Excess defers */ 17862306a36Sopenharmony_ci#define MREGS_TXRCNT_CMASK 0x0f /* TX retry count */ 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci#define MREGS_RXFCNTL_LOWLAT 0x08 /* RX low latency */ 18162306a36Sopenharmony_ci#define MREGS_RXFCNTL_AREJECT 0x04 /* RX addr match rej */ 18262306a36Sopenharmony_ci#define MREGS_RXFCNTL_AUTOSTRIP 0x01 /* RX auto strip */ 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ci#define MREGS_RXFSTAT_OVERFLOW 0x80 /* RX overflow */ 18562306a36Sopenharmony_ci#define MREGS_RXFSTAT_LCOLL 0x40 /* RX late collision */ 18662306a36Sopenharmony_ci#define MREGS_RXFSTAT_FERROR 0x20 /* RX framing error */ 18762306a36Sopenharmony_ci#define MREGS_RXFSTAT_FCSERROR 0x10 /* RX FCS error */ 18862306a36Sopenharmony_ci#define MREGS_RXFSTAT_RBCNT 0x0f /* RX msg byte count */ 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ci#define MREGS_FFCNT_RX 0xf0 /* RX FIFO frame cnt */ 19162306a36Sopenharmony_ci#define MREGS_FFCNT_TX 0x0f /* TX FIFO frame cnt */ 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_ci#define MREGS_IREG_JABBER 0x80 /* IRQ Jabber error */ 19462306a36Sopenharmony_ci#define MREGS_IREG_BABBLE 0x40 /* IRQ Babble error */ 19562306a36Sopenharmony_ci#define MREGS_IREG_COLL 0x20 /* IRQ Collision error */ 19662306a36Sopenharmony_ci#define MREGS_IREG_RCCO 0x10 /* IRQ Collision cnt overflow */ 19762306a36Sopenharmony_ci#define MREGS_IREG_RPKTCO 0x08 /* IRQ Runt packet count overflow */ 19862306a36Sopenharmony_ci#define MREGS_IREG_MPKTCO 0x04 /* IRQ missed packet cnt overflow */ 19962306a36Sopenharmony_ci#define MREGS_IREG_RXIRQ 0x02 /* IRQ RX'd a packet */ 20062306a36Sopenharmony_ci#define MREGS_IREG_TXIRQ 0x01 /* IRQ TX'd a packet */ 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_ci#define MREGS_IMASK_BABBLE 0x40 /* IMASK Babble errors */ 20362306a36Sopenharmony_ci#define MREGS_IMASK_COLL 0x20 /* IMASK Collision errors */ 20462306a36Sopenharmony_ci#define MREGS_IMASK_MPKTCO 0x04 /* IMASK Missed pkt cnt overflow */ 20562306a36Sopenharmony_ci#define MREGS_IMASK_RXIRQ 0x02 /* IMASK RX interrupts */ 20662306a36Sopenharmony_ci#define MREGS_IMASK_TXIRQ 0x01 /* IMASK TX interrupts */ 20762306a36Sopenharmony_ci 20862306a36Sopenharmony_ci#define MREGS_POLL_TXVALID 0x80 /* TX is valid */ 20962306a36Sopenharmony_ci#define MREGS_POLL_TDTR 0x40 /* TX data transfer request */ 21062306a36Sopenharmony_ci#define MREGS_POLL_RDTR 0x20 /* RX data transfer request */ 21162306a36Sopenharmony_ci 21262306a36Sopenharmony_ci#define MREGS_BCONFIG_BSWAP 0x40 /* Byte Swap */ 21362306a36Sopenharmony_ci#define MREGS_BCONFIG_4TS 0x00 /* 4byte transmit start point */ 21462306a36Sopenharmony_ci#define MREGS_BCONFIG_16TS 0x10 /* 16byte transmit start point */ 21562306a36Sopenharmony_ci#define MREGS_BCONFIG_64TS 0x20 /* 64byte transmit start point */ 21662306a36Sopenharmony_ci#define MREGS_BCONFIG_112TS 0x30 /* 112byte transmit start point */ 21762306a36Sopenharmony_ci#define MREGS_BCONFIG_RESET 0x01 /* SW-Reset the MACE */ 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_ci#define MREGS_FCONFIG_TXF8 0x00 /* TX fifo 8 write cycles */ 22062306a36Sopenharmony_ci#define MREGS_FCONFIG_TXF32 0x80 /* TX fifo 32 write cycles */ 22162306a36Sopenharmony_ci#define MREGS_FCONFIG_TXF16 0x40 /* TX fifo 16 write cycles */ 22262306a36Sopenharmony_ci#define MREGS_FCONFIG_RXF64 0x20 /* RX fifo 64 write cycles */ 22362306a36Sopenharmony_ci#define MREGS_FCONFIG_RXF32 0x10 /* RX fifo 32 write cycles */ 22462306a36Sopenharmony_ci#define MREGS_FCONFIG_RXF16 0x00 /* RX fifo 16 write cycles */ 22562306a36Sopenharmony_ci#define MREGS_FCONFIG_TFWU 0x08 /* TX fifo watermark update */ 22662306a36Sopenharmony_ci#define MREGS_FCONFIG_RFWU 0x04 /* RX fifo watermark update */ 22762306a36Sopenharmony_ci#define MREGS_FCONFIG_TBENAB 0x02 /* TX burst enable */ 22862306a36Sopenharmony_ci#define MREGS_FCONFIG_RBENAB 0x01 /* RX burst enable */ 22962306a36Sopenharmony_ci 23062306a36Sopenharmony_ci#define MREGS_MCONFIG_PROMISC 0x80 /* Promiscuous mode enable */ 23162306a36Sopenharmony_ci#define MREGS_MCONFIG_TPDDISAB 0x40 /* TX 2part deferral enable */ 23262306a36Sopenharmony_ci#define MREGS_MCONFIG_MBAENAB 0x20 /* Modified backoff enable */ 23362306a36Sopenharmony_ci#define MREGS_MCONFIG_RPADISAB 0x08 /* RX physical addr disable */ 23462306a36Sopenharmony_ci#define MREGS_MCONFIG_RBDISAB 0x04 /* RX broadcast disable */ 23562306a36Sopenharmony_ci#define MREGS_MCONFIG_TXENAB 0x02 /* Enable transmitter */ 23662306a36Sopenharmony_ci#define MREGS_MCONFIG_RXENAB 0x01 /* Enable receiver */ 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci#define MREGS_PLSCONFIG_TXMS 0x08 /* TX mode select */ 23962306a36Sopenharmony_ci#define MREGS_PLSCONFIG_GPSI 0x06 /* Use GPSI connector */ 24062306a36Sopenharmony_ci#define MREGS_PLSCONFIG_DAI 0x04 /* Use DAI connector */ 24162306a36Sopenharmony_ci#define MREGS_PLSCONFIG_TP 0x02 /* Use TwistedPair connector */ 24262306a36Sopenharmony_ci#define MREGS_PLSCONFIG_AUI 0x00 /* Use AUI connector */ 24362306a36Sopenharmony_ci#define MREGS_PLSCONFIG_IOENAB 0x01 /* PLS I/O enable */ 24462306a36Sopenharmony_ci 24562306a36Sopenharmony_ci#define MREGS_PHYCONFIG_LSTAT 0x80 /* Link status */ 24662306a36Sopenharmony_ci#define MREGS_PHYCONFIG_LTESTDIS 0x40 /* Disable link test logic */ 24762306a36Sopenharmony_ci#define MREGS_PHYCONFIG_RXPOLARITY 0x20 /* RX polarity */ 24862306a36Sopenharmony_ci#define MREGS_PHYCONFIG_APCDISAB 0x10 /* AutoPolarityCorrect disab */ 24962306a36Sopenharmony_ci#define MREGS_PHYCONFIG_LTENAB 0x08 /* Select low threshold */ 25062306a36Sopenharmony_ci#define MREGS_PHYCONFIG_AUTO 0x04 /* Connector port auto-sel */ 25162306a36Sopenharmony_ci#define MREGS_PHYCONFIG_RWU 0x02 /* Remote WakeUp */ 25262306a36Sopenharmony_ci#define MREGS_PHYCONFIG_AW 0x01 /* Auto Wakeup */ 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_ci#define MREGS_IACONFIG_ACHNGE 0x80 /* Do address change */ 25562306a36Sopenharmony_ci#define MREGS_IACONFIG_PARESET 0x04 /* Physical address reset */ 25662306a36Sopenharmony_ci#define MREGS_IACONFIG_LARESET 0x02 /* Logical address reset */ 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_ci#define MREGS_UTEST_RTRENAB 0x80 /* Enable resv test register */ 25962306a36Sopenharmony_ci#define MREGS_UTEST_RTRDISAB 0x40 /* Disab resv test register */ 26062306a36Sopenharmony_ci#define MREGS_UTEST_RPACCEPT 0x20 /* Accept runt packets */ 26162306a36Sopenharmony_ci#define MREGS_UTEST_FCOLL 0x10 /* Force collision status */ 26262306a36Sopenharmony_ci#define MREGS_UTEST_FCSENAB 0x08 /* Enable FCS on RX */ 26362306a36Sopenharmony_ci#define MREGS_UTEST_INTLOOPM 0x06 /* Intern lpback w/MENDEC */ 26462306a36Sopenharmony_ci#define MREGS_UTEST_INTLOOP 0x04 /* Intern lpback */ 26562306a36Sopenharmony_ci#define MREGS_UTEST_EXTLOOP 0x02 /* Extern lpback */ 26662306a36Sopenharmony_ci#define MREGS_UTEST_NOLOOP 0x00 /* No loopback */ 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_cistruct qe_rxd { 26962306a36Sopenharmony_ci u32 rx_flags; 27062306a36Sopenharmony_ci u32 rx_addr; 27162306a36Sopenharmony_ci}; 27262306a36Sopenharmony_ci 27362306a36Sopenharmony_ci#define RXD_OWN 0x80000000 /* Ownership. */ 27462306a36Sopenharmony_ci#define RXD_UPDATE 0x10000000 /* Being Updated? */ 27562306a36Sopenharmony_ci#define RXD_LENGTH 0x000007ff /* Packet Length. */ 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_cistruct qe_txd { 27862306a36Sopenharmony_ci u32 tx_flags; 27962306a36Sopenharmony_ci u32 tx_addr; 28062306a36Sopenharmony_ci}; 28162306a36Sopenharmony_ci 28262306a36Sopenharmony_ci#define TXD_OWN 0x80000000 /* Ownership. */ 28362306a36Sopenharmony_ci#define TXD_SOP 0x40000000 /* Start Of Packet */ 28462306a36Sopenharmony_ci#define TXD_EOP 0x20000000 /* End Of Packet */ 28562306a36Sopenharmony_ci#define TXD_UPDATE 0x10000000 /* Being Updated? */ 28662306a36Sopenharmony_ci#define TXD_LENGTH 0x000007ff /* Packet Length. */ 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_ci#define TX_RING_MAXSIZE 256 28962306a36Sopenharmony_ci#define RX_RING_MAXSIZE 256 29062306a36Sopenharmony_ci 29162306a36Sopenharmony_ci#define TX_RING_SIZE 16 29262306a36Sopenharmony_ci#define RX_RING_SIZE 16 29362306a36Sopenharmony_ci 29462306a36Sopenharmony_ci#define NEXT_RX(num) (((num) + 1) & (RX_RING_MAXSIZE - 1)) 29562306a36Sopenharmony_ci#define NEXT_TX(num) (((num) + 1) & (TX_RING_MAXSIZE - 1)) 29662306a36Sopenharmony_ci#define PREV_RX(num) (((num) - 1) & (RX_RING_MAXSIZE - 1)) 29762306a36Sopenharmony_ci#define PREV_TX(num) (((num) - 1) & (TX_RING_MAXSIZE - 1)) 29862306a36Sopenharmony_ci 29962306a36Sopenharmony_ci#define TX_BUFFS_AVAIL(qp) \ 30062306a36Sopenharmony_ci (((qp)->tx_old <= (qp)->tx_new) ? \ 30162306a36Sopenharmony_ci (qp)->tx_old + (TX_RING_SIZE - 1) - (qp)->tx_new : \ 30262306a36Sopenharmony_ci (qp)->tx_old - (qp)->tx_new - 1) 30362306a36Sopenharmony_ci 30462306a36Sopenharmony_cistruct qe_init_block { 30562306a36Sopenharmony_ci struct qe_rxd qe_rxd[RX_RING_MAXSIZE]; 30662306a36Sopenharmony_ci struct qe_txd qe_txd[TX_RING_MAXSIZE]; 30762306a36Sopenharmony_ci}; 30862306a36Sopenharmony_ci 30962306a36Sopenharmony_ci#define qib_offset(mem, elem) \ 31062306a36Sopenharmony_ci((__u32)((unsigned long)(&(((struct qe_init_block *)0)->mem[elem])))) 31162306a36Sopenharmony_ci 31262306a36Sopenharmony_cistruct sunqe; 31362306a36Sopenharmony_ci 31462306a36Sopenharmony_cistruct sunqec { 31562306a36Sopenharmony_ci void __iomem *gregs; /* QEC Global Registers */ 31662306a36Sopenharmony_ci struct sunqe *qes[4]; /* Each child MACE */ 31762306a36Sopenharmony_ci unsigned int qec_bursts; /* Support burst sizes */ 31862306a36Sopenharmony_ci struct platform_device *op; /* QEC's OF device */ 31962306a36Sopenharmony_ci struct sunqec *next_module; /* List of all QECs in system */ 32062306a36Sopenharmony_ci}; 32162306a36Sopenharmony_ci 32262306a36Sopenharmony_ci#define PKT_BUF_SZ 1664 32362306a36Sopenharmony_ci#define RXD_PKT_SZ 1664 32462306a36Sopenharmony_ci 32562306a36Sopenharmony_cistruct sunqe_buffers { 32662306a36Sopenharmony_ci u8 tx_buf[TX_RING_SIZE][PKT_BUF_SZ]; 32762306a36Sopenharmony_ci u8 __pad[2]; 32862306a36Sopenharmony_ci u8 rx_buf[RX_RING_SIZE][PKT_BUF_SZ]; 32962306a36Sopenharmony_ci}; 33062306a36Sopenharmony_ci 33162306a36Sopenharmony_ci#define qebuf_offset(mem, elem) \ 33262306a36Sopenharmony_ci((__u32)((unsigned long)(&(((struct sunqe_buffers *)0)->mem[elem][0])))) 33362306a36Sopenharmony_ci 33462306a36Sopenharmony_cistruct sunqe { 33562306a36Sopenharmony_ci void __iomem *qcregs; /* QEC per-channel Registers */ 33662306a36Sopenharmony_ci void __iomem *mregs; /* Per-channel MACE Registers */ 33762306a36Sopenharmony_ci struct qe_init_block *qe_block; /* RX and TX descriptors */ 33862306a36Sopenharmony_ci dma_addr_t qblock_dvma; /* RX and TX descriptors */ 33962306a36Sopenharmony_ci spinlock_t lock; /* Protects txfull state */ 34062306a36Sopenharmony_ci int rx_new, rx_old; /* RX ring extents */ 34162306a36Sopenharmony_ci int tx_new, tx_old; /* TX ring extents */ 34262306a36Sopenharmony_ci struct sunqe_buffers *buffers; /* CPU visible address. */ 34362306a36Sopenharmony_ci dma_addr_t buffers_dvma; /* DVMA visible address. */ 34462306a36Sopenharmony_ci struct sunqec *parent; 34562306a36Sopenharmony_ci u8 mconfig; /* Base MACE mconfig value */ 34662306a36Sopenharmony_ci struct platform_device *op; /* QE's OF device struct */ 34762306a36Sopenharmony_ci struct net_device *dev; /* QE's netdevice struct */ 34862306a36Sopenharmony_ci int channel; /* Who am I? */ 34962306a36Sopenharmony_ci}; 35062306a36Sopenharmony_ci 35162306a36Sopenharmony_ci#endif /* !(_SUNQE_H) */ 352