xref: /freebsd-13-stable/sys/dev/dme/if_dmereg.h (revision f8167e0404dab9ffeaca95853dd237ab7c587f82)
1 /*
2  * Copyright (C) 2010 Andrew Turner
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  */
26 
27 #ifndef __IF_DMEREG_H__
28 #define __IF_DMEREG_H__
29 
30 /*
31  * DM9000 register definitions
32  */
33 #define DME_NCR		0x00
34 #define  NCR_EXT_PHY	(1<<7)
35 #define  NCR_WAKEEN	(1<<6)
36 #define  NCR_FCOL	(1<<4)
37 #define  NCR_FDX	(1<<3)
38 #define  NCR_LBK_NORMAL	(0<<1)
39 #define  NCR_LBK_MAC	(1<<1)
40 #define  NCR_LBK_PHY	(2<<1)
41 #define  NCR_RST	(1<<0)
42 #define DME_NSR		0x01
43 #define  NSR_SPEED	(1<<7)
44 #define  NSR_LINKST	(1<<6)
45 #define  NSR_WAKEST	(1<<5)
46 #define  NSR_TX2END	(1<<3)
47 #define  NSR_TX1END	(1<<2)
48 #define  NSR_RXOV	(1<<1)
49 #define DME_TCR		0x02
50 #define  TCR_TJDIS	(1<<6)
51 #define  TCR_EXCECM	(1<<5)
52 #define  TCR_PAD_DIS2	(1<<4)
53 #define  TCR_PAD_CRC2	(1<<3)
54 #define  TCR_PAD_DIS1	(1<<2)
55 #define  TCR_PAD_CRC1	(1<<1)
56 #define  TCR_TXREQ	(1<<0)
57 #define DME_TSR1	0x03
58 #define DME_TSR2	0x04
59 #define DME_RCR		0x05
60 #define  RCR_WTDIS	(1<<6)
61 #define  RCR_DIS_LONG	(1<<5)
62 #define  RCR_DIS_CRC	(1<<4)
63 #define  RCR_ALL	(1<<3)
64 #define  RCR_RUNT	(1<<2)
65 #define  RCR_PRMSC	(1<<1)
66 #define  RCR_RXEN	(1<<0)
67 #define DME_RSR		0x06
68 #define DME_ROCR	0x07
69 #define DME_BPTR	0x08
70 #define  BPTR_BPHW(v)	(((v) & 0x0f) << 4)
71 #define  BPTR_JPT(v)	(((v) & 0x0f) << 0)
72 #define DME_FCTR	0x09
73 #define  FCTR_HWOT(v)	(((v) & 0x0f) << 4)
74 #define  FCTR_LWOT(v)	(((v) & 0x0f) << 0)
75 #define DME_FCR		0x0A
76 #define DME_EPCR	0x0B
77 #define  EPCR_REEP	(1<<5)
78 #define  EPCR_WEP	(1<<4)
79 #define  EPCR_EPOS	(1<<3)
80 #define  EPCR_ERPRR	(1<<2)
81 #define  EPCR_ERPRW	(1<<1)
82 #define  EPCR_ERRE	(1<<0)
83 #define DME_EPAR	0x0C
84 #define DME_EPDRL	0x0D
85 #define DME_EPDRH	0x0E
86 #define DME_WCR		0x0F
87 #define DME_PAR_BASE	0x10
88 #define DME_PAR(n)	(DME_PAR_BASE + n)
89 #define DME_MAR_BASE	0x16
90 #define DME_MAR(n)	(DME_MAR_BASE + n)
91 #define DME_GPCR	0x1E
92 #define DME_GPR		0x1F
93 #define DME_TRPAL	0x22
94 #define DME_TRPAH	0x23
95 #define DME_RWPAL	0x24
96 #define DME_RWPAH	0x25
97 #define DME_VIDL	0x28
98 #define DME_VIDH	0x29
99 #define DME_PIDL	0x2A
100 #define DME_PIDH	0x2B
101 #define DME_CHIPR	0x2C
102 #define DME_SMCR	0x2F
103 #define DME_MRCMDX	0xF0
104 #define DME_MRCMD	0xF2
105 #define DME_MRRL	0xF4
106 #define DME_MRRH	0xF5
107 #define DME_MWCMDX	0xF6
108 #define DME_MWCMD	0xF8
109 #define DME_MWRL	0xFA
110 #define DME_MWRH	0xFB
111 #define DME_TXPLL	0xFC
112 #define DME_TXPLH	0xFD
113 #define DME_ISR		0xFE
114 #define  ISR_LNKCHG	(1<<5)
115 #define  ISR_UDRUN	(1<<4)
116 #define  ISR_ROO	(1<<3)
117 #define  ISR_ROS	(1<<2)
118 #define  ISR_PT		(1<<1)
119 #define  ISR_PR		(1<<0)
120 
121 #define DME_IMR		0xFF
122 #define  IMR_PAR	(1<<7)
123 #define  IMR_LNKCHGI	(1<<5)
124 #define  IMR_UDRUNI	(1<<4)
125 #define  IMR_ROOI	(1<<3)
126 #define  IMR_ROI	(1<<2)
127 #define  IMR_PTI	(1<<1)
128 #define  IMR_PRI	(1<<0)
129 
130 /* Extra PHY register from DM9000B */
131 #define MII_DME_DSPCR	0x1B
132 #define DSPCR_INIT	0xE100
133 
134 #endif /* __DMEREGS_H__ */
135 
136