xref: /freebsd/sys/dev/le/am79900reg.h (revision 29363fb446372cb3f10bc98664e9767c53fbb457)
1a7ee7a7dSMarius Strobl /*	$NetBSD: am79900reg.h,v 1.8 2005/12/11 12:21:25 christos Exp $	*/
2a7ee7a7dSMarius Strobl 
3a7ee7a7dSMarius Strobl /*-
4*b61a5730SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause AND BSD-3-Clause
5718cf2ccSPedro F. Giffuni  *
6a7ee7a7dSMarius Strobl  * Copyright (c) 1998 The NetBSD Foundation, Inc.
7a7ee7a7dSMarius Strobl  * All rights reserved.
8a7ee7a7dSMarius Strobl  *
9a7ee7a7dSMarius Strobl  * This code is derived from software contributed to The NetBSD Foundation
10a7ee7a7dSMarius Strobl  * by Charles M. Hannum.
11a7ee7a7dSMarius Strobl  *
12a7ee7a7dSMarius Strobl  * Redistribution and use in source and binary forms, with or without
13a7ee7a7dSMarius Strobl  * modification, are permitted provided that the following conditions
14a7ee7a7dSMarius Strobl  * are met:
15a7ee7a7dSMarius Strobl  * 1. Redistributions of source code must retain the above copyright
16a7ee7a7dSMarius Strobl  *    notice, this list of conditions and the following disclaimer.
17a7ee7a7dSMarius Strobl  * 2. Redistributions in binary form must reproduce the above copyright
18a7ee7a7dSMarius Strobl  *    notice, this list of conditions and the following disclaimer in the
19a7ee7a7dSMarius Strobl  *    documentation and/or other materials provided with the distribution.
20a7ee7a7dSMarius Strobl  *
21a7ee7a7dSMarius Strobl  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22a7ee7a7dSMarius Strobl  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23a7ee7a7dSMarius Strobl  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24a7ee7a7dSMarius Strobl  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25a7ee7a7dSMarius Strobl  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26a7ee7a7dSMarius Strobl  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27a7ee7a7dSMarius Strobl  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28a7ee7a7dSMarius Strobl  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29a7ee7a7dSMarius Strobl  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30a7ee7a7dSMarius Strobl  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31a7ee7a7dSMarius Strobl  * POSSIBILITY OF SUCH DAMAGE.
32a7ee7a7dSMarius Strobl  */
33a7ee7a7dSMarius Strobl 
34a7ee7a7dSMarius Strobl /*-
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_AM79900REG_H_
68a7ee7a7dSMarius Strobl #define	_DEV_LE_AM79900REG_H_
69a7ee7a7dSMarius Strobl 
70a7ee7a7dSMarius Strobl /*
71a7ee7a7dSMarius Strobl  * Receive message descriptor
72a7ee7a7dSMarius Strobl  */
73a7ee7a7dSMarius Strobl struct lermd {
74a7ee7a7dSMarius Strobl 	uint32_t	rmd0;
75a7ee7a7dSMarius Strobl 	uint32_t	rmd1;
76a7ee7a7dSMarius Strobl 	uint32_t	rmd2;
77a7ee7a7dSMarius Strobl 	int32_t		rmd3;
78a7ee7a7dSMarius Strobl };
79a7ee7a7dSMarius Strobl 
80a7ee7a7dSMarius Strobl /*
81a7ee7a7dSMarius Strobl  * Transmit message descriptor
82a7ee7a7dSMarius Strobl  */
83a7ee7a7dSMarius Strobl struct letmd {
84a7ee7a7dSMarius Strobl 	uint32_t	tmd0;
85a7ee7a7dSMarius Strobl 	uint32_t	tmd1;
86a7ee7a7dSMarius Strobl 	uint32_t	tmd2;
87a7ee7a7dSMarius Strobl 	int32_t		tmd3;
88a7ee7a7dSMarius Strobl };
89a7ee7a7dSMarius Strobl 
90a7ee7a7dSMarius Strobl /*
91a7ee7a7dSMarius Strobl  * Initialization block
92a7ee7a7dSMarius Strobl  */
93a7ee7a7dSMarius Strobl struct leinit {
94a7ee7a7dSMarius Strobl 	uint32_t	init_mode;	/* +0x0000 */
95a7ee7a7dSMarius Strobl 	uint32_t	init_padr[2];	/* +0x0002 */
96a7ee7a7dSMarius Strobl 	uint16_t	init_ladrf[4];	/* +0x0008 */
97a7ee7a7dSMarius Strobl 	uint32_t	init_rdra;	/* +0x0010 */
98a7ee7a7dSMarius Strobl 	uint32_t	init_tdra;	/* +0x0014 */
99a7ee7a7dSMarius Strobl 	int32_t	 	pad;		/* Pad to 8 ints. */
100a7ee7a7dSMarius Strobl };
101a7ee7a7dSMarius Strobl 
102a7ee7a7dSMarius Strobl /* Receive message descriptor 1 (rmd1_bits) */
103a7ee7a7dSMarius Strobl #define	LE_R1_OWN	(1U << 31)	/* LANCE owns the packet */
104a7ee7a7dSMarius Strobl #define	LE_R1_ERR	(1U << 30)	/* error summary */
105a7ee7a7dSMarius Strobl #define	LE_R1_FRAM	(1U << 29)	/* framing error */
106a7ee7a7dSMarius Strobl #define	LE_R1_OFLO	(1U << 28)	/* overflow error */
107a7ee7a7dSMarius Strobl #define	LE_R1_CRC	(1U << 27)	/* CRC error */
108a7ee7a7dSMarius Strobl #define	LE_R1_BUFF	(1U << 26)	/* buffer error */
109a7ee7a7dSMarius Strobl #define	LE_R1_STP	(1U << 25)	/* start of packet */
110a7ee7a7dSMarius Strobl #define	LE_R1_ENP	(1U << 24)	/* end of packet */
111a7ee7a7dSMarius Strobl #define	LE_R1_ONES	(0xfU << 12)	/* must be ones */
112a7ee7a7dSMarius Strobl #define	LE_R1_BCNT_MASK	(0xfff)		/* byte count mask */
113a7ee7a7dSMarius Strobl 
114a7ee7a7dSMarius Strobl #define	LE_R1_BITS \
115a7ee7a7dSMarius Strobl     "\20\40OWN\37ERR\36FRAM\35OFLO\34CRC\33BUFF\32STP\31ENP"
116a7ee7a7dSMarius Strobl 
117a7ee7a7dSMarius Strobl /* Transmit message descriptor 1 (tmd1_bits) */
118a7ee7a7dSMarius Strobl #define	LE_T1_OWN	(1U << 31)	/* LANCE owns the packet */
119a7ee7a7dSMarius Strobl #define	LE_T1_ERR	(1U << 30)	/* error summary */
120a7ee7a7dSMarius Strobl #define	LE_T1_ADD_FCS	(1U << 29)	/* add FCS (PCnet-PCI) */
121a7ee7a7dSMarius Strobl #define	LE_T1_NO_FCS	(1U << 29)	/* no FCS (ILACC) */
122a7ee7a7dSMarius Strobl #define	LE_T1_MORE	(1U << 28)	/* multiple collisions */
123a7ee7a7dSMarius Strobl #define	LE_T1_LTINT	(1U << 28)	/* transmit interrupt (if LTINTEN) */
124a7ee7a7dSMarius Strobl #define	LE_T1_ONE	(1U << 27)	/* single collision */
125a7ee7a7dSMarius Strobl #define	LE_T1_DEF	(1U << 26)	/* deferred transmit */
126a7ee7a7dSMarius Strobl #define	LE_T1_STP	(1U << 25)	/* start of packet */
127a7ee7a7dSMarius Strobl #define	LE_T1_ENP	(1U << 24)	/* end of packet */
128a7ee7a7dSMarius Strobl #define	LE_T1_ONES	(0xfU << 12)	/* must be ones */
129a7ee7a7dSMarius Strobl #define	LE_T1_BCNT_MASK	(0xfff)		/* byte count mask */
130a7ee7a7dSMarius Strobl 
131a7ee7a7dSMarius Strobl #define	LE_T1_BITS \
132a7ee7a7dSMarius Strobl     "\20\40OWN\37ERR\36RES\35MORE\34ONE\33DEF\32STP\31ENP"
133a7ee7a7dSMarius Strobl 
134a7ee7a7dSMarius Strobl /* Transmit message descriptor 3 (tmd3) */
135a7ee7a7dSMarius Strobl #define	LE_T2_BUFF	(1U << 31)	/* buffer error */
136a7ee7a7dSMarius Strobl #define	LE_T2_UFLO	(1U << 30)	/* underflow error */
137a7ee7a7dSMarius Strobl #define	LE_T2_EXDEF	(1U << 29)	/* excessive defferral */
138a7ee7a7dSMarius Strobl #define	LE_T2_LCOL	(1U << 28)	/* late collision */
139a7ee7a7dSMarius Strobl #define	LE_T2_LCAR	(1U << 27)	/* loss of carrier */
140a7ee7a7dSMarius Strobl #define	LE_T2_RTRY	(1U << 26)	/* retry error */
141a7ee7a7dSMarius Strobl #if 0
142a7ee7a7dSMarius Strobl #define	LE_T3_TDR_MASK	0x03ff		/* time domain reflectometry counter */
143a7ee7a7dSMarius Strobl #endif
144a7ee7a7dSMarius Strobl 
145a7ee7a7dSMarius Strobl #define	LE_T3_BITS \
146a7ee7a7dSMarius Strobl     "\12\40BUFF\37UFLO\35LCOL\34LCAR\33RTRY"
147a7ee7a7dSMarius Strobl 
148a7ee7a7dSMarius Strobl #endif /* !_DEV_LE_AM7990REG_H_ */
149