]> git.karo-electronics.de Git - karo-tx-uboot.git/blob - drivers/net/sk98lin/h/skdrv1st.h
imported U-Boot Release 2009.08 from Freescale BSP L2.6.31_10.08.01
[karo-tx-uboot.git] / drivers / net / sk98lin / h / skdrv1st.h
1 /******************************************************************************
2  *
3  * Name:        skdrv1st.h
4  * Project:     GEnesis, PCI Gigabit Ethernet Adapter
5  * Version:     $Revision$
6  * Date:        $Date$
7  * Purpose:     First header file for driver and all other modules
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  *
28  *      $Log$
29  *      Revision 1.1.1.1  2011-02-28 14:37:53  lothar
30  *      imported U-Boot Release 2009.08 from Freescale BSP L2.6.31_10.08.01
31  *
32  *      Revision 1.11  2003/02/25 14:16:40  mlindner
33  *      Fix: Copyright statement
34  *
35  *      Revision 1.10  2002/10/02 12:46:02  mlindner
36  *      Add: Support for Yukon
37  *
38  *      Revision 1.9.2.2  2001/12/07 12:06:42  mlindner
39  *      Fix: malloc -> slab changes
40  *
41  *      Revision 1.9.2.1  2001/03/12 16:50:59  mlindner
42  *      chg: kernel 2.4 adaption
43  *
44  *      Revision 1.9  2001/01/22 14:16:04  mlindner
45  *      added ProcFs functionality
46  *      Dual Net functionality integrated
47  *      Rlmt networks added
48  *
49  *      Revision 1.8  2000/02/21 12:19:18  cgoos
50  *      Added default for SK_DEBUG_CHKMOD/_CHKCAT
51  *
52  *      Revision 1.7  1999/11/22 13:50:00  cgoos
53  *      Changed license header to GPL.
54  *      Added overwrite for several functions.
55  *      Removed linux 2.0.x definitions.
56  *      Removed PCI vendor ID definition (now in kernel).
57  *
58  *      Revision 1.6  1999/07/27 08:03:33  cgoos
59  *      Changed SK_IN/OUT macros to readX/writeX instead of memory
60  *      accesses (necessary for ALPHA).
61  *
62  *      Revision 1.5  1999/07/23 12:10:21  cgoos
63  *      Removed SK_RLMT_SLOW_LOOKAHEAD define.
64  *
65  *      Revision 1.4  1999/07/14 12:31:13  cgoos
66  *      Added SK_RLMT_SLOW_LOOKAHEAD define.
67  *
68  *      Revision 1.3  1999/04/07 10:12:54  cgoos
69  *      Added check for KERNEL and OPTIMIZATION defines.
70  *
71  *      Revision 1.2  1999/03/01 08:51:47  cgoos
72  *      Fixed pcibios_read/write definitions.
73  *
74  *      Revision 1.1  1999/02/16 07:40:49  cgoos
75  *      First version.
76  *
77  *
78  *
79  ******************************************************************************/
80
81 /******************************************************************************
82  *
83  * Description:
84  *
85  * This is the first include file of the driver, which includes all
86  * neccessary system header files and some of the GEnesis header files.
87  * It also defines some basic items.
88  *
89  * Include File Hierarchy:
90  *
91  *      see skge.c
92  *
93  ******************************************************************************/
94
95 #ifndef __INC_SKDRV1ST_H
96 #define __INC_SKDRV1ST_H
97
98 #if 0
99 /* Check kernel version */
100 #include <linux/version.h>
101 #if (LINUX_VERSION_CODE > 0x020300)
102 #endif
103 #endif
104
105 typedef struct s_AC     SK_AC;
106
107 /* override some default functions with optimized linux functions */
108
109 #define SK_PNMI_STORE_U16(p,v)          memcpy((char*)(p),(char*)&(v),2)
110 #define SK_PNMI_STORE_U32(p,v)          memcpy((char*)(p),(char*)&(v),4)
111 #define SK_PNMI_STORE_U64(p,v)          memcpy((char*)(p),(char*)&(v),8)
112 #define SK_PNMI_READ_U16(p,v)           memcpy((char*)&(v),(char*)(p),2)
113 #define SK_PNMI_READ_U32(p,v)           memcpy((char*)&(v),(char*)(p),2)
114 #define SK_PNMI_READ_U64(p,v)           memcpy((char*)&(v),(char*)(p),2)
115
116 #define SkCsCalculateChecksum(p,l)      ((~ip_compute_csum(p, l)) & 0xffff)
117
118 #define SK_ADDR_EQUAL(a1,a2)            (!memcmp(a1,a2,6))
119
120
121 #if !defined(__OPTIMIZE__)  ||  !defined(__KERNEL__)
122 #warning  You must compile this file with the correct options!
123 #warning  See the last lines of the source file.
124 #error You must compile this driver with "-O".
125 #endif
126
127 #if 0
128 #include <linux/version.h>
129 #endif
130 #include <linux/types.h>
131 #if 0
132 #include <linux/kernel.h>
133 #endif
134 #include <linux/string.h>
135 #if 0
136 #include <linux/errno.h>
137 #include <linux/ioport.h>
138 #include <linux/slab.h>
139 #include <linux/interrupt.h>
140 #include <linux/pci.h>
141 #endif
142 #include <asm/byteorder.h>
143 #include <asm/bitops.h>
144 #include <asm/io.h>
145 #if 0
146 #include <linux/netdevice.h>
147 #include <linux/etherdevice.h>
148 #include <linux/skbuff.h>
149
150 #include <linux/init.h>
151 #include <asm/uaccess.h>
152 #include <net/checksum.h>
153 #endif
154
155 #include        "h/sktypes.h"
156 #include        "h/skerror.h"
157 #include        "h/skdebug.h"
158 #include        "h/lm80.h"
159 #include        "h/xmac_ii.h"
160
161 #include "u-boot_compat.h"
162
163 #ifdef __LITTLE_ENDIAN
164 #define SK_LITTLE_ENDIAN
165 #else
166 #define SK_BIG_ENDIAN
167 #endif
168
169 #if 0
170 #define SK_NET_DEVICE   net_device
171 #else
172 #define SK_NET_DEVICE   eth_device
173 #endif
174
175
176 /* we use gethrtime(), return unit: nanoseconds */
177 #if 0
178 #define SK_TICKS_PER_SEC        HZ
179 #else
180 #define SK_TICKS_PER_SEC        CONFIG_SYS_HZ
181 #endif
182
183 #define SK_MEM_MAPPED_IO
184
185 /* #define SK_RLMT_SLOW_LOOKAHEAD */
186
187 #define SK_MAX_MACS             2
188 #define SK_MAX_NETS             2
189
190 #define SK_IOC                  char*
191
192 typedef struct s_DrvRlmtMbuf SK_MBUF;
193
194 #define SK_CONST64      INT64_C
195 #define SK_CONSTU64     UINT64_C
196
197 #define SK_MEMCPY(dest,src,size)        memcpy(dest,src,size)
198 #define SK_MEMCMP(s1,s2,size)           memcmp(s1,s2,size)
199 #define SK_MEMSET(dest,val,size)        memset(dest,val,size)
200 #define SK_STRLEN(pStr)                 strlen((char*)(pStr))
201 #define SK_STRNCPY(pDest,pSrc,size)     strncpy((char*)(pDest),(char*)(pSrc),size)
202 #define SK_STRCMP(pStr1,pStr2)          strcmp((char*)(pStr1),(char*)(pStr2))
203
204 /* macros to access the adapter */
205 #define SK_OUT8(b,a,v)          writeb((v), ((b)+(a)))
206 #define SK_OUT16(b,a,v)         writew((v), ((b)+(a)))
207 #define SK_OUT32(b,a,v)         writel((v), ((b)+(a)))
208 #define SK_IN8(b,a,pv)          (*(pv) = readb((b)+(a)))
209 #define SK_IN16(b,a,pv)         (*(pv) = readw((b)+(a)))
210 #define SK_IN32(b,a,pv)         (*(pv) = readl((b)+(a)))
211
212 #define int8_t          char
213 #define int16_t         short
214 #define int32_t         long
215 #define int64_t         long long
216 #define uint8_t         u_char
217 #define uint16_t        u_short
218 #define uint32_t        u_long
219 #define uint64_t        unsigned long long
220 #define t_scalar_t      int
221 #define t_uscalar_t     unsigned int
222 #define uintptr_t       unsigned long
223
224 #define __CONCAT__(A,B) A##B
225
226 #define INT32_C(a)              __CONCAT__(a,L)
227 #define INT64_C(a)              __CONCAT__(a,LL)
228 #define UINT32_C(a)             __CONCAT__(a,UL)
229 #define UINT64_C(a)             __CONCAT__(a,ULL)
230
231 #ifdef DEBUG
232 #define SK_DBG_PRINTF           printk
233 #ifndef SK_DEBUG_CHKMOD
234 #define SK_DEBUG_CHKMOD         0
235 #endif
236 #ifndef SK_DEBUG_CHKCAT
237 #define SK_DEBUG_CHKCAT         0
238 #endif
239 /* those come from the makefile */
240 #define SK_DBG_CHKMOD(pAC)      (SK_DEBUG_CHKMOD)
241 #define SK_DBG_CHKCAT(pAC)      (SK_DEBUG_CHKCAT)
242
243 extern void SkDbgPrintf(const char *format,...);
244
245 #define SK_DBGMOD_DRV                   0x00010000
246
247 /**** possible driver debug categories ********************************/
248 #define SK_DBGCAT_DRV_ENTRY             0x00010000
249 #define SK_DBGCAT_DRV_SAP               0x00020000
250 #define SK_DBGCAT_DRV_MCA               0x00040000
251 #define SK_DBGCAT_DRV_TX_PROGRESS       0x00080000
252 #define SK_DBGCAT_DRV_RX_PROGRESS       0x00100000
253 #define SK_DBGCAT_DRV_PROGRESS          0x00200000
254 #define SK_DBGCAT_DRV_MSG               0x00400000
255 #define SK_DBGCAT_DRV_PROM              0x00800000
256 #define SK_DBGCAT_DRV_TX_FRAME          0x01000000
257 #define SK_DBGCAT_DRV_ERROR             0x02000000
258 #define SK_DBGCAT_DRV_INT_SRC           0x04000000
259 #define SK_DBGCAT_DRV_EVENT             0x08000000
260
261 #endif
262
263 #define SK_ERR_LOG              SkErrorLog
264
265 extern void SkErrorLog(SK_AC*, int, int, char*);
266
267 #endif