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

Subversion Repositories or1k

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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1626 jcastillo
/*------------------------------------------------------------------------
2
 . smc91111.h - macros for the LAN91C111 Ethernet Driver
3
 .
4
 . Copyright (C) 2001 Standard Microsystems Corporation (SMSC)
5
 .       Developed by Simple Network Magic Corporation (SNMC)
6
 . Copyright (C) 1996 by Erik Stahlman (ES)
7
 .
8
 . This program is free software; you can redistribute it and/or modify
9
 . it under the terms of the GNU General Public License as published by
10
 . the Free Software Foundation; either version 2 of the License, or
11
 . (at your option) any later version.
12
 .
13
 . This program is distributed in the hope that it will be useful,
14
 . but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 . MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 . GNU General Public License for more details.
17
 .
18
 . You should have received a copy of the GNU General Public License
19
 . along with this program; if not, write to the Free Software
20
 . Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
 .
22
 . This file contains register information and access macros for
23
 . the LAN91C111 single chip ethernet controller.  It is a modified
24
 . version of the smc9194.h file.
25
 .
26
 . Information contained in this file was obtained from the LAN91C111
27
 . manual from SMC.  To get a copy, if you really want one, you can find
28
 . information under www.smsc.com.
29
 .
30
 . macros to provide 2.2 functions in a 2.0 enviroment
31
 . These macros are taken from "Linux Device Drivers" by Alessandro Rubini
32
 . and Jonathan Corbet, published by O'Reilly & Associates
33
 .
34
 . Authors
35
 .      Erik Stahlman                           ( erik@vt.edu )
36
 .      Daris A Nevil                           ( dnevil@snmc.com )
37
 .  David Armstrong     ( armstrong@sedsystems.ca )
38
 . History
39
 . 03/16/01             Daris A Nevil   Modified for use with LAN91C111 device
40
 . 09.04/01   David Armstrong Modified for use with 2.0 kernels
41
 ---------------------------------------------------------------------------*/
42
#ifndef _SMC91111_H_
43
#define _SMC91111_H_
44
 
45
/* I want some simple types */
46
 
47
typedef unsigned char                   byte;
48
typedef unsigned short                  word;
49
typedef unsigned long int               dword;
50
 
51
 
52
/* Because of bank switching, the LAN91xxx uses only 16 I/O ports */
53
 
54
#define SMC_IO_EXTENT   16
55
 
56
 
57
/*---------------------------------------------------------------
58
 .
59
 . A description of the SMSC registers is probably in order here,
60
 . although for details, the SMC datasheet is invaluable.
61
 .
62
 . Basically, the chip has 4 banks of registers ( 0 to 3 ), which
63
 . are accessed by writing a number into the BANK_SELECT register
64
 . ( I also use a SMC_SELECT_BANK macro for this ).
65
 .
66
 . The banks are configured so that for most purposes, bank 2 is all
67
 . that is needed for simple run time tasks.
68
 -----------------------------------------------------------------------*/
69
 
70
/*
71
 . Bank Select Register:
72
 .
73
 .              yyyy yyyy 0000 00xx
74
 .              xx              = bank number
75
 .              yyyy yyyy       = 0x33, for identification purposes.
76
*/
77
#define BANK_SELECT             14
78
 
79
// Transmit Control Register
80
/* BANK 0  */
81
#define TCR_REG         0x0000  // transmit control register 
82
#define TCR_ENABLE      0x0001  // When 1 we can transmit
83
#define TCR_LOOP        0x0002  // Controls output pin LBK
84
#define TCR_FORCOL      0x0004  // When 1 will force a collision
85
#define TCR_PAD_EN      0x0080  // When 1 will pad tx frames < 64 bytes w/0
86
#define TCR_NOCRC       0x0100  // When 1 will not append CRC to tx frames
87
#define TCR_MON_CSN     0x0400  // When 1 tx monitors carrier
88
#define TCR_FDUPLX      0x0800  // When 1 enables full duplex operation
89
#define TCR_STP_SQET    0x1000  // When 1 stops tx if Signal Quality Error
90
#define TCR_EPH_LOOP    0x2000  // When 1 enables EPH block loopback
91
#define TCR_SWFDUP      0x8000  // When 1 enables Switched Full Duplex mode
92
 
93
#define TCR_CLEAR       0        /* do NOTHING */
94
/* the default settings for the TCR register : */
95
/* QUESTION: do I want to enable padding of short packets ? */
96
#define TCR_DEFAULT     TCR_ENABLE 
97
 
98
 
99
// EPH Status Register
100
/* BANK 0  */
101
#define EPH_STATUS_REG  0x0002
102
#define ES_TX_SUC       0x0001  // Last TX was successful
103
#define ES_SNGL_COL     0x0002  // Single collision detected for last tx
104
#define ES_MUL_COL      0x0004  // Multiple collisions detected for last tx
105
#define ES_LTX_MULT     0x0008  // Last tx was a multicast
106
#define ES_16COL        0x0010  // 16 Collisions Reached
107
#define ES_SQET         0x0020  // Signal Quality Error Test
108
#define ES_LTXBRD       0x0040  // Last tx was a broadcast
109
#define ES_TXDEFR       0x0080  // Transmit Deferred
110
#define ES_LATCOL       0x0200  // Late collision detected on last tx
111
#define ES_LOSTCARR     0x0400  // Lost Carrier Sense
112
#define ES_EXC_DEF      0x0800  // Excessive Deferral
113
#define ES_CTR_ROL      0x1000  // Counter Roll Over indication
114
#define ES_LINK_OK      0x4000  // Driven by inverted value of nLNK pin
115
#define ES_TXUNRN       0x8000  // Tx Underrun
116
 
117
 
118
// Receive Control Register
119
/* BANK 0  */
120
#define RCR_REG         0x0004
121
#define RCR_RX_ABORT    0x0001  // Set if a rx frame was aborted
122
#define RCR_PRMS        0x0002  // Enable promiscuous mode
123
#define RCR_ALMUL       0x0004  // When set accepts all multicast frames
124
#define RCR_RXEN        0x0100  // IFF this is set, we can receive packets
125
#define RCR_STRIP_CRC   0x0200  // When set strips CRC from rx packets
126
#define RCR_ABORT_ENB   0x0200  // When set will abort rx on collision 
127
#define RCR_FILT_CAR    0x0400  // When set filters leading 12 bit s of carrier
128
#define RCR_SOFTRST     0x8000  // resets the chip
129
 
130
/* the normal settings for the RCR register : */
131
#define RCR_DEFAULT     (RCR_STRIP_CRC | RCR_RXEN)
132
#define RCR_CLEAR       0x0     // set it to a base state
133
 
134
// Counter Register
135
/* BANK 0  */
136
#define COUNTER_REG     0x0006
137
 
138
// Memory Information Register
139
/* BANK 0  */
140
#define MIR_REG         0x0008
141
 
142
// Receive/Phy Control Register
143
/* BANK 0  */
144
#define RPC_REG         0x000A
145
#define RPC_SPEED       0x2000  // When 1 PHY is in 100Mbps mode.
146
#define RPC_DPLX        0x1000  // When 1 PHY is in Full-Duplex Mode
147
#define RPC_ANEG        0x0800  // When 1 PHY is in Auto-Negotiate Mode
148
#define RPC_LSXA_SHFT   5       // Bits to shift LS2A,LS1A,LS0A to lsb
149
#define RPC_LSXB_SHFT   2       // Bits to get LS2B,LS1B,LS0B to lsb
150
#define RPC_LED_100_10  (0x00)  // LED = 100Mbps OR's with 10Mbps link detect
151
#define RPC_LED_RES     (0x01)  // LED = Reserved
152
#define RPC_LED_10      (0x02)  // LED = 10Mbps link detect
153
#define RPC_LED_FD      (0x03)  // LED = Full Duplex Mode
154
#define RPC_LED_TX_RX   (0x04)  // LED = TX or RX packet occurred
155
#define RPC_LED_100     (0x05)  // LED = 100Mbps link dectect
156
#define RPC_LED_TX      (0x06)  // LED = TX packet occurred
157
#define RPC_LED_RX      (0x07)  // LED = RX packet occurred
158
/* The default led functions:
159
   LEDA - LINK
160
   LEDB - ACTIVITY
161
   */
162
#define RPC_DEFAULT \
163
        ((RPC_ANEG) | (RPC_LED_100_10 << RPC_LSXA_SHFT) | \
164
         (RPC_LED_TX_RX << RPC_LSXB_SHFT) | RPC_SPEED | RPC_DPLX)
165
 
166
/* Bank 0 0x000C is reserved */
167
 
168
// Bank Select Register
169
/* All Banks */
170
#define BSR_REG 0x000E
171
 
172
 
173
// Configuration Reg
174
/* BANK 1 */
175
#define CONFIG_REG      0x0000
176
#define CONFIG_EXT_PHY  0x0200  // 1=external MII, 0=internal Phy
177
#define CONFIG_GPCNTRL  0x0400  // Inverse value drives pin nCNTRL
178
#define CONFIG_NO_WAIT  0x1000  // When 1 no extra wait states on ISA bus
179
#define CONFIG_EPH_POWER_EN 0x8000 // When 0 EPH is placed into low power mode.
180
 
181
// Default is powered-up, Internal Phy, Wait States, and pin nCNTRL=low
182
#define CONFIG_DEFAULT  (CONFIG_EPH_POWER_EN)
183
 
184
 
185
// Base Address Register
186
/* BANK 1 */
187
#define BASE_REG        0x0002
188
 
189
 
190
// Individual Address Registers
191
/* BANK 1 */
192
#define ADDR0_REG       0x0004
193
#define ADDR1_REG       0x0006
194
#define ADDR2_REG       0x0008
195
 
196
 
197
// General Purpose Register
198
/* BANK 1 */
199
#define GP_REG          0x000A
200
 
201
 
202
// Control Register
203
/* BANK 1 */
204
#define CTL_REG         0x000C
205
#define CTL_RCV_BAD     0x4000 // When 1 bad CRC packets are received
206
#define CTL_AUTO_RELEASE 0x0800 // When 1 tx pages are released automatically
207
#define CTL_LE_ENABLE   0x0080 // When 1 enables Link Error interrupt
208
#define CTL_CR_ENABLE   0x0040 // When 1 enables Counter Rollover interrupt
209
#define CTL_TE_ENABLE   0x0020 // When 1 enables Transmit Error interrupt
210
#define CTL_EEPROM_SELECT 0x0004 // Controls EEPROM reload & store
211
#define CTL_RELOAD      0x0002 // When set reads EEPROM into registers
212
#define CTL_STORE       0x0001 // When set stores registers into EEPROM
213
 
214
 
215
// MMU Command Register
216
/* BANK 2 */
217
#define MMU_CMD_REG     0x0000
218
#define MC_BUSY         1       // When 1 the last release has not completed
219
#define MC_NOP          (0<<5)  // No Op
220
#define MC_ALLOC        (1<<5)  // OR with number of 256 byte packets
221
#define MC_RESET        (2<<5)  // Reset MMU to initial state
222
#define MC_REMOVE       (3<<5)  // Remove the current rx packet
223
#define MC_RELEASE      (4<<5)  // Remove and release the current rx packet
224
#define MC_FREEPKT      (5<<5)  // Release packet in PNR register
225
#define MC_ENQUEUE      (6<<5)  // Enqueue the packet for transmit
226
#define MC_RSTTXFIFO    (7<<5)  // Reset the TX FIFOs
227
 
228
 
229
// Packet Number Register
230
/* BANK 2 */
231
#define PN_REG          0x0002
232
 
233
 
234
// Allocation Result Register
235
/* BANK 2 */
236
#define AR_REG          0x0003
237
#define AR_FAILED       0x80    // Alocation Failed
238
 
239
 
240
// RX FIFO Ports Register
241
/* BANK 2 */
242
#define RXFIFO_REG      0x0004  // Must be read as a word
243
#define RXFIFO_REMPTY   0x8000  // RX FIFO Empty
244
 
245
 
246
// TX FIFO Ports Register
247
/* BANK 2 */
248
#define TXFIFO_REG      RXFIFO_REG      // Must be read as a word
249
#define TXFIFO_TEMPTY   0x80    // TX FIFO Empty
250
 
251
 
252
// Pointer Register
253
/* BANK 2 */
254
#define PTR_REG         0x0006
255
#define PTR_RCV         0x8000 // 1=Receive area, 0=Transmit area
256
#define PTR_AUTOINC     0x4000 // Auto increment the pointer on each access
257
#define PTR_READ        0x2000 // When 1 the operation is a read
258
 
259
 
260
// Data Register
261
/* BANK 2 */
262
#define DATA_REG        0x0008
263
 
264
 
265
// Interrupt Status/Acknowledge Register
266
// BANK 2
267
#define INT_REG         0x000C
268
 
269
 
270
// Interrupt Mask Register
271
// BANK 2
272
#define IM_REG          0x000D
273
 
274
#define IM_MDINT        0x80 // PHY MI Register 18 Interrupt
275
#define IM_ERCV_INT     0x40 // Early Receive Interrupt
276
#define IM_EPH_INT      0x20 // Set by Etheret Protocol Handler section
277
#define IM_RX_OVRN_INT  0x10 // Set by Receiver Overruns
278
#define IM_ALLOC_INT    0x08 // Set when allocation request is completed
279
#define IM_TX_EMPTY_INT 0x04 // Set if the TX FIFO goes empty
280
#define IM_TX_INT       0x02 // Transmit Interrrupt
281
#define IM_RCV_INT      0x01 // Receive Interrupt
282
 
283
 
284
// Multicast Table Registers
285
/* BANK 3 */
286
#define MCAST_REG1      0x0000
287
#define MCAST_REG2      0x0002
288
#define MCAST_REG3      0x0004
289
#define MCAST_REG4      0x0006
290
 
291
 
292
// Management Interface Register (MII)
293
/* BANK 3 */
294
#define MII_REG         0x0008
295
#define MII_MSK_CRS100  0x4000 // Disables CRS100 detection during tx half dup
296
#define MII_MDOE        0x0008 // MII Output Enable
297
#define MII_MCLK        0x0004 // MII Clock, pin MDCLK
298
#define MII_MDI         0x0002 // MII Input, pin MDI
299
#define MII_MDO         0x0001 // MII Output, pin MDO
300
 
301
 
302
// Revision Register
303
/* BANK 3 */
304
#define REV_REG         0x000A /* ( hi: chip id   low: rev # ) */
305
 
306
 
307
// Early RCV Register
308
/* BANK 3 */
309
/* this is NOT on SMC9192 */
310
#define ERCV_REG        0x000C
311
#define ERCV_RCV_DISCRD 0x0080 // When 1 discards a packet being received
312
#define ERCV_THRESHOLD  0x001F // ERCV Threshold Mask
313
 
314
// External Register
315
/* BANK 7 */
316
#define EXT_REG         0x0000
317
 
318
 
319
#define CHIP_9192       3
320
#define CHIP_9194       4
321
#define CHIP_9195       5
322
#define CHIP_9196       6
323
#define CHIP_91100      7
324
#define CHIP_91100FD    8
325
#define CHIP_91111FD    9
326
 
327
static const char * chip_ids[ 15 ] =  {
328
        NULL, NULL, NULL,
329
        /* 3 */ "SMC91C90/91C92",
330
        /* 4 */ "SMC91C94",
331
        /* 5 */ "SMC91C95",
332
        /* 6 */ "SMC91C96",
333
        /* 7 */ "SMC91C100",
334
        /* 8 */ "SMC91C100FD",
335
        /* 9 */ "SMC91C11xFD",
336
        NULL, NULL,
337
        NULL, NULL, NULL};
338
 
339
/*
340
 . Transmit status bits
341
*/
342
#define TS_SUCCESS 0x0001
343
#define TS_LOSTCAR 0x0400
344
#define TS_LATCOL  0x0200
345
#define TS_16COL   0x0010
346
 
347
/*
348
 . Receive status bits
349
*/
350
#define RS_ALGNERR      0x8000
351
#define RS_BRODCAST     0x4000
352
#define RS_BADCRC       0x2000
353
#define RS_ODDFRAME     0x1000  // bug: the LAN91C111 never sets this on receive
354
#define RS_TOOLONG      0x0800
355
#define RS_TOOSHORT     0x0400
356
#define RS_MULTICAST    0x0001
357
#define RS_ERRORS       (RS_ALGNERR | RS_BADCRC | RS_TOOLONG | RS_TOOSHORT) 
358
 
359
 
360
// PHY Types
361
enum {
362
        PHY_LAN83C183 = 1,      // LAN91C111 Internal PHY
363
        PHY_LAN83C180
364
};
365
 
366
 
367
// PHY Register Addresses (LAN91C111 Internal PHY)
368
 
369
// PHY Control Register
370
#define PHY_CNTL_REG            0x00
371
#define PHY_CNTL_RST            0x8000  // 1=PHY Reset
372
#define PHY_CNTL_LPBK           0x4000  // 1=PHY Loopback
373
#define PHY_CNTL_SPEED          0x2000  // 1=100Mbps, 0=10Mpbs
374
#define PHY_CNTL_ANEG_EN        0x1000 // 1=Enable Auto negotiation
375
#define PHY_CNTL_PDN            0x0800  // 1=PHY Power Down mode
376
#define PHY_CNTL_MII_DIS        0x0400  // 1=MII 4 bit interface disabled
377
#define PHY_CNTL_ANEG_RST       0x0200 // 1=Reset Auto negotiate
378
#define PHY_CNTL_DPLX           0x0100  // 1=Full Duplex, 0=Half Duplex
379
#define PHY_CNTL_COLTST         0x0080  // 1= MII Colision Test
380
 
381
// PHY Status Register
382
#define PHY_STAT_REG            0x01
383
#define PHY_STAT_CAP_T4         0x8000  // 1=100Base-T4 capable
384
#define PHY_STAT_CAP_TXF        0x4000  // 1=100Base-X full duplex capable
385
#define PHY_STAT_CAP_TXH        0x2000  // 1=100Base-X half duplex capable
386
#define PHY_STAT_CAP_TF         0x1000  // 1=10Mbps full duplex capable
387
#define PHY_STAT_CAP_TH         0x0800  // 1=10Mbps half duplex capable
388
#define PHY_STAT_CAP_SUPR       0x0040  // 1=recv mgmt frames with not preamble
389
#define PHY_STAT_ANEG_ACK       0x0020  // 1=ANEG has completed
390
#define PHY_STAT_REM_FLT        0x0010  // 1=Remote Fault detected
391
#define PHY_STAT_CAP_ANEG       0x0008  // 1=Auto negotiate capable
392
#define PHY_STAT_LINK           0x0004  // 1=valid link
393
#define PHY_STAT_JAB            0x0002  // 1=10Mbps jabber condition
394
#define PHY_STAT_EXREG          0x0001  // 1=extended registers implemented
395
#define PHY_STAT_RESERVED   0x0780  // Reserved bits mask.
396
 
397
// PHY Identifier Registers
398
#define PHY_ID1_REG             0x02    // PHY Identifier 1
399
#define PHY_ID2_REG             0x03    // PHY Identifier 2
400
 
401
// PHY Auto-Negotiation Advertisement Register
402
#define PHY_AD_REG              0x04
403
#define PHY_AD_NP               0x8000  // 1=PHY requests exchange of Next Page
404
#define PHY_AD_ACK              0x4000  // 1=got link code word from remote
405
#define PHY_AD_RF               0x2000  // 1=advertise remote fault
406
#define PHY_AD_T4               0x0200  // 1=PHY is capable of 100Base-T4
407
#define PHY_AD_TX_FDX           0x0100  // 1=PHY is capable of 100Base-TX FDPLX
408
#define PHY_AD_TX_HDX           0x0080  // 1=PHY is capable of 100Base-TX HDPLX
409
#define PHY_AD_10_FDX           0x0040  // 1=PHY is capable of 10Base-T FDPLX
410
#define PHY_AD_10_HDX           0x0020  // 1=PHY is capable of 10Base-T HDPLX
411
#define PHY_AD_CSMA             0x0001  // 1=PHY is capable of 802.3 CMSA
412
 
413
// PHY Auto-negotiation Remote End Capability Register
414
#define PHY_RMT_REG             0x05
415
// Uses same bit definitions as PHY_AD_REG
416
 
417
// PHY Configuration Register 1
418
#define PHY_CFG1_REG            0x10
419
#define PHY_CFG1_LNKDIS         0x8000  // 1=Rx Link Detect Function disabled
420
#define PHY_CFG1_XMTDIS         0x4000  // 1=TP Transmitter Disabled
421
#define PHY_CFG1_XMTPDN         0x2000  // 1=TP Transmitter Powered Down
422
#define PHY_CFG1_BYPSCR         0x0400  // 1=Bypass scrambler/descrambler
423
#define PHY_CFG1_UNSCDS         0x0200  // 1=Unscramble Idle Reception Disable
424
#define PHY_CFG1_EQLZR          0x0100  // 1=Rx Equalizer Disabled
425
#define PHY_CFG1_CABLE          0x0080  // 1=STP(150ohm), 0=UTP(100ohm)
426
#define PHY_CFG1_RLVL0          0x0040  // 1=Rx Squelch level reduced by 4.5db
427
#define PHY_CFG1_TLVL_SHIFT     2       // Transmit Output Level Adjust
428
#define PHY_CFG1_TLVL_MASK      0x003C
429
#define PHY_CFG1_TRF_MASK       0x0003  // Transmitter Rise/Fall time
430
 
431
 
432
// PHY Configuration Register 2
433
#define PHY_CFG2_REG            0x11
434
#define PHY_CFG2_APOLDIS        0x0020  // 1=Auto Polarity Correction disabled
435
#define PHY_CFG2_JABDIS         0x0010  // 1=Jabber disabled
436
#define PHY_CFG2_MREG           0x0008  // 1=Multiple register access (MII mgt)
437
#define PHY_CFG2_INTMDIO        0x0004  // 1=Interrupt signaled with MDIO pulseo
438
 
439
// PHY Status Output (and Interrupt status) Register
440
#define PHY_INT_REG             0x12    // Status Output (Interrupt Status)
441
#define PHY_INT_INT             0x8000  // 1=bits have changed since last read
442
#define PHY_INT_LNKFAIL         0x4000  // 1=Link Not detected
443
#define PHY_INT_LOSSSYNC        0x2000  // 1=Descrambler has lost sync
444
#define PHY_INT_CWRD            0x1000  // 1=Invalid 4B5B code detected on rx
445
#define PHY_INT_SSD             0x0800  // 1=No Start Of Stream detected on rx
446
#define PHY_INT_ESD             0x0400  // 1=No End Of Stream detected on rx
447
#define PHY_INT_RPOL            0x0200  // 1=Reverse Polarity detected
448
#define PHY_INT_JAB             0x0100  // 1=Jabber detected
449
#define PHY_INT_SPDDET          0x0080  // 1=100Base-TX mode, 0=10Base-T mode
450
#define PHY_INT_DPLXDET         0x0040  // 1=Device in Full Duplex
451
 
452
// PHY Interrupt/Status Mask Register
453
#define PHY_MASK_REG            0x13    // Interrupt Mask
454
// Uses the same bit definitions as PHY_INT_REG
455
 
456
 
457
 
458
/*-------------------------------------------------------------------------
459
 .  I define some macros to make it easier to do somewhat common
460
 . or slightly complicated, repeated tasks.
461
 --------------------------------------------------------------------------*/
462
 
463
/* macros to provide 2.2 functions in a 2.0 enviroment */
464
/* These macros are taken from "Linux Device Drivers" by Alessandro Rubini */
465
/* and Jonathan Corbet, published by O'Reilly & Associates */
466
extern inline void schedule_timeout(int timeout)
467
{
468
        current->timeout = jiffies + timeout;
469
        current->state =TASK_INTERRUPTIBLE;
470
        schedule();
471
        current->timeout = 0;
472
}
473
#define test_and_set_bit(nr,addr) test_bit((nr),(addr))
474
#define mdelay(x) udelay(x*1000)
475
#define signal_pending(current) ((current)->signal & ~(current)->blocked)
476
#define in_interrupt() (intr_count !=0)
477
 
478
 
479
/* select a register bank, 0 to 3  */
480
#define SMC_SELECT_BANK(x)  { outw( x, ioaddr + BANK_SELECT ); } 
481
 
482
 
483
/*
484
 *      Some boards have the SMC91c111 connected in such a way thay
485
 *      they can only be used with 16bit reads and writes. This is
486
 *      not really a problem (and certainly has no performance impact).
487
 */
488
#if defined(CONFIG_SMC16BITONLY)
489
 
490
/* this enables an interrupt in the interrupt mask register */
491
#define SMC_ENABLE_INT(x) {\
492
                unsigned short mask;\
493
                SMC_SELECT_BANK(2);\
494
                mask = inb( ioaddr + IM_REG );\
495
                mask |= (x);\
496
                outw( mask << 8, ioaddr + INT_REG ); \
497
}
498
 
499
/* this disables an interrupt from the interrupt mask register */
500
#define SMC_DISABLE_INT(x) {\
501
                unsigned short mask;\
502
                SMC_SELECT_BANK(2);\
503
                mask = inb( ioaddr + IM_REG );\
504
                mask &= ~(x);\
505
                outw( mask << 8, ioaddr + IM_REG ); \
506
}
507
 
508
#else
509
 
510
/* this enables an interrupt in the interrupt mask register */
511
#define SMC_ENABLE_INT(x) {\
512
                unsigned char mask;\
513
                SMC_SELECT_BANK(2);\
514
                mask = inb( ioaddr + IM_REG );\
515
                mask |= (x);\
516
                outb( mask, ioaddr + IM_REG ); \
517
}
518
 
519
/* this disables an interrupt from the interrupt mask register */
520
#define SMC_DISABLE_INT(x) {\
521
                unsigned char mask;\
522
                SMC_SELECT_BANK(2);\
523
                mask = inb( ioaddr + IM_REG );\
524
                mask &= ~(x);\
525
                outb( mask, ioaddr + IM_REG ); \
526
}
527
 
528
#endif  /* CONFIG_SMC16BITONLY */
529
 
530
/*----------------------------------------------------------------------
531
 . Define the interrupts that I want to receive from the card
532
 .
533
 . I want:
534
 .  IM_EPH_INT, for nasty errors
535
 .  IM_RCV_INT, for happy received packets
536
 .  IM_RX_OVRN_INT, because I have to kick the receiver
537
 .  IM_MDINT, for PHY Register 18 Status Changes
538
 --------------------------------------------------------------------------*/
539
#define SMC_INTERRUPT_MASK   (IM_EPH_INT | IM_RX_OVRN_INT | IM_RCV_INT | \
540
        IM_MDINT)
541
 
542
 
543
#ifdef CONFIG_SYSCTL
544
 
545
 
546
/*
547
 * Declarations for the sysctl interface, which allows users the ability to
548
 * control the finer aspects of the LAN91C111 chip.  Since the smc
549
 * module currently registers its sysctl table dynamically, the sysctl path
550
 * for module FOO is /proc/sys/dev/ethX/FOO
551
 */
552
#define CTL_SMC         (CTL_BUS+1389)      // arbitrary and hopefully unused
553
 
554
enum {
555
        CTL_SMC_INFO = 1,       // Sysctl files information
556
        CTL_SMC_SWVER,          // Driver Software Version Info
557
        CTL_SMC_SWFDUP,         // Switched Full Duplex Mode
558
        CTL_SMC_EPHLOOP,        // EPH Block Internal Loopback
559
        CTL_SMC_MIIOP,          // MII Operation
560
        CTL_SMC_AUTONEG,        // Auto-negotiate Mode
561
        CTL_SMC_RFDUPLX,        // Request Full Duplex Mode
562
        CTL_SMC_RSPEED,         // Request Speed Selection
563
        CTL_SMC_AFDUPLX,        // Actual Full Duplex Mode
564
        CTL_SMC_ASPEED,         // Actual Speed Selection
565
        CTL_SMC_LNKFAIL,        // Link Failed
566
        CTL_SMC_FORCOL,         // Force a Collision
567
        CTL_SMC_FILTCAR,        // Filter Carrier
568
        CTL_SMC_FREEMEM,        // Free Buffer Memory
569
        CTL_SMC_TOTMEM,         // Total Buffer Memory
570
        CTL_SMC_LEDA,           // Output of LED-A
571
        CTL_SMC_LEDB,           // Output of LED-B
572
        CTL_SMC_CHIPREV,        // LAN91C111 Chip Revision ID
573
#ifdef SMC_DEBUG
574
        // Register access for debugging
575
        CTL_SMC_REG_BSR,        // Bank Select
576
        CTL_SMC_REG_TCR,        // Transmit Control
577
        CTL_SMC_REG_ESR,        // EPH Status
578
        CTL_SMC_REG_RCR,        // Receive Control
579
        CTL_SMC_REG_CTRR,       // Counter
580
        CTL_SMC_REG_MIR,        // Memory Information
581
        CTL_SMC_REG_RPCR,       // Receive/Phy Control
582
        CTL_SMC_REG_CFGR,       // Configuration
583
        CTL_SMC_REG_BAR,        // Base Address
584
        CTL_SMC_REG_IAR0,       // Individual Address 0
585
        CTL_SMC_REG_IAR1,       // Individual Address 1 
586
        CTL_SMC_REG_IAR2,       // Individual Address 2
587
        CTL_SMC_REG_GPR,        // General Purpose
588
        CTL_SMC_REG_CTLR,       // Control
589
        CTL_SMC_REG_MCR,        // MMU Command
590
        CTL_SMC_REG_PNR,        // Packet Number
591
        CTL_SMC_REG_FPR,        // FIFO Ports
592
        CTL_SMC_REG_PTR,        // Pointer
593
        CTL_SMC_REG_DR,         // Data 
594
        CTL_SMC_REG_ISR,        // Interrupt Status
595
        CTL_SMC_REG_MTR1,       // Multicast Table Entry 1
596
        CTL_SMC_REG_MTR2,       // Multicast Table Entry 2
597
        CTL_SMC_REG_MTR3,       // Multicast Table Entry 3
598
        CTL_SMC_REG_MTR4,       // Multicast Table Entry 4
599
        CTL_SMC_REG_MIIR,       // Management Interface
600
        CTL_SMC_REG_REVR,       // Revision
601
        CTL_SMC_REG_ERCVR,      // Early RCV
602
        CTL_SMC_REG_EXTR,       // External
603
        CTL_SMC_PHY_CTRL,       // PHY Control
604
        CTL_SMC_PHY_STAT,       // PHY Status
605
        CTL_SMC_PHY_ID1,        // PHY ID1
606
        CTL_SMC_PHY_ID2,        // PHY ID2
607
        CTL_SMC_PHY_ADC,        // PHY Advertise Capability
608
        CTL_SMC_PHY_REMC,       // PHY Advertise Capability
609
        CTL_SMC_PHY_CFG1,       // PHY Configuration 1
610
        CTL_SMC_PHY_CFG2,       // PHY Configuration 2
611
        CTL_SMC_PHY_INT,        // PHY Interrupt/Status Output
612
        CTL_SMC_PHY_MASK,       // PHY Interrupt/Status Mask
613
#endif
614
        // ---------------------------------------------------
615
        CTL_SMC_LAST_ENTRY      // Add new entries above the line
616
};
617
 
618
#endif // CONFIG_SYSCTL
619
 
620
#endif  /* _SMC_91111_H_ */
621
 
622
 

powered by: WebSVN 2.1.0

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