3 Copyright (C) 2005 Neil Cafferkey
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston,
35 #define PROREG_STATUS 0
36 #define PROREG_INTSTATUS 1
37 #define PROREG_COMMAND 2
38 #define PROREG_GENPTR 4
40 #define PROREG_EEPROM 14
41 #define PROREG_MIICONTROL 16
42 #define PROREG_RXDMABYTECOUNT 20
44 #define PROREG_PMDR 27
45 #define PROREG_GENCTRL 28
46 #define PROREG_GENSTATUS 30
49 /* EEPROM Data Offsets */
50 /* =================== */
52 #define PROROM_ADDRESS0 0
53 #define PROROM_ADDRESS1 1
54 #define PROROM_ADDRESS2 2
55 #define PROROM_PHYINFO0 6
56 #define PROROM_PHYINFO1 7
62 #define PROINTB_GENERAL 7
63 #define PROINTB_RXDONE 6
64 #define PROINTB_CUINACTIVE 5
65 #define PROINTB_RXINACTIVE 4
67 #define PROINTB_REQINT 2
68 #define PROINTB_FCPAUSE 0
70 #define PROINTF_GENERAL (1 << PROINTB_GENERAL)
71 #define PROINTF_RXDONE (1 << PROINTB_RXDONE)
72 #define PROINTF_CUINACTIVE (1 << PROINTB_CUINACTIVE)
73 #define PROINTF_RXINACTIVE (1 << PROINTB_RXINACTIVE)
74 #define PROINTF_MDI (1 << PROINTB_MDI)
75 #define PROINTF_REQINT (1 << PROINTB_REQINT)
76 #define PROINTF_FCPAUSE (1 << PROINTB_FCPAUSE)
79 /* Register Details */
80 /* ================ */
82 /* SCB Status Register */
84 #define PROREG_STATUSB_CUSTATE 6
85 #define PROREG_STATUSB_RUSTATE 2
87 #define PROREG_STATUSF_CUSTATE (0x3 << PROREG_STATUSB_CUSTATE)
88 #define PROREG_STATUSF_RUSTATE (0xf << PROREG_STATUSB_RUSTATE)
90 #define PRO_CUSTATE_IDLE 0
91 #define PRO_CUSTATE_SUSPENDED 1
92 #define PRO_CUSTATE_LPQACTIVE 2
93 #define PRO_CUSTATE_HQPACTIVE 3
95 #define PRO_RUSTATE_IDLE 0
96 #define PRO_RUSTATE_SUSPENDED 1
97 #define PRO_RUSTATE_NORESOURCES 2
98 #define PRO_RUSTATE_READY 4
100 /* SCB Command Register */
102 #define PROREG_COMMANDB_CUCMD 4
103 #define PROREG_COMMANDB_RUCMD 0
105 #define PROREG_COMMANDF_CUCMD (0xf << PROREG_COMMANDB_CUCMD)
106 #define PROREG_COMMANDF_RUCMD (0x7 << PROREG_COMMANDB_RUCMD)
108 /* EEPROM Command Register */
110 #define PROREG_EEPROMB_DATAIN 3
111 #define PROREG_EEPROMB_DATAOUT 2
112 #define PROREG_EEPROMB_SELECT 1
113 #define PROREG_EEPROMB_CLK 0
115 #define PROREG_EEPROMF_DATAIN (1 << PROREG_EEPROMB_DATAIN)
116 #define PROREG_EEPROMF_DATAOUT (1 << PROREG_EEPROMB_DATAOUT)
117 #define PROREG_EEPROMF_SELECT (1 << PROREG_EEPROMB_SELECT)
118 #define PROREG_EEPROMF_CLK (1 << PROREG_EEPROMB_CLK)
120 #define PRO_CUCMD_NOP (0 << PROREG_COMMANDB_CUCMD)
121 #define PRO_CUCMD_START (1 << PROREG_COMMANDB_CUCMD)
122 #define PRO_CUCMD_RESUME (2 << PROREG_COMMANDB_CUCMD)
123 #define PRO_CUCMD_SETSTATSBUFFER (4 << PROREG_COMMANDB_CUCMD)
124 #define PRO_CUCMD_DUMPSTATS (5 << PROREG_COMMANDB_CUCMD)
125 #define PRO_CUCMD_SETBASE (6 << PROREG_COMMANDB_CUCMD)
126 #define PRO_CUCMD_DUMPRESETSTATS (7 << PROREG_COMMANDB_CUCMD)
127 #define PRO_CUCMD_STATICRESUME (10 << PROREG_COMMANDB_CUCMD)
129 #define PRO_RUCMD_NOP 0
130 #define PRO_RUCMD_START 1
131 #define PRO_RUCMD_RESUME 2
132 #define PRO_RUCMD_RXDMAREDIRECT 3
133 #define PRO_RUCMD_ABORT 4
134 #define PRO_RUCMD_SETHEADERSIZE 5
135 #define PRO_RUCMD_SETBASE 6
137 /* MII Control Register */
139 #define PROREG_MIICONTROLB_INT 29
140 #define PROREG_MIICONTROLB_READY 28
141 #define PROREG_MIICONTROLB_CMD 26
142 #define PROREG_MIICONTROLB_PHYNO 21
143 #define PROREG_MIICONTROLB_REGNO 16
144 #define PROREG_MIICONTROLB_DATA 0
146 #define PROREG_MIICONTROLF_INT (1 << PROREG_MIICONTROLB_INT)
147 #define PROREG_MIICONTROLF_READY (1 << PROREG_MIICONTROLB_READY)
148 #define PROREG_MIICONTROLF_CMD (0x3 << PROREG_MIICONTROLB_CMD)
149 #define PROREG_MIICONTROLF_PHYNO (0x1f << PROREG_MIICONTROLB_PHYNO)
150 #define PROREG_MIICONTROLF_REGNO (0x1f << PROREG_MIICONTROLB_REGNO)
151 #define PROREG_MIICONTROLF_DATA (0xffff << PROREG_MIICONTROLB_DATA)
154 /* EEPROM Field Details */
155 /* ==================== */
157 /* PHY Information 0 */
159 #define PROROM_PHYINFO0B_AUI 15
160 #define PROROM_PHYINFO0B_TYPE 8
161 #define PROROM_PHYINFO0B_ADDR 0
163 #define PROROM_PHYINFO0F_AUI (1 << PROROM_PHYINFO0B_AUI)
164 #define PROROM_PHYINFO0F_TYPE (0xf << PROROM_PHYINFO0B_TYPE)
165 #define PROROM_PHYINFO0F_ADDR (0x1f << PROROM_PHYINFO0B_ADDR)
167 #define PRO_PHY_DP83840 (4 << PROROM_PHYINFO0B_TYPE)
168 #define PRO_PHY_DP83840A (10 << PROROM_PHYINFO0B_TYPE)
171 /* Action Commands */
172 /* =============== */
174 #define PROACT_NOP (0 << PROCB_CONTROLB_ACTION)
175 #define PROACT_SETADDRESS (1 << PROCB_CONTROLB_ACTION)
176 #define PROACT_CONFIGURE (2 << PROCB_CONTROLB_ACTION)
177 #define PROACT_SETMCAST (3 << PROCB_CONTROLB_ACTION)
178 #define PROACT_TX (4 << PROCB_CONTROLB_ACTION)
179 #define PROACT_LOADCODE (5 << PROCB_CONTROLB_ACTION)
180 #define PROACT_DUMP (6 << PROCB_CONTROLB_ACTION)
181 #define PROACT_DIAGNOSE (7 << PROCB_CONTROLB_ACTION)
184 /* Control Block Fields */
185 /* ==================== */
187 #define PROCB_CONTROL 0
189 #define PROCB_COUNT 2
190 #define PROCB_FRAGMENTS 2
191 #define PROCB_ADDRESS 2
192 #define PROCB_TXINFO 3
193 #define PROCB_RXINFO 3
194 #define PROCB_BUFFER 4
195 #define PROCB_EXTBUFFER 8
196 #define PROCB_EXTFRAGS 4
206 #define PROFRAG_ADDR 0
207 #define PROFRAG_LEN 1
209 #define PROFRAG_LENB_LAST 16
211 #define PROFRAG_LENF_LAST (1 << PROFRAG_LENB_LAST)
214 /* Control Block Field Detials */
215 /* =========================== */
217 #define PROCB_CONTROLB_LAST 31
218 #define PROCB_CONTROLB_SUSPEND 30
219 #define PROCB_CONTROLB_INT 29
220 #define PROCB_CONTROLB_NOCRC 20
221 #define PROCB_CONTROLB_FLEXIBLE 19
222 #define PROCB_CONTROLB_ACTION 16
223 #define PROCB_CONTROLB_DONE 15
224 #define PROCB_CONTROLB_OK 13
225 #define PROCB_CONTROLB_UNDERRUN 12
227 #define PROCB_CONTROLF_LAST (1 << PROCB_CONTROLB_LAST)
228 #define PROCB_CONTROLF_SUSPEND (1 << PROCB_CONTROLB_SUSPEND)
229 #define PROCB_CONTROLF_INT (1 << PROCB_CONTROLB_INT)
230 #define PROCB_CONTROLF_NOCRC (1 << PROCB_CONTROLB_NOCRC)
231 #define PROCB_CONTROLF_FLEXIBLE (1 << PROCB_CONTROLB_FLEXIBLE)
232 #define PROCB_CONTROLF_ACTION (0x7 << PROCB_CONTROLB_ACTION)
233 #define PROCB_CONTROLF_DONE (1 << PROCB_CONTROLB_DONE)
234 #define PROCB_CONTROLF_OK (1 << PROCB_CONTROLB_OK)
235 #define PROCB_CONTROLF_UNDERRUN (1 << PROCB_CONTROLB_UNDERRUN)
237 #define PROCB_TXINFOB_FRAGCOUNT 24
238 #define PROCB_TXINFOB_THRESHOLD 16
239 #define PROCB_TXINFOB_EOF 15
240 #define PROCB_TXINFOB_BUFFERSIZE 0
242 #define PROCB_TXINFOF_FRAGCOUNT (0xff << PROCB_TXINFOB_FRAGCOUNT)
243 #define PROCB_TXINFOF_THRESHOLD (0xff << PROCB_TXINFOB_THRESHOLD)
244 #define PROCB_TXINFOF_EOF (1 << PROCB_TXINFOB_EOF)
245 #define PROCB_TXINFOF_BUFFERSIZE (0x3fff << PROCB_TXINFOB_BUFFERSIZE)
247 #define PROCB_RXINFOB_BUFFERSIZE 16
248 #define PROCB_RXINFOB_EOF 15
249 #define PROCB_RXINFOB_SIZEVALID 14
250 #define PROCB_RXINFOB_FRAMESIZE 0
252 #define PROCB_RXINFOF_BUFFERSIZE (0x3fff << PROCB_RXINFOB_BUFFERSIZE)
253 #define PROCB_RXINFOF_EOF (1 << PROCB_RXINFOB_EOF)
254 #define PROCB_RXINFOF_SIZEVALID (1 << PROCB_RXINFOB_SIZEVALID)
255 #define PROCB_RXINFOF_FRAMESIZE (0x3fff << PROCB_RXINFOB_FRAMESIZE)
257 #define PROCB_CF0B_CACHELINESTOP 27
258 #define PROCB_CF0B_READALIGN 26
259 #define PROCB_CF0B_MWI 24
260 #define PROCB_CF0B_ADAPTIVEIFS 16
261 #define PROCB_CF0B_TXFIFOLIM 12
262 #define PROCB_CF0B_RXFIFOLIM 8
263 #define PROCB_CF0B_SIZE 0
265 #define PROCB_CF0F_ADAPTIVEIFS 0x00ff0000
266 #define PROCB_CF0F_TXFIFOLIM 0x00007000
267 #define PROCB_CF0F_RXFIFOLIM 0x00000f00
268 #define PROCB_CF0F_SIZE 0x0000003f
270 #define PROCB_CF1B_UNDERRUNRETRIES 25
271 #define PROCB_CF1B_DISCARDRUNTS 24
273 #define PROCB_CF1F_DYNAMICTBD 0x80000000
274 #define PROCB_CF1F_2FRAMESMAX 0x40000000
275 #define PROCB_CF1F_UNDERRUNRETRIES 0x06000000
276 #define PROCB_CF1F_DISCARDRUNTS 0x01000000
277 #define PROCB_CF1F_SAVEBADFRAMES 0x00800000
278 #define PROCB_CF1F_SAVEOVERRUNS 0x00400000
279 #define PROCB_CF1F_STDSTATS 0x00200000
280 #define PROCB_CF1F_STDTXBLOCK 0x00100000
281 #define PROCB_CF1F_CIINT 0x00080000
282 #define PROCB_CF1F_TNOINT 0x00040000
283 #define PROCB_CF1F_TCOSTATS 0x00040000
284 #define PROCB_CF1F_LATEINT 0x00010000
285 #define PROCB_CF1F_THROTTLEDMA 0x00008000
286 #define PROCB_CF1F_RXDMAMAXSIZE 0x00007f00
287 #define PROCB_CF1F_TXDMAMAXSIZE 0x0000007f
289 #define PROCB_CF2B_PRIORITY 24
290 #define PROCB_CF2B_LOOPBACK 22
291 #define PROCB_CF2B_PREAMBLETYPE 20
292 #define PROCB_CF2B_NOSOURCEINSERT 19
293 #define PROCB_CF2B_MCASTWAKE 15
294 #define PROCB_CF2B_ARPWAKE 14
295 #define PROCB_CF2B_LINKWAKE 13
296 #define PROCB_CF2B_VLANARPWAKE 12
297 #define PROCB_CF2B_VLANTCO 12
298 #define PROCB_CF2B_TCPCHECKSUM 8
299 #define PROCB_CF2B_NOCSMA 7
300 #define PROCB_CF2B_MIIMODE 0
302 #define PROCB_CF2F_PRIORITY (0x7 << PROCB_CF2B_PRIORITY)
303 #define PROCB_CF2F_LOOPBACK 0x00c00000
304 #define PROCB_CF2F_PREAMBLETYPE 0x00300000
305 #define PROCB_CF2F_NOSOURCEINSERT (1 << PROCB_CF2B_NOSOURCEINSERT)
306 #define PROCB_CF2F_MIIMODE (1 << PROCB_CF2B_MIIMODE)
308 #define PROCB_CF3B_CDT 31
309 #define PROCB_CF3B_CRC16 29
310 #define PROCB_CF3B_IGNOREUL 28
311 #define PROCB_CF3B_WAITAFTERWIN 26
312 #define PROCB_CF3B_NOBCAST 25
313 #define PROCB_CF3B_PROM 24
314 #define PROCB_CF3B_ARPFILTER 8
315 #define PROCB_CF3B_IFS 4
316 #define PROCB_CF3B_RXPRIORITY 0
318 #define PROCB_CF3F_CDT (1 << PROCB_CF3B_CDT)
319 #define PROCB_CF3F_PROM (1 << PROCB_CF3B_PROM)
320 #define PROCB_CF3F_ARPFILTER (0xffff << PROCB_CF3B_ARPFILTER)
321 #define PROCB_CF3F_IFS (0xf << PROCB_CF3B_IFS)
322 #define PROCB_CF3F_RXPRIORITY (1 << PROCB_CF3B_RXPRIORITY)
324 #define PROCB_CF4B_USEFDPIN 31
325 #define PROCB_CF4B_FORCEFD 30
326 #define PROCB_CF4B_REJECTFC 29
327 #define PROCB_CF4B_FDRESTARTFC 28
328 #define PROCB_CF4B_FDRESTOPFC 27
329 #define PROCB_CF4B_NOFDTXFC 26
330 #define PROCB_CF4B_NOMAGICWAKE 25
331 #define PROCB_CF4B_ADDRESSWAKE 24
332 #define PROCB_CF4B_LONGRXOK 19
333 #define PROCB_CF4B_SAVECRC 18
334 #define PROCB_CF4B_PADDING 17
335 #define PROCB_CF4B_STRIPPING 16
337 #define PROCB_CF4F_USEFDPIN (1 << PROCB_CF4B_USEFDPIN)
338 #define PROCB_CF4F_PRIFCTHRESH 0x00700000
339 #define PROCB_CF4F_FCDELAY 0x0000ffff
340 #define PROCB_CF4F_PADDING (1 << PROCB_CF4B_PADDING)
342 #define PROCB_CF5B_ALLMCAST 11
343 #define PROCB_CF5B_MULTIADDRESS 6
344 #define PROCB_CF5B_ALTPRIFCFIELD 5
346 #define PROCB_CF5F_ALLMCAST (1 << PROCB_CF5B_ALLMCAST)
347 #define PROCB_CF5F_MULTIADDRESS (1 << PROCB_CF5B_MULTIADDRESS)
353 #define PROSTAT_TXFRAMESOK 0
354 #define PROSTAT_FRAMESDEFERRED 5
355 #define PROSTAT_RXFRAMESOK 9
356 #define PROSTAT_RXOVERRUNS 13
357 #define PROSTAT_TXUNDERRUNS 3