OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [drivers/] [net/] [smc9194.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1626 jcastillo
/*------------------------------------------------------------------------
2
 . smc9194.h
3
 . Copyright (C) 1996 by Erik Stahlman
4
 .
5
 . This software may be used and distributed according to the terms
6
 . of the GNU Public License, incorporated herein by reference.
7
 .
8
 . This file contains register information and access macros for
9
 . the SMC91xxx chipset.
10
 .
11
 . Information contained in this file was obtained from the SMC91C94
12
 . manual from SMC.  To get a copy, if you really want one, you can find
13
 . information under www.smc.com in the components division.
14
 . ( this thanks to advice from Donald Becker ).
15
 .
16
 . Authors
17
 .      Erik Stahlman                           ( erik@vt.edu )
18
 .
19
 . History
20
 . 01/06/96              Erik Stahlman   moved definitions here from main .c file
21
 . 01/19/96              Erik Stahlman    polished this up some, and added better
22
 .                                                                                error handling
23
 .
24
 ---------------------------------------------------------------------------*/
25
#ifndef _SMC9194_H_
26
#define _SMC9194_H_
27
 
28
/* I want some simple types */
29
 
30
typedef unsigned char                   byte;
31
typedef unsigned short                  word;
32
typedef unsigned long int               dword;
33
 
34
 
35
/* Because of bank switching, the SMC91xxx uses only 16 I/O ports */
36
 
37
#define SMC_IO_EXTENT   16
38
 
39
 
40
/*---------------------------------------------------------------
41
 .
42
 . A description of the SMC registers is probably in order here,
43
 . although for details, the SMC datasheet is invaluable.
44
 .
45
 . Basically, the chip has 4 banks of registers ( 0 to 3 ), which
46
 . are accessed by writing a number into the BANK_SELECT register
47
 . ( I also use a SMC_SELECT_BANK macro for this ).
48
 .
49
 . The banks are configured so that for most purposes, bank 2 is all
50
 . that is needed for simple run time tasks.
51
 -----------------------------------------------------------------------*/
52
 
53
/*
54
 . Bank Select Register:
55
 .
56
 .              yyyy yyyy 0000 00xx
57
 .              xx              = bank number
58
 .              yyyy yyyy       = 0x33, for identification purposes.
59
*/
60
#define BANK_SELECT             14
61
 
62
/* BANK 0  */
63
 
64
#define TCR             0       /* transmit control register */
65
#define TCR_ENABLE      0x0001  /* if this is 1, we can transmit */ 
66
#define TCR_FDUPLX      0x0800  /* receive packets sent out */
67
#define TCR_STP_SQET    0x1000  /* stop transmitting if Signal quality error */
68
#define TCR_MON_CNS     0x0400  /* monitors the carrier status */
69
#define TCR_PAD_ENABLE  0x0080  /* pads short packets to 64 bytes */
70
 
71
#define TCR_CLEAR       0        /* do NOTHING */
72
/* the normal settings for the TCR register : */
73
/* QUESTION: do I want to enable padding of short packets ? */
74
#define TCR_NORMAL      TCR_ENABLE 
75
 
76
 
77
#define EPH_STATUS      2
78
#define ES_LINK_OK      0x4000  /* is the link integrity ok ? */
79
 
80
#define RCR             4
81
#define RCR_SOFTRESET   0x8000  /* resets the chip */   
82
#define RCR_STRIP_CRC   0x200   /* strips CRC */
83
#define RCR_ENABLE      0x100   /* IFF this is set, we can receive packets */
84
#define RCR_ALMUL       0x4     /* receive all multicast packets */
85
#define RCR_PROMISC     0x2     /* enable promiscuous mode */
86
 
87
/* the normal settings for the RCR register : */
88
#define RCR_NORMAL      (RCR_STRIP_CRC | RCR_ENABLE)
89
#define RCR_CLEAR       0x0             /* set it to a base state */
90
 
91
#define COUNTER         6
92
#define MIR             8
93
#define MCR             10
94
/* 12 is reserved */
95
 
96
/* BANK 1 */
97
#define CONFIG                  0
98
#define CFG_AUI_SELECT          0x100
99
#define BASE                    2
100
#define ADDR0                   4
101
#define ADDR1                   6
102
#define ADDR2                   8
103
#define GENERAL                 10
104
#define CONTROL                 12
105
#define CTL_POWERDOWN           0x2000
106
#define CTL_LE_ENABLE           0x80
107
#define CTL_CR_ENABLE           0x40
108
#define CTL_TE_ENABLE           0x0020
109
#define CTL_AUTO_RELEASE        0x0800
110
#define CTL_EPROM_ACCESS        0x0003 /* high if Eprom is being read */
111
 
112
/* BANK 2 */
113
#define MMU_CMD         0
114
#define MC_BUSY         1       /* only readable bit in the register */
115
#define MC_NOP          0
116
#define MC_ALLOC        0x20    /* or with number of 256 byte packets */
117
#define MC_RESET        0x40    
118
#define MC_REMOVE       0x60    /* remove the current rx packet */
119
#define MC_RELEASE      0x80    /* remove and release the current rx packet */
120
#define MC_FREEPKT      0xA0    /* Release packet in PNR register */
121
#define MC_ENQUEUE      0xC0    /* Enqueue the packet for transmit */
122
 
123
#
124
#define PNR_ARR         2
125
#define FIFO_PORTS      4
126
 
127
#define FP_RXEMPTY  0x8000
128
#define FP_TXEMPTY  0x80
129
 
130
#define POINTER         6
131
#define PTR_READ        0x2000
132
#define PTR_RCV         0x8000
133
#define PTR_AUTOINC     0x4000
134
#define PTR_AUTO_INC    0x0040
135
 
136
#define DATA_1          8
137
#define DATA_2          10
138
#define INTERRUPT       12
139
 
140
#define INT_MASK        13
141
#define IM_RCV_INT      0x1
142
#define IM_TX_INT       0x2
143
#define IM_TX_EMPTY_INT 0x4     
144
#define IM_ALLOC_INT    0x8
145
#define IM_RX_OVRN_INT  0x10
146
#define IM_EPH_INT      0x20
147
#define IM_ERCV_INT     0x40 /* not on SMC9192 */               
148
 
149
#define INT_MASK_W      12
150
 
151
/* BANK 3 */
152
#define MULTICAST1      0
153
#define MULTICAST2      2
154
#define MULTICAST3      4
155
#define MULTICAST4      6
156
#define MGMT            8
157
#define REVISION        10 /* ( hi: chip id   low: rev # ) */
158
 
159
 
160
/* this is NOT on SMC9192 */
161
#define ERCV            12
162
 
163
#define CHIP_9190       3
164
#define CHIP_9194       4
165
#define CHIP_9195       5
166
#define CHIP_91100      7
167
 
168
static const char * chip_ids[ 15 ] =  {
169
        NULL, NULL, NULL,
170
        /* 3 */ "SMC91C90/91C92",
171
        /* 4 */ "SMC91C94",
172
        /* 5 */ "SMC91C95",
173
        NULL,
174
        /* 7 */ "SMC91C100",
175
        NULL,
176
        /* 9 */ "SMC91C110",
177
        NULL, NULL, NULL,
178
        NULL, NULL, NULL};
179
 
180
/*
181
 . Transmit status bits
182
*/
183
#define TS_SUCCESS 0x0001
184
#define TS_LOSTCAR 0x0400
185
#define TS_LATCOL  0x0200
186
#define TS_16COL   0x0010
187
 
188
/*
189
 . Receive status bits
190
*/
191
#define RS_ALGNERR      0x8000
192
#define RS_BADCRC       0x2000
193
#define RS_ODDFRAME     0x1000
194
#define RS_TOOLONG      0x0800
195
#define RS_TOOSHORT     0x0400
196
#define RS_MULTICAST    0x0001
197
#define RS_ERRORS       (RS_ALGNERR | RS_BADCRC | RS_TOOLONG | RS_TOOSHORT) 
198
 
199
static const char * interfaces[ 2 ] = { "TP", "AUI" };
200
 
201
/*-------------------------------------------------------------------------
202
 .  I define some macros to make it easier to do somewhat common
203
 . or slightly complicated, repeated tasks.
204
 --------------------------------------------------------------------------*/
205
 
206
/* select a register bank, 0 to 3  */
207
 
208
#define SMC_SELECT_BANK(x)  { outw( x, ioaddr + BANK_SELECT ); } 
209
 
210
/* define a small delay for the reset */
211
#define SMC_DELAY() { inw( ioaddr + RCR );\
212
                        inw( ioaddr + RCR );\
213
                        inw( ioaddr + RCR );  }
214
 
215
/*
216
 *      On ColdFire systems the SMC part can only be accessed with
217
 *      16bit transfers -- no 8 bit reads or writes. So we need to
218
 *      clean up the outb() calls to all be outw.
219
 */
220
#ifdef CONFIG_COLDFIRE
221
 
222
/* this enables an interrupt in the interrupt mask register */
223
#define SMC_ENABLE_INT(x) {\
224
                unsigned short mask;\
225
                SMC_SELECT_BANK(2);\
226
                mask = inb( ioaddr + INT_MASK );\
227
                mask |= (x);\
228
                outw( mask << 8, ioaddr + INT_MASK_W ); \
229
}
230
 
231
/* this disables an interrupt from the interrupt mask register */
232
#define SMC_DISABLE_INT(x) {\
233
                unsigned short mask;\
234
                SMC_SELECT_BANK(2);\
235
                mask = inb( ioaddr + INT_MASK );\
236
                mask &= ~(x);\
237
                outw( mask << 8, ioaddr + INT_MASK_W ); \
238
}
239
 
240
/* set the interrupt mask register */
241
#define SMC_SET_INT(x) {\
242
                SMC_SELECT_BANK(2);\
243
                outw( ((unsigned short) (x)) << 8, ioaddr + INT_MASK_W );\
244
}
245
 
246
/* acknowledge an interrupt */
247
#define SMC_ACK_INT(x) {\
248
                unsigned short val;\
249
                /* assume BANK 2 selected */\
250
                val = inb( ioaddr + INT_MASK );\
251
                val = (val << 8) | (x);\
252
                outw( val, ioaddr + INT_MASK_W );\
253
}
254
 
255
#else
256
 
257
/* this enables an interrupt in the interrupt mask register */
258
#define SMC_ENABLE_INT(x) {\
259
                unsigned char mask;\
260
                SMC_SELECT_BANK(2);\
261
                mask = inb( ioaddr + INT_MASK );\
262
                mask |= (x);\
263
                outb( mask, ioaddr + INT_MASK ); \
264
}
265
 
266
/* this disables an interrupt from the interrupt mask register */
267
#define SMC_DISABLE_INT(x) {\
268
                unsigned char mask;\
269
                SMC_SELECT_BANK(2);\
270
                mask = inb( ioaddr + INT_MASK );\
271
                mask &= ~(x);\
272
                outb( mask, ioaddr + INT_MASK ); \
273
}
274
 
275
 
276
/* set the interrupt mask register */
277
#define SMC_SET_INT(x) {\
278
                SMC_SELECT_BANK(2);\
279
                outb( (x), ioaddr + INT_MASK );\
280
}
281
 
282
/* acknowledge an interrupt */
283
#define SMC_ACK_INT(x)  outb( (x), ioaddr + INTERRUPT )
284
 
285
#endif  /* CONFIG_COLDFIRE */
286
 
287
/*----------------------------------------------------------------------
288
 . Define the interrupts that I want to receive from the card
289
 .
290
 . I want:
291
 .  IM_EPH_INT, for nasty errors
292
 .  IM_RCV_INT, for happy received packets
293
 .  IM_RX_OVRN_INT, because I have to kick the receiver
294
 --------------------------------------------------------------------------*/
295
#define SMC_INTERRUPT_MASK   (IM_EPH_INT | IM_RX_OVRN_INT | IM_RCV_INT) 
296
 
297
#endif  /* _SMC_9194_H_ */
298
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.