xref: /freebsd/sys/dev/le/am7990reg.h (revision 29363fb446372cb3f10bc98664e9767c53fbb457)
1a7ee7a7dSMarius Strobl /*	$NetBSD: am7990reg.h,v 1.11 2005/12/11 12:21:25 christos Exp $	*/
2a7ee7a7dSMarius Strobl 
3a7ee7a7dSMarius Strobl /*-
4a7ee7a7dSMarius Strobl  * Copyright (c) 1998 The NetBSD Foundation, Inc.
5a7ee7a7dSMarius Strobl  * All rights reserved.
6a7ee7a7dSMarius Strobl  *
7a7ee7a7dSMarius Strobl  * This code is derived from software contributed to The NetBSD Foundation
8a7ee7a7dSMarius Strobl  * by Charles M. Hannum.
9a7ee7a7dSMarius Strobl  *
10a7ee7a7dSMarius Strobl  * Redistribution and use in source and binary forms, with or without
11a7ee7a7dSMarius Strobl  * modification, are permitted provided that the following conditions
12a7ee7a7dSMarius Strobl  * are met:
13a7ee7a7dSMarius Strobl  * 1. Redistributions of source code must retain the above copyright
14a7ee7a7dSMarius Strobl  *    notice, this list of conditions and the following disclaimer.
15a7ee7a7dSMarius Strobl  * 2. Redistributions in binary form must reproduce the above copyright
16a7ee7a7dSMarius Strobl  *    notice, this list of conditions and the following disclaimer in the
17a7ee7a7dSMarius Strobl  *    documentation and/or other materials provided with the distribution.
18a7ee7a7dSMarius Strobl  *
19a7ee7a7dSMarius Strobl  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20a7ee7a7dSMarius Strobl  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21a7ee7a7dSMarius Strobl  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22a7ee7a7dSMarius Strobl  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23a7ee7a7dSMarius Strobl  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24a7ee7a7dSMarius Strobl  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25a7ee7a7dSMarius Strobl  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26a7ee7a7dSMarius Strobl  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27a7ee7a7dSMarius Strobl  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28a7ee7a7dSMarius Strobl  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29a7ee7a7dSMarius Strobl  * POSSIBILITY OF SUCH DAMAGE.
30a7ee7a7dSMarius Strobl  */
31a7ee7a7dSMarius Strobl 
32a7ee7a7dSMarius Strobl /*-
33*718cf2ccSPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
34*718cf2ccSPedro F. Giffuni  *
35a7ee7a7dSMarius Strobl  * Copyright (c) 1992, 1993
36a7ee7a7dSMarius Strobl  *	The Regents of the University of California.  All rights reserved.
37a7ee7a7dSMarius Strobl  *
38a7ee7a7dSMarius Strobl  * This code is derived from software contributed to Berkeley by
39a7ee7a7dSMarius Strobl  * Ralph Campbell and Rick Macklem.
40a7ee7a7dSMarius Strobl  *
41a7ee7a7dSMarius Strobl  * Redistribution and use in source and binary forms, with or without
42a7ee7a7dSMarius Strobl  * modification, are permitted provided that the following conditions
43a7ee7a7dSMarius Strobl  * are met:
44a7ee7a7dSMarius Strobl  * 1. Redistributions of source code must retain the above copyright
45a7ee7a7dSMarius Strobl  *    notice, this list of conditions and the following disclaimer.
46a7ee7a7dSMarius Strobl  * 2. Redistributions in binary form must reproduce the above copyright
47a7ee7a7dSMarius Strobl  *    notice, this list of conditions and the following disclaimer in the
48a7ee7a7dSMarius Strobl  *    documentation and/or other materials provided with the distribution.
49a7ee7a7dSMarius Strobl  * 3. Neither the name of the University nor the names of its contributors
50a7ee7a7dSMarius Strobl  *    may be used to endorse or promote products derived from this software
51a7ee7a7dSMarius Strobl  *    without specific prior written permission.
52a7ee7a7dSMarius Strobl  *
53a7ee7a7dSMarius Strobl  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
54a7ee7a7dSMarius Strobl  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
55a7ee7a7dSMarius Strobl  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56a7ee7a7dSMarius Strobl  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
57a7ee7a7dSMarius Strobl  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58a7ee7a7dSMarius Strobl  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
59a7ee7a7dSMarius Strobl  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
60a7ee7a7dSMarius Strobl  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61a7ee7a7dSMarius Strobl  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62a7ee7a7dSMarius Strobl  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63a7ee7a7dSMarius Strobl  * SUCH DAMAGE.
64a7ee7a7dSMarius Strobl  */
65a7ee7a7dSMarius Strobl 
66a7ee7a7dSMarius Strobl 
67a7ee7a7dSMarius Strobl #ifndef _DEV_LE_AM7990REG_H_
68a7ee7a7dSMarius Strobl #define	_DEV_LE_AM7990REG_H_
69a7ee7a7dSMarius Strobl 
70a7ee7a7dSMarius Strobl /*
71a7ee7a7dSMarius Strobl  * Receive message descriptor
72a7ee7a7dSMarius Strobl  */
73a7ee7a7dSMarius Strobl struct lermd {
74a7ee7a7dSMarius Strobl 	uint16_t rmd0;
75a7ee7a7dSMarius Strobl #if BYTE_ORDER == BIG_ENDIAN
76a7ee7a7dSMarius Strobl 	uint8_t  rmd1_bits;
77a7ee7a7dSMarius Strobl 	uint8_t  rmd1_hadr;
78a7ee7a7dSMarius Strobl #else
79a7ee7a7dSMarius Strobl 	uint8_t  rmd1_hadr;
80a7ee7a7dSMarius Strobl 	uint8_t  rmd1_bits;
81a7ee7a7dSMarius Strobl #endif
82a7ee7a7dSMarius Strobl 	int16_t	 rmd2;
83a7ee7a7dSMarius Strobl 	uint16_t rmd3;
84a7ee7a7dSMarius Strobl } __packed;
85a7ee7a7dSMarius Strobl 
86a7ee7a7dSMarius Strobl /*
87a7ee7a7dSMarius Strobl  * Transmit message descriptor
88a7ee7a7dSMarius Strobl  */
89a7ee7a7dSMarius Strobl struct letmd {
90a7ee7a7dSMarius Strobl 	uint16_t tmd0;
91a7ee7a7dSMarius Strobl #if BYTE_ORDER == BIG_ENDIAN
92a7ee7a7dSMarius Strobl 	uint8_t  tmd1_bits;
93a7ee7a7dSMarius Strobl 	uint8_t  tmd1_hadr;
94a7ee7a7dSMarius Strobl #else
95a7ee7a7dSMarius Strobl 	uint8_t  tmd1_hadr;
96a7ee7a7dSMarius Strobl 	uint8_t  tmd1_bits;
97a7ee7a7dSMarius Strobl #endif
98a7ee7a7dSMarius Strobl 	int16_t	 tmd2;
99a7ee7a7dSMarius Strobl 	uint16_t tmd3;
100a7ee7a7dSMarius Strobl } __packed;
101a7ee7a7dSMarius Strobl 
102a7ee7a7dSMarius Strobl /*
103a7ee7a7dSMarius Strobl  * Initialization block
104a7ee7a7dSMarius Strobl  */
105a7ee7a7dSMarius Strobl struct leinit {
106a7ee7a7dSMarius Strobl 	uint16_t init_mode;		/* +0x0000 */
107a7ee7a7dSMarius Strobl 	uint16_t init_padr[3];		/* +0x0002 */
108a7ee7a7dSMarius Strobl 	uint16_t init_ladrf[4];		/* +0x0008 */
109a7ee7a7dSMarius Strobl 	uint16_t init_rdra;		/* +0x0010 */
110a7ee7a7dSMarius Strobl 	uint16_t init_rlen;		/* +0x0012 */
111a7ee7a7dSMarius Strobl 	uint16_t init_tdra;		/* +0x0014 */
112a7ee7a7dSMarius Strobl 	uint16_t init_tlen;		/* +0x0016 */
113a7ee7a7dSMarius Strobl 	int16_t	 pad0[4];		/* Pad to 16 shorts. */
114a7ee7a7dSMarius Strobl } __packed;
115a7ee7a7dSMarius Strobl 
116a7ee7a7dSMarius Strobl /* Receive message descriptor 1 (rmd1_bits) */
117a7ee7a7dSMarius Strobl #define	LE_R1_OWN	0x80		/* LANCE owns the packet */
118a7ee7a7dSMarius Strobl #define	LE_R1_ERR	0x40		/* error summary */
119a7ee7a7dSMarius Strobl #define	LE_R1_FRAM	0x20		/* framing error */
120a7ee7a7dSMarius Strobl #define	LE_R1_OFLO	0x10		/* overflow error */
121a7ee7a7dSMarius Strobl #define	LE_R1_CRC	0x08		/* CRC error */
122a7ee7a7dSMarius Strobl #define	LE_R1_BUFF	0x04		/* buffer error */
123a7ee7a7dSMarius Strobl #define	LE_R1_STP	0x02		/* start of packet */
124a7ee7a7dSMarius Strobl #define	LE_R1_ENP	0x01		/* end of packet */
125a7ee7a7dSMarius Strobl 
126a7ee7a7dSMarius Strobl #define	LE_R1_BITS \
127a7ee7a7dSMarius Strobl     "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP"
128a7ee7a7dSMarius Strobl 
129a7ee7a7dSMarius Strobl /* Transmit message descriptor 1 (tmd1_bits) */
130a7ee7a7dSMarius Strobl #define	LE_T1_OWN	0x80		/* LANCE owns the packet */
131a7ee7a7dSMarius Strobl #define	LE_T1_ERR	0x40		/* error summary */
132a7ee7a7dSMarius Strobl #define	LE_T1_MORE	0x10		/* multiple collisions */
133a7ee7a7dSMarius Strobl #define	LE_T1_ONE	0x08		/* single collision */
134a7ee7a7dSMarius Strobl #define	LE_T1_DEF	0x04		/* deferred transmit */
135a7ee7a7dSMarius Strobl #define	LE_T1_STP	0x02		/* start of packet */
136a7ee7a7dSMarius Strobl #define	LE_T1_ENP	0x01		/* end of packet */
137a7ee7a7dSMarius Strobl 
138a7ee7a7dSMarius Strobl #define	LE_T1_BITS \
139a7ee7a7dSMarius Strobl     "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP"
140a7ee7a7dSMarius Strobl 
141a7ee7a7dSMarius Strobl /* Transmit message descriptor 3 (tmd3) */
142a7ee7a7dSMarius Strobl #define	LE_T3_BUFF	0x8000		/* buffer error */
143a7ee7a7dSMarius Strobl #define	LE_T3_UFLO	0x4000		/* underflow error */
144a7ee7a7dSMarius Strobl #define	LE_T3_LCOL	0x1000		/* late collision */
145a7ee7a7dSMarius Strobl #define	LE_T3_LCAR	0x0800		/* loss of carrier */
146a7ee7a7dSMarius Strobl #define	LE_T3_RTRY	0x0400		/* retry error */
147a7ee7a7dSMarius Strobl #define	LE_T3_TDR_MASK	0x03ff		/* time domain reflectometry counter */
148a7ee7a7dSMarius Strobl 
149a7ee7a7dSMarius Strobl #define	LE_XMD2_ONES	0xf000
150a7ee7a7dSMarius Strobl 
151a7ee7a7dSMarius Strobl #define	LE_T3_BITS \
152a7ee7a7dSMarius Strobl     "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY"
153a7ee7a7dSMarius Strobl 
154a7ee7a7dSMarius Strobl /*
155a7ee7a7dSMarius Strobl  * PCnet-ISA defines which are not available on LANCE 7990.
156a7ee7a7dSMarius Strobl  */
157a7ee7a7dSMarius Strobl 
158a7ee7a7dSMarius Strobl /* (ISA) Bus Configuration Registers */
159a7ee7a7dSMarius Strobl #define	LE_BCR_MSRDA	0x0000
160a7ee7a7dSMarius Strobl #define	LE_BCR_MSWRA	0x0001
161a7ee7a7dSMarius Strobl #define	LE_BCR_MC	0x0002
162a7ee7a7dSMarius Strobl #define	LE_BCR_LED1	0x0005
163a7ee7a7dSMarius Strobl #define	LE_BCR_LED2	0x0006
164a7ee7a7dSMarius Strobl #define	LE_BCR_LED3	0x0007
165a7ee7a7dSMarius Strobl 
166a7ee7a7dSMarius Strobl /* Bus configurations bits (MC) */
167a7ee7a7dSMarius Strobl #define	LE_MC_EADISEL	0x0008		/* EADI selection */
168a7ee7a7dSMarius Strobl #define	LE_MC_AWAKE	0x0004		/* auto-wake */
169a7ee7a7dSMarius Strobl #define	LE_MC_ASEL	0x0002		/* auto selection */
170a7ee7a7dSMarius Strobl #define	LE_MC_XMAUSEL	0x0001		/* external MAU selection */
171a7ee7a7dSMarius Strobl 
172a7ee7a7dSMarius Strobl /* LED bis (LED[123]) */
173a7ee7a7dSMarius Strobl #define	LE_LED_LEDOUT	0x8000
174a7ee7a7dSMarius Strobl #define	LE_LED_PSE	0x0080
175a7ee7a7dSMarius Strobl #define	LE_LED_XMTE	0x0010
176a7ee7a7dSMarius Strobl #define	LE_LED_PVPE	0x0008
177a7ee7a7dSMarius Strobl #define	LE_LED_PCVE	0x0004
178a7ee7a7dSMarius Strobl #define	LE_LED_JABE	0x0002
179a7ee7a7dSMarius Strobl #define	LE_LED_COLE	0x0001
180a7ee7a7dSMarius Strobl 
181a7ee7a7dSMarius Strobl #endif /* !_DEV_LE_AM7990REG_H_ */
182