1 #ifndef CIRRUS_H
2 #define CIRRUS_H
3 
4 /*
5  * linux/drivers/net/cirrus.h
6  *
7  * Author: Abraham van der Merwe <abraham@2d3d.co.za>
8  *
9  * A Cirrus Logic CS8900A driver for Linux
10  * based on the cs89x0 driver written by Russell Nelson,
11  * Donald Becker, and others.
12  *
13  * This source code is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * version 2 as published by the Free Software Foundation.
16  */
17 
18 /*
19  * Ports
20  */
21 
22 #define PP_Address		0x0a	/* PacketPage Pointer Port (Section 4.10.10) */
23 #define PP_Data			0x0c	/* PacketPage Data Port (Section 4.10.10) */
24 
25 /*
26  * Registers
27  */
28 
29 #define PP_ProductID		0x0000	/* Section 4.3.1   Product Identification Code */
30 #define PP_MemBase			0x002c	/* Section 4.9.2   Memory Base Address Register */
31 #define PP_IntNum			0x0022	/* Section 3.2.3   Interrupt Number */
32 #define PP_EEPROMCommand	0x0040	/* Section 4.3.11  EEPROM Command */
33 #define PP_EEPROMData		0x0042	/* Section 4.3.12  EEPROM Data */
34 #define PP_RxCFG			0x0102	/* Section 4.4.6   Receiver Configuration */
35 #define PP_RxCTL			0x0104	/* Section 4.4.8   Receiver Control */
36 #define PP_TxCFG			0x0106	/* Section 4.4.9   Transmit Configuration */
37 #define PP_BufCFG			0x010a	/* Section 4.4.12  Buffer Configuration */
38 #define PP_LineCTL			0x0112	/* Section 4.4.16  Line Control */
39 #define PP_SelfCTL			0x0114	/* Section 4.4.18  Self Control */
40 #define PP_BusCTL			0x0116	/* Section 4.4.20  Bus Control */
41 #define PP_TestCTL			0x0118	/* Section 4.4.22  Test Control */
42 #define PP_ISQ				0x0120	/* Section 4.4.5   Interrupt Status Queue */
43 #define PP_TxEvent			0x0128	/* Section 4.4.10  Transmitter Event */
44 #define PP_BufEvent			0x012c	/* Section 4.4.13  Buffer Event */
45 #define PP_RxMISS			0x0130	/* Section 4.4.14  Receiver Miss Counter */
46 #define PP_TxCOL			0x0132	/* Section 4.4.15  Transmit Collision Counter */
47 #define PP_SelfST			0x0136	/* Section 4.4.19  Self Status */
48 #define PP_BusST			0x0138	/* Section 4.4.21  Bus Status */
49 #define PP_TxCMD			0x0144	/* Section 4.4.11  Transmit Command */
50 #define PP_TxLength			0x0146	/* Section 4.5.2   Transmit Length */
51 #define PP_IA				0x0158	/* Section 4.6.2   Individual Address (IEEE Address) */
52 #define PP_RxStatus			0x0400	/* Section 4.7.1   Receive Status */
53 #define PP_RxLength			0x0402	/* Section 4.7.1   Receive Length (in bytes) */
54 #define PP_RxFrame			0x0404	/* Section 4.7.2   Receive Frame Location */
55 #define PP_TxFrame			0x0a00	/* Section 4.7.2   Transmit Frame Location */
56 
57 /*
58  * Values
59  */
60 
61 /* PP_IntNum */
62 #define INTRQ0			0x0000
63 #define INTRQ1			0x0001
64 #define INTRQ2			0x0002
65 #define INTRQ3			0x0003
66 
67 /* PP_ProductID */
68 #define EISA_REG_CODE	0x630e
69 #define REVISION(x)		(((x) & 0x1f00) >> 8)
70 #define VERSION(x)		((x) & ~0x1f00)
71 
72 #define CS8900A			0x0000
73 #define REV_B			7
74 #define REV_C			8
75 #define REV_D			9
76 
77 /* PP_RxCFG */
78 #define Skip_1			0x0040
79 #define StreamE			0x0080
80 #define RxOKiE			0x0100
81 #define RxDMAonly		0x0200
82 #define AutoRxDMAE		0x0400
83 #define BufferCRC		0x0800
84 #define CRCerroriE		0x1000
85 #define RuntiE			0x2000
86 #define ExtradataiE		0x4000
87 
88 /* PP_RxCTL */
89 #define IAHashA			0x0040
90 #define PromiscuousA	0x0080
91 #define RxOKA			0x0100
92 #define MulticastA		0x0200
93 #define IndividualA		0x0400
94 #define BroadcastA		0x0800
95 #define CRCerrorA		0x1000
96 #define RuntA			0x2000
97 #define ExtradataA		0x4000
98 
99 /* PP_TxCFG */
100 #define Loss_of_CRSiE	0x0040
101 #define SQErroriE		0x0080
102 #define TxOKiE			0x0100
103 #define Out_of_windowiE	0x0200
104 #define JabberiE		0x0400
105 #define AnycolliE		0x0800
106 #define T16colliE		0x8000
107 
108 /* PP_BufCFG */
109 #define SWint_X			0x0040
110 #define RxDMAiE			0x0080
111 #define Rdy4TxiE		0x0100
112 #define TxUnderruniE	0x0200
113 #define RxMissiE		0x0400
114 #define Rx128iE			0x0800
115 #define TxColOvfiE		0x1000
116 #define MissOvfloiE		0x2000
117 #define RxDestiE		0x8000
118 
119 /* PP_LineCTL */
120 #define SerRxON			0x0040
121 #define SerTxON			0x0080
122 #define AUIonly			0x0100
123 #define AutoAUI_10BT	0x0200
124 #define ModBackoffE		0x0800
125 #define PolarityDis		0x1000
126 #define L2_partDefDis	0x2000
127 #define LoRxSquelch		0x4000
128 
129 /* PP_SelfCTL */
130 #define RESET			0x0040
131 #define SWSuspend		0x0100
132 #define HWSleepE		0x0200
133 #define HWStandbyE		0x0400
134 #define HC0E			0x1000
135 #define HC1E			0x2000
136 #define HCB0			0x4000
137 #define HCB1			0x8000
138 
139 /* PP_BusCTL */
140 #define ResetRxDMA		0x0040
141 #define DMAextend		0x0100
142 #define UseSA			0x0200
143 #define MemoryE			0x0400
144 #define DMABurst		0x0800
145 #define IOCHRDYE		0x1000
146 #define RxDMAsize		0x2000
147 #define EnableRQ		0x8000
148 
149 /* PP_TestCTL */
150 #define DisableLT		0x0080
151 #define ENDECloop		0x0200
152 #define AUIloop			0x0400
153 #define DisableBackoff	0x0800
154 #define FDX				0x4000
155 
156 /* PP_ISQ */
157 #define RegNum(x) ((x) & 0x3f)
158 #define RegContent(x) ((x) & ~0x3d)
159 
160 #define RxEvent			0x0004
161 #define TxEvent			0x0008
162 #define BufEvent		0x000c
163 #define RxMISS			0x0010
164 #define TxCOL			0x0012
165 
166 /* PP_RxStatus */
167 #define IAHash			0x0040
168 #define Dribblebits		0x0080
169 #define RxOK			0x0100
170 #define Hashed			0x0200
171 #define IndividualAdr	0x0400
172 #define Broadcast		0x0800
173 #define CRCerror		0x1000
174 #define Runt			0x2000
175 #define Extradata		0x4000
176 
177 #define HashTableIndex(x) ((x) >> 0xa)
178 
179 /* PP_TxCMD */
180 #define After5			0
181 #define After381		1
182 #define After1021		2
183 #define AfterAll		3
184 #define TxStart(x) ((x) << 6)
185 
186 #define Force			0x0100
187 #define Onecoll			0x0200
188 #define InhibitCRC		0x1000
189 #define TxPadDis		0x2000
190 
191 /* PP_BusST */
192 #define TxBidErr		0x0080
193 #define Rdy4TxNOW		0x0100
194 
195 /* PP_TxEvent */
196 #define Loss_of_CRS		0x0040
197 #define SQEerror		0x0080
198 #define TxOK			0x0100
199 #define Out_of_window	0x0200
200 #define Jabber			0x0400
201 #define T16coll			0x8000
202 
203 #define TX_collisions(x) (((x) >> 0xb) & ~0x8000)
204 
205 /* PP_BufEvent */
206 #define SWint			0x0040
207 #define RxDMAFrame		0x0080
208 #define Rdy4Tx			0x0100
209 #define TxUnderrun		0x0200
210 #define RxMiss			0x0400
211 #define Rx128			0x0800
212 #define RxDest			0x8000
213 
214 /* PP_RxMISS */
215 #define MissCount(x) ((x) >> 6)
216 
217 /* PP_TxCOL */
218 #define ColCount(x) ((x) >> 6)
219 
220 /* PP_SelfST */
221 #define T3VActive		0x0040
222 #define INITD			0x0080
223 #define SIBUSY			0x0100
224 #define EEPROMpresent	0x0200
225 #define EEPROMOK		0x0400
226 #define ELpresent		0x0800
227 #define EEsize			0x1000
228 
229 /* PP_EEPROMCommand */
230 #define EEWriteRegister	0x0100
231 #define EEReadRegister	0x0200
232 #define EEEraseRegister	0x0300
233 #define ELSEL			0x0400
234 
235 #endif	/* #ifndef CIRRUS_H */
236