summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/io/upf/adm8511reg.h
blob: 71fd41eeb0dc1c74eacc807721cebccdb0a60f62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/*
 * @(#)adm8511reg.h	1.1 09/06/20
 * Register dehinitsions of ADMtek ADM8511 Fast Ethernet to USB controller.
 * Codeded by Masayuki Murayama(KHF04453@nifty.ne.jp)
 * This file is public domain.
 */

#ifndef __ADM8511_H__
#define	__ADM8511_H__

#define	EC0		0x00	/* B */
#define	EC1		0x01	/* B */
#define	EC2		0x02	/* B */
#define	MA		0x08	/* 8byte array */
#define	EID		0x10	/* B */
#define	PAUSETIMER	0x18	/* B pause timer */
#define	RPNBFC		0x1a	/* B */
#define	ORFBFC		0x1b	/* B */
#define	EP1C		0x1c	/* B */
#define	RXFC		0x1d	/* B */
#define	BIST		0x1e	/* B */
#define	EEOFFSET	0x20	/* B */
#define	EEDATA		0x21	/* W */
#define	EECTRL		0x23	/* B */
#define	PHYA		0x25	/* B */
#define	PHYD		0x26 	/* W */
#define	PHYAC		0x28	/* B */
#define	USBSTAT		0x2a	/* B */
#define	ETHTXSTAT	0x2b	/* W */
#define	ETHRXSTAT	0x2d	/* B */
#define	LOSTCNT		0x2e	/* W */
#define	WF0MASK		0x30	/* 16byte array */
#define	WF0OFFSET	0x40	/* W */
#define	WF0CRC		0x41	/* W */
#define	WF1MASK		0x48	/* 16byte array */
#define	WF1OFFSET	0x58	/* W */
#define	WF1CRC		0x59	/* W */
#define	WF2MASK		0x60	/* 16byte array */
#define	WF2OFFSET	0x70	/* W */
#define	WF2CRC		0x71	/* W */
#define	WCTRL		0x78	/* B */
#define	WSTAT		0x7a	/* B */
#define	IPHYC		0x7b	/* B */
#define	GPIO54		0x7c	/* B */
#define	GPIO10		0x7e	/* B */
#define	GPIO32		0x7f	/* B */
#define	TEST		0x80	/* B */
#define	TM		0x81	/* B */
#define	RPN		0x82	/* B */

/* Ethernet control register 0: offset 0 */
#define	EC0_TXE		0x80U
#define	EC0_RXE		0x40U
#define	EC0_RXFCE	0x20U
#define	EC0_WOE		0x10U
#define	EC0_RXSA	0x08U
#define	EC0_SBO		0x04U
#define	EC0_RXMA	0x02U
#define	EC0_RXCS	0x01U

#define	EC0_BITS	\
	"\020"	\
	"\010TXE"	\
	"\007RXE"	\
	"\006RXFCE"	\
	"\005WOE"	\
	"\004RXSA"	\
	"\003SBO"	\
	"\002RXMA"	\
	"\001RXCS"

/* Ethernet control register 1: offset 1 */
#define	EC1_FD		0x20U
#define	EC1_100M	0x10U	/* 0:10Mbps 1:100Mbps */
#define	EC1_RM		0x08U	/* reset mac */

#define	EC1_BITS	\
	"\020"	\
	"\006FD"	\
	"\005100M"	\
	"\004RM"

/* Ethernet control register 2: offset 2 */
#define	EC2_MEPL	0x80U	/* 8515: MTU 0:1528, 1:1638 */
#define	EC2_RPNC	0x40U
#define	EC2_LEEPRS	0x20U
#define	EC2_EEPRW	0x10U
#define	EC2_LB		0x08U
#define	EC2_PROM	0x04U
#define	EC2_RXBP	0x02U
#define	EC2_EP3RC	0x01U

#define	EC2_BITS	\
	"\020"	\
	"\010MEPS"	\
	"\007RPNC"	\
	"\006LEEPRS"	\
	"\005EEPRW"	\
	"\004LB"	\
	"\003PROM"	\
	"\002RXBP"	\
	"\001EP3RC"

/* Recieve Packet number based Flow Control register: offset 0x1a */
#define	RPNBFC_PN	0x7eU	/* */
#define		RPNBFC_PN_SHIFT	1
#define	RPNBFC_FCP	0x01U	/* enable rx flow control */

/* Occupied Recieve FIFO based Flow Control register: offset 0x1b */
#define	ORFBFC_RXS	0x7eU	/* */
#define		ORFBFC_RXS_SHIFT	1
#define		ORFBFC_RXS_UNIT	1024U
#define	ORFBFC_FCRXS	0x01U	/* enable rx flow control */

/* EP1 control register: offset 0x1c */
#define	EP1C_EP1S0E	0x80U	/* send 0 enable */
#define	EP1C_ITMA	0x60U	/* internal test mode A */
#define	EP1C_ITMB	0x1fU	/* internal test mode B */

#define	EP1C_BITS	\
	"\020"	\
	"\010EP1S0E"

/* Rx FIFO Control register: offset 0x1d */
#define	RXFC_EXT_SRAM	0x02	/* enable external 32k sram */
#define	RXFC_RX32PKT	0x01	/* max 32 packet */

/* EEPROM offset register: offset 0x20 */
#define	EEOFFSET_MASK	0x3f	/* eeprom offset address in word */

/* EEPROM access control register: offset 0x23 */
#define	EECTRL_DONE	0x04
#define	EECTRL_RD	0x02
#define	EECTRL_WR	0x01

#define	EECTRL_BITS	\
	"\020"	\
	"\003DONE"	\
	"\002RD"	\
	"\001WR"

/* PHY control register: offset 28 */
#define	PHYAC_DO	0x80U	/* Done */
#define	PHYAC_RDPHY	0x40U	/* read phy */
#define	PHYAC_WRPHY	0x20U	/* write phy */
#define	PHYAC_PHYRA	0x1fU	/* PHY register address */

#define	PHYCTRL_BITS	\
	"\020"	\
	"\010DO"	\
	"\007RDPHY"	\
	"\006WRPHY"

/* Internal PHY control register: offset 7b */
#define	IPHYC_EPHY	0x02
#define	IPHYC_PHYR	0x01

#define	IPHYC_BITS	\
	"\020"	\
	"\002EPHY"	\
	"\001PHYR"

/* GPIO45 register: offset 7c */
#define	GPIO54_5OE	0x20
#define	GPIO54_5O	0x10
#define	GPIO54_5I	0x08
#define	GPIO54_4OE	0x04
#define	GPIO54_4O	0x02
#define	GPIO54_4I	0x01

/* GPIO01 register: offset 7e */
#define	GPIO10_1OE	0x20
#define	GPIO10_1O	0x10
#define	GPIO10_1I	0x08
#define	GPIO10_0OE	0x04
#define	GPIO10_0O	0x02
#define	GPIO10_0I	0x01

/* GPIO23 register: offset 7f */
#define	GPIO32_3OE	0x20
#define	GPIO32_3O	0x10
#define	GPIO32_3I	0x08
#define	GPIO32_2OE	0x04
#define	GPIO32_2O	0x02
#define	GPIO32_2I	0x01

/* rx status at the end of received packets */
/* byte 0 and 1 is packet length in little endian */
/* byte 2 is receive status */
#define	RSR_DRIBBLE	0x10
#define	RSR_CRC		0x08
#define	RSR_RUNT	0x04
#define	RSR_LONG	0x02
#define	RSR_MULTI	0x01

#define	RSR_ERRORS	\
	(RSR_DRIBBLE | RSR_CRC | RSR_RUNT | RSR_LONG | RSR_MULTI)

#define	RSR_BITS	\
	"\020"	\
	"\005DRIBBLE"	\
	"\004CRC"	\
	"\003RUNT"	\
	"\002LONG"	\
	"\001MULTI"
/* byte 3 is reserved */

/* TEST register: offset 80 */

#endif /* __ADM8511_H__ */