blob: 8aad4425f7920226aeb5d0bbaed2a1f027764da2 [file] [log] [blame]
wdenk7152b1d2003-09-05 23:19:14 +00001/******************************************************************************
2 *
3 * Name: skgehw.h
4 * Project: GEnesis, PCI Gigabit Ethernet Adapter
5 * Version: $Revision: 1.49 $
6 * Date: $Date: 2003/01/28 09:43:49 $
7 * Purpose: Defines and Macros for the Gigabit Ethernet Adapter Product Family
8 *
9 ******************************************************************************/
10
11/******************************************************************************
12 *
13 * (C)Copyright 1998-2003 SysKonnect GmbH.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * The information in this file is provided "AS IS" without warranty.
21 *
22 ******************************************************************************/
23
24/******************************************************************************
25 *
26 * History:
27 * $Log: skgehw.h,v $
28 * Revision 1.49 2003/01/28 09:43:49 rschmidt
29 * Added defines for PCI-Spec. 2.3 IRQ
30 * Added defines for CLK_RUN (YUKON-Lite)
31 * Editorial changes
32 *
33 * Revision 1.48 2002/12/05 10:25:11 rschmidt
34 * Added defines for Half Duplex Burst Mode On/Off
35 * Added defines for Rx GMAC FIFO Flush feature
36 * Editorial changes
37 *
38 * Revision 1.47 2002/11/12 17:01:31 rschmidt
39 * Added defines for WOL_CTL_DEFAULT
40 * Editorial changes
41 *
42 * Revision 1.46 2002/10/14 14:47:57 rschmidt
43 * Corrected bit mask for HW self test results
44 * Added defines for WOL Registers
45 * Editorial changes
46 *
47 * Revision 1.45 2002/10/11 09:25:22 mkarl
48 * Added bit mask for HW self test results.
49 *
50 * Revision 1.44 2002/08/16 14:44:36 rschmidt
51 * Added define GPC_HWCFG_GMII_FIB for YUKON Fiber
52 *
53 * Revision 1.43 2002/08/12 13:31:50 rschmidt
54 * Corrected macros for GMAC Address Registers: GM_INADDR(),
55 * GM_OUTADDR(), GM_INHASH, GM_OUTHASH.
56 * Editorial changes
57 *
58 * Revision 1.42 2002/08/08 15:37:56 rschmidt
59 * Added defines for Power Management Capabilities
60 * Editorial changes
61 *
62 * Revision 1.41 2002/07/23 16:02:25 rschmidt
63 * Added macro WOL_REG() to access WOL reg. (HW-Bug in YUKON 1st rev.)
64 *
65 * Revision 1.40 2002/07/15 15:41:37 rschmidt
66 * Added new defines for Power Management Cap. & Control
67 * Editorial changes
68 *
69 * Revision 1.39 2002/06/10 09:37:07 rschmidt
70 * Added macros for the ADDR-Modul
71 *
72 * Revision 1.38 2002/06/05 08:15:19 rschmidt
73 * Added defines for WOL Registers
74 * Editorial changes
75 *
76 * Revision 1.37 2002/04/25 11:39:23 rschmidt
77 * Added new defines for PCI Our Register 1
78 * Added new registers and defines for YUKON (Rx FIFO, Tx FIFO,
79 * Time Stamp Timer, GMAC Control, GPHY Control,Link Control,
80 * GMAC IRQ Source and Mask, Wake-up Frame Pattern Match);
81 * Added new defines for Control/Status (VAUX available)
82 * Added Chip ID for YUKON
83 * Added define for descriptors with UDP ext. for YUKON
84 * Added macros to access the GMAC
85 * Added new Phy Type for Marvell 88E1011S (GPHY)
86 * Editorial changes
87 *
88 * Revision 1.36 2000/11/09 12:32:49 rassmann
89 * Renamed variables.
90 *
91 * Revision 1.35 2000/05/19 10:17:13 cgoos
92 * Added inactivity check in PHY_READ (in DEBUG mode only).
93 *
94 * Revision 1.34 1999/11/22 13:53:40 cgoos
95 * Changed license header to GPL.
96 *
97 * Revision 1.33 1999/08/27 11:17:10 malthoff
98 * It's more savely to put brackets around macro parameters.
99 * Brackets added for PHY_READ and PHY_WRITE.
100 *
101 * Revision 1.32 1999/05/19 07:31:01 cgoos
102 * Changes for 1000Base-T.
103 * Added HWAC_LINK_LED macro.
104 *
105 * Revision 1.31 1999/03/12 13:27:40 malthoff
106 * Remove __STDC__.
107 *
108 * Revision 1.30 1999/02/09 09:28:20 malthoff
109 * Add PCI_ERRBITS.
110 *
111 * Revision 1.29 1999/01/26 08:55:48 malthoff
112 * Bugfix: The 16 bit field relations inside the descriptor are
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200113 * endianess dependend if the descriptor reversal feature
114 * (PCI_REV_DESC bit in PCI_OUR_REG_2) is enabled.
115 * Drivers which use this feature has to set the define
116 * SK_USE_REV_DESC.
wdenk7152b1d2003-09-05 23:19:14 +0000117 *
118 * Revision 1.28 1998/12/10 11:10:22 malthoff
119 * bug fix: IS_IRQ_STAT and IS_IRQ_MST_ERR has been twisted.
120 *
121 * Revision 1.27 1998/11/13 14:19:21 malthoff
122 * Bug Fix: The bit definition of B3_PA_CTRL has completely
123 * changed from HW Spec v1.3 to v1.5.
124 *
125 * Revision 1.26 1998/11/04 08:31:48 cgoos
126 * Fixed byte ordering in XM_OUTADDR/XM_OUTHASH macros.
127 *
128 * Revision 1.25 1998/11/04 07:16:25 cgoos
129 * Changed byte ordering in XM_INADDR/XM_INHASH again.
130 *
131 * Revision 1.24 1998/11/02 11:08:43 malthoff
132 * RxCtrl and TxCtrl must be volatile.
133 *
134 * Revision 1.23 1998/10/28 13:50:45 malthoff
135 * Fix: Endian support missing in XM_IN/OUT-ADDR/HASH macros.
136 *
137 * Revision 1.22 1998/10/26 08:01:36 malthoff
138 * RX_MFF_CTRL1 is split up into RX_MFF_CTRL1,
139 * RX_MFF_STAT_TO, and RX_MFF_TIST_TO.
140 * TX_MFF_CTRL1 is split up TX_MFF_CTRL1 and TX_MFF_WAF.
141 *
142 * Revision 1.21 1998/10/20 07:43:10 malthoff
143 * Fix: XM_IN/OUT/ADDR/HASH macros:
144 * The pointer must be casted.
145 *
146 * Revision 1.20 1998/10/19 15:53:59 malthoff
147 * Remove ML proto definitions.
148 *
149 * Revision 1.19 1998/10/16 14:40:17 gklug
150 * fix: typo B0_XM_IMSK regs
151 *
152 * Revision 1.18 1998/10/16 09:46:54 malthoff
153 * Remove temp defines for ML diag prototype.
154 * Fix register definition for B0_XM1_PHY_DATA, B0_XM1_PHY_DATA
155 * B0_XM2_PHY_DATA, B0_XM2_PHY_ADDR, B0_XA1_CSR, B0_XS1_CSR,
156 * B0_XS2_CSR, and B0_XA2_CSR.
157 *
158 * Revision 1.17 1998/10/14 06:03:14 cgoos
159 * Changed shifted constant to ULONG.
160 *
161 * Revision 1.16 1998/10/09 07:05:41 malthoff
162 * Rename ALL_PA_ENA_TO to PA_ENA_TO_ALL.
163 *
164 * Revision 1.15 1998/10/05 07:54:23 malthoff
165 * Split up RB_CTRL and it's bit definition into
166 * RB_CTRL, RB_TST1, and RB_TST2.
167 * Rename RB_RX_HTPP to RB_RX_LTPP.
168 * Add ALL_PA_ENA_TO. Modify F_WATER_MARK
169 * according to HW Spec. v1.5.
170 * Add MFF_TX_CTRL_DEF.
171 *
172 * Revision 1.14 1998/09/28 13:31:16 malthoff
173 * bug fix: B2_MAC_3 is 0x110 not 0x114
174 *
175 * Revision 1.13 1998/09/24 14:42:56 malthoff
176 * Split the RX_MFF_TST into RX_MFF_CTRL2,
177 * RX_MFF_TST1, and RX_MFF_TST2.
178 * Rename RX_MFF_CTRL to RX_MFF_CTRL1.
179 * Add BMU bit CSR_SV_IDLE.
180 * Add macros PHY_READ() and PHY_WRITE().
181 * Rename macro SK_ADDR() to SK_HW_ADDR()
182 * because of conflicts with the Address Module.
183 *
184 * Revision 1.12 1998/09/16 07:25:33 malthoff
185 * Change the parameter order in the XM_INxx and XM_OUTxx macros,
186 * to have the IoC as first parameter.
187 *
188 * Revision 1.11 1998/09/03 09:58:41 malthoff
189 * Rework the XM_xxx macros. Use {} instead of () to
190 * be compatible with SK_xxx macros which are defined
191 * with {}.
192 *
193 * Revision 1.10 1998/09/02 11:16:39 malthoff
194 * Temporary modify B2_I2C_SW to make tests with
195 * the GE/ML prototype.
196 *
197 * Revision 1.9 1998/08/19 09:11:49 gklug
198 * fix: struct are removed from c-source (see CCC)
199 * add: typedefs for all structs
200 *
201 * Revision 1.8 1998/08/18 08:27:27 malthoff
202 * Add some temporary workarounds to test GE
203 * sources with the ML.
204 *
205 * Revision 1.7 1998/07/03 14:42:26 malthoff
206 * bug fix: Correct macro XMA().
207 * Add temporary workaround to access the PCI config space over I/O
208 *
209 * Revision 1.6 1998/06/23 11:30:36 malthoff
210 * Remove ';' with ',' in macors.
211 *
212 * Revision 1.5 1998/06/22 14:20:57 malthoff
213 * Add macro SK_ADDR(Base,Addr).
214 *
215 * Revision 1.4 1998/06/19 13:35:43 malthoff
216 * change 'pGec' with 'pAC'
217 *
218 * Revision 1.3 1998/06/17 14:58:16 cvs
219 * Lost keywords reinserted.
220 *
221 * Revision 1.1 1998/06/17 14:16:36 cvs
222 * created
223 *
224 *
225 ******************************************************************************/
226
227#ifndef __INC_SKGEHW_H
228#define __INC_SKGEHW_H
229
230#ifdef __cplusplus
231extern "C" {
232#endif /* __cplusplus */
233
234/* defines ********************************************************************/
235
236#define BIT_31 (1UL << 31)
237#define BIT_30 (1L << 30)
238#define BIT_29 (1L << 29)
239#define BIT_28 (1L << 28)
240#define BIT_27 (1L << 27)
241#define BIT_26 (1L << 26)
242#define BIT_25 (1L << 25)
243#define BIT_24 (1L << 24)
244#define BIT_23 (1L << 23)
245#define BIT_22 (1L << 22)
246#define BIT_21 (1L << 21)
247#define BIT_20 (1L << 20)
248#define BIT_19 (1L << 19)
249#define BIT_18 (1L << 18)
250#define BIT_17 (1L << 17)
251#define BIT_16 (1L << 16)
252#define BIT_15 (1L << 15)
253#define BIT_14 (1L << 14)
254#define BIT_13 (1L << 13)
255#define BIT_12 (1L << 12)
256#define BIT_11 (1L << 11)
257#define BIT_10 (1L << 10)
258#define BIT_9 (1L << 9)
259#define BIT_8 (1L << 8)
260#define BIT_7 (1L << 7)
261#define BIT_6 (1L << 6)
262#define BIT_5 (1L << 5)
263#define BIT_4 (1L << 4)
264#define BIT_3 (1L << 3)
265#define BIT_2 (1L << 2)
266#define BIT_1 (1L << 1)
267#define BIT_0 1L
268
269#define BIT_15S (1U << 15)
270#define BIT_14S (1 << 14)
271#define BIT_13S (1 << 13)
272#define BIT_12S (1 << 12)
273#define BIT_11S (1 << 11)
274#define BIT_10S (1 << 10)
275#define BIT_9S (1 << 9)
276#define BIT_8S (1 << 8)
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200277#define BIT_7S (1 << 7)
wdenk7152b1d2003-09-05 23:19:14 +0000278#define BIT_6S (1 << 6)
279#define BIT_5S (1 << 5)
280#define BIT_4S (1 << 4)
281#define BIT_3S (1 << 3)
282#define BIT_2S (1 << 2)
283#define BIT_1S (1 << 1)
284#define BIT_0S 1
285
286#define SHIFT31(x) ((x) << 31)
287#define SHIFT30(x) ((x) << 30)
288#define SHIFT29(x) ((x) << 29)
289#define SHIFT28(x) ((x) << 28)
290#define SHIFT27(x) ((x) << 27)
291#define SHIFT26(x) ((x) << 26)
292#define SHIFT25(x) ((x) << 25)
293#define SHIFT24(x) ((x) << 24)
294#define SHIFT23(x) ((x) << 23)
295#define SHIFT22(x) ((x) << 22)
296#define SHIFT21(x) ((x) << 21)
297#define SHIFT20(x) ((x) << 20)
298#define SHIFT19(x) ((x) << 19)
299#define SHIFT18(x) ((x) << 18)
300#define SHIFT17(x) ((x) << 17)
301#define SHIFT16(x) ((x) << 16)
302#define SHIFT15(x) ((x) << 15)
303#define SHIFT14(x) ((x) << 14)
304#define SHIFT13(x) ((x) << 13)
305#define SHIFT12(x) ((x) << 12)
306#define SHIFT11(x) ((x) << 11)
307#define SHIFT10(x) ((x) << 10)
308#define SHIFT9(x) ((x) << 9)
309#define SHIFT8(x) ((x) << 8)
310#define SHIFT7(x) ((x) << 7)
311#define SHIFT6(x) ((x) << 6)
312#define SHIFT5(x) ((x) << 5)
313#define SHIFT4(x) ((x) << 4)
314#define SHIFT3(x) ((x) << 3)
315#define SHIFT2(x) ((x) << 2)
316#define SHIFT1(x) ((x) << 1)
317#define SHIFT0(x) ((x) << 0)
318
319/*
320 * Configuration Space header
321 * Since this module is used for different OS', those may be
322 * duplicate on some of them (e.g. Linux). But to keep the
323 * common source, we have to live with this...
324 */
325#define PCI_VENDOR_ID 0x00 /* 16 bit Vendor ID */
326#define PCI_DEVICE_ID 0x02 /* 16 bit Device ID */
327#define PCI_COMMAND 0x04 /* 16 bit Command */
328#define PCI_STATUS 0x06 /* 16 bit Status */
329#define PCI_REV_ID 0x08 /* 8 bit Revision ID */
330#if 0
331#define PCI_CLASS_CODE 0x09 /* 24 bit Class Code */
332#endif
333#define PCI_CACHE_LSZ 0x0c /* 8 bit Cache Line Size */
334#define PCI_LAT_TIM 0x0d /* 8 bit Latency Timer */
335#define PCI_HEADER_T 0x0e /* 8 bit Header Type */
336#define PCI_BIST 0x0f /* 8 bit Built-in selftest */
337#define PCI_BASE_1ST 0x10 /* 32 bit 1st Base address */
338#define PCI_BASE_2ND 0x14 /* 32 bit 2nd Base address */
339 /* Byte 0x18..0x2b: reserved */
340#define PCI_SUB_VID 0x2c /* 16 bit Subsystem Vendor ID */
341#define PCI_SUB_ID 0x2e /* 16 bit Subsystem ID */
342#define PCI_BASE_ROM 0x30 /* 32 bit Expansion ROM Base Address */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200343#define PCI_CAP_PTR 0x34 /* 8 bit Capabilities Ptr */
wdenk7152b1d2003-09-05 23:19:14 +0000344 /* Byte 35..3b: reserved */
345#define PCI_IRQ_LINE 0x3c /* 8 bit Interrupt Line */
346#define PCI_IRQ_PIN 0x3d /* 8 bit Interrupt Pin */
347#define PCI_MIN_GNT 0x3e /* 8 bit Min_Gnt */
348#define PCI_MAX_LAT 0x3f /* 8 bit Max_Lat */
349 /* Device Dependent Region */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200350#define PCI_OUR_REG_1 0x40 /* 32 bit Our Register 1 */
351#define PCI_OUR_REG_2 0x44 /* 32 bit Our Register 2 */
wdenk7152b1d2003-09-05 23:19:14 +0000352 /* Power Management Region */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200353#define PCI_PM_CAP_ID 0x48 /* 8 bit Power Management Cap. ID */
354#define PCI_PM_NITEM 0x49 /* 8 bit Next Item Ptr */
355#define PCI_PM_CAP_REG 0x4a /* 16 bit Power Management Capabilities */
356#define PCI_PM_CTL_STS 0x4c /* 16 bit Power Manag. Control/Status */
wdenk7152b1d2003-09-05 23:19:14 +0000357 /* Byte 0x4e: reserved */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200358#define PCI_PM_DAT_REG 0x4f /* 8 bit Power Manag. Data Register */
wdenk7152b1d2003-09-05 23:19:14 +0000359 /* VPD Region */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200360#define PCI_VPD_CAP_ID 0x50 /* 8 bit VPD Cap. ID */
361#define PCI_VPD_NITEM 0x51 /* 8 bit Next Item Ptr */
362#define PCI_VPD_ADR_REG 0x52 /* 16 bit VPD Address Register */
363#define PCI_VPD_DAT_REG 0x54 /* 32 bit VPD Data Register */
wdenk7152b1d2003-09-05 23:19:14 +0000364 /* Byte 0x58..0xff: reserved */
365
366/*
367 * I2C Address (PCI Config)
368 *
369 * Note: The temperature and voltage sensors are relocated on a different
370 * I2C bus.
371 */
372#define I2C_ADDR_VPD 0xA0 /* I2C address for the VPD EEPROM */
373
374/*
375 * Define Bits and Values of the registers
376 */
377/* PCI_COMMAND 16 bit Command */
378 /* Bit 15..11: reserved */
379#define PCI_INT_DIS BIT_10S /* Interrupt INTx# disable (PCI 2.3) */
380#define PCI_FBTEN BIT_9S /* Fast Back-To-Back enable */
381#define PCI_SERREN BIT_8S /* SERR enable */
382#define PCI_ADSTEP BIT_7S /* Address Stepping */
383#define PCI_PERREN BIT_6S /* Parity Report Response enable */
384#define PCI_VGA_SNOOP BIT_5S /* VGA palette snoop */
385#define PCI_MWIEN BIT_4S /* Memory write an inv cycl ena */
386#define PCI_SCYCEN BIT_3S /* Special Cycle enable */
387#define PCI_BMEN BIT_2S /* Bus Master enable */
388#define PCI_MEMEN BIT_1S /* Memory Space Access enable */
389#define PCI_IOEN BIT_0S /* I/O Space Access enable */
390
391#define PCI_COMMAND_VAL (PCI_FBTEN | PCI_SERREN | PCI_PERREN | PCI_MWIEN |\
392 PCI_BMEN | PCI_MEMEN | PCI_IOEN)
393
394/* PCI_STATUS 16 bit Status */
395#define PCI_PERR BIT_15S /* Parity Error */
396#define PCI_SERR BIT_14S /* Signaled SERR */
397#define PCI_RMABORT BIT_13S /* Received Master Abort */
398#define PCI_RTABORT BIT_12S /* Received Target Abort */
399 /* Bit 11: reserved */
400#define PCI_DEVSEL (3<<9) /* Bit 10.. 9: DEVSEL Timing */
401#define PCI_DEV_FAST (0<<9) /* fast */
402#define PCI_DEV_MEDIUM (1<<9) /* medium */
403#define PCI_DEV_SLOW (2<<9) /* slow */
404#define PCI_DATAPERR BIT_8S /* DATA Parity error detected */
405#define PCI_FB2BCAP BIT_7S /* Fast Back-to-Back Capability */
406#define PCI_UDF BIT_6S /* User Defined Features */
407#define PCI_66MHZCAP BIT_5S /* 66 MHz PCI bus clock capable */
408#define PCI_NEWCAP BIT_4S /* New cap. list implemented */
409#define PCI_INT_STAT BIT_3S /* Interrupt INTx# Status (PCI 2.3) */
410 /* Bit 2.. 0: reserved */
411
412#define PCI_ERRBITS (PCI_PERR | PCI_SERR | PCI_RMABORT | PCI_RTABORT |\
413 PCI_DATAPERR)
414
415/* PCI_CLASS_CODE 24 bit Class Code */
416/* Byte 2: Base Class (02) */
417/* Byte 1: SubClass (00) */
418/* Byte 0: Programming Interface (00) */
419
420/* PCI_CACHE_LSZ 8 bit Cache Line Size */
421/* Possible values: 0,2,4,8,16,32,64,128 */
422
423/* PCI_HEADER_T 8 bit Header Type */
424#define PCI_HD_MF_DEV BIT_7S /* 0= single, 1= multi-func dev */
425#define PCI_HD_TYPE 0x7f /* Bit 6..0: Header Layout 0= normal */
426
427/* PCI_BIST 8 bit Built-in selftest */
428/* Built-in Self test not supported (optional) */
429
430/* PCI_BASE_1ST 32 bit 1st Base address */
431#define PCI_MEMSIZE 0x4000L /* use 16 kB Memory Base */
432#define PCI_MEMBASE_MSK 0xffffc000L /* Bit 31..14: Memory Base Address */
433#define PCI_MEMSIZE_MSK 0x00003ff0L /* Bit 13.. 4: Memory Size Req. */
434#define PCI_PREFEN BIT_3 /* Prefetchable */
435#define PCI_MEM_TYP (3L<<2) /* Bit 2.. 1: Memory Type */
436#define PCI_MEM32BIT (0L<<1) /* Base addr anywhere in 32 Bit range */
437#define PCI_MEM1M (1L<<1) /* Base addr below 1 MegaByte */
438#define PCI_MEM64BIT (2L<<1) /* Base addr anywhere in 64 Bit range */
439#define PCI_MEMSPACE BIT_0 /* Memory Space Indic. */
440
441/* PCI_BASE_2ND 32 bit 2nd Base address */
442#define PCI_IOBASE 0xffffff00L /* Bit 31.. 8: I/O Base address */
443#define PCI_IOSIZE 0x000000fcL /* Bit 7.. 2: I/O Size Requirements */
444 /* Bit 1: reserved */
445#define PCI_IOSPACE BIT_0 /* I/O Space Indicator */
446
447/* PCI_BASE_ROM 32 bit Expansion ROM Base Address */
448#define PCI_ROMBASE 0xfffe0000L /* Bit 31..17: ROM BASE address (1st)*/
449#define PCI_ROMBASZ (0x1cL<<14) /* Bit 16..14: Treat as BASE or SIZE */
450#define PCI_ROMSIZE (0x38L<<11) /* Bit 13..11: ROM Size Requirements */
451 /* Bit 10.. 1: reserved */
452#define PCI_ROMEN BIT_0 /* Address Decode enable */
453
454/* Device Dependent Region */
455/* PCI_OUR_REG_1 32 bit Our Register 1 */
456 /* Bit 31..29: reserved */
457#define PCI_PHY_COMA BIT_28 /* Set PHY to Coma Mode */
458#define PCI_EN_CAL BIT_27 /* Enable PCI buffer strength calibr. */
459#define PCI_DIS_CAL BIT_26 /* Disable PCI buffer strength calibr. */
460#define PCI_VIO BIT_25 /* PCI I/O Voltage, 0 = 3.3V, 1 = 5V */
461#define PCI_DIS_BOOT BIT_24 /* Disable BOOT via ROM */
462#define PCI_EN_IO BIT_23 /* Mapping to I/O space */
463#define PCI_EN_FPROM BIT_22 /* Enable FLASH mapping to memory */
464 /* 1 = Map Flash to memory */
465 /* 0 = Disable addr. dec */
466#define PCI_PAGESIZE (3L<<20) /* Bit 21..20: FLASH Page Size */
467#define PCI_PAGE_16 (0L<<20) /* 16 k pages */
468#define PCI_PAGE_32K (1L<<20) /* 32 k pages */
469#define PCI_PAGE_64K (2L<<20) /* 64 k pages */
470#define PCI_PAGE_128K (3L<<20) /* 128 k pages */
471 /* Bit 19: reserved */
472#define PCI_PAGEREG (7L<<16) /* Bit 18..16: Page Register */
473#define PCI_NOTAR BIT_15 /* No turnaround cycle */
474#define PCI_FORCE_BE BIT_14 /* Assert all BEs on MR */
475#define PCI_DIS_MRL BIT_13 /* Disable Mem Read Line */
476#define PCI_DIS_MRM BIT_12 /* Disable Mem Read Multiple */
477#define PCI_DIS_MWI BIT_11 /* Disable Mem Write & Invalidate */
478#define PCI_DISC_CLS BIT_10 /* Disc: cacheLsz bound */
479#define PCI_BURST_DIS BIT_9 /* Burst Disable */
480#define PCI_DIS_PCI_CLK BIT_8 /* Disable PCI clock driving */
481#define PCI_SKEW_DAS (0xfL<<4) /* Bit 7.. 4: Skew Ctrl, DAS Ext */
482#define PCI_SKEW_BASE 0xfL /* Bit 3.. 0: Skew Ctrl, Base */
483
484
485/* PCI_OUR_REG_2 32 bit Our Register 2 */
486#define PCI_VPD_WR_THR (0xffL<<24) /* Bit 31..24: VPD Write Threshold */
487#define PCI_DEV_SEL (0x7fL<<17) /* Bit 23..17: EEPROM Device Select */
488#define PCI_VPD_ROM_SZ (7L<<14) /* Bit 16..14: VPD ROM Size */
489 /* Bit 13..12: reserved */
490#define PCI_PATCH_DIR (0xfL<<8) /* Bit 11.. 8: Ext Patches dir 3..0 */
491#define PCI_PATCH_DIR_3 BIT_11
492#define PCI_PATCH_DIR_2 BIT_10
493#define PCI_PATCH_DIR_1 BIT_9
494#define PCI_PATCH_DIR_0 BIT_8
495#define PCI_EXT_PATCHS (0xfL<<4) /* Bit 7.. 4: Extended Patches 3..0 */
496#define PCI_EXT_PATCH_3 BIT_7
497#define PCI_EXT_PATCH_2 BIT_6
498#define PCI_EXT_PATCH_1 BIT_5
499#define PCI_EXT_PATCH_0 BIT_4
500#define PCI_EN_DUMMY_RD BIT_3 /* Enable Dummy Read */
501#define PCI_REV_DESC BIT_2 /* Reverse Desc. Bytes */
502 /* Bit 1: reserved */
503#define PCI_USEDATA64 BIT_0 /* Use 64Bit Data bus ext */
504
505
506/* Power Management Region */
507/* PCI_PM_CAP_REG 16 bit Power Management Capabilities */
508#define PCI_PME_SUP_MSK (0x1f<<11) /* Bit 15..11: PM Event Support Mask */
509#define PCI_PME_D3C_SUP BIT_15S /* PME from D3cold Support (if Vaux) */
510#define PCI_PME_D3H_SUP BIT_14S /* PME from D3hot Support */
511#define PCI_PME_D2_SUP BIT_13S /* PME from D2 Support */
512#define PCI_PME_D1_SUP BIT_12S /* PME from D1 Support */
513#define PCI_PME_D0_SUP BIT_11S /* PME from D0 Support */
514#define PCI_PM_D2_SUP BIT_10S /* D2 Support in 33 MHz mode */
515#define PCI_PM_D1_SUP BIT_9S /* D1 Support */
516 /* Bit 8.. 6: reserved */
517#define PCI_PM_DSI BIT_5S /* Device Specific Initialization */
518#define PCI_PM_APS BIT_4S /* Auxialiary Power Source */
519#define PCI_PME_CLOCK BIT_3S /* PM Event Clock */
520#define PCI_PM_VER_MSK 7 /* Bit 2.. 0: PM PCI Spec. version */
521
522/* PCI_PM_CTL_STS 16 bit Power Management Control/Status */
523#define PCI_PME_STATUS BIT_15S /* PME Status (YUKON only) */
524#define PCI_PM_DAT_SCL (3<<13) /* Bit 14..13: Data Reg. scaling factor */
525#define PCI_PM_DAT_SEL (0xf<<9) /* Bit 12.. 9: PM data selector field */
526#define PCI_PME_EN BIT_8S /* Enable PME# generation (YUKON only) */
527 /* Bit 7.. 2: reserved */
528#define PCI_PM_STATE_MSK 3 /* Bit 1.. 0: Power Management State */
529
530#define PCI_PM_STATE_D0 0 /* D0: Operational (default) */
531#define PCI_PM_STATE_D1 1 /* D1: (YUKON only) */
532#define PCI_PM_STATE_D2 2 /* D2: (YUKON only) */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200533#define PCI_PM_STATE_D3 3 /* D3: HOT, Power Down and Reset */
wdenk7152b1d2003-09-05 23:19:14 +0000534
535/* VPD Region */
536/* PCI_VPD_ADR_REG 16 bit VPD Address Register */
537#define PCI_VPD_FLAG BIT_15S /* starts VPD rd/wr cycle */
538#define PCI_VPD_ADR_MSK 0x7fffL /* Bit 14.. 0: VPD address mask */
539
540/* Control Register File (Address Map) */
541
542/*
543 * Bank 0
544 */
545#define B0_RAP 0x0000 /* 8 bit Register Address Port */
546 /* 0x0001 - 0x0003: reserved */
547#define B0_CTST 0x0004 /* 16 bit Control/Status register */
548#define B0_LED 0x0006 /* 8 Bit LED register */
549#define B0_POWER_CTRL 0x0007 /* 8 Bit Power Control reg (YUKON only) */
550#define B0_ISRC 0x0008 /* 32 bit Interrupt Source Register */
551#define B0_IMSK 0x000c /* 32 bit Interrupt Mask Register */
552#define B0_HWE_ISRC 0x0010 /* 32 bit HW Error Interrupt Src Reg */
553#define B0_HWE_IMSK 0x0014 /* 32 bit HW Error Interrupt Mask Reg */
554#define B0_SP_ISRC 0x0018 /* 32 bit Special Interrupt Source Reg */
555 /* 0x001c: reserved */
556
557/* B0 XMAC 1 registers (GENESIS only) */
558#define B0_XM1_IMSK 0x0020 /* 16 bit r/w XMAC 1 Interrupt Mask Register*/
559 /* 0x0022 - 0x0027: reserved */
560#define B0_XM1_ISRC 0x0028 /* 16 bit ro XMAC 1 Interrupt Status Reg */
561 /* 0x002a - 0x002f: reserved */
562#define B0_XM1_PHY_ADDR 0x0030 /* 16 bit r/w XMAC 1 PHY Address Register */
563 /* 0x0032 - 0x0033: reserved */
564#define B0_XM1_PHY_DATA 0x0034 /* 16 bit r/w XMAC 1 PHY Data Register */
565 /* 0x0036 - 0x003f: reserved */
566
567/* B0 XMAC 2 registers (GENESIS only) */
568#define B0_XM2_IMSK 0x0040 /* 16 bit r/w XMAC 2 Interrupt Mask Register*/
569 /* 0x0042 - 0x0047: reserved */
570#define B0_XM2_ISRC 0x0048 /* 16 bit ro XMAC 2 Interrupt Status Reg */
571 /* 0x004a - 0x004f: reserved */
572#define B0_XM2_PHY_ADDR 0x0050 /* 16 bit r/w XMAC 2 PHY Address Register */
573 /* 0x0052 - 0x0053: reserved */
574#define B0_XM2_PHY_DATA 0x0054 /* 16 bit r/w XMAC 2 PHY Data Register */
575 /* 0x0056 - 0x005f: reserved */
576
577/* BMU Control Status Registers */
578#define B0_R1_CSR 0x0060 /* 32 bit BMU Ctrl/Stat Rx Queue 1 */
579#define B0_R2_CSR 0x0064 /* 32 bit BMU Ctrl/Stat Rx Queue 2 */
580#define B0_XS1_CSR 0x0068 /* 32 bit BMU Ctrl/Stat Sync Tx Queue 1 */
581#define B0_XA1_CSR 0x006c /* 32 bit BMU Ctrl/Stat Async Tx Queue 1*/
582#define B0_XS2_CSR 0x0070 /* 32 bit BMU Ctrl/Stat Sync Tx Queue 2 */
583#define B0_XA2_CSR 0x0074 /* 32 bit BMU Ctrl/Stat Async Tx Queue 2*/
584 /* 0x0078 - 0x007f: reserved */
585
586/*
587 * Bank 1
588 * - completely empty (this is the RAP Block window)
589 * Note: if RAP = 1 this page is reserved
590 */
591
592/*
593 * Bank 2
594 */
595/* NA reg = 48 bit Network Address Register, 3x16 or 8x8 bit readable */
596#define B2_MAC_1 0x0100 /* NA reg MAC Address 1 */
597 /* 0x0106 - 0x0107: reserved */
598#define B2_MAC_2 0x0108 /* NA reg MAC Address 2 */
599 /* 0x010e - 0x010f: reserved */
600#define B2_MAC_3 0x0110 /* NA reg MAC Address 3 */
601 /* 0x0116 - 0x0117: reserved */
602#define B2_CONN_TYP 0x0118 /* 8 bit Connector type */
603#define B2_PMD_TYP 0x0119 /* 8 bit PMD type */
604#define B2_MAC_CFG 0x011a /* 8 bit MAC Configuration / Chip Revision */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200605#define B2_CHIP_ID 0x011b /* 8 bit Chip Identification Number */
wdenk7152b1d2003-09-05 23:19:14 +0000606 /* Eprom registers are currently of no use */
607#define B2_E_0 0x011c /* 8 bit EPROM Byte 0 (ext. SRAM size */
608#define B2_E_1 0x011d /* 8 bit EPROM Byte 1 (PHY type) */
609#define B2_E_2 0x011e /* 8 bit EPROM Byte 2 */
610#define B2_E_3 0x011f /* 8 bit EPROM Byte 3 */
611#define B2_FAR 0x0120 /* 32 bit Flash-Prom Addr Reg/Cnt */
612#define B2_FDP 0x0124 /* 8 bit Flash-Prom Data Port */
613 /* 0x0125 - 0x0127: reserved */
614#define B2_LD_CRTL 0x0128 /* 8 bit EPROM loader control register */
615#define B2_LD_TEST 0x0129 /* 8 bit EPROM loader test register */
616 /* 0x012a - 0x012f: reserved */
617#define B2_TI_INI 0x0130 /* 32 bit Timer Init Value */
618#define B2_TI_VAL 0x0134 /* 32 bit Timer Value */
619#define B2_TI_CRTL 0x0138 /* 8 bit Timer Control */
620#define B2_TI_TEST 0x0139 /* 8 Bit Timer Test */
621 /* 0x013a - 0x013f: reserved */
622#define B2_IRQM_INI 0x0140 /* 32 bit IRQ Moderation Timer Init Reg.*/
623#define B2_IRQM_VAL 0x0144 /* 32 bit IRQ Moderation Timer Value */
624#define B2_IRQM_CTRL 0x0148 /* 8 bit IRQ Moderation Timer Control */
625#define B2_IRQM_TEST 0x0149 /* 8 bit IRQ Moderation Timer Test */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200626#define B2_IRQM_MSK 0x014c /* 32 bit IRQ Moderation Mask */
wdenk7152b1d2003-09-05 23:19:14 +0000627#define B2_IRQM_HWE_MSK 0x0150 /* 32 bit IRQ Moderation HW Error Mask */
628 /* 0x0154 - 0x0157: reserved */
629#define B2_TST_CTRL1 0x0158 /* 8 bit Test Control Register 1 */
630#define B2_TST_CTRL2 0x0159 /* 8 bit Test Control Register 2 */
631 /* 0x015a - 0x015b: reserved */
632#define B2_GP_IO 0x015c /* 32 bit General Purpose I/O Register */
633#define B2_I2C_CTRL 0x0160 /* 32 bit I2C HW Control Register */
634#define B2_I2C_DATA 0x0164 /* 32 bit I2C HW Data Register */
635#define B2_I2C_IRQ 0x0168 /* 32 bit I2C HW IRQ Register */
636#define B2_I2C_SW 0x016c /* 32 bit I2C SW Port Register */
637
638/* Blink Source Counter (GENESIS only) */
639#define B2_BSC_INI 0x0170 /* 32 bit Blink Source Counter Init Val */
640#define B2_BSC_VAL 0x0174 /* 32 bit Blink Source Counter Value */
641#define B2_BSC_CTRL 0x0178 /* 8 bit Blink Source Counter Control */
642#define B2_BSC_STAT 0x0179 /* 8 bit Blink Source Counter Status */
643#define B2_BSC_TST 0x017a /* 16 bit Blink Source Counter Test Reg */
644 /* 0x017c - 0x017f: reserved */
645
646/*
647 * Bank 3
648 */
649/* RAM Random Registers */
650#define B3_RAM_ADDR 0x0180 /* 32 bit RAM Address, to read or write */
651#define B3_RAM_DATA_LO 0x0184 /* 32 bit RAM Data Word (low dWord) */
652#define B3_RAM_DATA_HI 0x0188 /* 32 bit RAM Data Word (high dWord) */
653 /* 0x018c - 0x018f: reserved */
654
655/* RAM Interface Registers */
656/*
657 * The HW-Spec. calls this registers Timeout Value 0..11. But this names are
658 * not usable in SW. Please notice these are NOT real timeouts, these are
659 * the number of qWords transferred continuously.
660 */
661#define B3_RI_WTO_R1 0x0190 /* 8 bit WR Timeout Queue R1 (TO0) */
662#define B3_RI_WTO_XA1 0x0191 /* 8 bit WR Timeout Queue XA1 (TO1) */
663#define B3_RI_WTO_XS1 0x0192 /* 8 bit WR Timeout Queue XS1 (TO2) */
664#define B3_RI_RTO_R1 0x0193 /* 8 bit RD Timeout Queue R1 (TO3) */
665#define B3_RI_RTO_XA1 0x0194 /* 8 bit RD Timeout Queue XA1 (TO4) */
666#define B3_RI_RTO_XS1 0x0195 /* 8 bit RD Timeout Queue XS1 (TO5) */
667#define B3_RI_WTO_R2 0x0196 /* 8 bit WR Timeout Queue R2 (TO6) */
668#define B3_RI_WTO_XA2 0x0197 /* 8 bit WR Timeout Queue XA2 (TO7) */
669#define B3_RI_WTO_XS2 0x0198 /* 8 bit WR Timeout Queue XS2 (TO8) */
670#define B3_RI_RTO_R2 0x0199 /* 8 bit RD Timeout Queue R2 (TO9) */
671#define B3_RI_RTO_XA2 0x019a /* 8 bit RD Timeout Queue XA2 (TO10)*/
672#define B3_RI_RTO_XS2 0x019b /* 8 bit RD Timeout Queue XS2 (TO11)*/
673#define B3_RI_TO_VAL 0x019c /* 8 bit Current Timeout Count Val */
674 /* 0x019d - 0x019f: reserved */
675#define B3_RI_CTRL 0x01a0 /* 16 bit RAM Interface Control Register */
676#define B3_RI_TEST 0x01a2 /* 8 bit RAM Interface Test Register */
677 /* 0x01a3 - 0x01af: reserved */
678
679/* MAC Arbiter Registers (GENESIS only) */
680/* these are the no. of qWord transferred continuously and NOT real timeouts */
681#define B3_MA_TOINI_RX1 0x01b0 /* 8 bit Timeout Init Val Rx Path MAC 1 */
682#define B3_MA_TOINI_RX2 0x01b1 /* 8 bit Timeout Init Val Rx Path MAC 2 */
683#define B3_MA_TOINI_TX1 0x01b2 /* 8 bit Timeout Init Val Tx Path MAC 1 */
684#define B3_MA_TOINI_TX2 0x01b3 /* 8 bit Timeout Init Val Tx Path MAC 2 */
685#define B3_MA_TOVAL_RX1 0x01b4 /* 8 bit Timeout Value Rx Path MAC 1 */
686#define B3_MA_TOVAL_RX2 0x01b5 /* 8 bit Timeout Value Rx Path MAC 1 */
687#define B3_MA_TOVAL_TX1 0x01b6 /* 8 bit Timeout Value Tx Path MAC 2 */
688#define B3_MA_TOVAL_TX2 0x01b7 /* 8 bit Timeout Value Tx Path MAC 2 */
689#define B3_MA_TO_CTRL 0x01b8 /* 16 bit MAC Arbiter Timeout Ctrl Reg */
690#define B3_MA_TO_TEST 0x01ba /* 16 bit MAC Arbiter Timeout Test Reg */
691 /* 0x01bc - 0x01bf: reserved */
692#define B3_MA_RCINI_RX1 0x01c0 /* 8 bit Recovery Init Val Rx Path MAC 1 */
693#define B3_MA_RCINI_RX2 0x01c1 /* 8 bit Recovery Init Val Rx Path MAC 2 */
694#define B3_MA_RCINI_TX1 0x01c2 /* 8 bit Recovery Init Val Tx Path MAC 1 */
695#define B3_MA_RCINI_TX2 0x01c3 /* 8 bit Recovery Init Val Tx Path MAC 2 */
696#define B3_MA_RCVAL_RX1 0x01c4 /* 8 bit Recovery Value Rx Path MAC 1 */
697#define B3_MA_RCVAL_RX2 0x01c5 /* 8 bit Recovery Value Rx Path MAC 1 */
698#define B3_MA_RCVAL_TX1 0x01c6 /* 8 bit Recovery Value Tx Path MAC 2 */
699#define B3_MA_RCVAL_TX2 0x01c7 /* 8 bit Recovery Value Tx Path MAC 2 */
700#define B3_MA_RC_CTRL 0x01c8 /* 16 bit MAC Arbiter Recovery Ctrl Reg */
701#define B3_MA_RC_TEST 0x01ca /* 16 bit MAC Arbiter Recovery Test Reg */
702 /* 0x01cc - 0x01cf: reserved */
703
704/* Packet Arbiter Registers (GENESIS only) */
705/* these are real timeouts */
706#define B3_PA_TOINI_RX1 0x01d0 /* 16 bit Timeout Init Val Rx Path MAC 1 */
707 /* 0x01d2 - 0x01d3: reserved */
708#define B3_PA_TOINI_RX2 0x01d4 /* 16 bit Timeout Init Val Rx Path MAC 2 */
709 /* 0x01d6 - 0x01d7: reserved */
710#define B3_PA_TOINI_TX1 0x01d8 /* 16 bit Timeout Init Val Tx Path MAC 1 */
711 /* 0x01da - 0x01db: reserved */
712#define B3_PA_TOINI_TX2 0x01dc /* 16 bit Timeout Init Val Tx Path MAC 2 */
713 /* 0x01de - 0x01df: reserved */
714#define B3_PA_TOVAL_RX1 0x01e0 /* 16 bit Timeout Val Rx Path MAC 1 */
715 /* 0x01e2 - 0x01e3: reserved */
716#define B3_PA_TOVAL_RX2 0x01e4 /* 16 bit Timeout Val Rx Path MAC 2 */
717 /* 0x01e6 - 0x01e7: reserved */
718#define B3_PA_TOVAL_TX1 0x01e8 /* 16 bit Timeout Val Tx Path MAC 1 */
719 /* 0x01ea - 0x01eb: reserved */
720#define B3_PA_TOVAL_TX2 0x01ec /* 16 bit Timeout Val Tx Path MAC 2 */
721 /* 0x01ee - 0x01ef: reserved */
722#define B3_PA_CTRL 0x01f0 /* 16 bit Packet Arbiter Ctrl Register */
723#define B3_PA_TEST 0x01f2 /* 16 bit Packet Arbiter Test Register */
724 /* 0x01f4 - 0x01ff: reserved */
725
726/*
727 * Bank 4 - 5
728 */
729/* Transmit Arbiter Registers MAC 1 and 2, use MR_ADDR() to access */
730#define TXA_ITI_INI 0x0200 /* 32 bit Tx Arb Interval Timer Init Val*/
731#define TXA_ITI_VAL 0x0204 /* 32 bit Tx Arb Interval Timer Value */
732#define TXA_LIM_INI 0x0208 /* 32 bit Tx Arb Limit Counter Init Val */
733#define TXA_LIM_VAL 0x020c /* 32 bit Tx Arb Limit Counter Value */
734#define TXA_CTRL 0x0210 /* 8 bit Tx Arbiter Control Register */
735#define TXA_TEST 0x0211 /* 8 bit Tx Arbiter Test Register */
736#define TXA_STAT 0x0212 /* 8 bit Tx Arbiter Status Register */
737 /* 0x0213 - 0x027f: reserved */
738 /* 0x0280 - 0x0292: MAC 2 */
739 /* 0x0213 - 0x027f: reserved */
740
741/*
742 * Bank 6
743 */
744/* External registers (GENESIS only) */
745#define B6_EXT_REG 0x0300
746
747/*
748 * Bank 7
749 */
750/* This is a copy of the Configuration register file (lower half) */
751#define B7_CFG_SPC 0x0380
752
753/*
754 * Bank 8 - 15
755 */
756/* Receive and Transmit Queue Registers, use Q_ADDR() to access */
757#define B8_Q_REGS 0x0400
758
759/* Queue Register Offsets, use Q_ADDR() to access */
760#define Q_D 0x00 /* 8*32 bit Current Descriptor */
761#define Q_DA_L 0x20 /* 32 bit Current Descriptor Address Low dWord */
762#define Q_DA_H 0x24 /* 32 bit Current Descriptor Address High dWord */
763#define Q_AC_L 0x28 /* 32 bit Current Address Counter Low dWord */
764#define Q_AC_H 0x2c /* 32 bit Current Address Counter High dWord */
765#define Q_BC 0x30 /* 32 bit Current Byte Counter */
766#define Q_CSR 0x34 /* 32 bit BMU Control/Status Register */
767#define Q_F 0x38 /* 32 bit Flag Register */
768#define Q_T1 0x3c /* 32 bit Test Register 1 */
769#define Q_T1_TR 0x3c /* 8 bit Test Register 1 Transfer SM */
770#define Q_T1_WR 0x3d /* 8 bit Test Register 1 Write Descriptor SM */
771#define Q_T1_RD 0x3e /* 8 bit Test Register 1 Read Descriptor SM */
772#define Q_T1_SV 0x3f /* 8 bit Test Register 1 Supervisor SM */
773#define Q_T2 0x40 /* 32 bit Test Register 2 */
774#define Q_T3 0x44 /* 32 bit Test Register 3 */
775 /* 0x48 - 0x7f: reserved */
776
777/*
778 * Bank 16 - 23
779 */
780/* RAM Buffer Registers */
781#define B16_RAM_REGS 0x0800
782
783/* RAM Buffer Register Offsets, use RB_ADDR() to access */
784#define RB_START 0x00 /* 32 bit RAM Buffer Start Address */
785#define RB_END 0x04 /* 32 bit RAM Buffer End Address */
786#define RB_WP 0x08 /* 32 bit RAM Buffer Write Pointer */
787#define RB_RP 0x0c /* 32 bit RAM Buffer Read Pointer */
788#define RB_RX_UTPP 0x10 /* 32 bit Rx Upper Threshold, Pause Pack */
789#define RB_RX_LTPP 0x14 /* 32 bit Rx Lower Threshold, Pause Pack */
790#define RB_RX_UTHP 0x18 /* 32 bit Rx Upper Threshold, High Prio */
791#define RB_RX_LTHP 0x1c /* 32 bit Rx Lower Threshold, High Prio */
792 /* 0x10 - 0x1f: reserved at Tx RAM Buffer Registers */
793#define RB_PC 0x20 /* 32 bit RAM Buffer Packet Counter */
794#define RB_LEV 0x24 /* 32 bit RAM Buffer Level Register */
795#define RB_CTRL 0x28 /* 8 bit RAM Buffer Control Register */
796#define RB_TST1 0x29 /* 8 bit RAM Buffer Test Register 1 */
797#define RB_TST2 0x2A /* 8 bit RAM Buffer Test Register 2 */
798 /* 0x2c - 0x7f: reserved */
799
800/*
801 * Bank 24
802 */
803/*
804 * Receive MAC FIFO, Receive LED, and Link_Sync regs (GENESIS only)
805 * use MR_ADDR() to access
806 */
807#define RX_MFF_EA 0x0c00 /* 32 bit Receive MAC FIFO End Address */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200808#define RX_MFF_WP 0x0c04 /* 32 bit Receive MAC FIFO Write Pointer */
wdenk7152b1d2003-09-05 23:19:14 +0000809 /* 0x0c08 - 0x0c0b: reserved */
810#define RX_MFF_RP 0x0c0c /* 32 bit Receive MAC FIFO Read Pointer */
811#define RX_MFF_PC 0x0c10 /* 32 bit Receive MAC FIFO Packet Cnt */
812#define RX_MFF_LEV 0x0c14 /* 32 bit Receive MAC FIFO Level */
813#define RX_MFF_CTRL1 0x0c18 /* 16 bit Receive MAC FIFO Control Reg 1*/
814#define RX_MFF_STAT_TO 0x0c1a /* 8 bit Receive MAC Status Timeout */
815#define RX_MFF_TIST_TO 0x0c1b /* 8 bit Receive MAC Time Stamp Timeout */
816#define RX_MFF_CTRL2 0x0c1c /* 8 bit Receive MAC FIFO Control Reg 2*/
817#define RX_MFF_TST1 0x0c1d /* 8 bit Receive MAC FIFO Test Reg 1 */
818#define RX_MFF_TST2 0x0c1e /* 8 bit Receive MAC FIFO Test Reg 2 */
819 /* 0x0c1f: reserved */
820#define RX_LED_INI 0x0c20 /* 32 bit Receive LED Cnt Init Value */
821#define RX_LED_VAL 0x0c24 /* 32 bit Receive LED Cnt Current Value */
822#define RX_LED_CTRL 0x0c28 /* 8 bit Receive LED Cnt Control Reg */
823#define RX_LED_TST 0x0c29 /* 8 bit Receive LED Cnt Test Register */
824 /* 0x0c2a - 0x0c2f: reserved */
825#define LNK_SYNC_INI 0x0c30 /* 32 bit Link Sync Cnt Init Value */
826#define LNK_SYNC_VAL 0x0c34 /* 32 bit Link Sync Cnt Current Value */
827#define LNK_SYNC_CTRL 0x0c38 /* 8 bit Link Sync Cnt Control Register */
828#define LNK_SYNC_TST 0x0c39 /* 8 bit Link Sync Cnt Test Register */
829 /* 0x0c3a - 0x0c3b: reserved */
830#define LNK_LED_REG 0x0c3c /* 8 bit Link LED Register */
831 /* 0x0c3d - 0x0c3f: reserved */
832
833/* Receive GMAC FIFO (YUKON only), use MR_ADDR() to access */
834#define RX_GMF_EA 0x0c40 /* 32 bit Rx GMAC FIFO End Address */
835#define RX_GMF_AF_THR 0x0c44 /* 32 bit Rx GMAC FIFO Almost Full Thresh. */
836#define RX_GMF_CTRL_T 0x0c48 /* 32 bit Rx GMAC FIFO Control/Test */
837#define RX_GMF_FL_MSK 0x0c4c /* 32 bit Rx GMAC FIFO Flush Mask */
838#define RX_GMF_FL_THR 0x0c50 /* 32 bit Rx GMAC FIFO Flush Threshold */
839 /* 0x0c54 - 0x0c5f: reserved */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200840#define RX_GMF_WP 0x0c60 /* 32 bit Rx GMAC FIFO Write Pointer */
wdenk7152b1d2003-09-05 23:19:14 +0000841 /* 0x0c64 - 0x0c67: reserved */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200842#define RX_GMF_WLEV 0x0c68 /* 32 bit Rx GMAC FIFO Write Level */
wdenk7152b1d2003-09-05 23:19:14 +0000843 /* 0x0c6c - 0x0c6f: reserved */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200844#define RX_GMF_RP 0x0c70 /* 32 bit Rx GMAC FIFO Read Pointer */
wdenk7152b1d2003-09-05 23:19:14 +0000845 /* 0x0c74 - 0x0c77: reserved */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200846#define RX_GMF_RLEV 0x0c78 /* 32 bit Rx GMAC FIFO Read Level */
wdenk7152b1d2003-09-05 23:19:14 +0000847 /* 0x0c7c - 0x0c7f: reserved */
848
849/*
850 * Bank 25
851 */
852 /* 0x0c80 - 0x0cbf: MAC 2 */
853 /* 0x0cc0 - 0x0cff: reserved */
854
855/*
856 * Bank 26
857 */
858/*
859 * Transmit MAC FIFO and Transmit LED Registers (GENESIS only),
860 * use MR_ADDR() to access
861 */
862#define TX_MFF_EA 0x0d00 /* 32 bit Transmit MAC FIFO End Address */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200863#define TX_MFF_WP 0x0d04 /* 32 bit Transmit MAC FIFO WR Pointer */
wdenk7152b1d2003-09-05 23:19:14 +0000864#define TX_MFF_WSP 0x0d08 /* 32 bit Transmit MAC FIFO WR Shadow Ptr */
865#define TX_MFF_RP 0x0d0c /* 32 bit Transmit MAC FIFO RD Pointer */
866#define TX_MFF_PC 0x0d10 /* 32 bit Transmit MAC FIFO Packet Cnt */
867#define TX_MFF_LEV 0x0d14 /* 32 bit Transmit MAC FIFO Level */
868#define TX_MFF_CTRL1 0x0d18 /* 16 bit Transmit MAC FIFO Ctrl Reg 1 */
869#define TX_MFF_WAF 0x0d1a /* 8 bit Transmit MAC Wait after flush */
870 /* 0x0c1b: reserved */
871#define TX_MFF_CTRL2 0x0d1c /* 8 bit Transmit MAC FIFO Ctrl Reg 2 */
872#define TX_MFF_TST1 0x0d1d /* 8 bit Transmit MAC FIFO Test Reg 1 */
873#define TX_MFF_TST2 0x0d1e /* 8 bit Transmit MAC FIFO Test Reg 2 */
874 /* 0x0d1f: reserved */
875#define TX_LED_INI 0x0d20 /* 32 bit Transmit LED Cnt Init Value */
876#define TX_LED_VAL 0x0d24 /* 32 bit Transmit LED Cnt Current Val */
877#define TX_LED_CTRL 0x0d28 /* 8 bit Transmit LED Cnt Control Reg */
878#define TX_LED_TST 0x0d29 /* 8 bit Transmit LED Cnt Test Reg */
879 /* 0x0d2a - 0x0d3f: reserved */
880
881/* Transmit GMAC FIFO (YUKON only), use MR_ADDR() to access */
882#define TX_GMF_EA 0x0d40 /* 32 bit Tx GMAC FIFO End Address */
883#define TX_GMF_AE_THR 0x0d44 /* 32 bit Tx GMAC FIFO Almost Empty Thresh.*/
884#define TX_GMF_CTRL_T 0x0d48 /* 32 bit Tx GMAC FIFO Control/Test */
885 /* 0x0d4c - 0x0d5f: reserved */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200886#define TX_GMF_WP 0x0d60 /* 32 bit Tx GMAC FIFO Write Pointer */
887#define TX_GMF_WSP 0x0d64 /* 32 bit Tx GMAC FIFO Write Shadow Ptr. */
888#define TX_GMF_WLEV 0x0d68 /* 32 bit Tx GMAC FIFO Write Level */
wdenk7152b1d2003-09-05 23:19:14 +0000889 /* 0x0d6c - 0x0d6f: reserved */
Wolfgang Denk53677ef2008-05-20 16:00:29 +0200890#define TX_GMF_RP 0x0d70 /* 32 bit Tx GMAC FIFO Read Pointer */
891#define TX_GMF_RSTP 0x0d74 /* 32 bit Tx GMAC FIFO Restart Pointer */
892#define TX_GMF_RLEV 0x0d78 /* 32 bit Tx GMAC FIFO Read Level */
wdenk7152b1d2003-09-05 23:19:14 +0000893 /* 0x0d7c - 0x0d7f: reserved */
894
895/*
896 * Bank 27
897 */
898 /* 0x0d80 - 0x0dbf: MAC 2 */
899 /* 0x0daa - 0x0dff: reserved */
900
901/*
902 * Bank 28
903 */
904/* Descriptor Poll Timer Registers */
905#define B28_DPT_INI 0x0e00 /* 24 bit Descriptor Poll Timer Init Val */
906#define B28_DPT_VAL 0x0e04 /* 24 bit Descriptor Poll Timer Curr Val */
907#define B28_DPT_CTRL 0x0e08 /* 8 bit Descriptor Poll Timer Ctrl Reg */
908 /* 0x0e09: reserved */
909#define B28_DPT_TST 0x0e0a /* 8 bit Descriptor Poll Timer Test Reg */
910 /* 0x0e0b: reserved */
911
912/* Time Stamp Timer Registers (YUKON only) */
913 /* 0x0e10: reserved */
914#define GMAC_TI_ST_VAL 0x0e14 /* 32 bit Time Stamp Timer Curr Val */
915#define GMAC_TI_ST_CTRL 0x0e18 /* 8 bit Time Stamp Timer Ctrl Reg */
916 /* 0x0e19: reserved */
917#define GMAC_TI_ST_TST 0x0e1a /* 8 bit Time Stamp Timer Test Reg */
918 /* 0x0e1b - 0x0e7f: reserved */
919
920/*
921 * Bank 29
922 */
923 /* 0x0e80 - 0x0efc: reserved */
924
925/*
926 * Bank 30
927 */
928/* GMAC and GPHY Control Registers (YUKON only) */
929#define GMAC_CTRL 0x0f00 /* 32 bit GMAC Control Reg */
930#define GPHY_CTRL 0x0f04 /* 32 bit GPHY Control Reg */
931#define GMAC_IRQ_SRC 0x0f08 /* 8 bit GMAC Interrupt Source Reg */
932 /* 0x0f09 - 0x0f0b: reserved */
933#define GMAC_IRQ_MSK 0x0f0c /* 8 bit GMAC Interrupt Mask Reg */
934 /* 0x0f0d - 0x0f0f: reserved */
935#define GMAC_LINK_CTRL 0x0f10 /* 16 bit Link Control Reg */
936 /* 0x0f14 - 0x0f1f: reserved */
937
938/* Wake-up Frame Pattern Match Control Registers (YUKON only) */
939
940#define WOL_REG_OFFS 0x20 /* HW-Bug: Address is + 0x20 against spec. */
941
942#define WOL_CTRL_STAT 0x0f20 /* 16 bit WOL Control/Status Reg */
943#define WOL_MATCH_CTL 0x0f22 /* 8 bit WOL Match Control Reg */
944#define WOL_MATCH_RES 0x0f23 /* 8 bit WOL Match Result Reg */
945#define WOL_MAC_ADDR_LO 0x0f24 /* 32 bit WOL MAC Address Low */
946#define WOL_MAC_ADDR_HI 0x0f28 /* 16 bit WOL MAC Address High */
947#define WOL_PATT_RPTR 0x0f2c /* 8 bit WOL Pattern Read Ptr */
948
949/* use this macro to access above registers */
950#define WOL_REG(Reg) ((Reg) + (pAC->GIni.GIWolOffs))
951
952
953/* WOL Pattern Length Registers (YUKON only) */
954
955#define WOL_PATT_LEN_LO 0x0f30 /* 32 bit WOL Pattern Length 3..0 */
956#define WOL_PATT_LEN_HI 0x0f34 /* 24 bit WOL Pattern Length 6..4 */
957
958/* WOL Pattern Counter Registers (YUKON only) */
959
960#define WOL_PATT_CNT_0 0x0f38 /* 32 bit WOL Pattern Counter 3..0 */
961#define WOL_PATT_CNT_4 0x0f3c /* 24 bit WOL Pattern Counter 6..4 */
962 /* 0x0f40 - 0x0f7f: reserved */
963
964/*
965 * Bank 31
966 */
967/* 0x0f80 - 0x0fff: reserved */
968
969/*
970 * Bank 32 - 33
971 */
972#define WOL_PATT_RAM_1 0x1000 /* WOL Pattern RAM Link 1 */
973
974/*
975 * Bank 0x22 - 0x3f
976 */
977/* 0x1100 - 0x1fff: reserved */
978
979/*
980 * Bank 0x40 - 0x4f
981 */
982#define BASE_XMAC_1 0x2000 /* XMAC 1 registers */
983
984/*
985 * Bank 0x50 - 0x5f
986 */
987
988#define BASE_GMAC_1 0x2800 /* GMAC 1 registers */
989
990/*
991 * Bank 0x60 - 0x6f
992 */
993#define BASE_XMAC_2 0x3000 /* XMAC 2 registers */
994
995/*
996 * Bank 0x70 - 0x7f
997 */
998#define BASE_GMAC_2 0x3800 /* GMAC 2 registers */
999
1000/*
1001 * Control Register Bit Definitions:
1002 */
1003/* B0_RAP 8 bit Register Address Port */
1004 /* Bit 7: reserved */
1005#define RAP_RAP 0x3f /* Bit 6..0: 0 = block 0,..,6f = block 6f */
1006
1007/* B0_CTST 16 bit Control/Status register */
1008 /* Bit 15..14: reserved */
1009#define CS_CLK_RUN_HOT BIT_13S /* CLK_RUN hot m. (YUKON-Lite only) */
1010#define CS_CLK_RUN_RST BIT_12S /* CLK_RUN reset (YUKON-Lite only) */
1011#define CS_CLK_RUN_ENA BIT_11S /* CLK_RUN enable (YUKON-Lite only) */
1012#define CS_VAUX_AVAIL BIT_10S /* VAUX available (YUKON only) */
1013#define CS_BUS_CLOCK BIT_9S /* Bus Clock 0/1 = 33/66 MHz */
1014#define CS_BUS_SLOT_SZ BIT_8S /* Slot Size 0/1 = 32/64 bit slot */
1015#define CS_ST_SW_IRQ BIT_7S /* Set IRQ SW Request */
1016#define CS_CL_SW_IRQ BIT_6S /* Clear IRQ SW Request */
1017#define CS_STOP_DONE BIT_5S /* Stop Master is finished */
1018#define CS_STOP_MAST BIT_4S /* Command Bit to stop the master */
1019#define CS_MRST_CLR BIT_3S /* Clear Master reset */
1020#define CS_MRST_SET BIT_2S /* Set Master reset */
1021#define CS_RST_CLR BIT_1S /* Clear Software reset */
1022#define CS_RST_SET BIT_0S /* Set Software reset */
1023
1024/* B0_LED 8 Bit LED register */
1025 /* Bit 7.. 2: reserved */
1026#define LED_STAT_ON BIT_1S /* Status LED on */
1027#define LED_STAT_OFF BIT_0S /* Status LED off */
1028
1029/* B0_POWER_CTRL 8 Bit Power Control reg (YUKON only) */
1030#define PC_VAUX_ENA BIT_7 /* Switch VAUX Enable */
1031#define PC_VAUX_DIS BIT_6 /* Switch VAUX Disable */
1032#define PC_VCC_ENA BIT_5 /* Switch VCC Enable */
1033#define PC_VCC_DIS BIT_4 /* Switch VCC Disable */
1034#define PC_VAUX_ON BIT_3 /* Switch VAUX On */
1035#define PC_VAUX_OFF BIT_2 /* Switch VAUX Off */
1036#define PC_VCC_ON BIT_1 /* Switch VCC On */
1037#define PC_VCC_OFF BIT_0 /* Switch VCC Off */
1038
1039/* B0_ISRC 32 bit Interrupt Source Register */
1040/* B0_IMSK 32 bit Interrupt Mask Register */
1041/* B0_SP_ISRC 32 bit Special Interrupt Source Reg */
Wolfgang Denk53677ef2008-05-20 16:00:29 +02001042/* B2_IRQM_MSK 32 bit IRQ Moderation Mask */
1043#define IS_ALL_MSK 0xbfffffffL /* All Interrupt bits */
wdenk7152b1d2003-09-05 23:19:14 +00001044#define IS_HW_ERR BIT_31 /* Interrupt HW Error */
1045 /* Bit 30: reserved */
1046#define IS_PA_TO_RX1 BIT_29 /* Packet Arb Timeout Rx1 */
1047#define IS_PA_TO_RX2 BIT_28 /* Packet Arb Timeout Rx2 */
1048#define IS_PA_TO_TX1 BIT_27 /* Packet Arb Timeout Tx1 */
1049#define IS_PA_TO_TX2 BIT_26 /* Packet Arb Timeout Tx2 */
1050#define IS_I2C_READY BIT_25 /* IRQ on end of I2C Tx */
1051#define IS_IRQ_SW BIT_24 /* SW forced IRQ */
1052#define IS_EXT_REG BIT_23 /* IRQ from LM80 or PHY (GENESIS only) */
1053 /* IRQ from PHY (YUKON only) */
1054#define IS_TIMINT BIT_22 /* IRQ from Timer */
1055#define IS_MAC1 BIT_21 /* IRQ from MAC 1 */
1056#define IS_LNK_SYNC_M1 BIT_20 /* Link Sync Cnt wrap MAC 1 */
1057#define IS_MAC2 BIT_19 /* IRQ from MAC 2 */
1058#define IS_LNK_SYNC_M2 BIT_18 /* Link Sync Cnt wrap MAC 2 */
1059/* Receive Queue 1 */
1060#define IS_R1_B BIT_17 /* Q_R1 End of Buffer */
1061#define IS_R1_F BIT_16 /* Q_R1 End of Frame */
1062#define IS_R1_C BIT_15 /* Q_R1 Encoding Error */
1063/* Receive Queue 2 */
1064#define IS_R2_B BIT_14 /* Q_R2 End of Buffer */
1065#define IS_R2_F BIT_13 /* Q_R2 End of Frame */
1066#define IS_R2_C BIT_12 /* Q_R2 Encoding Error */
1067/* Synchronous Transmit Queue 1 */
1068#define IS_XS1_B BIT_11 /* Q_XS1 End of Buffer */
1069#define IS_XS1_F BIT_10 /* Q_XS1 End of Frame */
1070#define IS_XS1_C BIT_9 /* Q_XS1 Encoding Error */
1071/* Asynchronous Transmit Queue 1 */
1072#define IS_XA1_B BIT_8 /* Q_XA1 End of Buffer */
1073#define IS_XA1_F BIT_7 /* Q_XA1 End of Frame */
1074#define IS_XA1_C BIT_6 /* Q_XA1 Encoding Error */
1075/* Synchronous Transmit Queue 2 */
1076#define IS_XS2_B BIT_5 /* Q_XS2 End of Buffer */
1077#define IS_XS2_F BIT_4 /* Q_XS2 End of Frame */
1078#define IS_XS2_C BIT_3 /* Q_XS2 Encoding Error */
1079/* Asynchronous Transmit Queue 2 */
1080#define IS_XA2_B BIT_2 /* Q_XA2 End of Buffer */
1081#define IS_XA2_F BIT_1 /* Q_XA2 End of Frame */
1082#define IS_XA2_C BIT_0 /* Q_XA2 Encoding Error */
1083
1084
1085/* B0_HWE_ISRC 32 bit HW Error Interrupt Src Reg */
1086/* B0_HWE_IMSK 32 bit HW Error Interrupt Mask Reg */
1087/* B2_IRQM_HWE_MSK 32 bit IRQ Moderation HW Error Mask */
Wolfgang Denk53677ef2008-05-20 16:00:29 +02001088#define IS_ERR_MSK 0x00000fffL /* All Error bits */
wdenk7152b1d2003-09-05 23:19:14 +00001089 /* Bit 31..14: reserved */
1090#define IS_IRQ_TIST_OV BIT_13 /* Time Stamp Timer Overflow (YUKON only) */
1091#define IS_IRQ_SENSOR BIT_12 /* IRQ from Sensor (YUKON only) */
1092#define IS_IRQ_MST_ERR BIT_11 /* IRQ master error detected */
1093#define IS_IRQ_STAT BIT_10 /* IRQ status exception */
1094#define IS_NO_STAT_M1 BIT_9 /* No Rx Status from MAC 1 */
1095#define IS_NO_STAT_M2 BIT_8 /* No Rx Status from MAC 2 */
1096#define IS_NO_TIST_M1 BIT_7 /* No Time Stamp from MAC 1 */
1097#define IS_NO_TIST_M2 BIT_6 /* No Time Stamp from MAC 2 */
1098#define IS_RAM_RD_PAR BIT_5 /* RAM Read Parity Error */
1099#define IS_RAM_WR_PAR BIT_4 /* RAM Write Parity Error */
1100#define IS_M1_PAR_ERR BIT_3 /* MAC 1 Parity Error */
1101#define IS_M2_PAR_ERR BIT_2 /* MAC 2 Parity Error */
1102#define IS_R1_PAR_ERR BIT_1 /* Queue R1 Parity Error */
1103#define IS_R2_PAR_ERR BIT_0 /* Queue R2 Parity Error */
1104
1105/* B2_CONN_TYP 8 bit Connector type */
1106/* B2_PMD_TYP 8 bit PMD type */
1107/* Values of connector and PMD type comply to SysKonnect internal std */
1108
1109/* B2_MAC_CFG 8 bit MAC Configuration / Chip Revision */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +02001110#define CONFIG_SYS_CHIP_R_MSK (0xf<<4) /* Bit 7.. 4: Chip Revision */
wdenk7152b1d2003-09-05 23:19:14 +00001111 /* Bit 3.. 2: reserved */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +02001112#define CONFIG_SYS_DIS_M2_CLK BIT_1S /* Disable Clock for 2nd MAC */
1113#define CONFIG_SYS_SNG_MAC BIT_0S /* MAC Config: 0=2 MACs / 1=1 MAC*/
wdenk7152b1d2003-09-05 23:19:14 +00001114
Wolfgang Denk53677ef2008-05-20 16:00:29 +02001115/* B2_CHIP_ID 8 bit Chip Identification Number */
wdenk7152b1d2003-09-05 23:19:14 +00001116#define CHIP_ID_GENESIS 0x0a /* Chip ID for GENESIS */
1117#define CHIP_ID_YUKON 0xb0 /* Chip ID for YUKON */
1118
1119/* B2_FAR 32 bit Flash-Prom Addr Reg/Cnt */
1120#define FAR_ADDR 0x1ffffL /* Bit 16.. 0: FPROM Address mask */
1121
1122/* B2_LD_CRTL 8 bit EPROM loader control register */
1123/* Bits are currently reserved */
1124
1125/* B2_LD_TEST 8 bit EPROM loader test register */
1126 /* Bit 7.. 4: reserved */
1127#define LD_T_ON BIT_3S /* Loader Test mode on */
1128#define LD_T_OFF BIT_2S /* Loader Test mode off */
1129#define LD_T_STEP BIT_1S /* Decrement FPROM addr. Counter */
1130#define LD_START BIT_0S /* Start loading FPROM */
1131
1132/*
1133 * Timer Section
1134 */
1135/* B2_TI_CRTL 8 bit Timer control */
1136/* B2_IRQM_CTRL 8 bit IRQ Moderation Timer Control */
1137 /* Bit 7.. 3: reserved */
1138#define TIM_START BIT_2S /* Start Timer */
1139#define TIM_STOP BIT_1S /* Stop Timer */
1140#define TIM_CLR_IRQ BIT_0S /* Clear Timer IRQ (!IRQM) */
1141
1142/* B2_TI_TEST 8 Bit Timer Test */
1143/* B2_IRQM_TEST 8 bit IRQ Moderation Timer Test */
1144/* B28_DPT_TST 8 bit Descriptor Poll Timer Test Reg */
1145 /* Bit 7.. 3: reserved */
1146#define TIM_T_ON BIT_2S /* Test mode on */
1147#define TIM_T_OFF BIT_1S /* Test mode off */
1148#define TIM_T_STEP BIT_0S /* Test step */
1149
1150/* B28_DPT_INI 32 bit Descriptor Poll Timer Init Val */
1151/* B28_DPT_VAL 32 bit Descriptor Poll Timer Curr Val */
1152 /* Bit 31..24: reserved */
1153#define DPT_MSK 0x00ffffffL /* Bit 23.. 0: Desc Poll Timer Bits */
1154
1155/* B28_DPT_CTRL 8 bit Descriptor Poll Timer Ctrl Reg */
1156 /* Bit 7.. 2: reserved */
1157#define DPT_START BIT_1S /* Start Descriptor Poll Timer */
1158#define DPT_STOP BIT_0S /* Stop Descriptor Poll Timer */
1159
Wolfgang Denk53677ef2008-05-20 16:00:29 +02001160/* B2_E_3 8 bit lower 4 bits used for HW self test result */
wdenk7152b1d2003-09-05 23:19:14 +00001161#define B2_E3_RES_MASK 0x0f
1162
1163/* B2_TST_CTRL1 8 bit Test Control Register 1 */
1164#define TST_FRC_DPERR_MR BIT_7S /* force DATAPERR on MST RD */
1165#define TST_FRC_DPERR_MW BIT_6S /* force DATAPERR on MST WR */
1166#define TST_FRC_DPERR_TR BIT_5S /* force DATAPERR on TRG RD */
1167#define TST_FRC_DPERR_TW BIT_4S /* force DATAPERR on TRG WR */
1168#define TST_FRC_APERR_M BIT_3S /* force ADDRPERR on MST */
1169#define TST_FRC_APERR_T BIT_2S /* force ADDRPERR on TRG */
1170#define TST_CFG_WRITE_ON BIT_1S /* Enable Config Reg WR */
1171#define TST_CFG_WRITE_OFF BIT_0S /* Disable Config Reg WR */
1172
1173/* B2_TST_CTRL2 8 bit Test Control Register 2 */
1174 /* Bit 7.. 4: reserved */
1175 /* force the following error on the next master read/write */
1176#define TST_FRC_DPERR_MR64 BIT_3S /* DataPERR RD 64 */
1177#define TST_FRC_DPERR_MW64 BIT_2S /* DataPERR WR 64 */
1178#define TST_FRC_APERR_1M64 BIT_1S /* AddrPERR on 1. phase */
1179#define TST_FRC_APERR_2M64 BIT_0S /* AddrPERR on 2. phase */
1180
1181/* B2_GP_IO 32 bit General Purpose I/O Register */
1182 /* Bit 31..26: reserved */
1183#define GP_DIR_9 BIT_25 /* IO_9 direct, 0=I/1=O */
1184#define GP_DIR_8 BIT_24 /* IO_8 direct, 0=I/1=O */
1185#define GP_DIR_7 BIT_23 /* IO_7 direct, 0=I/1=O */
1186#define GP_DIR_6 BIT_22 /* IO_6 direct, 0=I/1=O */
1187#define GP_DIR_5 BIT_21 /* IO_5 direct, 0=I/1=O */
1188#define GP_DIR_4 BIT_20 /* IO_4 direct, 0=I/1=O */
1189#define GP_DIR_3 BIT_19 /* IO_3 direct, 0=I/1=O */
1190#define GP_DIR_2 BIT_18 /* IO_2 direct, 0=I/1=O */
1191#define GP_DIR_1 BIT_17 /* IO_1 direct, 0=I/1=O */
1192#define GP_DIR_0 BIT_16 /* IO_0 direct, 0=I/1=O */
1193 /* Bit 15..10: reserved */
1194#define GP_IO_9 BIT_9 /* IO_9 pin */
1195#define GP_IO_8 BIT_8 /* IO_8 pin */
1196#define GP_IO_7 BIT_7 /* IO_7 pin */
1197#define GP_IO_6 BIT_6 /* IO_6 pin */
1198#define GP_IO_5 BIT_5 /* IO_5 pin */
1199#define GP_IO_4 BIT_4 /* IO_4 pin */
1200#define GP_IO_3 BIT_3 /* IO_3 pin */
1201#define GP_IO_2 BIT_2 /* IO_2 pin */
1202#define GP_IO_1 BIT_1 /* IO_1 pin */
1203#define GP_IO_0 BIT_0 /* IO_0 pin */
1204
1205/* B2_I2C_CTRL 32 bit I2C HW Control Register */
1206#define I2C_FLAG BIT_31 /* Start read/write if WR */
1207#define I2C_ADDR (0x7fffL<<16) /* Bit 30..16: Addr to be RD/WR */
1208#define I2C_DEV_SEL (0x7fL<<9) /* Bit 15.. 9: I2C Device Select */
1209 /* Bit 8.. 5: reserved */
1210#define I2C_BURST_LEN BIT_4 /* Burst Len, 1/4 bytes */
1211#define I2C_DEV_SIZE (7L<<1) /* Bit 3.. 1: I2C Device Size */
1212#define I2C_025K_DEV (0L<<1) /* 0: 256 Bytes or smal. */
Wolfgang Denk53677ef2008-05-20 16:00:29 +02001213#define I2C_05K_DEV (1L<<1) /* 1: 512 Bytes */
wdenk7152b1d2003-09-05 23:19:14 +00001214#define I2C_1K_DEV (2L<<1) /* 2: 1024 Bytes */
1215#define I2C_2K_DEV (3L<<1) /* 3: 2048 Bytes */
1216#define I2C_4K_DEV (4L<<1) /* 4: 4096 Bytes */
1217#define I2C_8K_DEV (5L<<1) /* 5: 8192 Bytes */
1218#define I2C_16K_DEV (6L<<1) /* 6: 16384 Bytes */
1219#define I2C_32K_DEV (7L<<1) /* 7: 32768 Bytes */
1220#define I2C_STOP BIT_0 /* Interrupt I2C transfer */
1221
1222/* B2_I2C_IRQ 32 bit I2C HW IRQ Register */
1223 /* Bit 31.. 1 reserved */
1224#define I2C_CLR_IRQ BIT_0 /* Clear I2C IRQ */
1225
1226/* B2_I2C_SW 32 bit (8 bit access) I2C HW SW Port Register */
1227 /* Bit 7.. 3: reserved */
1228#define I2C_DATA_DIR BIT_2S /* direction of I2C_DATA */
1229#define I2C_DATA BIT_1S /* I2C Data Port */
1230#define I2C_CLK BIT_0S /* I2C Clock Port */
1231
1232/*
1233 * I2C Address
1234 */
1235#define I2C_SENS_ADDR LM80_ADDR /* I2C Sensor Address, (Volt and Temp)*/
1236
1237
1238/* B2_BSC_CTRL 8 bit Blink Source Counter Control */
1239 /* Bit 7.. 2: reserved */
1240#define BSC_START BIT_1S /* Start Blink Source Counter */
1241#define BSC_STOP BIT_0S /* Stop Blink Source Counter */
1242
1243/* B2_BSC_STAT 8 bit Blink Source Counter Status */
1244 /* Bit 7.. 1: reserved */
1245#define BSC_SRC BIT_0S /* Blink Source, 0=Off / 1=On */
1246
1247/* B2_BSC_TST 16 bit Blink Source Counter Test Reg */
1248#define BSC_T_ON BIT_2S /* Test mode on */
1249#define BSC_T_OFF BIT_1S /* Test mode off */
1250#define BSC_T_STEP BIT_0S /* Test step */
1251
1252
1253/* B3_RAM_ADDR 32 bit RAM Address, to read or write */
1254 /* Bit 31..19: reserved */
1255#define RAM_ADR_RAN 0x0007ffffL /* Bit 18.. 0: RAM Address Range */
1256
1257/* RAM Interface Registers */
1258/* B3_RI_CTRL 16 bit RAM Iface Control Register */
1259 /* Bit 15..10: reserved */
1260#define RI_CLR_RD_PERR BIT_9S /* Clear IRQ RAM Read Parity Err */
1261#define RI_CLR_WR_PERR BIT_8S /* Clear IRQ RAM Write Parity Err*/
1262 /* Bit 7.. 2: reserved */
1263#define RI_RST_CLR BIT_1S /* Clear RAM Interface Reset */
1264#define RI_RST_SET BIT_0S /* Set RAM Interface Reset */
1265
1266/* B3_RI_TEST 8 bit RAM Iface Test Register */
1267 /* Bit 15.. 4: reserved */
1268#define RI_T_EV BIT_3S /* Timeout Event occured */
1269#define RI_T_ON BIT_2S /* Timeout Timer Test On */
1270#define RI_T_OFF BIT_1S /* Timeout Timer Test Off */
1271#define RI_T_STEP BIT_0S /* Timeout Timer Step */
1272
1273/* MAC Arbiter Registers */
1274/* B3_MA_TO_CTRL 16 bit MAC Arbiter Timeout Ctrl Reg */
1275 /* Bit 15.. 4: reserved */
1276#define MA_FOE_ON BIT_3S /* XMAC Fast Output Enable ON */
1277#define MA_FOE_OFF BIT_2S /* XMAC Fast Output Enable OFF */
1278#define MA_RST_CLR BIT_1S /* Clear MAC Arbiter Reset */
1279#define MA_RST_SET BIT_0S /* Set MAC Arbiter Reset */
1280
1281/* B3_MA_RC_CTRL 16 bit MAC Arbiter Recovery Ctrl Reg */
1282 /* Bit 15.. 8: reserved */
1283#define MA_ENA_REC_TX2 BIT_7S /* Enable Recovery Timer TX2 */
1284#define MA_DIS_REC_TX2 BIT_6S /* Disable Recovery Timer TX2 */
1285#define MA_ENA_REC_TX1 BIT_5S /* Enable Recovery Timer TX1 */
1286#define MA_DIS_REC_TX1 BIT_4S /* Disable Recovery Timer TX1 */
1287#define MA_ENA_REC_RX2 BIT_3S /* Enable Recovery Timer RX2 */
1288#define MA_DIS_REC_RX2 BIT_2S /* Disable Recovery Timer RX2 */
1289#define MA_ENA_REC_RX1 BIT_1S /* Enable Recovery Timer RX1 */
1290#define MA_DIS_REC_RX1 BIT_0S /* Disable Recovery Timer RX1 */
1291
1292/* Packet Arbiter Registers */
1293/* B3_PA_CTRL 16 bit Packet Arbiter Ctrl Register */
1294 /* Bit 15..14: reserved */
1295#define PA_CLR_TO_TX2 BIT_13S /* Clear IRQ Packet Timeout TX2 */
1296#define PA_CLR_TO_TX1 BIT_12S /* Clear IRQ Packet Timeout TX1 */
1297#define PA_CLR_TO_RX2 BIT_11S /* Clear IRQ Packet Timeout RX2 */
1298#define PA_CLR_TO_RX1 BIT_10S /* Clear IRQ Packet Timeout RX1 */
1299#define PA_ENA_TO_TX2 BIT_9S /* Enable Timeout Timer TX2 */
1300#define PA_DIS_TO_TX2 BIT_8S /* Disable Timeout Timer TX2 */
1301#define PA_ENA_TO_TX1 BIT_7S /* Enable Timeout Timer TX1 */
1302#define PA_DIS_TO_TX1 BIT_6S /* Disable Timeout Timer TX1 */
1303#define PA_ENA_TO_RX2 BIT_5S /* Enable Timeout Timer RX2 */
1304#define PA_DIS_TO_RX2 BIT_4S /* Disable Timeout Timer RX2 */
1305#define PA_ENA_TO_RX1 BIT_3S /* Enable Timeout Timer RX1 */
1306#define PA_DIS_TO_RX1 BIT_2S /* Disable Timeout Timer RX1 */
1307#define PA_RST_CLR BIT_1S /* Clear MAC Arbiter Reset */
1308#define PA_RST_SET BIT_0S /* Set MAC Arbiter Reset */
1309
1310#define PA_ENA_TO_ALL (PA_ENA_TO_RX1 | PA_ENA_TO_RX2 |\
1311 PA_ENA_TO_TX1 | PA_ENA_TO_TX2)
1312
1313/* Rx/Tx Path related Arbiter Test Registers */
1314/* B3_MA_TO_TEST 16 bit MAC Arbiter Timeout Test Reg */
1315/* B3_MA_RC_TEST 16 bit MAC Arbiter Recovery Test Reg */
1316/* B3_PA_TEST 16 bit Packet Arbiter Test Register */
1317/* Bit 15, 11, 7, and 3 are reserved in B3_PA_TEST */
1318#define TX2_T_EV BIT_15S /* TX2 Timeout/Recv Event occured */
1319#define TX2_T_ON BIT_14S /* TX2 Timeout/Recv Timer Test On */
1320#define TX2_T_OFF BIT_13S /* TX2 Timeout/Recv Timer Tst Off */
1321#define TX2_T_STEP BIT_12S /* TX2 Timeout/Recv Timer Step */
1322#define TX1_T_EV BIT_11S /* TX1 Timeout/Recv Event occured */
1323#define TX1_T_ON BIT_10S /* TX1 Timeout/Recv Timer Test On */
1324#define TX1_T_OFF BIT_9S /* TX1 Timeout/Recv Timer Tst Off */
1325#define TX1_T_STEP BIT_8S /* TX1 Timeout/Recv Timer Step */
1326#define RX2_T_EV BIT_7S /* RX2 Timeout/Recv Event occured */
1327#define RX2_T_ON BIT_6S /* RX2 Timeout/Recv Timer Test On */
1328#define RX2_T_OFF BIT_5S /* RX2 Timeout/Recv Timer Tst Off */
1329#define RX2_T_STEP BIT_4S /* RX2 Timeout/Recv Timer Step */
1330#define RX1_T_EV BIT_3S /* RX1 Timeout/Recv Event occured */
1331#define RX1_T_ON BIT_2S /* RX1 Timeout/Recv Timer Test On */
1332#define RX1_T_OFF BIT_1S /* RX1 Timeout/Recv Timer Tst Off */
1333#define RX1_T_STEP BIT_0S /* RX1 Timeout/Recv Timer Step */
1334
1335
1336/* Transmit Arbiter Registers MAC 1 and 2, use MR_ADDR() to access */
1337/* TXA_ITI_INI 32 bit Tx Arb Interval Timer Init Val */
1338/* TXA_ITI_VAL 32 bit Tx Arb Interval Timer Value */
1339/* TXA_LIM_INI 32 bit Tx Arb Limit Counter Init Val */
1340/* TXA_LIM_VAL 32 bit Tx Arb Limit Counter Value */
1341 /* Bit 31..24: reserved */
1342#define TXA_MAX_VAL 0x00ffffffL /* Bit 23.. 0: Max TXA Timer/Cnt Val */
1343
1344/* TXA_CTRL 8 bit Tx Arbiter Control Register */
1345#define TXA_ENA_FSYNC BIT_7S /* Enable force of sync Tx queue */
1346#define TXA_DIS_FSYNC BIT_6S /* Disable force of sync Tx queue */
1347#define TXA_ENA_ALLOC BIT_5S /* Enable alloc of free bandwidth */
1348#define TXA_DIS_ALLOC BIT_4S /* Disable alloc of free bandwidth */
1349#define TXA_START_RC BIT_3S /* Start sync Rate Control */
1350#define TXA_STOP_RC BIT_2S /* Stop sync Rate Control */
1351#define TXA_ENA_ARB BIT_1S /* Enable Tx Arbiter */
1352#define TXA_DIS_ARB BIT_0S /* Disable Tx Arbiter */
1353
1354/* TXA_TEST 8 bit Tx Arbiter Test Register */
1355 /* Bit 7.. 6: reserved */
1356#define TXA_INT_T_ON BIT_5S /* Tx Arb Interval Timer Test On */
1357#define TXA_INT_T_OFF BIT_4S /* Tx Arb Interval Timer Test Off */
1358#define TXA_INT_T_STEP BIT_3S /* Tx Arb Interval Timer Step */
1359#define TXA_LIM_T_ON BIT_2S /* Tx Arb Limit Timer Test On */
1360#define TXA_LIM_T_OFF BIT_1S /* Tx Arb Limit Timer Test Off */
1361#define TXA_LIM_T_STEP BIT_0S /* Tx Arb Limit Timer Step */
1362
1363/* TXA_STAT 8 bit Tx Arbiter Status Register */
1364 /* Bit 7.. 1: reserved */
1365#define TXA_PRIO_XS BIT_0S /* sync queue has prio to send */
1366
1367/* Q_BC 32 bit Current Byte Counter */
1368 /* Bit 31..16: reserved */
1369#define BC_MAX 0xffff /* Bit 15.. 0: Byte counter */
1370
1371/* BMU Control Status Registers */
1372/* B0_R1_CSR 32 bit BMU Ctrl/Stat Rx Queue 1 */
1373/* B0_R2_CSR 32 bit BMU Ctrl/Stat Rx Queue 2 */
1374/* B0_XA1_CSR 32 bit BMU Ctrl/Stat Sync Tx Queue 1 */
1375/* B0_XS1_CSR 32 bit BMU Ctrl/Stat Async Tx Queue 1 */
1376/* B0_XA2_CSR 32 bit BMU Ctrl/Stat Sync Tx Queue 2 */
1377/* B0_XS2_CSR 32 bit BMU Ctrl/Stat Async Tx Queue 2 */
1378/* Q_CSR 32 bit BMU Control/Status Register */
1379 /* Bit 31..25: reserved */
1380#define CSR_SV_IDLE BIT_24 /* BMU SM Idle */
1381 /* Bit 23..22: reserved */
1382#define CSR_DESC_CLR BIT_21 /* Clear Reset for Descr */
1383#define CSR_DESC_SET BIT_20 /* Set Reset for Descr */
1384#define CSR_FIFO_CLR BIT_19 /* Clear Reset for FIFO */
1385#define CSR_FIFO_SET BIT_18 /* Set Reset for FIFO */
1386#define CSR_HPI_RUN BIT_17 /* Release HPI SM */
1387#define CSR_HPI_RST BIT_16 /* Reset HPI SM to Idle */
1388#define CSR_SV_RUN BIT_15 /* Release Supervisor SM */
1389#define CSR_SV_RST BIT_14 /* Reset Supervisor SM */
1390#define CSR_DREAD_RUN BIT_13 /* Release Descr Read SM */
1391#define CSR_DREAD_RST BIT_12 /* Reset Descr Read SM */
1392#define CSR_DWRITE_RUN BIT_11 /* Release Descr Write SM */
1393#define CSR_DWRITE_RST BIT_10 /* Reset Descr Write SM */
1394#define CSR_TRANS_RUN BIT_9 /* Release Transfer SM */
1395#define CSR_TRANS_RST BIT_8 /* Reset Transfer SM */
1396#define CSR_ENA_POL BIT_7 /* Enable Descr Polling */
1397#define CSR_DIS_POL BIT_6 /* Disable Descr Polling */
1398#define CSR_STOP BIT_5 /* Stop Rx/Tx Queue */
1399#define CSR_START BIT_4 /* Start Rx/Tx Queue */
1400#define CSR_IRQ_CL_P BIT_3 /* (Rx) Clear Parity IRQ */
1401#define CSR_IRQ_CL_B BIT_2 /* Clear EOB IRQ */
1402#define CSR_IRQ_CL_F BIT_1 /* Clear EOF IRQ */
1403#define CSR_IRQ_CL_C BIT_0 /* Clear ERR IRQ */
1404
1405#define CSR_SET_RESET (CSR_DESC_SET | CSR_FIFO_SET | CSR_HPI_RST |\
1406 CSR_SV_RST | CSR_DREAD_RST | CSR_DWRITE_RST |\
1407 CSR_TRANS_RST)
1408#define CSR_CLR_RESET (CSR_DESC_CLR | CSR_FIFO_CLR | CSR_HPI_RUN |\
1409 CSR_SV_RUN | CSR_DREAD_RUN | CSR_DWRITE_RUN |\
1410 CSR_TRANS_RUN)
1411
1412/* Q_F 32 bit Flag Register */
1413 /* Bit 31..28: reserved */
1414#define F_ALM_FULL BIT_27 /* Rx FIFO: almost full */
1415#define F_EMPTY BIT_27 /* Tx FIFO: empty flag */
1416#define F_FIFO_EOF BIT_26 /* Tag (EOF Flag) bit in FIFO */
1417#define F_WM_REACHED BIT_25 /* Watermark reached */
1418 /* reserved */
1419#define F_FIFO_LEVEL (0x1fL<<16) /* Bit 23..16: # of Qwords in FIFO */
Wolfgang Denk53677ef2008-05-20 16:00:29 +02001420 /* Bit 15..11: reserved */
wdenk7152b1d2003-09-05 23:19:14 +00001421#define F_WATER_MARK 0x0007ffL /* Bit 10.. 0: Watermark */
1422
1423/* Q_T1 32 bit Test Register 1 */
1424/* Holds four State Machine control Bytes */
1425#define SM_CRTL_SV_MSK (0xffL<<24) /* Bit 31..24: Control Supervisor SM */
1426#define SM_CRTL_RD_MSK (0xffL<<16) /* Bit 23..16: Control Read Desc SM */
1427#define SM_CRTL_WR_MSK (0xffL<<8) /* Bit 15.. 8: Control Write Desc SM */
1428#define SM_CRTL_TR_MSK 0xffL /* Bit 7.. 0: Control Transfer SM */
1429
1430/* Q_T1_TR 8 bit Test Register 1 Transfer SM */
1431/* Q_T1_WR 8 bit Test Register 1 Write Descriptor SM */
1432/* Q_T1_RD 8 bit Test Register 1 Read Descriptor SM */
1433/* Q_T1_SV 8 bit Test Register 1 Supervisor SM */
1434
1435/* The control status byte of each machine looks like ... */
1436#define SM_STATE 0xf0 /* Bit 7.. 4: State which shall be loaded */
1437#define SM_LOAD BIT_3S /* Load the SM with SM_STATE */
1438#define SM_TEST_ON BIT_2S /* Switch on SM Test Mode */
1439#define SM_TEST_OFF BIT_1S /* Go off the Test Mode */
1440#define SM_STEP BIT_0S /* Step the State Machine */
1441/* The encoding of the states is not supported by the Diagnostics Tool */
1442
1443/* Q_T2 32 bit Test Register 2 */
1444 /* Bit 31.. 8: reserved */
1445#define T2_AC_T_ON BIT_7 /* Address Counter Test Mode on */
1446#define T2_AC_T_OFF BIT_6 /* Address Counter Test Mode off */
1447#define T2_BC_T_ON BIT_5 /* Byte Counter Test Mode on */
1448#define T2_BC_T_OFF BIT_4 /* Byte Counter Test Mode off */
1449#define T2_STEP04 BIT_3 /* Inc AC/Dec BC by 4 */
1450#define T2_STEP03 BIT_2 /* Inc AC/Dec BC by 3 */
1451#define T2_STEP02 BIT_1 /* Inc AC/Dec BC by 2 */
1452#define T2_STEP01 BIT_0 /* Inc AC/Dec BC by 1 */
1453
1454/* Q_T3 32 bit Test Register 3 */
1455 /* Bit 31.. 7: reserved */
1456#define T3_MUX_MSK (7<<4) /* Bit 6.. 4: Mux Position */
1457 /* Bit 3: reserved */
1458#define T3_VRAM_MSK 7 /* Bit 2.. 0: Virtual RAM Buffer Address */
1459
1460/* RAM Buffer Register Offsets, use RB_ADDR(Queue, Offs) to access */
1461/* RB_START 32 bit RAM Buffer Start Address */
1462/* RB_END 32 bit RAM Buffer End Address */
1463/* RB_WP 32 bit RAM Buffer Write Pointer */
1464/* RB_RP 32 bit RAM Buffer Read Pointer */
1465/* RB_RX_UTPP 32 bit Rx Upper Threshold, Pause Pack */
1466/* RB_RX_LTPP 32 bit Rx Lower Threshold, Pause Pack */
1467/* RB_RX_UTHP 32 bit Rx Upper Threshold, High Prio */
1468/* RB_RX_LTHP 32 bit Rx Lower Threshold, High Prio */
1469/* RB_PC 32 bit RAM Buffer Packet Counter */
1470/* RB_LEV 32 bit RAM Buffer Level Register */
1471 /* Bit 31..19: reserved */
1472#define RB_MSK 0x0007ffff /* Bit 18.. 0: RAM Buffer Pointer Bits */
1473
1474/* RB_TST2 8 bit RAM Buffer Test Register 2 */
1475 /* Bit 7.. 4: reserved */
1476#define RB_PC_DEC BIT_3S /* Packet Counter Decrem */
1477#define RB_PC_T_ON BIT_2S /* Packet Counter Test On */
1478#define RB_PC_T_OFF BIT_1S /* Packet Counter Tst Off */
1479#define RB_PC_INC BIT_0S /* Packet Counter Increm */
1480
1481/* RB_TST1 8 bit RAM Buffer Test Register 1 */
1482 /* Bit 7: reserved */
1483#define RB_WP_T_ON BIT_6S /* Write Pointer Test On */
1484#define RB_WP_T_OFF BIT_5S /* Write Pointer Test Off */
1485#define RB_WP_INC BIT_4S /* Write Pointer Increm */
1486 /* Bit 3: reserved */
1487#define RB_RP_T_ON BIT_2S /* Read Pointer Test On */
1488#define RB_RP_T_OFF BIT_1S /* Read Pointer Test Off */
1489#define RB_RP_DEC BIT_0S /* Read Pointer Decrement */
1490
1491/* RB_CTRL 8 bit RAM Buffer Control Register */
1492 /* Bit 7.. 6: reserved */
1493#define RB_ENA_STFWD BIT_5S /* Enable Store & Forward */
1494#define RB_DIS_STFWD BIT_4S /* Disable Store & Forward */
1495#define RB_ENA_OP_MD BIT_3S /* Enable Operation Mode */
1496#define RB_DIS_OP_MD BIT_2S /* Disable Operation Mode */
1497#define RB_RST_CLR BIT_1S /* Clear RAM Buf STM Reset */
1498#define RB_RST_SET BIT_0S /* Set RAM Buf STM Reset */
1499
1500
1501/* Receive and Transmit MAC FIFO Registers (GENESIS only) */
1502
1503/* RX_MFF_EA 32 bit Receive MAC FIFO End Address */
Wolfgang Denk53677ef2008-05-20 16:00:29 +02001504/* RX_MFF_WP 32 bit Receive MAC FIFO Write Pointer */
wdenk7152b1d2003-09-05 23:19:14 +00001505/* RX_MFF_RP 32 bit Receive MAC FIFO Read Pointer */
1506/* RX_MFF_PC 32 bit Receive MAC FIFO Packet Counter */
1507/* RX_MFF_LEV 32 bit Receive MAC FIFO Level */
1508/* TX_MFF_EA 32 bit Transmit MAC FIFO End Address */
Wolfgang Denk53677ef2008-05-20 16:00:29 +02001509/* TX_MFF_WP 32 bit Transmit MAC FIFO Write Pointer */
wdenk7152b1d2003-09-05 23:19:14 +00001510/* TX_MFF_WSP 32 bit Transmit MAC FIFO WR Shadow Pointer */
1511/* TX_MFF_RP 32 bit Transmit MAC FIFO Read Pointer */
1512/* TX_MFF_PC 32 bit Transmit MAC FIFO Packet Cnt */
1513/* TX_MFF_LEV 32 bit Transmit MAC FIFO Level */
1514 /* Bit 31.. 6: reserved */
1515#define MFF_MSK 0x007fL /* Bit 5.. 0: MAC FIFO Address/Ptr Bits */
1516
1517/* RX_MFF_CTRL1 16 bit Receive MAC FIFO Control Reg 1 */
1518 /* Bit 15..14: reserved */
1519#define MFF_ENA_RDY_PAT BIT_13S /* Enable Ready Patch */
1520#define MFF_DIS_RDY_PAT BIT_12S /* Disable Ready Patch */
1521#define MFF_ENA_TIM_PAT BIT_11S /* Enable Timing Patch */
1522#define MFF_DIS_TIM_PAT BIT_10S /* Disable Timing Patch */
1523#define MFF_ENA_ALM_FUL BIT_9S /* Enable AlmostFull Sign */
1524#define MFF_DIS_ALM_FUL BIT_8S /* Disable AlmostFull Sign */
1525#define MFF_ENA_PAUSE BIT_7S /* Enable Pause Signaling */
1526#define MFF_DIS_PAUSE BIT_6S /* Disable Pause Signaling */
1527#define MFF_ENA_FLUSH BIT_5S /* Enable Frame Flushing */
1528#define MFF_DIS_FLUSH BIT_4S /* Disable Frame Flushing */
1529#define MFF_ENA_TIST BIT_3S /* Enable Time Stamp Gener */
1530#define MFF_DIS_TIST BIT_2S /* Disable Time Stamp Gener */
1531#define MFF_CLR_INTIST BIT_1S /* Clear IRQ No Time Stamp */
1532#define MFF_CLR_INSTAT BIT_0S /* Clear IRQ No Status */
1533
1534#define MFF_RX_CTRL_DEF MFF_ENA_TIM_PAT
1535
1536/* TX_MFF_CTRL1 16 bit Transmit MAC FIFO Control Reg 1 */
1537#define MFF_CLR_PERR BIT_15S /* Clear Parity Error IRQ */
1538 /* Bit 14: reserved */
1539#define MFF_ENA_PKT_REC BIT_13S /* Enable Packet Recovery */
1540#define MFF_DIS_PKT_REC BIT_12S /* Disable Packet Recovery */
1541/* MFF_ENA_TIM_PAT (see RX_MFF_CTRL1) Bit 11: Enable Timing Patch */
1542/* MFF_DIS_TIM_PAT (see RX_MFF_CTRL1) Bit 10: Disable Timing Patch */
1543/* MFF_ENA_ALM_FUL (see RX_MFF_CTRL1) Bit 9: Enable Almost Full Sign */
1544/* MFF_DIS_ALM_FUL (see RX_MFF_CTRL1) Bit 8: Disable Almost Full Sign */
1545#define MFF_ENA_W4E BIT_7S /* Enable Wait for Empty */
1546#define MFF_DIS_W4E BIT_6S /* Disable Wait for Empty */
1547/* MFF_ENA_FLUSH (see RX_MFF_CTRL1) Bit 5: Enable Frame Flushing */
1548/* MFF_DIS_FLUSH (see RX_MFF_CTRL1) Bit 4: Disable Frame Flushing */
1549#define MFF_ENA_LOOPB BIT_3S /* Enable Loopback */
1550#define MFF_DIS_LOOPB BIT_2S /* Disable Loopback */
1551#define MFF_CLR_MAC_RST BIT_1S /* Clear XMAC Reset */
1552#define MFF_SET_MAC_RST BIT_0S /* Set XMAC Reset */
1553
1554#define MFF_TX_CTRL_DEF (MFF_ENA_PKT_REC | MFF_ENA_TIM_PAT | MFF_ENA_FLUSH)
1555
Wolfgang Denk53677ef2008-05-20 16:00:29 +02001556/* RX_MFF_TST2 8 bit Receive MAC FIFO Test Register 2 */
1557/* TX_MFF_TST2 8 bit Transmit MAC FIFO Test Register 2 */
wdenk7152b1d2003-09-05 23:19:14 +00001558 /* Bit 7: reserved */
1559#define MFF_WSP_T_ON BIT_6S /* Tx: Write Shadow Ptr TestOn */
1560#define MFF_WSP_T_OFF BIT_5S /* Tx: Write Shadow Ptr TstOff */
1561#define MFF_WSP_INC BIT_4S /* Tx: Write Shadow Ptr Increment */
1562#define MFF_PC_DEC BIT_3S /* Packet Counter Decrement */
1563#define MFF_PC_T_ON BIT_2S /* Packet Counter Test On */
1564#define MFF_PC_T_OFF BIT_1S /* Packet Counter Test Off */
1565#define MFF_PC_INC BIT_0S /* Packet Counter Increment */
1566
Wolfgang Denk53677ef2008-05-20 16:00:29 +02001567/* RX_MFF_TST1 8 bit Receive MAC FIFO Test Register 1 */
1568/* TX_MFF_TST1 8 bit Transmit MAC FIFO Test Register 1 */
wdenk7152b1d2003-09-05 23:19:14 +00001569 /* Bit 7: reserved */
1570#define MFF_WP_T_ON BIT_6S /* Write Pointer Test On */
1571#define MFF_WP_T_OFF BIT_5S /* Write Pointer Test Off */
1572#define MFF_WP_INC BIT_4S /* Write Pointer Increm */
1573 /* Bit 3: reserved */
1574#define MFF_RP_T_ON BIT_2S /* Read Pointer Test On */
1575#define MFF_RP_T_OFF BIT_1S /* Read Pointer Test Off */
1576#define MFF_RP_DEC BIT_0S /* Read Pointer Decrement */
1577
1578/* RX_MFF_CTRL2 8 bit Receive MAC FIFO Control Reg 2 */
1579/* TX_MFF_CTRL2 8 bit Transmit MAC FIFO Control Reg 2 */
1580 /* Bit 7..4: reserved */
1581#define MFF_ENA_OP_MD BIT_3S /* Enable Operation Mode */
1582#define MFF_DIS_OP_MD BIT_2S /* Disable Operation Mode */
1583#define MFF_RST_CLR BIT_1S /* Clear MAC FIFO Reset */
1584#define MFF_RST_SET BIT_0S /* Set MAC FIFO Reset */
1585
1586
1587/* Link LED Counter Registers (GENESIS only) */
1588
1589/* RX_LED_CTRL 8 bit Receive LED Cnt Control Reg */
1590/* TX_LED_CTRL 8 bit Transmit LED Cnt Control Reg */
1591/* LNK_SYNC_CTRL 8 bit Link Sync Cnt Control Register */
1592 /* Bit 7.. 3: reserved */
1593#define LED_START BIT_2S /* Start Timer */
1594#define LED_STOP BIT_1S /* Stop Timer */
1595#define LED_STATE BIT_0S /* Rx/Tx: LED State, 1=LED on */
Wolfgang Denk53677ef2008-05-20 16:00:29 +02001596#define LED_CLR_IRQ BIT_0S /* Lnk: Clear Link IRQ */
wdenk7152b1d2003-09-05 23:19:14 +00001597
1598/* RX_LED_TST 8 bit Receive LED Cnt Test Register */
1599/* TX_LED_TST 8 bit Transmit LED Cnt Test Register */
1600/* LNK_SYNC_TST 8 bit Link Sync Cnt Test Register */
1601 /* Bit 7.. 3: reserved */
1602#define LED_T_ON BIT_2S /* LED Counter Test mode On */
1603#define LED_T_OFF BIT_1S /* LED Counter Test mode Off */
1604#define LED_T_STEP BIT_0S /* LED Counter Step */
1605
Wolfgang Denk53677ef2008-05-20 16:00:29 +02001606/* LNK_LED_REG 8 bit Link LED Register */
wdenk7152b1d2003-09-05 23:19:14 +00001607 /* Bit 7.. 6: reserved */
1608#define LED_BLK_ON BIT_5S /* Link LED Blinking On */
1609#define LED_BLK_OFF BIT_4S /* Link LED Blinking Off */
1610#define LED_SYNC_ON BIT_3S /* Use Sync Wire to switch LED */
1611#define LED_SYNC_OFF BIT_2S /* Disable Sync Wire Input */
1612#define LED_ON BIT_1S /* switch LED on */
1613#define LED_OFF BIT_0S /* switch LED off */
1614
1615/* Receive and Transmit GMAC FIFO Registers (YUKON only) */
1616
1617/* RX_GMF_EA 32 bit Rx GMAC FIFO End Address */
1618/* RX_GMF_AF_THR 32 bit Rx GMAC FIFO Almost Full Thresh. */
Wolfgang Denk53677ef2008-05-20 16:00:29 +02001619/* RX_GMF_WP 32 bit Rx GMAC FIFO Write Pointer */
1620/* RX_GMF_WLEV 32 bit Rx GMAC FIFO Write Level */
1621/* RX_GMF_RP 32 bit Rx GMAC FIFO Read Pointer */
1622/* RX_GMF_RLEV 32 bit Rx GMAC FIFO Read Level */
wdenk7152b1d2003-09-05 23:19:14 +00001623/* TX_GMF_EA 32 bit Tx GMAC FIFO End Address */
1624/* TX_GMF_AE_THR 32 bit Tx GMAC FIFO Almost Empty Thresh.*/
Wolfgang Denk53677ef2008-05-20 16:00:29 +02001625/* TX_GMF_WP 32 bit Tx GMAC FIFO Write Pointer */
1626/* TX_GMF_WSP 32 bit Tx GMAC FIFO Write Shadow Ptr. */
1627/* TX_GMF_WLEV 32 bit Tx GMAC FIFO Write Level */
1628/* TX_GMF_RP 32 bit Tx GMAC FIFO Read Pointer */
1629/* TX_GMF_RSTP 32 bit Tx GMAC FIFO Restart Pointer */
1630/* TX_GMF_RLEV 32 bit Tx GMAC FIFO Read Level */
wdenk7152b1d2003-09-05 23:19:14 +00001631
1632/* RX_GMF_CTRL_T 32 bit Rx GMAC FIFO Control/Test */
1633 /* Bits 31..15: reserved */
1634#define GMF_WP_TST_ON BIT_14 /* Write Pointer Test On */
1635#define GMF_WP_TST_OFF BIT_13 /* Write Pointer Test Off */
1636#define GMF_WP_STEP BIT_12 /* Write Pointer Step/Increment */
1637 /* Bit 11: reserved */
1638#define GMF_RP_TST_ON BIT_10 /* Read Pointer Test On */
1639#define GMF_RP_TST_OFF BIT_9 /* Read Pointer Test Off */
1640#define GMF_RP_STEP BIT_8 /* Read Pointer Step/Increment */
1641#define GMF_RX_F_FL_ON BIT_7 /* Rx FIFO Flush Mode On */
1642#define GMF_RX_F_FL_OFF BIT_6 /* Rx FIFO Flush Mode Off */
1643#define GMF_CLI_RX_FO BIT_5 /* Clear IRQ Rx FIFO Overrun */
1644#define GMF_CLI_RX_FC BIT_4 /* Clear IRQ Rx Frame Complete */
1645#define GMF_OPER_ON BIT_3 /* Operational Mode On */
1646#define GMF_OPER_OFF BIT_2 /* Operational Mode Off */
1647#define GMF_RST_CLR BIT_1 /* Clear GMAC FIFO Reset */
1648#define GMF_RST_SET BIT_0 /* Set GMAC FIFO Reset */
1649
1650/* TX_GMF_CTRL_T 32 bit Tx GMAC FIFO Control/Test */
1651 /* Bits 31..19: reserved */
1652#define GMF_WSP_TST_ON BIT_18 /* Write Shadow Pointer Test On */
1653#define GMF_WSP_TST_OFF BIT_17 /* Write Shadow Pointer Test Off */
1654#define GMF_WSP_STEP BIT_16 /* Write Shadow Pointer Step/Increment */
1655 /* Bits 15..7: same as for RX_GMF_CTRL_T */
1656#define GMF_CLI_TX_FU BIT_6 /* Clear IRQ Tx FIFO Underrun */
1657#define GMF_CLI_TX_FC BIT_5 /* Clear IRQ Tx Frame Complete */
1658#define GMF_CLI_TX_PE BIT_4 /* Clear IRQ Tx Parity Error */
1659 /* Bits 3..0: same as for RX_GMF_CTRL_T */
1660
1661#define GMF_RX_CTRL_DEF (GMF_OPER_ON | GMF_RX_F_FL_ON)
1662#define GMF_TX_CTRL_DEF GMF_OPER_ON
1663
1664#define RX_GMF_FL_THR_DEF 0x0a /* Rx GMAC FIFO Flush Threshold default */
1665
1666/* GMAC_TI_ST_CTRL 8 bit Time Stamp Timer Ctrl Reg (YUKON only) */
1667 /* Bit 7.. 3: reserved */
1668#define GMT_ST_START BIT_2S /* Start Time Stamp Timer */
1669#define GMT_ST_STOP BIT_1S /* Stop Time Stamp Timer */
1670#define GMT_ST_CLR_IRQ BIT_0S /* Clear Time Stamp Timer IRQ */
1671
1672/* GMAC_CTRL 32 bit GMAC Control Reg (YUKON only) */
1673 /* Bits 31.. 8: reserved */
1674#define GMC_H_BURST_ON BIT_7 /* Half Duplex Burst Mode On */
1675#define GMC_H_BURST_OFF BIT_6 /* Half Duplex Burst Mode Off */
1676#define GMC_F_LOOPB_ON BIT_5 /* FIFO Loopback On */
1677#define GMC_F_LOOPB_OFF BIT_4 /* FIFO Loopback Off */
1678#define GMC_PAUSE_ON BIT_3 /* Pause On */
1679#define GMC_PAUSE_OFF BIT_2 /* Pause Off */
1680#define GMC_RST_CLR BIT_1 /* Clear GMAC Reset */
1681#define GMC_RST_SET BIT_0 /* Set GMAC Reset */
1682
1683/* GPHY_CTRL 32 bit GPHY Control Reg (YUKON only) */
1684 /* Bits 31..29: reserved */
1685#define GPC_SEL_BDT BIT_28 /* Select Bi-Dir. Transfer for MDC/MDIO */
1686#define GPC_INT_POL_HI BIT_27 /* IRQ Polarity is Active HIGH */
1687#define GPC_75_OHM BIT_26 /* Use 75 Ohm Termination instead of 50 */
1688#define GPC_DIS_FC BIT_25 /* Disable Automatic Fiber/Copper Detection */
1689#define GPC_DIS_SLEEP BIT_24 /* Disable Energy Detect */
1690#define GPC_HWCFG_M_3 BIT_23 /* HWCFG_MODE[3] */
1691#define GPC_HWCFG_M_2 BIT_22 /* HWCFG_MODE[2] */
1692#define GPC_HWCFG_M_1 BIT_21 /* HWCFG_MODE[1] */
1693#define GPC_HWCFG_M_0 BIT_20 /* HWCFG_MODE[0] */
1694#define GPC_ANEG_0 BIT_19 /* ANEG[0] */
1695#define GPC_ENA_XC BIT_18 /* Enable MDI crossover */
1696#define GPC_DIS_125 BIT_17 /* Disable 125 MHz clock */
1697#define GPC_ANEG_3 BIT_16 /* ANEG[3] */
1698#define GPC_ANEG_2 BIT_15 /* ANEG[2] */
1699#define GPC_ANEG_1 BIT_14 /* ANEG[1] */
1700#define GPC_ENA_PAUSE BIT_13 /* Enable Pause (SYM_OR_REM) */
1701#define GPC_PHYADDR_4 BIT_12 /* Bit 4 of Phy Addr */
1702#define GPC_PHYADDR_3 BIT_11 /* Bit 3 of Phy Addr */
1703#define GPC_PHYADDR_2 BIT_10 /* Bit 2 of Phy Addr */
1704#define GPC_PHYADDR_1 BIT_9 /* Bit 1 of Phy Addr */
1705#define GPC_PHYADDR_0 BIT_8 /* Bit 0 of Phy Addr */
1706 /* Bits 7..2: reserved */
1707#define GPC_RST_CLR BIT_1 /* Clear GPHY Reset */
1708#define GPC_RST_SET BIT_0 /* Set GPHY Reset */
1709
1710#define GPC_HWCFG_GMII_COP (GPC_HWCFG_M_3 | GPC_HWCFG_M_2 | \
1711 GPC_HWCFG_M_1 | GPC_HWCFG_M_0)
1712
1713#define GPC_HWCFG_GMII_FIB ( GPC_HWCFG_M_2 | \
1714 GPC_HWCFG_M_1 | GPC_HWCFG_M_0)
1715
1716#define GPC_ANEG_ADV_ALL_M (GPC_ANEG_3 | GPC_ANEG_2 | \
1717 GPC_ANEG_1 | GPC_ANEG_0)
1718
1719/* forced speed and duplex mode (don't mix with other ANEG bits) */
1720#define GPC_FRC10MBIT_HALF 0
1721#define GPC_FRC10MBIT_FULL GPC_ANEG_0
1722#define GPC_FRC100MBIT_HALF GPC_ANEG_1
1723#define GPC_FRC100MBIT_FULL (GPC_ANEG_0 | GPC_ANEG_1)
1724
1725/* auto-negotiation with limited advertised speeds */
1726/* mix only with master/slave settings (for copper) */
1727#define GPC_ADV_1000_HALF GPC_ANEG_2
1728#define GPC_ADV_1000_FULL GPC_ANEG_3
1729#define GPC_ADV_ALL (GPC_ANEG_2 | GPC_ANEG_3)
1730
1731/* master/slave settings */
1732/* only for copper with 1000 Mbps */
1733#define GPC_FORCE_MASTER 0
1734#define GPC_FORCE_SLAVE GPC_ANEG_0
1735#define GPC_PREF_MASTER GPC_ANEG_1
1736#define GPC_PREF_SLAVE (GPC_ANEG_1 | GPC_ANEG_0)
1737
1738/* GMAC_IRQ_SRC 8 bit GMAC Interrupt Source Reg (YUKON only) */
1739/* GMAC_IRQ_MSK 8 bit GMAC Interrupt Mask Reg (YUKON only) */
1740#define GM_IS_TX_CO_OV BIT_5 /* Transmit Counter Overflow IRQ */
1741#define GM_IS_RX_CO_OV BIT_4 /* Receive Counter Overflow IRQ */
1742#define GM_IS_TX_FF_UR BIT_3 /* Transmit FIFO Underrun */
1743#define GM_IS_TX_COMPL BIT_2 /* Frame Transmission Complete */
1744#define GM_IS_RX_FF_OR BIT_1 /* Receive FIFO Overrun */
1745#define GM_IS_RX_COMPL BIT_0 /* Frame Reception Complete */
1746
1747#define GMAC_DEF_MSK (GM_IS_TX_CO_OV | GM_IS_RX_CO_OV | \
1748 GM_IS_TX_FF_UR)
1749
1750/* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */
1751 /* Bits 15.. 2: reserved */
1752#define GMLC_RST_CLR BIT_1S /* Clear GMAC Link Reset */
1753#define GMLC_RST_SET BIT_0S /* Set GMAC Link Reset */
1754
1755
1756/* WOL_CTRL_STAT 16 bit WOL Control/Status Reg */
1757#define WOL_CTL_LINK_CHG_OCC BIT_15S
1758#define WOL_CTL_MAGIC_PKT_OCC BIT_14S
1759#define WOL_CTL_PATTERN_OCC BIT_13S
1760
1761#define WOL_CTL_CLEAR_RESULT BIT_12S
1762
1763#define WOL_CTL_ENA_PME_ON_LINK_CHG BIT_11S
1764#define WOL_CTL_DIS_PME_ON_LINK_CHG BIT_10S
1765#define WOL_CTL_ENA_PME_ON_MAGIC_PKT BIT_9S
1766#define WOL_CTL_DIS_PME_ON_MAGIC_PKT BIT_8S
1767#define WOL_CTL_ENA_PME_ON_PATTERN BIT_7S
1768#define WOL_CTL_DIS_PME_ON_PATTERN BIT_6S
1769
1770#define WOL_CTL_ENA_LINK_CHG_UNIT BIT_5S
1771#define WOL_CTL_DIS_LINK_CHG_UNIT BIT_4S
1772#define WOL_CTL_ENA_MAGIC_PKT_UNIT BIT_3S
1773#define WOL_CTL_DIS_MAGIC_PKT_UNIT BIT_2S
1774#define WOL_CTL_ENA_PATTERN_UNIT BIT_1S
1775#define WOL_CTL_DIS_PATTERN_UNIT BIT_0S
1776
1777#define WOL_CTL_DEFAULT \
1778 (WOL_CTL_DIS_PME_ON_LINK_CHG | \
1779 WOL_CTL_DIS_PME_ON_PATTERN | \
1780 WOL_CTL_DIS_PME_ON_MAGIC_PKT | \
1781 WOL_CTL_DIS_LINK_CHG_UNIT | \
1782 WOL_CTL_DIS_PATTERN_UNIT | \
1783 WOL_CTL_DIS_MAGIC_PKT_UNIT)
wdenk42d1f032003-10-15 23:53:47 +00001784
wdenk7152b1d2003-09-05 23:19:14 +00001785/* WOL_MATCH_CTL 8 bit WOL Match Control Reg */
1786#define WOL_CTL_PATT_ENA(x) (BIT_0 << (x))
1787
1788#define SK_NUM_WOL_PATTERN 7
1789#define SK_PATTERN_PER_WORD 4
1790#define SK_BITMASK_PATTERN 7
1791#define SK_POW_PATTERN_LENGTH 128
1792
1793#define WOL_LENGTH_MSK 0x7f
1794#define WOL_LENGTH_SHIFT 8
1795
1796
1797/* Receive and Transmit Descriptors ******************************************/
1798
1799/* Transmit Descriptor struct */
1800typedef struct s_HwTxd {
1801 SK_U32 volatile TxCtrl; /* Transmit Buffer Control Field */
1802 SK_U32 TxNext; /* Physical Address Pointer to the next TxD */
1803 SK_U32 TxAdrLo; /* Physical Tx Buffer Address lower dword */
1804 SK_U32 TxAdrHi; /* Physical Tx Buffer Address upper dword */
1805 SK_U32 TxStat; /* Transmit Frame Status Word */
1806#ifndef SK_USE_REV_DESC
1807 SK_U16 TxTcpOffs; /* TCP Checksum Calculation Start Value */
1808 SK_U16 TxRes1; /* 16 bit reserved field */
1809 SK_U16 TxTcpWp; /* TCP Checksum Write Position */
1810 SK_U16 TxTcpSp; /* TCP Checksum Calculation Start Position */
1811#else /* SK_USE_REV_DESC */
1812 SK_U16 TxRes1; /* 16 bit reserved field */
1813 SK_U16 TxTcpOffs; /* TCP Checksum Calculation Start Value */
1814 SK_U16 TxTcpSp; /* TCP Checksum Calculation Start Position */
1815 SK_U16 TxTcpWp; /* TCP Checksum Write Position */
1816#endif /* SK_USE_REV_DESC */
1817 SK_U32 TxRes2; /* 32 bit reserved field */
1818} SK_HWTXD;
1819
1820/* Receive Descriptor struct */
1821typedef struct s_HwRxd {
1822 SK_U32 volatile RxCtrl; /* Receive Buffer Control Field */
1823 SK_U32 RxNext; /* Physical Address Pointer to the next RxD */
1824 SK_U32 RxAdrLo; /* Physical Rx Buffer Address lower dword */
1825 SK_U32 RxAdrHi; /* Physical Rx Buffer Address upper dword */
1826 SK_U32 RxStat; /* Receive Frame Status Word */
1827 SK_U32 RxTiSt; /* Receive Time Stamp (from XMAC on GENESIS) */
wdenk42d1f032003-10-15 23:53:47 +00001828#ifndef SK_USE_REV_DESC
wdenk7152b1d2003-09-05 23:19:14 +00001829 SK_U16 RxTcpSum1; /* TCP Checksum 1 */
1830 SK_U16 RxTcpSum2; /* TCP Checksum 2 */
1831 SK_U16 RxTcpSp1; /* TCP Checksum Calculation Start Position 1 */
1832 SK_U16 RxTcpSp2; /* TCP Checksum Calculation Start Position 2 */
1833#else /* SK_USE_REV_DESC */
1834 SK_U16 RxTcpSum2; /* TCP Checksum 2 */
1835 SK_U16 RxTcpSum1; /* TCP Checksum 1 */
1836 SK_U16 RxTcpSp2; /* TCP Checksum Calculation Start Position 2 */
1837 SK_U16 RxTcpSp1; /* TCP Checksum Calculation Start Position 1 */
1838#endif /* SK_USE_REV_DESC */
1839} SK_HWRXD;
1840
1841/*
1842 * Drivers which use the reverse descriptor feature (PCI_OUR_REG_2)
1843 * should set the define SK_USE_REV_DESC.
1844 * Structures are 'normaly' not endianess dependent. But in
1845 * this case the SK_U16 fields are bound to bit positions inside the
1846 * descriptor. RxTcpSum1 e.g. must start at bit 0 within the 6.th DWord.
1847 * The bit positions inside a DWord are of course endianess dependent and
1848 * swaps if the DWord is swapped by the hardware.
1849 */
1850
1851
1852/* Descriptor Bit Definition */
1853/* TxCtrl Transmit Buffer Control Field */
1854/* RxCtrl Receive Buffer Control Field */
1855#define BMU_OWN BIT_31 /* OWN bit: 0=host/1=BMU */
1856#define BMU_STF BIT_30 /* Start of Frame */
1857#define BMU_EOF BIT_29 /* End of Frame */
1858#define BMU_IRQ_EOB BIT_28 /* Req "End of Buffer" IRQ */
1859#define BMU_IRQ_EOF BIT_27 /* Req "End of Frame" IRQ */
1860/* TxCtrl specific bits */
1861#define BMU_STFWD BIT_26 /* (Tx) Store & Forward Frame */
1862#define BMU_NO_FCS BIT_25 /* (Tx) Disable MAC FCS (CRC) generation */
1863#define BMU_SW BIT_24 /* (Tx) 1 bit res. for SW use */
1864/* RxCtrl specific bits */
1865#define BMU_DEV_0 BIT_26 /* (Rx) Transfer data to Dev0 */
1866#define BMU_STAT_VAL BIT_25 /* (Rx) Rx Status Valid */
1867#define BMU_TIST_VAL BIT_24 /* (Rx) Rx TimeStamp Valid */
1868 /* Bit 23..16: BMU Check Opcodes */
1869#define BMU_CHECK (0x55L<<16) /* Default BMU check */
1870#define BMU_TCP_CHECK (0x56L<<16) /* Descr with TCP ext */
1871#define BMU_UDP_CHECK (0x57L<<16) /* Descr with UDP ext (YUKON only) */
1872#define BMU_BBC 0xFFFFL /* Bit 15.. 0: Buffer Byte Counter */
1873
1874/* TxStat Transmit Frame Status Word */
1875/* RxStat Receive Frame Status Word */
1876/*
1877 *Note: TxStat is reserved for ASIC loopback mode only
1878 *
1879 * The Bits of the Status words are defined in xmac_ii.h
1880 * (see XMR_FS bits)
1881 */
1882
1883/* other defines *************************************************************/
1884
1885/*
1886 * FlashProm specification
1887 */
1888#define MAX_PAGES 0x20000L /* Every byte has a single page */
1889#define MAX_FADDR 1 /* 1 byte per page */
1890#define SKFDDI_PSZ 8 /* address PROM size */
1891
1892/* macros ********************************************************************/
1893
1894/*
1895 * Receive and Transmit Queues
1896 */
1897#define Q_R1 0x0000 /* Receive Queue 1 */
1898#define Q_R2 0x0080 /* Receive Queue 2 */
1899#define Q_XS1 0x0200 /* Synchronous Transmit Queue 1 */
1900#define Q_XA1 0x0280 /* Asynchronous Transmit Queue 1 */
1901#define Q_XS2 0x0300 /* Synchronous Transmit Queue 2 */
1902#define Q_XA2 0x0380 /* Asynchronous Transmit Queue 2 */
1903
1904/*
1905 * Macro Q_ADDR()
1906 *
1907 * Use this macro to access the Receive and Transmit Queue Registers.
1908 *
wdenk42d1f032003-10-15 23:53:47 +00001909 * para:
wdenk7152b1d2003-09-05 23:19:14 +00001910 * Queue Queue to access.
1911 * Values: Q_R1, Q_R2, Q_XS1, Q_XA1, Q_XS2, and Q_XA2
1912 * Offs Queue register offset.
1913 * Values: Q_D, Q_DA_L ... Q_T2, Q_T3
1914 *
1915 * usage SK_IN32(pAC, Q_ADDR(Q_R2, Q_BC), pVal)
1916 */
1917#define Q_ADDR(Queue, Offs) (B8_Q_REGS + (Queue) + (Offs))
1918
1919/*
1920 * Macro RB_ADDR()
1921 *
1922 * Use this macro to access the RAM Buffer Registers.
1923 *
wdenk42d1f032003-10-15 23:53:47 +00001924 * para:
wdenk7152b1d2003-09-05 23:19:14 +00001925 * Queue Queue to access.
1926 * Values: Q_R1, Q_R2, Q_XS1, Q_XA1, Q_XS2, and Q_XA2
1927 * Offs Queue register offset.
1928 * Values: RB_START, RB_END ... RB_LEV, RB_CTRL
1929 *
1930 * usage SK_IN32(pAC, RB_ADDR(Q_R2, RB_RP), pVal)
1931 */
1932#define RB_ADDR(Queue, Offs) (B16_RAM_REGS + (Queue) + (Offs))
1933
1934
1935/*
1936 * MAC Related Registers
1937 */
1938#define MAC_1 0 /* belongs to the port near the slot */
1939#define MAC_2 1 /* belongs to the port far away from the slot */
1940
1941/*
1942 * Macro MR_ADDR()
1943 *
1944 * Use this macro to access a MAC Related Registers inside the ASIC.
1945 *
wdenk42d1f032003-10-15 23:53:47 +00001946 * para:
wdenk7152b1d2003-09-05 23:19:14 +00001947 * Mac MAC to access.
1948 * Values: MAC_1, MAC_2
1949 * Offs MAC register offset.
1950 * Values: RX_MFF_EA, RX_MFF_WP ... LNK_LED_REG,
1951 * TX_MFF_EA, TX_MFF_WP ... TX_LED_TST
1952 *
1953 * usage SK_IN32(pAC, MR_ADDR(MAC_1, TX_MFF_EA), pVal)
1954 */
1955#define MR_ADDR(Mac, Offs) (((Mac) << 7) + (Offs))
1956
1957#ifdef SK_LITTLE_ENDIAN
1958#define XM_WORD_LO 0
1959#define XM_WORD_HI 1
1960#else /* !SK_LITTLE_ENDIAN */
1961#define XM_WORD_LO 1
1962#define XM_WORD_HI 0
1963#endif /* !SK_LITTLE_ENDIAN */
1964
1965
1966/*
1967 * macros to access the XMAC (GENESIS only)
1968 *
1969 * XM_IN16(), to read a 16 bit register (e.g. XM_MMU_CMD)
1970 * XM_OUT16(), to write a 16 bit register (e.g. XM_MMU_CMD)
1971 * XM_IN32(), to read a 32 bit register (e.g. XM_TX_EV_CNT)
1972 * XM_OUT32(), to write a 32 bit register (e.g. XM_TX_EV_CNT)
1973 * XM_INADDR(), to read a network address register (e.g. XM_SRC_CHK)
1974 * XM_OUTADDR(), to write a network address register (e.g. XM_SRC_CHK)
1975 * XM_INHASH(), to read the XM_HSM_CHK register
1976 * XM_OUTHASH() to write the XM_HSM_CHK register
1977 *
1978 * para:
1979 * Mac XMAC to access values: MAC_1 or MAC_2
1980 * IoC I/O context needed for SK I/O macros
1981 * Reg XMAC Register to read or write
1982 * (p)Val Value or pointer to the value which should be read or written
1983 *
1984 * usage: XM_OUT16(IoC, MAC_1, XM_MMU_CMD, Value);
1985 */
1986
1987#define XMA(Mac, Reg) \
1988 ((BASE_XMAC_1 + (Mac) * (BASE_XMAC_2 - BASE_XMAC_1)) | ((Reg) << 1))
1989
1990#define XM_IN16(IoC, Mac, Reg, pVal) \
1991 SK_IN16((IoC), XMA((Mac), (Reg)), (pVal))
1992
1993#define XM_OUT16(IoC, Mac, Reg, Val) \
1994 SK_OUT16((IoC), XMA((Mac), (Reg)), (Val))
1995
1996#define XM_IN32(IoC, Mac, Reg, pVal) { \
1997 SK_IN16((IoC), XMA((Mac), (Reg)), \
1998 (SK_U16 *)&((SK_U16 *)(pVal))[XM_WORD_LO]); \
1999 SK_IN16((IoC), XMA((Mac), (Reg+2)), \
2000 (SK_U16 *)&((SK_U16 *)(pVal))[XM_WORD_HI]); \
2001}
2002
2003#define XM_OUT32(IoC, Mac, Reg, Val) { \
2004 SK_OUT16((IoC), XMA((Mac), (Reg)), (SK_U16)((Val) & 0xffffL)); \
2005 SK_OUT16((IoC), XMA((Mac), (Reg+2)), (SK_U16)(((Val) >> 16) & 0xffffL));\
2006}
2007
2008/* Remember: we are always writing to / reading from LITTLE ENDIAN memory */
2009
2010#define XM_INADDR(IoC, Mac, Reg, pVal) { \
2011 SK_U16 Word; \
2012 SK_U8 *pByte; \
2013 pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \
2014 SK_IN16((IoC), XMA((Mac), (Reg)), &Word); \
2015 pByte[0] = (SK_U8)(Word & 0x00ff); \
2016 pByte[1] = (SK_U8)((Word >> 8) & 0x00ff); \
2017 SK_IN16((IoC), XMA((Mac), (Reg+2)), &Word); \
2018 pByte[2] = (SK_U8)(Word & 0x00ff); \
2019 pByte[3] = (SK_U8)((Word >> 8) & 0x00ff); \
2020 SK_IN16((IoC), XMA((Mac), (Reg+4)), &Word); \
2021 pByte[4] = (SK_U8)(Word & 0x00ff); \
2022 pByte[5] = (SK_U8)((Word >> 8) & 0x00ff); \
2023}
2024
2025#define XM_OUTADDR(IoC, Mac, Reg, pVal) { \
2026 SK_U8 *pByte; \
2027 pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \
2028 SK_OUT16((IoC), XMA((Mac), (Reg)), (SK_U16) \
2029 (((SK_U16)(pByte[0]) & 0x00ff) | \
2030 (((SK_U16)(pByte[1]) << 8) & 0xff00))); \
2031 SK_OUT16((IoC), XMA((Mac), (Reg+2)), (SK_U16) \
2032 (((SK_U16)(pByte[2]) & 0x00ff) | \
2033 (((SK_U16)(pByte[3]) << 8) & 0xff00))); \
2034 SK_OUT16((IoC), XMA((Mac), (Reg+4)), (SK_U16) \
2035 (((SK_U16)(pByte[4]) & 0x00ff) | \
2036 (((SK_U16)(pByte[5]) << 8) & 0xff00))); \
2037}
2038
2039#define XM_INHASH(IoC, Mac, Reg, pVal) { \
2040 SK_U16 Word; \
2041 SK_U8 *pByte; \
2042 pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \
2043 SK_IN16((IoC), XMA((Mac), (Reg)), &Word); \
2044 pByte[0] = (SK_U8)(Word & 0x00ff); \
2045 pByte[1] = (SK_U8)((Word >> 8) & 0x00ff); \
2046 SK_IN16((IoC), XMA((Mac), (Reg+2)), &Word); \
2047 pByte[2] = (SK_U8)(Word & 0x00ff); \
2048 pByte[3] = (SK_U8)((Word >> 8) & 0x00ff); \
2049 SK_IN16((IoC), XMA((Mac), (Reg+4)), &Word); \
2050 pByte[4] = (SK_U8)(Word & 0x00ff); \
2051 pByte[5] = (SK_U8)((Word >> 8) & 0x00ff); \
2052 SK_IN16((IoC), XMA((Mac), (Reg+6)), &Word); \
2053 pByte[6] = (SK_U8)(Word & 0x00ff); \
2054 pByte[7] = (SK_U8)((Word >> 8) & 0x00ff); \
2055}
2056
2057#define XM_OUTHASH(IoC, Mac, Reg, pVal) { \
2058 SK_U8 *pByte; \
2059 pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \
2060 SK_OUT16((IoC), XMA((Mac), (Reg)), (SK_U16) \
2061 (((SK_U16)(pByte[0]) & 0x00ff)| \
2062 (((SK_U16)(pByte[1]) << 8) & 0xff00))); \
2063 SK_OUT16((IoC), XMA((Mac), (Reg+2)), (SK_U16) \
2064 (((SK_U16)(pByte[2]) & 0x00ff)| \
2065 (((SK_U16)(pByte[3]) << 8) & 0xff00))); \
2066 SK_OUT16((IoC), XMA((Mac), (Reg+4)), (SK_U16) \
2067 (((SK_U16)(pByte[4]) & 0x00ff)| \
2068 (((SK_U16)(pByte[5]) << 8) & 0xff00))); \
2069 SK_OUT16((IoC), XMA((Mac), (Reg+6)), (SK_U16) \
2070 (((SK_U16)(pByte[6]) & 0x00ff)| \
2071 (((SK_U16)(pByte[7]) << 8) & 0xff00))); \
2072}
2073
2074/*
2075 * macros to access the GMAC (YUKON only)
2076 *
2077 * GM_IN16(), to read a 16 bit register (e.g. GM_GP_STAT)
2078 * GM_OUT16(), to write a 16 bit register (e.g. GM_GP_CTRL)
2079 * GM_IN32(), to read a 32 bit register (e.g. GM_)
2080 * GM_OUT32(), to write a 32 bit register (e.g. GM_)
2081 * GM_INADDR(), to read a network address register (e.g. GM_SRC_ADDR_1L)
2082 * GM_OUTADDR(), to write a network address register (e.g. GM_SRC_ADDR_2L)
2083 * GM_INHASH(), to read the GM_MC_ADDR_H1 register
2084 * GM_OUTHASH() to write the GM_MC_ADDR_H1 register
2085 *
2086 * para:
2087 * Mac GMAC to access values: MAC_1 or MAC_2
2088 * IoC I/O context needed for SK I/O macros
2089 * Reg GMAC Register to read or write
2090 * (p)Val Value or pointer to the value which should be read or written
2091 *
2092 * usage: GM_OUT16(IoC, MAC_1, GM_GP_CTRL, Value);
2093 */
2094
2095#define GMA(Mac, Reg) \
2096 ((BASE_GMAC_1 + (Mac) * (BASE_GMAC_2 - BASE_GMAC_1)) | (Reg))
2097
2098#define GM_IN16(IoC, Mac, Reg, pVal) \
2099 SK_IN16((IoC), GMA((Mac), (Reg)), (pVal))
2100
2101#define GM_OUT16(IoC, Mac, Reg, Val) \
2102 SK_OUT16((IoC), GMA((Mac), (Reg)), (Val))
2103
2104#define GM_IN32(IoC, Mac, Reg, pVal) { \
2105 SK_IN16((IoC), GMA((Mac), (Reg)), \
2106 (SK_U16 *)&((SK_U16 *)(pVal))[XM_WORD_LO]); \
2107 SK_IN16((IoC), GMA((Mac), (Reg+4)), \
2108 (SK_U16 *)&((SK_U16 *)(pVal))[XM_WORD_HI]); \
2109}
2110
2111#define GM_OUT32(IoC, Mac, Reg, Val) { \
2112 SK_OUT16((IoC), GMA((Mac), (Reg)), (SK_U16)((Val) & 0xffffL)); \
2113 SK_OUT16((IoC), GMA((Mac), (Reg+4)), (SK_U16)(((Val) >> 16) & 0xffffL));\
2114}
2115
2116#define GM_INADDR(IoC, Mac, Reg, pVal) { \
2117 SK_U16 Word; \
2118 SK_U8 *pByte; \
2119 pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \
2120 SK_IN16((IoC), GMA((Mac), (Reg)), &Word); \
2121 pByte[0] = (SK_U8)(Word & 0x00ff); \
2122 pByte[1] = (SK_U8)((Word >> 8) & 0x00ff); \
2123 SK_IN16((IoC), GMA((Mac), (Reg+4)), &Word); \
2124 pByte[2] = (SK_U8)(Word & 0x00ff); \
2125 pByte[3] = (SK_U8)((Word >> 8) & 0x00ff); \
2126 SK_IN16((IoC), GMA((Mac), (Reg+8)), &Word); \
2127 pByte[4] = (SK_U8)(Word & 0x00ff); \
2128 pByte[5] = (SK_U8)((Word >> 8) & 0x00ff); \
2129}
2130
2131#define GM_OUTADDR(IoC, Mac, Reg, pVal) { \
2132 SK_U8 *pByte; \
2133 pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \
2134 SK_OUT16((IoC), GMA((Mac), (Reg)), (SK_U16) \
2135 (((SK_U16)(pByte[0]) & 0x00ff) | \
2136 (((SK_U16)(pByte[1]) << 8) & 0xff00))); \
2137 SK_OUT16((IoC), GMA((Mac), (Reg+4)), (SK_U16) \
2138 (((SK_U16)(pByte[2]) & 0x00ff) | \
2139 (((SK_U16)(pByte[3]) << 8) & 0xff00))); \
2140 SK_OUT16((IoC), GMA((Mac), (Reg+8)), (SK_U16) \
2141 (((SK_U16)(pByte[4]) & 0x00ff) | \
2142 (((SK_U16)(pByte[5]) << 8) & 0xff00))); \
2143}
2144
2145#define GM_INHASH(IoC, Mac, Reg, pVal) { \
2146 SK_U16 Word; \
2147 SK_U8 *pByte; \
2148 pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \
2149 SK_IN16((IoC), GMA((Mac), (Reg)), &Word); \
2150 pByte[0] = (SK_U8)(Word & 0x00ff); \
2151 pByte[1] = (SK_U8)((Word >> 8) & 0x00ff); \
2152 SK_IN16((IoC), GMA((Mac), (Reg+4)), &Word); \
2153 pByte[2] = (SK_U8)(Word & 0x00ff); \
2154 pByte[3] = (SK_U8)((Word >> 8) & 0x00ff); \
2155 SK_IN16((IoC), GMA((Mac), (Reg+8)), &Word); \
2156 pByte[4] = (SK_U8)(Word & 0x00ff); \
2157 pByte[5] = (SK_U8)((Word >> 8) & 0x00ff); \
2158 SK_IN16((IoC), GMA((Mac), (Reg+12)), &Word); \
2159 pByte[6] = (SK_U8)(Word & 0x00ff); \
2160 pByte[7] = (SK_U8)((Word >> 8) & 0x00ff); \
2161}
2162
2163#define GM_OUTHASH(IoC, Mac, Reg, pVal) { \
2164 SK_U8 *pByte; \
2165 pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0]; \
2166 SK_OUT16((IoC), GMA((Mac), (Reg)), (SK_U16) \
2167 (((SK_U16)(pByte[0]) & 0x00ff)| \
2168 (((SK_U16)(pByte[1]) << 8) & 0xff00))); \
2169 SK_OUT16((IoC), GMA((Mac), (Reg+4)), (SK_U16) \
2170 (((SK_U16)(pByte[2]) & 0x00ff)| \
2171 (((SK_U16)(pByte[3]) << 8) & 0xff00))); \
2172 SK_OUT16((IoC), GMA((Mac), (Reg+8)), (SK_U16) \
2173 (((SK_U16)(pByte[4]) & 0x00ff)| \
2174 (((SK_U16)(pByte[5]) << 8) & 0xff00))); \
2175 SK_OUT16((IoC), GMA((Mac), (Reg+12)), (SK_U16) \
2176 (((SK_U16)(pByte[6]) & 0x00ff)| \
2177 (((SK_U16)(pByte[7]) << 8) & 0xff00))); \
2178}
2179
2180/*
2181 * Different MAC Types
2182 */
2183#define SK_MAC_XMAC 0 /* Xaqti XMAC II */
2184#define SK_MAC_GMAC 1 /* Marvell GMAC */
2185
2186/*
2187 * Different PHY Types
2188 */
2189#define SK_PHY_XMAC 0 /* integrated in XMAC II */
2190#define SK_PHY_BCOM 1 /* Broadcom BCM5400 */
2191#define SK_PHY_LONE 2 /* Level One LXT1000 */
2192#define SK_PHY_NAT 3 /* National DP83891 */
2193#define SK_PHY_MARV_COPPER 4 /* Marvell 88E1011S */
2194#define SK_PHY_MARV_FIBER 5 /* Marvell 88E1011S working on fiber */
2195
2196/*
2197 * PHY addresses (bits 12..8 of PHY address reg)
2198 */
2199#define PHY_ADDR_XMAC (0<<8)
2200#define PHY_ADDR_BCOM (1<<8)
2201#define PHY_ADDR_LONE (3<<8)
2202#define PHY_ADDR_NAT (0<<8)
wdenk42d1f032003-10-15 23:53:47 +00002203
wdenk7152b1d2003-09-05 23:19:14 +00002204/* GPHY address (bits 15..11 of SMI control reg) */
2205#define PHY_ADDR_MARV 0
2206
2207/*
2208 * macros to access the PHY
2209 *
2210 * PHY_READ() read a 16 bit value from the PHY
2211 * PHY_WRITE() write a 16 bit value to the PHY
2212 *
wdenk42d1f032003-10-15 23:53:47 +00002213 * para:
Wolfgang Denk53677ef2008-05-20 16:00:29 +02002214 * IoC I/O context needed for SK I/O macros
2215 * pPort Pointer to port struct for PhyAddr
2216 * Mac XMAC to access values: MAC_1 or MAC_2
2217 * PhyReg PHY Register to read or write
2218 * (p)Val Value or pointer to the value which should be read or
wdenk7152b1d2003-09-05 23:19:14 +00002219 * written.
2220 *
2221 * usage: PHY_READ(IoC, pPort, MAC_1, PHY_CTRL, Value);
2222 * Warning: a PHY_READ on an uninitialized PHY (PHY still in reset) never
2223 * comes back. This is checked in DEBUG mode.
2224 */
2225#ifndef DEBUG
2226#define PHY_READ(IoC, pPort, Mac, PhyReg, pVal) { \
Wolfgang Denk53677ef2008-05-20 16:00:29 +02002227 SK_U16 Mmu; \
wdenk7152b1d2003-09-05 23:19:14 +00002228 \
2229 XM_OUT16((IoC), (Mac), XM_PHY_ADDR, (PhyReg) | (pPort)->PhyAddr); \
2230 XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \
2231 if ((pPort)->PhyType != SK_PHY_XMAC) { \
Wolfgang Denk53677ef2008-05-20 16:00:29 +02002232 do { \
wdenk7152b1d2003-09-05 23:19:14 +00002233 XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \
2234 } while ((Mmu & XM_MMU_PHY_RDY) == 0); \
2235 XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \
Wolfgang Denk53677ef2008-05-20 16:00:29 +02002236 } \
wdenk7152b1d2003-09-05 23:19:14 +00002237}
2238#else
2239#define PHY_READ(IoC, pPort, Mac, PhyReg, pVal) { \
Wolfgang Denk53677ef2008-05-20 16:00:29 +02002240 SK_U16 Mmu; \
wdenk7152b1d2003-09-05 23:19:14 +00002241 int __i = 0; \
2242 \
2243 XM_OUT16((IoC), (Mac), XM_PHY_ADDR, (PhyReg) | (pPort)->PhyAddr); \
2244 XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \
2245 if ((pPort)->PhyType != SK_PHY_XMAC) { \
Wolfgang Denk53677ef2008-05-20 16:00:29 +02002246 do { \
wdenk7152b1d2003-09-05 23:19:14 +00002247 XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \
2248 __i++; \
2249 if (__i > 100000) { \
2250 SK_DBG_PRINTF("*****************************\n"); \
2251 SK_DBG_PRINTF("PHY_READ on uninitialized PHY\n"); \
2252 SK_DBG_PRINTF("*****************************\n"); \
2253 break; \
2254 } \
2255 } while ((Mmu & XM_MMU_PHY_RDY) == 0); \
2256 XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \
Wolfgang Denk53677ef2008-05-20 16:00:29 +02002257 } \
wdenk7152b1d2003-09-05 23:19:14 +00002258}
2259#endif /* DEBUG */
2260
2261#define PHY_WRITE(IoC, pPort, Mac, PhyReg, Val) { \
2262 SK_U16 Mmu; \
2263 \
2264 if ((pPort)->PhyType != SK_PHY_XMAC) { \
Wolfgang Denk53677ef2008-05-20 16:00:29 +02002265 do { \
wdenk7152b1d2003-09-05 23:19:14 +00002266 XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \
2267 } while ((Mmu & XM_MMU_PHY_BUSY) != 0); \
Wolfgang Denk53677ef2008-05-20 16:00:29 +02002268 } \
wdenk7152b1d2003-09-05 23:19:14 +00002269 XM_OUT16((IoC), (Mac), XM_PHY_ADDR, (PhyReg) | (pPort)->PhyAddr); \
2270 XM_OUT16((IoC), (Mac), XM_PHY_DATA, (Val)); \
2271 if ((pPort)->PhyType != SK_PHY_XMAC) { \
Wolfgang Denk53677ef2008-05-20 16:00:29 +02002272 do { \
wdenk7152b1d2003-09-05 23:19:14 +00002273 XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \
2274 } while ((Mmu & XM_MMU_PHY_BUSY) != 0); \
Wolfgang Denk53677ef2008-05-20 16:00:29 +02002275 } \
wdenk7152b1d2003-09-05 23:19:14 +00002276}
2277
2278/*
2279 * Macro PCI_C()
2280 *
2281 * Use this macro to access PCI config register from the I/O space.
2282 *
2283 * para:
2284 * Addr PCI configuration register to access.
2285 * Values: PCI_VENDOR_ID ... PCI_VPD_ADR_REG,
2286 *
2287 * usage SK_IN16(pAC, PCI_C(PCI_VENDOR_ID), pVal);
2288 */
2289#define PCI_C(Addr) (B7_CFG_SPC + (Addr)) /* PCI Config Space */
2290
2291/*
2292 * Macro SK_HW_ADDR(Base, Addr)
2293 *
2294 * Calculates the effective HW address
2295 *
2296 * para:
2297 * Base I/O or memory base address
2298 * Addr Address offset
2299 *
2300 * usage: May be used in SK_INxx and SK_OUTxx macros
2301 * #define SK_IN8(pAC, Addr, pVal) ...\
2302 * *pVal = (SK_U8)inp(SK_HW_ADDR(pAC->Hw.Iop, Addr)))
2303 */
2304#ifdef SK_MEM_MAPPED_IO
2305#define SK_HW_ADDR(Base, Addr) ((Base) + (Addr))
2306#else /* SK_MEM_MAPPED_IO */
2307#define SK_HW_ADDR(Base, Addr) \
2308 ((Base) + (((Addr) & 0x7f) | (((Addr) >> 7 > 0) ? 0x80 : 0)))
2309#endif /* SK_MEM_MAPPED_IO */
2310
2311#define SZ_LONG (sizeof(SK_U32))
2312
2313/*
2314 * Macro SK_HWAC_LINK_LED()
2315 *
2316 * Use this macro to set the link LED mode.
2317 * para:
2318 * pAC Pointer to adapter context struct
2319 * IoC I/O context needed for SK I/O macros
2320 * Port Port number
2321 * Mode Mode to set for this LED
2322 */
2323#define SK_HWAC_LINK_LED(pAC, IoC, Port, Mode) \
2324 SK_OUT8(IoC, MR_ADDR(Port, LNK_LED_REG), Mode);
2325
2326
2327/* typedefs *******************************************************************/
2328
2329
2330/* function prototypes ********************************************************/
2331
2332#ifdef __cplusplus
2333}
2334#endif /* __cplusplus */
2335
2336#endif /* __INC_SKGEHW_H */