18c2ecf20Sopenharmony_ci/* am7990 (lance) definitions
28c2ecf20Sopenharmony_ci *
38c2ecf20Sopenharmony_ci * This is an extension to the Linux operating system, and is covered by
48c2ecf20Sopenharmony_ci * same GNU General Public License that covers that work.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Michael Hipp
78c2ecf20Sopenharmony_ci * email: mhipp@student.uni-tuebingen.de
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * sources: (mail me or ask archie if you need them)
108c2ecf20Sopenharmony_ci *    crynwr-packet-driver
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/*
148c2ecf20Sopenharmony_ci * 	Control and Status Register 0 (CSR0) bit definitions
158c2ecf20Sopenharmony_ci * (R=Readable) (W=Writeable) (S=Set on write) (C-Clear on write)
168c2ecf20Sopenharmony_ci *
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define CSR0_ERR	0x8000	/* Error summary (R) */
208c2ecf20Sopenharmony_ci#define CSR0_BABL	0x4000	/* Babble transmitter timeout error (RC) */
218c2ecf20Sopenharmony_ci#define CSR0_CERR	0x2000	/* Collision Error (RC) */
228c2ecf20Sopenharmony_ci#define CSR0_MISS	0x1000	/* Missed packet (RC) */
238c2ecf20Sopenharmony_ci#define CSR0_MERR	0x0800	/* Memory Error (RC) */
248c2ecf20Sopenharmony_ci#define CSR0_RINT	0x0400	/* Receiver Interrupt (RC) */
258c2ecf20Sopenharmony_ci#define CSR0_TINT       0x0200	/* Transmit Interrupt (RC) */
268c2ecf20Sopenharmony_ci#define CSR0_IDON	0x0100	/* Initialization Done (RC) */
278c2ecf20Sopenharmony_ci#define CSR0_INTR	0x0080	/* Interrupt Flag (R) */
288c2ecf20Sopenharmony_ci#define CSR0_INEA	0x0040	/* Interrupt Enable (RW) */
298c2ecf20Sopenharmony_ci#define CSR0_RXON	0x0020	/* Receiver on (R) */
308c2ecf20Sopenharmony_ci#define CSR0_TXON	0x0010	/* Transmitter on (R) */
318c2ecf20Sopenharmony_ci#define CSR0_TDMD	0x0008	/* Transmit Demand (RS) */
328c2ecf20Sopenharmony_ci#define CSR0_STOP	0x0004	/* Stop (RS) */
338c2ecf20Sopenharmony_ci#define CSR0_STRT	0x0002	/* Start (RS) */
348c2ecf20Sopenharmony_ci#define CSR0_INIT	0x0001	/* Initialize (RS) */
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define CSR0_CLRALL    0x7f00	/* mask for all clearable bits */
378c2ecf20Sopenharmony_ci/*
388c2ecf20Sopenharmony_ci *	Initialization Block  Mode operation Bit Definitions.
398c2ecf20Sopenharmony_ci */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define M_PROM		0x8000	/* Promiscuous Mode */
428c2ecf20Sopenharmony_ci#define M_INTL		0x0040	/* Internal Loopback */
438c2ecf20Sopenharmony_ci#define M_DRTY		0x0020	/* Disable Retry */
448c2ecf20Sopenharmony_ci#define M_COLL		0x0010	/* Force Collision */
458c2ecf20Sopenharmony_ci#define M_DTCR		0x0008	/* Disable Transmit CRC) */
468c2ecf20Sopenharmony_ci#define M_LOOP		0x0004	/* Loopback */
478c2ecf20Sopenharmony_ci#define M_DTX		0x0002	/* Disable the Transmitter */
488c2ecf20Sopenharmony_ci#define M_DRX		0x0001	/* Disable the Receiver */
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/*
528c2ecf20Sopenharmony_ci * 	Receive message descriptor bit definitions.
538c2ecf20Sopenharmony_ci */
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#define RCV_OWN		0x80	/* owner bit 0 = host, 1 = lance */
568c2ecf20Sopenharmony_ci#define RCV_ERR		0x40	/* Error Summary */
578c2ecf20Sopenharmony_ci#define RCV_FRAM	0x20	/* Framing Error */
588c2ecf20Sopenharmony_ci#define RCV_OFLO	0x10	/* Overflow Error */
598c2ecf20Sopenharmony_ci#define RCV_CRC		0x08	/* CRC Error */
608c2ecf20Sopenharmony_ci#define RCV_BUF_ERR	0x04	/* Buffer Error */
618c2ecf20Sopenharmony_ci#define RCV_START	0x02	/* Start of Packet */
628c2ecf20Sopenharmony_ci#define RCV_END		0x01	/* End of Packet */
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci/*
668c2ecf20Sopenharmony_ci *	Transmit  message descriptor bit definitions.
678c2ecf20Sopenharmony_ci */
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci#define XMIT_OWN	0x80	/* owner bit 0 = host, 1 = lance */
708c2ecf20Sopenharmony_ci#define XMIT_ERR	0x40	/* Error Summary */
718c2ecf20Sopenharmony_ci#define XMIT_RETRY	0x10	/* more the 1 retry needed to Xmit */
728c2ecf20Sopenharmony_ci#define XMIT_1_RETRY	0x08	/* one retry needed to Xmit */
738c2ecf20Sopenharmony_ci#define XMIT_DEF	0x04	/* Deferred */
748c2ecf20Sopenharmony_ci#define XMIT_START	0x02	/* Start of Packet */
758c2ecf20Sopenharmony_ci#define XMIT_END	0x01	/* End of Packet */
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/*
788c2ecf20Sopenharmony_ci * transmit status (2) (valid if XMIT_ERR == 1)
798c2ecf20Sopenharmony_ci */
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#define XMIT_TDRMASK    0x03ff	/* time-domain-reflectometer-value */
828c2ecf20Sopenharmony_ci#define XMIT_RTRY 	0x0400	/* Failed after 16 retransmissions  */
838c2ecf20Sopenharmony_ci#define XMIT_LCAR 	0x0800	/* Loss of Carrier */
848c2ecf20Sopenharmony_ci#define XMIT_LCOL 	0x1000	/* Late collision */
858c2ecf20Sopenharmony_ci#define XMIT_RESERV 	0x2000	/* Reserved */
868c2ecf20Sopenharmony_ci#define XMIT_UFLO 	0x4000	/* Underflow (late memory) */
878c2ecf20Sopenharmony_ci#define XMIT_BUFF 	0x8000	/* Buffering error (no ENP) */
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_cistruct init_block {
908c2ecf20Sopenharmony_ci	unsigned short mode;
918c2ecf20Sopenharmony_ci	unsigned char eaddr[6];
928c2ecf20Sopenharmony_ci	unsigned char filter[8];
938c2ecf20Sopenharmony_ci	/* bit 29-31: number of rmd's (power of 2) */
948c2ecf20Sopenharmony_ci	u32 rrp;		/* receive ring pointer (align 8) */
958c2ecf20Sopenharmony_ci	/* bit 29-31: number of tmd's (power of 2) */
968c2ecf20Sopenharmony_ci	u32 trp;		/* transmit ring pointer (align 8) */
978c2ecf20Sopenharmony_ci};
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_cistruct rmd {			/* Receive Message Descriptor */
1008c2ecf20Sopenharmony_ci	union {
1018c2ecf20Sopenharmony_ci		volatile u32 buffer;
1028c2ecf20Sopenharmony_ci		struct {
1038c2ecf20Sopenharmony_ci			volatile unsigned char dummy[3];
1048c2ecf20Sopenharmony_ci			volatile unsigned char status;
1058c2ecf20Sopenharmony_ci		} s;
1068c2ecf20Sopenharmony_ci	} u;
1078c2ecf20Sopenharmony_ci	volatile short blen;
1088c2ecf20Sopenharmony_ci	volatile unsigned short mlen;
1098c2ecf20Sopenharmony_ci};
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_cistruct tmd {
1128c2ecf20Sopenharmony_ci	union {
1138c2ecf20Sopenharmony_ci		volatile u32 buffer;
1148c2ecf20Sopenharmony_ci		struct {
1158c2ecf20Sopenharmony_ci			volatile unsigned char dummy[3];
1168c2ecf20Sopenharmony_ci			volatile unsigned char status;
1178c2ecf20Sopenharmony_ci		} s;
1188c2ecf20Sopenharmony_ci	} u;
1198c2ecf20Sopenharmony_ci	volatile unsigned short blen;
1208c2ecf20Sopenharmony_ci	volatile unsigned short status2;
1218c2ecf20Sopenharmony_ci};
122