1 /*======================================================================
3 A PCMCIA ethernet driver for SMC91c92-based cards.
5 This driver supports Megahertz PCMCIA ethernet cards; and
6 Megahertz, Motorola, Ositech, and Psion Dacom ethernet/modem
9 Copyright (C) 1999 David A. Hinds -- dahinds@users.sourceforge.net
11 smc91c92_cs.c 1.122 2002/10/25 06:26:39
13 This driver contains code written by Donald Becker
14 (becker@scyld.com), Rowan Hughes (x-csrdh@jcu.edu.au),
15 David Hinds (dahinds@users.sourceforge.net), and Erik Stahlman
16 (erik@vt.edu). Donald wrote the SMC 91c92 code using parts of
17 Erik's SMC 91c94 driver. Rowan wrote a similar driver, and I've
18 incorporated some parts of his driver here. I (Dave) wrote most
19 of the PCMCIA glue code, and the Ositech support code. Kelly
20 Stephens (kstephen@holli.com) added support for the Motorola
21 Mariner, with help from Allen Brost.
23 This software may be used and distributed according to the terms of
24 the GNU General Public License, incorporated herein by reference.
26 ======================================================================*/
28 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30 #include <linux/module.h>
31 #include <linux/kernel.h>
32 #include <linux/slab.h>
33 #include <linux/string.h>
34 #include <linux/timer.h>
35 #include <linux/interrupt.h>
36 #include <linux/delay.h>
37 #include <linux/crc32.h>
38 #include <linux/netdevice.h>
39 #include <linux/etherdevice.h>
40 #include <linux/skbuff.h>
41 #include <linux/if_arp.h>
42 #include <linux/ioport.h>
43 #include <linux/ethtool.h>
44 #include <linux/mii.h>
45 #include <linux/jiffies.h>
46 #include <linux/firmware.h>
48 #include <pcmcia/cistpl.h>
49 #include <pcmcia/cisreg.h>
50 #include <pcmcia/ciscode.h>
51 #include <pcmcia/ds.h>
52 #include <pcmcia/ss.h>
55 #include <asm/uaccess.h>
57 /*====================================================================*/
59 static const char *if_names
[] = { "auto", "10baseT", "10base2"};
62 #define FIRMWARE_NAME "ositech/Xilinx7OD.bin"
64 /* Module parameters */
66 MODULE_DESCRIPTION("SMC 91c92 series PCMCIA ethernet driver");
67 MODULE_LICENSE("GPL");
68 MODULE_FIRMWARE(FIRMWARE_NAME
);
70 #define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
73 Transceiver/media type.
75 1 = 10baseT (and autoselect if #define AUTOSELECT),
78 INT_MODULE_PARM(if_port
, 0);
81 #define DRV_NAME "smc91c92_cs"
82 #define DRV_VERSION "1.123"
84 /*====================================================================*/
86 /* Operational parameter that usually are not changed. */
88 /* Time in jiffies before concluding Tx hung */
89 #define TX_TIMEOUT ((400*HZ)/1000)
91 /* Maximum events (Rx packets, etc.) to handle at each interrupt. */
94 /* Times to check the check the chip before concluding that it doesn't
95 currently have room for another Tx packet. */
96 #define MEMORY_WAIT_TIME 8
99 struct pcmcia_device
*p_dev
;
104 struct sk_buff
*saved_skb
;
108 struct timer_list media
;
109 int watchdog
, tx_err
;
110 u_short media_status
;
113 struct mii_if_info mii_if
;
118 /* Special definitions for Megahertz multifunction cards */
119 #define MEGAHERTZ_ISR 0x0380
121 /* Special function registers for Motorola Mariner */
122 #define MOT_LAN 0x0000
123 #define MOT_UART 0x0020
124 #define MOT_EEPROM 0x20
127 (COR_LEVEL_REQ | COR_FUNC_ENA | COR_ADDR_DECODE | COR_IREQ_ENA)
129 /* Special function registers for Ositech cards */
130 #define OSITECH_AUI_CTL 0x0c
131 #define OSITECH_PWRDOWN 0x0d
132 #define OSITECH_RESET 0x0e
133 #define OSITECH_ISR 0x0f
134 #define OSITECH_AUI_PWR 0x0c
135 #define OSITECH_RESET_ISR 0x0e
137 #define OSI_AUI_PWR 0x40
138 #define OSI_LAN_PWRDOWN 0x02
139 #define OSI_MODEM_PWRDOWN 0x01
140 #define OSI_LAN_RESET 0x02
141 #define OSI_MODEM_RESET 0x01
143 /* Symbolic constants for the SMC91c9* series chips, from Erik Stahlman. */
144 #define BANK_SELECT 14 /* Window select register. */
145 #define SMC_SELECT_BANK(x) { outw(x, ioaddr + BANK_SELECT); }
147 /* Bank 0 registers. */
148 #define TCR 0 /* transmit control register */
149 #define TCR_CLEAR 0 /* do NOTHING */
150 #define TCR_ENABLE 0x0001 /* if this is 1, we can transmit */
151 #define TCR_PAD_EN 0x0080 /* pads short packets to 64 bytes */
152 #define TCR_MONCSN 0x0400 /* Monitor Carrier. */
153 #define TCR_FDUPLX 0x0800 /* Full duplex mode. */
154 #define TCR_NORMAL TCR_ENABLE | TCR_PAD_EN
156 #define EPH 2 /* Ethernet Protocol Handler report. */
157 #define EPH_TX_SUC 0x0001
158 #define EPH_SNGLCOL 0x0002
159 #define EPH_MULCOL 0x0004
160 #define EPH_LTX_MULT 0x0008
161 #define EPH_16COL 0x0010
162 #define EPH_SQET 0x0020
163 #define EPH_LTX_BRD 0x0040
164 #define EPH_TX_DEFR 0x0080
165 #define EPH_LAT_COL 0x0200
166 #define EPH_LOST_CAR 0x0400
167 #define EPH_EXC_DEF 0x0800
168 #define EPH_CTR_ROL 0x1000
169 #define EPH_RX_OVRN 0x2000
170 #define EPH_LINK_OK 0x4000
171 #define EPH_TX_UNRN 0x8000
172 #define MEMINFO 8 /* Memory Information Register */
173 #define MEMCFG 10 /* Memory Configuration Register */
175 /* Bank 1 registers. */
177 #define CFG_MII_SELECT 0x8000 /* 91C100 only */
178 #define CFG_NO_WAIT 0x1000
179 #define CFG_FULL_STEP 0x0400
180 #define CFG_SET_SQLCH 0x0200
181 #define CFG_AUI_SELECT 0x0100
182 #define CFG_16BIT 0x0080
183 #define CFG_DIS_LINK 0x0040
184 #define CFG_STATIC 0x0030
185 #define CFG_IRQ_SEL_1 0x0004
186 #define CFG_IRQ_SEL_0 0x0002
191 #define CTL_STORE 0x0001
192 #define CTL_RELOAD 0x0002
193 #define CTL_EE_SELECT 0x0004
194 #define CTL_TE_ENABLE 0x0020
195 #define CTL_CR_ENABLE 0x0040
196 #define CTL_LE_ENABLE 0x0080
197 #define CTL_AUTO_RELEASE 0x0800
198 #define CTL_POWERDOWN 0x2000
200 /* Bank 2 registers. */
202 #define MC_ALLOC 0x20 /* or with number of 256 byte packets */
203 #define MC_RESET 0x40
204 #define MC_RELEASE 0x80 /* remove and release the current rx packet */
205 #define MC_FREEPKT 0xA0 /* Release packet in PNR register */
206 #define MC_ENQUEUE 0xC0 /* Enqueue the packet for transmit */
209 #define FP_RXEMPTY 0x8000
211 #define PTR_AUTO_INC 0x0040
212 #define PTR_READ 0x2000
213 #define PTR_AUTOINC 0x4000
214 #define PTR_RCV 0x8000
217 #define IM_RCV_INT 0x1
218 #define IM_TX_INT 0x2
219 #define IM_TX_EMPTY_INT 0x4
220 #define IM_ALLOC_INT 0x8
221 #define IM_RX_OVRN_INT 0x10
222 #define IM_EPH_INT 0x20
225 enum RxCfg
{ RxAllMulti
= 0x0004, RxPromisc
= 0x0002,
226 RxEnable
= 0x0100, RxStripCRC
= 0x0200};
227 #define RCR_SOFTRESET 0x8000 /* resets the chip */
228 #define RCR_STRIP_CRC 0x200 /* strips CRC */
229 #define RCR_ENABLE 0x100 /* IFF this is set, we can receive packets */
230 #define RCR_ALMUL 0x4 /* receive all multicast packets */
231 #define RCR_PROMISC 0x2 /* enable promiscuous mode */
233 /* the normal settings for the RCR register : */
234 #define RCR_NORMAL (RCR_STRIP_CRC | RCR_ENABLE)
235 #define RCR_CLEAR 0x0 /* set it to a base state */
238 /* BANK 3 -- not the same values as in smc9194! */
244 #define REVISION 0x0a
246 /* Transmit status bits. */
247 #define TS_SUCCESS 0x0001
248 #define TS_16COL 0x0010
249 #define TS_LATCOL 0x0200
250 #define TS_LOSTCAR 0x0400
252 /* Receive status bits. */
253 #define RS_ALGNERR 0x8000
254 #define RS_BADCRC 0x2000
255 #define RS_ODDFRAME 0x1000
256 #define RS_TOOLONG 0x0800
257 #define RS_TOOSHORT 0x0400
258 #define RS_MULTICAST 0x0001
259 #define RS_ERRORS (RS_ALGNERR | RS_BADCRC | RS_TOOLONG | RS_TOOSHORT)
261 #define set_bits(v, p) outw(inw(p)|(v), (p))
262 #define mask_bits(v, p) outw(inw(p)&(v), (p))
264 /*====================================================================*/
266 static void smc91c92_detach(struct pcmcia_device
*p_dev
);
267 static int smc91c92_config(struct pcmcia_device
*link
);
268 static void smc91c92_release(struct pcmcia_device
*link
);
270 static int smc_open(struct net_device
*dev
);
271 static int smc_close(struct net_device
*dev
);
272 static int smc_ioctl(struct net_device
*dev
, struct ifreq
*rq
, int cmd
);
273 static void smc_tx_timeout(struct net_device
*dev
);
274 static netdev_tx_t
smc_start_xmit(struct sk_buff
*skb
,
275 struct net_device
*dev
);
276 static irqreturn_t
smc_interrupt(int irq
, void *dev_id
);
277 static void smc_rx(struct net_device
*dev
);
278 static void set_rx_mode(struct net_device
*dev
);
279 static int s9k_config(struct net_device
*dev
, struct ifmap
*map
);
280 static void smc_set_xcvr(struct net_device
*dev
, int if_port
);
281 static void smc_reset(struct net_device
*dev
);
282 static void media_check(u_long arg
);
283 static void mdio_sync(unsigned int addr
);
284 static int mdio_read(struct net_device
*dev
, int phy_id
, int loc
);
285 static void mdio_write(struct net_device
*dev
, int phy_id
, int loc
, int value
);
286 static int smc_link_ok(struct net_device
*dev
);
287 static const struct ethtool_ops ethtool_ops
;
289 static const struct net_device_ops smc_netdev_ops
= {
290 .ndo_open
= smc_open
,
291 .ndo_stop
= smc_close
,
292 .ndo_start_xmit
= smc_start_xmit
,
293 .ndo_tx_timeout
= smc_tx_timeout
,
294 .ndo_set_config
= s9k_config
,
295 .ndo_set_rx_mode
= set_rx_mode
,
296 .ndo_do_ioctl
= smc_ioctl
,
297 .ndo_change_mtu
= eth_change_mtu
,
298 .ndo_set_mac_address
= eth_mac_addr
,
299 .ndo_validate_addr
= eth_validate_addr
,
302 static int smc91c92_probe(struct pcmcia_device
*link
)
304 struct smc_private
*smc
;
305 struct net_device
*dev
;
307 dev_dbg(&link
->dev
, "smc91c92_attach()\n");
309 /* Create new ethernet device */
310 dev
= alloc_etherdev(sizeof(struct smc_private
));
313 smc
= netdev_priv(dev
);
317 spin_lock_init(&smc
->lock
);
319 /* The SMC91c92-specific entries in the device structure. */
320 dev
->netdev_ops
= &smc_netdev_ops
;
321 dev
->ethtool_ops
= ðtool_ops
;
322 dev
->watchdog_timeo
= TX_TIMEOUT
;
324 smc
->mii_if
.dev
= dev
;
325 smc
->mii_if
.mdio_read
= mdio_read
;
326 smc
->mii_if
.mdio_write
= mdio_write
;
327 smc
->mii_if
.phy_id_mask
= 0x1f;
328 smc
->mii_if
.reg_num_mask
= 0x1f;
330 return smc91c92_config(link
);
331 } /* smc91c92_attach */
333 static void smc91c92_detach(struct pcmcia_device
*link
)
335 struct net_device
*dev
= link
->priv
;
337 dev_dbg(&link
->dev
, "smc91c92_detach\n");
339 unregister_netdev(dev
);
341 smc91c92_release(link
);
344 } /* smc91c92_detach */
346 /*====================================================================*/
348 static int cvt_ascii_address(struct net_device
*dev
, char *s
)
354 for (i
= 0; i
< 6; i
++) {
356 for (j
= 0; j
< 2; j
++) {
359 da
+= ((c
>= '0') && (c
<= '9')) ?
360 (c
- '0') : ((c
& 0x0f) + 9);
362 dev
->dev_addr
[i
] = da
;
367 /*====================================================================
369 Configuration stuff for Megahertz cards
371 mhz_3288_power() is used to power up a 3288's ethernet chip.
372 mhz_mfc_config() handles socket setup for multifunction (1144
373 and 3288) cards. mhz_setup() gets a card's hardware ethernet
376 ======================================================================*/
378 static int mhz_3288_power(struct pcmcia_device
*link
)
380 struct net_device
*dev
= link
->priv
;
381 struct smc_private
*smc
= netdev_priv(dev
);
384 /* Read the ISR twice... */
385 readb(smc
->base
+MEGAHERTZ_ISR
);
387 readb(smc
->base
+MEGAHERTZ_ISR
);
392 /* Now read and write the COR... */
393 tmp
= readb(smc
->base
+ link
->config_base
+ CISREG_COR
);
395 writeb(tmp
, smc
->base
+ link
->config_base
+ CISREG_COR
);
400 static int mhz_mfc_config_check(struct pcmcia_device
*p_dev
, void *priv_data
)
403 p_dev
->io_lines
= 16;
404 p_dev
->resource
[1]->start
= p_dev
->resource
[0]->start
;
405 p_dev
->resource
[1]->end
= 8;
406 p_dev
->resource
[1]->flags
&= ~IO_DATA_PATH_WIDTH
;
407 p_dev
->resource
[1]->flags
|= IO_DATA_PATH_WIDTH_8
;
408 p_dev
->resource
[0]->end
= 16;
409 p_dev
->resource
[0]->flags
&= ~IO_DATA_PATH_WIDTH
;
410 p_dev
->resource
[0]->flags
|= IO_DATA_PATH_WIDTH_AUTO
;
411 for (k
= 0; k
< 0x400; k
+= 0x10) {
414 p_dev
->resource
[0]->start
= k
^ 0x300;
415 if (!pcmcia_request_io(p_dev
))
421 static int mhz_mfc_config(struct pcmcia_device
*link
)
423 struct net_device
*dev
= link
->priv
;
424 struct smc_private
*smc
= netdev_priv(dev
);
428 link
->config_flags
|= CONF_ENABLE_SPKR
| CONF_ENABLE_IRQ
|
431 /* The Megahertz combo cards have modem-like CIS entries, so
432 we have to explicitly try a bunch of port combinations. */
433 if (pcmcia_loop_config(link
, mhz_mfc_config_check
, NULL
))
436 dev
->base_addr
= link
->resource
[0]->start
;
438 /* Allocate a memory window, for accessing the ISR */
439 link
->resource
[2]->flags
= WIN_DATA_WIDTH_8
|WIN_MEMORY_TYPE_AM
|WIN_ENABLE
;
440 link
->resource
[2]->start
= link
->resource
[2]->end
= 0;
441 i
= pcmcia_request_window(link
, link
->resource
[2], 0);
445 smc
->base
= ioremap(link
->resource
[2]->start
,
446 resource_size(link
->resource
[2]));
447 offset
= (smc
->manfid
== MANFID_MOTOROLA
) ? link
->config_base
: 0;
448 i
= pcmcia_map_mem_page(link
, link
->resource
[2], offset
);
450 (smc
->manfid
== MANFID_MEGAHERTZ
) &&
451 (smc
->cardid
== PRODID_MEGAHERTZ_EM3288
))
452 mhz_3288_power(link
);
457 static int pcmcia_get_versmac(struct pcmcia_device
*p_dev
,
461 struct net_device
*dev
= priv
;
465 if (pcmcia_parse_tuple(tuple
, &parse
))
468 buf
= parse
.version_1
.str
+ parse
.version_1
.ofs
[3];
470 if ((parse
.version_1
.ns
> 3) && (cvt_ascii_address(dev
, buf
) == 0))
476 static int mhz_setup(struct pcmcia_device
*link
)
478 struct net_device
*dev
= link
->priv
;
483 /* Read the station address from the CIS. It is stored as the last
484 (fourth) string in the Version 1 Version/ID tuple. */
485 if ((link
->prod_id
[3]) &&
486 (cvt_ascii_address(dev
, link
->prod_id
[3]) == 0))
489 /* Workarounds for broken cards start here. */
490 /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */
491 if (!pcmcia_loop_tuple(link
, CISTPL_VERS_1
, pcmcia_get_versmac
, dev
))
494 /* Another possibility: for the EM3288, in a special tuple */
496 len
= pcmcia_get_tuple(link
, 0x81, &buf
);
497 if (buf
&& len
>= 13) {
499 if (cvt_ascii_address(dev
, buf
) == 0)
507 /*======================================================================
509 Configuration stuff for the Motorola Mariner
511 mot_config() writes directly to the Mariner configuration
512 registers because the CIS is just bogus.
514 ======================================================================*/
516 static void mot_config(struct pcmcia_device
*link
)
518 struct net_device
*dev
= link
->priv
;
519 struct smc_private
*smc
= netdev_priv(dev
);
520 unsigned int ioaddr
= dev
->base_addr
;
521 unsigned int iouart
= link
->resource
[1]->start
;
523 /* Set UART base address and force map with COR bit 1 */
524 writeb(iouart
& 0xff, smc
->base
+ MOT_UART
+ CISREG_IOBASE_0
);
525 writeb((iouart
>> 8) & 0xff, smc
->base
+ MOT_UART
+ CISREG_IOBASE_1
);
526 writeb(MOT_NORMAL
, smc
->base
+ MOT_UART
+ CISREG_COR
);
528 /* Set SMC base address and force map with COR bit 1 */
529 writeb(ioaddr
& 0xff, smc
->base
+ MOT_LAN
+ CISREG_IOBASE_0
);
530 writeb((ioaddr
>> 8) & 0xff, smc
->base
+ MOT_LAN
+ CISREG_IOBASE_1
);
531 writeb(MOT_NORMAL
, smc
->base
+ MOT_LAN
+ CISREG_COR
);
533 /* Wait for things to settle down */
537 static int mot_setup(struct pcmcia_device
*link
)
539 struct net_device
*dev
= link
->priv
;
540 unsigned int ioaddr
= dev
->base_addr
;
544 /* Read Ethernet address from Serial EEPROM */
546 for (i
= 0; i
< 3; i
++) {
548 outw(MOT_EEPROM
+ i
, ioaddr
+ POINTER
);
550 outw((CTL_RELOAD
| CTL_EE_SELECT
), ioaddr
+ CONTROL
);
552 for (loop
= wait
= 0; loop
< 200; loop
++) {
554 wait
= ((CTL_RELOAD
| CTL_STORE
) & inw(ioaddr
+ CONTROL
));
555 if (wait
== 0) break;
561 addr
= inw(ioaddr
+ GENERAL
);
562 dev
->dev_addr
[2*i
] = addr
& 0xff;
563 dev
->dev_addr
[2*i
+1] = (addr
>> 8) & 0xff;
569 /*====================================================================*/
571 static int smc_configcheck(struct pcmcia_device
*p_dev
, void *priv_data
)
573 p_dev
->resource
[0]->end
= 16;
574 p_dev
->resource
[0]->flags
&= ~IO_DATA_PATH_WIDTH
;
575 p_dev
->resource
[0]->flags
|= IO_DATA_PATH_WIDTH_AUTO
;
577 return pcmcia_request_io(p_dev
);
580 static int smc_config(struct pcmcia_device
*link
)
582 struct net_device
*dev
= link
->priv
;
585 link
->config_flags
|= CONF_ENABLE_IRQ
| CONF_AUTO_SET_IO
;
587 i
= pcmcia_loop_config(link
, smc_configcheck
, NULL
);
589 dev
->base_addr
= link
->resource
[0]->start
;
595 static int smc_setup(struct pcmcia_device
*link
)
597 struct net_device
*dev
= link
->priv
;
599 /* Check for a LAN function extension tuple */
600 if (!pcmcia_get_mac_from_cis(link
, dev
))
603 /* Try the third string in the Version 1 Version/ID tuple. */
604 if (link
->prod_id
[2]) {
605 if (cvt_ascii_address(dev
, link
->prod_id
[2]) == 0)
611 /*====================================================================*/
613 static int osi_config(struct pcmcia_device
*link
)
615 struct net_device
*dev
= link
->priv
;
616 static const unsigned int com
[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
619 link
->config_flags
|= CONF_ENABLE_SPKR
| CONF_ENABLE_IRQ
;
620 link
->resource
[0]->end
= 64;
621 link
->resource
[1]->flags
|= IO_DATA_PATH_WIDTH_8
;
622 link
->resource
[1]->end
= 8;
624 /* Enable Hard Decode, LAN, Modem */
626 link
->config_index
= 0x23;
628 for (i
= j
= 0; j
< 4; j
++) {
629 link
->resource
[1]->start
= com
[j
];
630 i
= pcmcia_request_io(link
);
635 /* Fallback: turn off hard decode */
636 link
->config_index
= 0x03;
637 link
->resource
[1]->end
= 0;
638 i
= pcmcia_request_io(link
);
640 dev
->base_addr
= link
->resource
[0]->start
+ 0x10;
644 static int osi_load_firmware(struct pcmcia_device
*link
)
646 const struct firmware
*fw
;
649 err
= request_firmware(&fw
, FIRMWARE_NAME
, &link
->dev
);
651 pr_err("Failed to load firmware \"%s\"\n", FIRMWARE_NAME
);
655 /* Download the Seven of Diamonds firmware */
656 for (i
= 0; i
< fw
->size
; i
++) {
657 outb(fw
->data
[i
], link
->resource
[0]->start
+ 2);
660 release_firmware(fw
);
664 static int pcmcia_osi_mac(struct pcmcia_device
*p_dev
,
668 struct net_device
*dev
= priv
;
671 if (tuple
->TupleDataLen
< 8)
673 if (tuple
->TupleData
[0] != 0x04)
675 for (i
= 0; i
< 6; i
++)
676 dev
->dev_addr
[i
] = tuple
->TupleData
[i
+2];
681 static int osi_setup(struct pcmcia_device
*link
, u_short manfid
, u_short cardid
)
683 struct net_device
*dev
= link
->priv
;
686 /* Read the station address from tuple 0x90, subtuple 0x04 */
687 if (pcmcia_loop_tuple(link
, 0x90, pcmcia_osi_mac
, dev
))
690 if (((manfid
== MANFID_OSITECH
) &&
691 (cardid
== PRODID_OSITECH_SEVEN
)) ||
692 ((manfid
== MANFID_PSION
) &&
693 (cardid
== PRODID_PSION_NET100
))) {
694 rc
= osi_load_firmware(link
);
697 } else if (manfid
== MANFID_OSITECH
) {
698 /* Make sure both functions are powered up */
699 set_bits(0x300, link
->resource
[0]->start
+ OSITECH_AUI_PWR
);
700 /* Now, turn on the interrupt for both card functions */
701 set_bits(0x300, link
->resource
[0]->start
+ OSITECH_RESET_ISR
);
702 dev_dbg(&link
->dev
, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n",
703 inw(link
->resource
[0]->start
+ OSITECH_AUI_PWR
),
704 inw(link
->resource
[0]->start
+ OSITECH_RESET_ISR
));
709 static int smc91c92_suspend(struct pcmcia_device
*link
)
711 struct net_device
*dev
= link
->priv
;
714 netif_device_detach(dev
);
719 static int smc91c92_resume(struct pcmcia_device
*link
)
721 struct net_device
*dev
= link
->priv
;
722 struct smc_private
*smc
= netdev_priv(dev
);
725 if ((smc
->manfid
== MANFID_MEGAHERTZ
) &&
726 (smc
->cardid
== PRODID_MEGAHERTZ_EM3288
))
727 mhz_3288_power(link
);
728 if (smc
->manfid
== MANFID_MOTOROLA
)
730 if ((smc
->manfid
== MANFID_OSITECH
) &&
731 (smc
->cardid
!= PRODID_OSITECH_SEVEN
)) {
732 /* Power up the card and enable interrupts */
733 set_bits(0x0300, dev
->base_addr
-0x10+OSITECH_AUI_PWR
);
734 set_bits(0x0300, dev
->base_addr
-0x10+OSITECH_RESET_ISR
);
736 if (((smc
->manfid
== MANFID_OSITECH
) &&
737 (smc
->cardid
== PRODID_OSITECH_SEVEN
)) ||
738 ((smc
->manfid
== MANFID_PSION
) &&
739 (smc
->cardid
== PRODID_PSION_NET100
))) {
740 i
= osi_load_firmware(link
);
742 netdev_err(dev
, "Failed to load firmware\n");
748 netif_device_attach(dev
);
755 /*======================================================================
757 This verifies that the chip is some SMC91cXX variant, and returns
758 the revision code if successful. Otherwise, it returns -ENODEV.
760 ======================================================================*/
762 static int check_sig(struct pcmcia_device
*link
)
764 struct net_device
*dev
= link
->priv
;
765 unsigned int ioaddr
= dev
->base_addr
;
770 if (inw(ioaddr
+ BANK_SELECT
) >> 8 != 0x33) {
771 /* Try powering up the chip */
772 outw(0, ioaddr
+ CONTROL
);
776 /* Try setting bus width */
777 width
= (link
->resource
[0]->flags
== IO_DATA_PATH_WIDTH_AUTO
);
778 s
= inb(ioaddr
+ CONFIG
);
783 outb(s
, ioaddr
+ CONFIG
);
785 /* Check Base Address Register to make sure bus width is OK */
786 s
= inw(ioaddr
+ BASE_ADDR
);
787 if ((inw(ioaddr
+ BANK_SELECT
) >> 8 == 0x33) &&
788 ((s
>> 8) != (s
& 0xff))) {
790 s
= inw(ioaddr
+ REVISION
);
795 netdev_info(dev
, "using 8-bit IO window\n");
797 smc91c92_suspend(link
);
798 pcmcia_fixup_iowidth(link
);
799 smc91c92_resume(link
);
800 return check_sig(link
);
805 static int smc91c92_config(struct pcmcia_device
*link
)
807 struct net_device
*dev
= link
->priv
;
808 struct smc_private
*smc
= netdev_priv(dev
);
814 dev_dbg(&link
->dev
, "smc91c92_config\n");
816 smc
->manfid
= link
->manf_id
;
817 smc
->cardid
= link
->card_id
;
819 if ((smc
->manfid
== MANFID_OSITECH
) &&
820 (smc
->cardid
!= PRODID_OSITECH_SEVEN
)) {
821 i
= osi_config(link
);
822 } else if ((smc
->manfid
== MANFID_MOTOROLA
) ||
823 ((smc
->manfid
== MANFID_MEGAHERTZ
) &&
824 ((smc
->cardid
== PRODID_MEGAHERTZ_VARIOUS
) ||
825 (smc
->cardid
== PRODID_MEGAHERTZ_EM3288
)))) {
826 i
= mhz_mfc_config(link
);
828 i
= smc_config(link
);
833 i
= pcmcia_request_irq(link
, smc_interrupt
);
836 i
= pcmcia_enable_device(link
);
840 if (smc
->manfid
== MANFID_MOTOROLA
)
843 dev
->irq
= link
->irq
;
845 if ((if_port
>= 0) && (if_port
<= 2))
846 dev
->if_port
= if_port
;
848 dev_notice(&link
->dev
, "invalid if_port requested\n");
850 switch (smc
->manfid
) {
853 i
= osi_setup(link
, smc
->manfid
, smc
->cardid
); break;
855 case MANFID_NEW_MEDIA
:
856 i
= smc_setup(link
); break;
857 case 0x128: /* For broken Megahertz cards */
858 case MANFID_MEGAHERTZ
:
859 i
= mhz_setup(link
); break;
860 case MANFID_MOTOROLA
:
861 default: /* get the hw address from EEPROM */
862 i
= mot_setup(link
); break;
866 dev_notice(&link
->dev
, "Unable to find hardware address.\n");
873 rev
= check_sig(link
);
877 case 3: name
= "92"; break;
878 case 4: name
= ((rev
& 15) >= 6) ? "96" : "94"; break;
879 case 5: name
= "95"; break;
880 case 7: name
= "100"; break;
881 case 8: name
= "100-FD"; break;
882 case 9: name
= "110"; break;
885 ioaddr
= dev
->base_addr
;
889 mir
= inw(ioaddr
+ MEMINFO
) & 0xff;
890 if (mir
== 0xff) mir
++;
891 /* Get scale factor for memory size */
892 mcr
= ((rev
>> 4) > 3) ? inw(ioaddr
+ MEMCFG
) : 0x0200;
893 mir
*= 128 * (1<<((mcr
>> 9) & 7));
895 smc
->cfg
= inw(ioaddr
+ CONFIG
) & ~CFG_AUI_SELECT
;
896 smc
->cfg
|= CFG_NO_WAIT
| CFG_16BIT
| CFG_STATIC
;
897 if (smc
->manfid
== MANFID_OSITECH
)
898 smc
->cfg
|= CFG_IRQ_SEL_1
| CFG_IRQ_SEL_0
;
900 smc
->cfg
|= CFG_MII_SELECT
;
904 if (smc
->cfg
& CFG_MII_SELECT
) {
907 for (i
= 0; i
< 32; i
++) {
908 j
= mdio_read(dev
, i
, 1);
909 if ((j
!= 0) && (j
!= 0xffff)) break;
911 smc
->mii_if
.phy_id
= (i
< 32) ? i
: -1;
916 SET_NETDEV_DEV(dev
, &link
->dev
);
918 if (register_netdev(dev
) != 0) {
919 dev_err(&link
->dev
, "register_netdev() failed\n");
923 netdev_info(dev
, "smc91c%s rev %d: io %#3lx, irq %d, hw_addr %pM\n",
924 name
, (rev
& 0x0f), dev
->base_addr
, dev
->irq
, dev
->dev_addr
);
928 netdev_info(dev
, " %lu byte", mir
);
930 netdev_info(dev
, " %lu kb", mir
>>10);
931 pr_cont(" buffer, %s xcvr\n",
932 (smc
->cfg
& CFG_MII_SELECT
) ? "MII" : if_names
[dev
->if_port
]);
935 if (smc
->cfg
& CFG_MII_SELECT
) {
936 if (smc
->mii_if
.phy_id
!= -1) {
937 netdev_dbg(dev
, " MII transceiver at index %d, status %x\n",
938 smc
->mii_if
.phy_id
, j
);
940 netdev_notice(dev
, " No MII transceivers found!\n");
946 unregister_netdev(dev
);
948 smc91c92_release(link
);
951 } /* smc91c92_config */
953 static void smc91c92_release(struct pcmcia_device
*link
)
955 dev_dbg(&link
->dev
, "smc91c92_release\n");
956 if (link
->resource
[2]->end
) {
957 struct net_device
*dev
= link
->priv
;
958 struct smc_private
*smc
= netdev_priv(dev
);
961 pcmcia_disable_device(link
);
964 /*======================================================================
966 MII interface support for SMC91cXX based cards
967 ======================================================================*/
969 #define MDIO_SHIFT_CLK 0x04
970 #define MDIO_DATA_OUT 0x01
971 #define MDIO_DIR_WRITE 0x08
972 #define MDIO_DATA_WRITE0 (MDIO_DIR_WRITE)
973 #define MDIO_DATA_WRITE1 (MDIO_DIR_WRITE | MDIO_DATA_OUT)
974 #define MDIO_DATA_READ 0x02
976 static void mdio_sync(unsigned int addr
)
979 for (bits
= 0; bits
< 32; bits
++) {
980 outb(MDIO_DATA_WRITE1
, addr
);
981 outb(MDIO_DATA_WRITE1
| MDIO_SHIFT_CLK
, addr
);
985 static int mdio_read(struct net_device
*dev
, int phy_id
, int loc
)
987 unsigned int addr
= dev
->base_addr
+ MGMT
;
988 u_int cmd
= (0x06<<10)|(phy_id
<<5)|loc
;
992 for (i
= 13; i
>= 0; i
--) {
993 int dat
= (cmd
&(1<<i
)) ? MDIO_DATA_WRITE1
: MDIO_DATA_WRITE0
;
995 outb(dat
| MDIO_SHIFT_CLK
, addr
);
997 for (i
= 19; i
> 0; i
--) {
999 retval
= (retval
<< 1) | ((inb(addr
) & MDIO_DATA_READ
) != 0);
1000 outb(MDIO_SHIFT_CLK
, addr
);
1002 return (retval
>>1) & 0xffff;
1005 static void mdio_write(struct net_device
*dev
, int phy_id
, int loc
, int value
)
1007 unsigned int addr
= dev
->base_addr
+ MGMT
;
1008 u_int cmd
= (0x05<<28)|(phy_id
<<23)|(loc
<<18)|(1<<17)|value
;
1012 for (i
= 31; i
>= 0; i
--) {
1013 int dat
= (cmd
&(1<<i
)) ? MDIO_DATA_WRITE1
: MDIO_DATA_WRITE0
;
1015 outb(dat
| MDIO_SHIFT_CLK
, addr
);
1017 for (i
= 1; i
>= 0; i
--) {
1019 outb(MDIO_SHIFT_CLK
, addr
);
1023 /*======================================================================
1025 The driver core code, most of which should be common with a
1026 non-PCMCIA implementation.
1028 ======================================================================*/
1031 static void smc_dump(struct net_device
*dev
)
1033 unsigned int ioaddr
= dev
->base_addr
;
1035 save
= inw(ioaddr
+ BANK_SELECT
);
1036 for (w
= 0; w
< 4; w
++) {
1038 netdev_dbg(dev
, "bank %d: ", w
);
1039 for (i
= 0; i
< 14; i
+= 2)
1040 pr_cont(" %04x", inw(ioaddr
+ i
));
1043 outw(save
, ioaddr
+ BANK_SELECT
);
1047 static int smc_open(struct net_device
*dev
)
1049 struct smc_private
*smc
= netdev_priv(dev
);
1050 struct pcmcia_device
*link
= smc
->p_dev
;
1052 dev_dbg(&link
->dev
, "%s: smc_open(%p), ID/Window %4.4x.\n",
1053 dev
->name
, dev
, inw(dev
->base_addr
+ BANK_SELECT
));
1058 /* Check that the PCMCIA card is still here. */
1059 if (!pcmcia_dev_present(link
))
1061 /* Physical device present signature. */
1062 if (check_sig(link
) < 0) {
1063 netdev_info(dev
, "Yikes! Bad chip signature!\n");
1068 netif_start_queue(dev
);
1069 smc
->saved_skb
= NULL
;
1070 smc
->packets_waiting
= 0;
1073 setup_timer(&smc
->media
, media_check
, (u_long
)dev
);
1074 mod_timer(&smc
->media
, jiffies
+ HZ
);
1079 /*====================================================================*/
1081 static int smc_close(struct net_device
*dev
)
1083 struct smc_private
*smc
= netdev_priv(dev
);
1084 struct pcmcia_device
*link
= smc
->p_dev
;
1085 unsigned int ioaddr
= dev
->base_addr
;
1087 dev_dbg(&link
->dev
, "%s: smc_close(), status %4.4x.\n",
1088 dev
->name
, inw(ioaddr
+ BANK_SELECT
));
1090 netif_stop_queue(dev
);
1092 /* Shut off all interrupts, and turn off the Tx and Rx sections.
1093 Don't bother to check for chip present. */
1094 SMC_SELECT_BANK(2); /* Nominally paranoia, but do no assume... */
1095 outw(0, ioaddr
+ INTERRUPT
);
1097 mask_bits(0xff00, ioaddr
+ RCR
);
1098 mask_bits(0xff00, ioaddr
+ TCR
);
1100 /* Put the chip into power-down mode. */
1102 outw(CTL_POWERDOWN
, ioaddr
+ CONTROL
);
1105 del_timer_sync(&smc
->media
);
1110 /*======================================================================
1112 Transfer a packet to the hardware and trigger the packet send.
1113 This may be called at either from either the Tx queue code
1114 or the interrupt handler.
1116 ======================================================================*/
1118 static void smc_hardware_send_packet(struct net_device
* dev
)
1120 struct smc_private
*smc
= netdev_priv(dev
);
1121 struct sk_buff
*skb
= smc
->saved_skb
;
1122 unsigned int ioaddr
= dev
->base_addr
;
1126 netdev_err(dev
, "In XMIT with no packet to send\n");
1130 /* There should be a packet slot waiting. */
1131 packet_no
= inw(ioaddr
+ PNR_ARR
) >> 8;
1132 if (packet_no
& 0x80) {
1133 /* If not, there is a hardware problem! Likely an ejected card. */
1134 netdev_warn(dev
, "hardware Tx buffer allocation failed, status %#2.2x\n",
1136 dev_kfree_skb_irq(skb
);
1137 smc
->saved_skb
= NULL
;
1138 netif_start_queue(dev
);
1142 dev
->stats
.tx_bytes
+= skb
->len
;
1143 /* The card should use the just-allocated buffer. */
1144 outw(packet_no
, ioaddr
+ PNR_ARR
);
1145 /* point to the beginning of the packet */
1146 outw(PTR_AUTOINC
, ioaddr
+ POINTER
);
1148 /* Send the packet length (+6 for status, length and ctl byte)
1149 and the status word (set to zeros). */
1151 u_char
*buf
= skb
->data
;
1152 u_int length
= skb
->len
; /* The chip will pad to ethernet min. */
1154 netdev_dbg(dev
, "Trying to xmit packet of length %d\n", length
);
1156 /* send the packet length: +6 for status word, length, and ctl */
1157 outw(0, ioaddr
+ DATA_1
);
1158 outw(length
+ 6, ioaddr
+ DATA_1
);
1159 outsw(ioaddr
+ DATA_1
, buf
, length
>> 1);
1161 /* The odd last byte, if there is one, goes in the control word. */
1162 outw((length
& 1) ? 0x2000 | buf
[length
-1] : 0, ioaddr
+ DATA_1
);
1165 /* Enable the Tx interrupts, both Tx (TxErr) and TxEmpty. */
1166 outw(((IM_TX_INT
|IM_TX_EMPTY_INT
)<<8) |
1167 (inw(ioaddr
+ INTERRUPT
) & 0xff00),
1168 ioaddr
+ INTERRUPT
);
1170 /* The chip does the rest of the work. */
1171 outw(MC_ENQUEUE
, ioaddr
+ MMU_CMD
);
1173 smc
->saved_skb
= NULL
;
1174 dev_kfree_skb_irq(skb
);
1175 dev
->trans_start
= jiffies
;
1176 netif_start_queue(dev
);
1179 /*====================================================================*/
1181 static void smc_tx_timeout(struct net_device
*dev
)
1183 struct smc_private
*smc
= netdev_priv(dev
);
1184 unsigned int ioaddr
= dev
->base_addr
;
1186 netdev_notice(dev
, "transmit timed out, Tx_status %2.2x status %4.4x.\n",
1187 inw(ioaddr
)&0xff, inw(ioaddr
+ 2));
1188 dev
->stats
.tx_errors
++;
1190 dev
->trans_start
= jiffies
; /* prevent tx timeout */
1191 smc
->saved_skb
= NULL
;
1192 netif_wake_queue(dev
);
1195 static netdev_tx_t
smc_start_xmit(struct sk_buff
*skb
,
1196 struct net_device
*dev
)
1198 struct smc_private
*smc
= netdev_priv(dev
);
1199 unsigned int ioaddr
= dev
->base_addr
;
1202 unsigned long flags
;
1204 netif_stop_queue(dev
);
1206 netdev_dbg(dev
, "smc_start_xmit(length = %d) called, status %04x\n",
1207 skb
->len
, inw(ioaddr
+ 2));
1209 if (smc
->saved_skb
) {
1210 /* THIS SHOULD NEVER HAPPEN. */
1211 dev
->stats
.tx_aborted_errors
++;
1212 netdev_dbg(dev
, "Internal error -- sent packet while busy\n");
1213 return NETDEV_TX_BUSY
;
1215 smc
->saved_skb
= skb
;
1217 num_pages
= skb
->len
>> 8;
1219 if (num_pages
> 7) {
1220 netdev_err(dev
, "Far too big packet error: %d pages\n", num_pages
);
1221 dev_kfree_skb (skb
);
1222 smc
->saved_skb
= NULL
;
1223 dev
->stats
.tx_dropped
++;
1224 return NETDEV_TX_OK
; /* Do not re-queue this packet. */
1226 /* A packet is now waiting. */
1227 smc
->packets_waiting
++;
1229 spin_lock_irqsave(&smc
->lock
, flags
);
1230 SMC_SELECT_BANK(2); /* Paranoia, we should always be in window 2 */
1232 /* need MC_RESET to keep the memory consistent. errata? */
1234 outw(MC_RESET
, ioaddr
+ MMU_CMD
);
1238 /* Allocate the memory; send the packet now if we win. */
1239 outw(MC_ALLOC
| num_pages
, ioaddr
+ MMU_CMD
);
1240 for (time_out
= MEMORY_WAIT_TIME
; time_out
>= 0; time_out
--) {
1241 ir
= inw(ioaddr
+INTERRUPT
);
1242 if (ir
& IM_ALLOC_INT
) {
1243 /* Acknowledge the interrupt, send the packet. */
1244 outw((ir
&0xff00) | IM_ALLOC_INT
, ioaddr
+ INTERRUPT
);
1245 smc_hardware_send_packet(dev
); /* Send the packet now.. */
1246 spin_unlock_irqrestore(&smc
->lock
, flags
);
1247 return NETDEV_TX_OK
;
1251 /* Otherwise defer until the Tx-space-allocated interrupt. */
1252 netdev_dbg(dev
, "memory allocation deferred.\n");
1253 outw((IM_ALLOC_INT
<< 8) | (ir
& 0xff00), ioaddr
+ INTERRUPT
);
1254 spin_unlock_irqrestore(&smc
->lock
, flags
);
1256 return NETDEV_TX_OK
;
1259 /*======================================================================
1261 Handle a Tx anomalous event. Entered while in Window 2.
1263 ======================================================================*/
1265 static void smc_tx_err(struct net_device
* dev
)
1267 struct smc_private
*smc
= netdev_priv(dev
);
1268 unsigned int ioaddr
= dev
->base_addr
;
1269 int saved_packet
= inw(ioaddr
+ PNR_ARR
) & 0xff;
1270 int packet_no
= inw(ioaddr
+ FIFO_PORTS
) & 0x7f;
1273 /* select this as the packet to read from */
1274 outw(packet_no
, ioaddr
+ PNR_ARR
);
1276 /* read the first word from this packet */
1277 outw(PTR_AUTOINC
| PTR_READ
| 0, ioaddr
+ POINTER
);
1279 tx_status
= inw(ioaddr
+ DATA_1
);
1281 dev
->stats
.tx_errors
++;
1282 if (tx_status
& TS_LOSTCAR
) dev
->stats
.tx_carrier_errors
++;
1283 if (tx_status
& TS_LATCOL
) dev
->stats
.tx_window_errors
++;
1284 if (tx_status
& TS_16COL
) {
1285 dev
->stats
.tx_aborted_errors
++;
1289 if (tx_status
& TS_SUCCESS
) {
1290 netdev_notice(dev
, "Successful packet caused error interrupt?\n");
1292 /* re-enable transmit */
1294 outw(inw(ioaddr
+ TCR
) | TCR_ENABLE
| smc
->duplex
, ioaddr
+ TCR
);
1297 outw(MC_FREEPKT
, ioaddr
+ MMU_CMD
); /* Free the packet memory. */
1299 /* one less packet waiting for me */
1300 smc
->packets_waiting
--;
1302 outw(saved_packet
, ioaddr
+ PNR_ARR
);
1305 /*====================================================================*/
1307 static void smc_eph_irq(struct net_device
*dev
)
1309 struct smc_private
*smc
= netdev_priv(dev
);
1310 unsigned int ioaddr
= dev
->base_addr
;
1311 u_short card_stats
, ephs
;
1314 ephs
= inw(ioaddr
+ EPH
);
1315 netdev_dbg(dev
, "Ethernet protocol handler interrupt, status %4.4x.\n",
1317 /* Could be a counter roll-over warning: update stats. */
1318 card_stats
= inw(ioaddr
+ COUNTER
);
1319 /* single collisions */
1320 dev
->stats
.collisions
+= card_stats
& 0xF;
1322 /* multiple collisions */
1323 dev
->stats
.collisions
+= card_stats
& 0xF;
1324 #if 0 /* These are for when linux supports these statistics */
1325 card_stats
>>= 4; /* deferred */
1326 card_stats
>>= 4; /* excess deferred */
1328 /* If we had a transmit error we must re-enable the transmitter. */
1329 outw(inw(ioaddr
+ TCR
) | TCR_ENABLE
| smc
->duplex
, ioaddr
+ TCR
);
1331 /* Clear a link error interrupt. */
1333 outw(CTL_AUTO_RELEASE
| 0x0000, ioaddr
+ CONTROL
);
1334 outw(CTL_AUTO_RELEASE
| CTL_TE_ENABLE
| CTL_CR_ENABLE
,
1339 /*====================================================================*/
1341 static irqreturn_t
smc_interrupt(int irq
, void *dev_id
)
1343 struct net_device
*dev
= dev_id
;
1344 struct smc_private
*smc
= netdev_priv(dev
);
1345 unsigned int ioaddr
;
1346 u_short saved_bank
, saved_pointer
, mask
, status
;
1347 unsigned int handled
= 1;
1348 char bogus_cnt
= INTR_WORK
; /* Work we are willing to do. */
1350 if (!netif_device_present(dev
))
1353 ioaddr
= dev
->base_addr
;
1355 netdev_dbg(dev
, "SMC91c92 interrupt %d at %#x.\n",
1358 spin_lock(&smc
->lock
);
1360 saved_bank
= inw(ioaddr
+ BANK_SELECT
);
1361 if ((saved_bank
& 0xff00) != 0x3300) {
1362 /* The device does not exist -- the card could be off-line, or
1363 maybe it has been ejected. */
1364 netdev_dbg(dev
, "SMC91c92 interrupt %d for non-existent/ejected device.\n",
1371 saved_pointer
= inw(ioaddr
+ POINTER
);
1372 mask
= inw(ioaddr
+ INTERRUPT
) >> 8;
1373 /* clear all interrupts */
1374 outw(0, ioaddr
+ INTERRUPT
);
1376 do { /* read the status flag, and mask it */
1377 status
= inw(ioaddr
+ INTERRUPT
) & 0xff;
1378 netdev_dbg(dev
, "Status is %#2.2x (mask %#2.2x).\n",
1380 if ((status
& mask
) == 0) {
1381 if (bogus_cnt
== INTR_WORK
)
1385 if (status
& IM_RCV_INT
) {
1386 /* Got a packet(s). */
1389 if (status
& IM_TX_INT
) {
1391 outw(IM_TX_INT
, ioaddr
+ INTERRUPT
);
1394 if (status
& IM_TX_EMPTY_INT
) {
1395 outw(IM_TX_EMPTY_INT
, ioaddr
+ INTERRUPT
);
1396 mask
&= ~IM_TX_EMPTY_INT
;
1397 dev
->stats
.tx_packets
+= smc
->packets_waiting
;
1398 smc
->packets_waiting
= 0;
1400 if (status
& IM_ALLOC_INT
) {
1401 /* Clear this interrupt so it doesn't happen again */
1402 mask
&= ~IM_ALLOC_INT
;
1404 smc_hardware_send_packet(dev
);
1406 /* enable xmit interrupts based on this */
1407 mask
|= (IM_TX_EMPTY_INT
| IM_TX_INT
);
1409 /* and let the card send more packets to me */
1410 netif_wake_queue(dev
);
1412 if (status
& IM_RX_OVRN_INT
) {
1413 dev
->stats
.rx_errors
++;
1414 dev
->stats
.rx_fifo_errors
++;
1416 smc
->rx_ovrn
= 1; /* need MC_RESET outside smc_interrupt */
1417 outw(IM_RX_OVRN_INT
, ioaddr
+ INTERRUPT
);
1419 if (status
& IM_EPH_INT
)
1421 } while (--bogus_cnt
);
1423 netdev_dbg(dev
, " Restoring saved registers mask %2.2x bank %4.4x pointer %4.4x.\n",
1424 mask
, saved_bank
, saved_pointer
);
1426 /* restore state register */
1427 outw((mask
<<8), ioaddr
+ INTERRUPT
);
1428 outw(saved_pointer
, ioaddr
+ POINTER
);
1429 SMC_SELECT_BANK(saved_bank
);
1431 netdev_dbg(dev
, "Exiting interrupt IRQ%d.\n", irq
);
1435 if ((smc
->manfid
== MANFID_OSITECH
) &&
1436 (smc
->cardid
!= PRODID_OSITECH_SEVEN
)) {
1437 /* Retrigger interrupt if needed */
1438 mask_bits(0x00ff, ioaddr
-0x10+OSITECH_RESET_ISR
);
1439 set_bits(0x0300, ioaddr
-0x10+OSITECH_RESET_ISR
);
1441 if (smc
->manfid
== MANFID_MOTOROLA
) {
1443 cor
= readb(smc
->base
+ MOT_UART
+ CISREG_COR
);
1444 writeb(cor
& ~COR_IREQ_ENA
, smc
->base
+ MOT_UART
+ CISREG_COR
);
1445 writeb(cor
, smc
->base
+ MOT_UART
+ CISREG_COR
);
1446 cor
= readb(smc
->base
+ MOT_LAN
+ CISREG_COR
);
1447 writeb(cor
& ~COR_IREQ_ENA
, smc
->base
+ MOT_LAN
+ CISREG_COR
);
1448 writeb(cor
, smc
->base
+ MOT_LAN
+ CISREG_COR
);
1451 if ((smc
->base
!= NULL
) && /* Megahertz MFC's */
1452 (smc
->manfid
== MANFID_MEGAHERTZ
) &&
1453 (smc
->cardid
== PRODID_MEGAHERTZ_EM3288
)) {
1456 tmp
= readb(smc
->base
+MEGAHERTZ_ISR
);
1457 tmp
= readb(smc
->base
+MEGAHERTZ_ISR
);
1459 /* Retrigger interrupt if needed */
1460 writeb(tmp
, smc
->base
+ MEGAHERTZ_ISR
);
1461 writeb(tmp
, smc
->base
+ MEGAHERTZ_ISR
);
1464 spin_unlock(&smc
->lock
);
1465 return IRQ_RETVAL(handled
);
1468 /*====================================================================*/
1470 static void smc_rx(struct net_device
*dev
)
1472 unsigned int ioaddr
= dev
->base_addr
;
1474 int packet_length
; /* Caution: not frame length, rather words
1475 to transfer from the chip. */
1477 /* Assertion: we are in Window 2. */
1479 if (inw(ioaddr
+ FIFO_PORTS
) & FP_RXEMPTY
) {
1480 netdev_err(dev
, "smc_rx() with nothing on Rx FIFO\n");
1484 /* Reset the read pointer, and read the status and packet length. */
1485 outw(PTR_READ
| PTR_RCV
| PTR_AUTOINC
, ioaddr
+ POINTER
);
1486 rx_status
= inw(ioaddr
+ DATA_1
);
1487 packet_length
= inw(ioaddr
+ DATA_1
) & 0x07ff;
1489 netdev_dbg(dev
, "Receive status %4.4x length %d.\n",
1490 rx_status
, packet_length
);
1492 if (!(rx_status
& RS_ERRORS
)) {
1493 /* do stuff to make a new packet */
1494 struct sk_buff
*skb
;
1496 /* Note: packet_length adds 5 or 6 extra bytes here! */
1497 skb
= netdev_alloc_skb(dev
, packet_length
+2);
1500 netdev_dbg(dev
, "Low memory, packet dropped.\n");
1501 dev
->stats
.rx_dropped
++;
1502 outw(MC_RELEASE
, ioaddr
+ MMU_CMD
);
1506 packet_length
-= (rx_status
& RS_ODDFRAME
? 5 : 6);
1507 skb_reserve(skb
, 2);
1508 insw(ioaddr
+DATA_1
, skb_put(skb
, packet_length
),
1509 (packet_length
+1)>>1);
1510 skb
->protocol
= eth_type_trans(skb
, dev
);
1513 dev
->last_rx
= jiffies
;
1514 dev
->stats
.rx_packets
++;
1515 dev
->stats
.rx_bytes
+= packet_length
;
1516 if (rx_status
& RS_MULTICAST
)
1517 dev
->stats
.multicast
++;
1520 dev
->stats
.rx_errors
++;
1522 if (rx_status
& RS_ALGNERR
) dev
->stats
.rx_frame_errors
++;
1523 if (rx_status
& (RS_TOOSHORT
| RS_TOOLONG
))
1524 dev
->stats
.rx_length_errors
++;
1525 if (rx_status
& RS_BADCRC
) dev
->stats
.rx_crc_errors
++;
1527 /* Let the MMU free the memory of this packet. */
1528 outw(MC_RELEASE
, ioaddr
+ MMU_CMD
);
1531 /*======================================================================
1533 Set the receive mode.
1535 This routine is used by both the protocol level to notify us of
1536 promiscuous/multicast mode changes, and by the open/reset code to
1537 initialize the Rx registers. We always set the multicast list and
1538 leave the receiver running.
1540 ======================================================================*/
1542 static void set_rx_mode(struct net_device
*dev
)
1544 unsigned int ioaddr
= dev
->base_addr
;
1545 struct smc_private
*smc
= netdev_priv(dev
);
1546 unsigned char multicast_table
[8];
1547 unsigned long flags
;
1548 u_short rx_cfg_setting
;
1551 memset(multicast_table
, 0, sizeof(multicast_table
));
1553 if (dev
->flags
& IFF_PROMISC
) {
1554 rx_cfg_setting
= RxStripCRC
| RxEnable
| RxPromisc
| RxAllMulti
;
1555 } else if (dev
->flags
& IFF_ALLMULTI
)
1556 rx_cfg_setting
= RxStripCRC
| RxEnable
| RxAllMulti
;
1558 if (!netdev_mc_empty(dev
)) {
1559 struct netdev_hw_addr
*ha
;
1561 netdev_for_each_mc_addr(ha
, dev
) {
1562 u_int position
= ether_crc(6, ha
->addr
);
1563 multicast_table
[position
>> 29] |= 1 << ((position
>> 26) & 7);
1566 rx_cfg_setting
= RxStripCRC
| RxEnable
;
1569 /* Load MC table and Rx setting into the chip without interrupts. */
1570 spin_lock_irqsave(&smc
->lock
, flags
);
1572 for (i
= 0; i
< 8; i
++)
1573 outb(multicast_table
[i
], ioaddr
+ MULTICAST0
+ i
);
1575 outw(rx_cfg_setting
, ioaddr
+ RCR
);
1577 spin_unlock_irqrestore(&smc
->lock
, flags
);
1580 /*======================================================================
1582 Senses when a card's config changes. Here, it's coax or TP.
1584 ======================================================================*/
1586 static int s9k_config(struct net_device
*dev
, struct ifmap
*map
)
1588 struct smc_private
*smc
= netdev_priv(dev
);
1589 if ((map
->port
!= (u_char
)(-1)) && (map
->port
!= dev
->if_port
)) {
1590 if (smc
->cfg
& CFG_MII_SELECT
)
1592 else if (map
->port
> 2)
1594 dev
->if_port
= map
->port
;
1595 netdev_info(dev
, "switched to %s port\n", if_names
[dev
->if_port
]);
1601 /*======================================================================
1603 Reset the chip, reloading every register that might be corrupted.
1605 ======================================================================*/
1608 Set transceiver type, perhaps to something other than what the user
1609 specified in dev->if_port.
1611 static void smc_set_xcvr(struct net_device
*dev
, int if_port
)
1613 struct smc_private
*smc
= netdev_priv(dev
);
1614 unsigned int ioaddr
= dev
->base_addr
;
1617 saved_bank
= inw(ioaddr
+ BANK_SELECT
);
1620 outw(smc
->cfg
| CFG_AUI_SELECT
, ioaddr
+ CONFIG
);
1621 if ((smc
->manfid
== MANFID_OSITECH
) &&
1622 (smc
->cardid
!= PRODID_OSITECH_SEVEN
))
1623 set_bits(OSI_AUI_PWR
, ioaddr
- 0x10 + OSITECH_AUI_PWR
);
1624 smc
->media_status
= ((dev
->if_port
== 0) ? 0x0001 : 0x0002);
1626 outw(smc
->cfg
, ioaddr
+ CONFIG
);
1627 if ((smc
->manfid
== MANFID_OSITECH
) &&
1628 (smc
->cardid
!= PRODID_OSITECH_SEVEN
))
1629 mask_bits(~OSI_AUI_PWR
, ioaddr
- 0x10 + OSITECH_AUI_PWR
);
1630 smc
->media_status
= ((dev
->if_port
== 0) ? 0x0012 : 0x4001);
1632 SMC_SELECT_BANK(saved_bank
);
1635 static void smc_reset(struct net_device
*dev
)
1637 unsigned int ioaddr
= dev
->base_addr
;
1638 struct smc_private
*smc
= netdev_priv(dev
);
1641 netdev_dbg(dev
, "smc91c92 reset called.\n");
1643 /* The first interaction must be a write to bring the chip out
1646 /* Reset the chip. */
1647 outw(RCR_SOFTRESET
, ioaddr
+ RCR
);
1650 /* Clear the transmit and receive configuration registers. */
1651 outw(RCR_CLEAR
, ioaddr
+ RCR
);
1652 outw(TCR_CLEAR
, ioaddr
+ TCR
);
1654 /* Set the Window 1 control, configuration and station addr registers.
1655 No point in writing the I/O base register ;-> */
1657 /* Automatically release successfully transmitted packets,
1658 Accept link errors, counter and Tx error interrupts. */
1659 outw(CTL_AUTO_RELEASE
| CTL_TE_ENABLE
| CTL_CR_ENABLE
,
1661 smc_set_xcvr(dev
, dev
->if_port
);
1662 if ((smc
->manfid
== MANFID_OSITECH
) &&
1663 (smc
->cardid
!= PRODID_OSITECH_SEVEN
))
1664 outw((dev
->if_port
== 2 ? OSI_AUI_PWR
: 0) |
1665 (inw(ioaddr
-0x10+OSITECH_AUI_PWR
) & 0xff00),
1666 ioaddr
- 0x10 + OSITECH_AUI_PWR
);
1668 /* Fill in the physical address. The databook is wrong about the order! */
1669 for (i
= 0; i
< 6; i
+= 2)
1670 outw((dev
->dev_addr
[i
+1]<<8)+dev
->dev_addr
[i
],
1671 ioaddr
+ ADDR0
+ i
);
1675 outw(MC_RESET
, ioaddr
+ MMU_CMD
);
1676 outw(0, ioaddr
+ INTERRUPT
);
1678 /* Re-enable the chip. */
1680 outw(((smc
->cfg
& CFG_MII_SELECT
) ? 0 : TCR_MONCSN
) |
1681 TCR_ENABLE
| TCR_PAD_EN
| smc
->duplex
, ioaddr
+ TCR
);
1684 if (smc
->cfg
& CFG_MII_SELECT
) {
1688 mdio_write(dev
, smc
->mii_if
.phy_id
, 0, 0x8000);
1690 /* Advertise 100F, 100H, 10F, 10H */
1691 mdio_write(dev
, smc
->mii_if
.phy_id
, 4, 0x01e1);
1693 /* Restart MII autonegotiation */
1694 mdio_write(dev
, smc
->mii_if
.phy_id
, 0, 0x0000);
1695 mdio_write(dev
, smc
->mii_if
.phy_id
, 0, 0x1200);
1698 /* Enable interrupts. */
1700 outw((IM_EPH_INT
| IM_RX_OVRN_INT
| IM_RCV_INT
) << 8,
1701 ioaddr
+ INTERRUPT
);
1704 /*======================================================================
1706 Media selection timer routine
1708 ======================================================================*/
1710 static void media_check(u_long arg
)
1712 struct net_device
*dev
= (struct net_device
*) arg
;
1713 struct smc_private
*smc
= netdev_priv(dev
);
1714 unsigned int ioaddr
= dev
->base_addr
;
1715 u_short i
, media
, saved_bank
;
1717 unsigned long flags
;
1719 spin_lock_irqsave(&smc
->lock
, flags
);
1721 saved_bank
= inw(ioaddr
+ BANK_SELECT
);
1723 if (!netif_device_present(dev
))
1728 /* need MC_RESET to keep the memory consistent. errata? */
1730 outw(MC_RESET
, ioaddr
+ MMU_CMD
);
1733 i
= inw(ioaddr
+ INTERRUPT
);
1735 media
= inw(ioaddr
+ EPH
) & EPH_LINK_OK
;
1737 media
|= (inw(ioaddr
+ CONFIG
) & CFG_AUI_SELECT
) ? 2 : 1;
1739 SMC_SELECT_BANK(saved_bank
);
1740 spin_unlock_irqrestore(&smc
->lock
, flags
);
1742 /* Check for pending interrupt with watchdog flag set: with
1743 this, we can limp along even if the interrupt is blocked */
1744 if (smc
->watchdog
++ && ((i
>>8) & i
)) {
1745 if (!smc
->fast_poll
)
1746 netdev_info(dev
, "interrupt(s) dropped!\n");
1747 local_irq_save(flags
);
1748 smc_interrupt(dev
->irq
, dev
);
1749 local_irq_restore(flags
);
1750 smc
->fast_poll
= HZ
;
1752 if (smc
->fast_poll
) {
1754 smc
->media
.expires
= jiffies
+ HZ
/100;
1755 add_timer(&smc
->media
);
1759 spin_lock_irqsave(&smc
->lock
, flags
);
1761 saved_bank
= inw(ioaddr
+ BANK_SELECT
);
1763 if (smc
->cfg
& CFG_MII_SELECT
) {
1764 if (smc
->mii_if
.phy_id
< 0)
1768 link
= mdio_read(dev
, smc
->mii_if
.phy_id
, 1);
1769 if (!link
|| (link
== 0xffff)) {
1770 netdev_info(dev
, "MII is missing!\n");
1771 smc
->mii_if
.phy_id
= -1;
1776 if (link
!= smc
->link_status
) {
1777 u_short p
= mdio_read(dev
, smc
->mii_if
.phy_id
, 5);
1778 netdev_info(dev
, "%s link beat\n", link
? "found" : "lost");
1779 smc
->duplex
= (((p
& 0x0100) || ((p
& 0x1c0) == 0x40))
1782 netdev_info(dev
, "autonegotiation complete: "
1783 "%dbaseT-%cD selected\n",
1784 (p
& 0x0180) ? 100 : 10, smc
->duplex
? 'F' : 'H');
1787 outw(inw(ioaddr
+ TCR
) | smc
->duplex
, ioaddr
+ TCR
);
1788 smc
->link_status
= link
;
1793 /* Ignore collisions unless we've had no rx's recently */
1794 if (time_after(jiffies
, dev
->last_rx
+ HZ
)) {
1795 if (smc
->tx_err
|| (smc
->media_status
& EPH_16COL
))
1800 if (media
!= smc
->media_status
) {
1801 if ((media
& smc
->media_status
& 1) &&
1802 ((smc
->media_status
^ media
) & EPH_LINK_OK
))
1803 netdev_info(dev
, "%s link beat\n",
1804 smc
->media_status
& EPH_LINK_OK
? "lost" : "found");
1805 else if ((media
& smc
->media_status
& 2) &&
1806 ((smc
->media_status
^ media
) & EPH_16COL
))
1807 netdev_info(dev
, "coax cable %s\n",
1808 media
& EPH_16COL
? "problem" : "ok");
1809 if (dev
->if_port
== 0) {
1811 if (media
& EPH_LINK_OK
)
1812 netdev_info(dev
, "flipped to 10baseT\n");
1814 smc_set_xcvr(dev
, 2);
1816 if (media
& EPH_16COL
)
1817 smc_set_xcvr(dev
, 1);
1819 netdev_info(dev
, "flipped to 10base2\n");
1822 smc
->media_status
= media
;
1826 smc
->media
.expires
= jiffies
+ HZ
;
1827 add_timer(&smc
->media
);
1828 SMC_SELECT_BANK(saved_bank
);
1829 spin_unlock_irqrestore(&smc
->lock
, flags
);
1832 static int smc_link_ok(struct net_device
*dev
)
1834 unsigned int ioaddr
= dev
->base_addr
;
1835 struct smc_private
*smc
= netdev_priv(dev
);
1837 if (smc
->cfg
& CFG_MII_SELECT
) {
1838 return mii_link_ok(&smc
->mii_if
);
1841 return inw(ioaddr
+ EPH
) & EPH_LINK_OK
;
1845 static int smc_netdev_get_ecmd(struct net_device
*dev
, struct ethtool_cmd
*ecmd
)
1848 unsigned int ioaddr
= dev
->base_addr
;
1850 ecmd
->supported
= (SUPPORTED_TP
| SUPPORTED_AUI
|
1851 SUPPORTED_10baseT_Half
| SUPPORTED_10baseT_Full
);
1854 tmp
= inw(ioaddr
+ CONFIG
);
1855 ecmd
->port
= (tmp
& CFG_AUI_SELECT
) ? PORT_AUI
: PORT_TP
;
1856 ecmd
->transceiver
= XCVR_INTERNAL
;
1857 ethtool_cmd_speed_set(ecmd
, SPEED_10
);
1858 ecmd
->phy_address
= ioaddr
+ MGMT
;
1861 tmp
= inw(ioaddr
+ TCR
);
1862 ecmd
->duplex
= (tmp
& TCR_FDUPLX
) ? DUPLEX_FULL
: DUPLEX_HALF
;
1867 static int smc_netdev_set_ecmd(struct net_device
*dev
, struct ethtool_cmd
*ecmd
)
1870 unsigned int ioaddr
= dev
->base_addr
;
1872 if (ethtool_cmd_speed(ecmd
) != SPEED_10
)
1874 if (ecmd
->duplex
!= DUPLEX_HALF
&& ecmd
->duplex
!= DUPLEX_FULL
)
1876 if (ecmd
->port
!= PORT_TP
&& ecmd
->port
!= PORT_AUI
)
1878 if (ecmd
->transceiver
!= XCVR_INTERNAL
)
1881 if (ecmd
->port
== PORT_AUI
)
1882 smc_set_xcvr(dev
, 1);
1884 smc_set_xcvr(dev
, 0);
1887 tmp
= inw(ioaddr
+ TCR
);
1888 if (ecmd
->duplex
== DUPLEX_FULL
)
1892 outw(tmp
, ioaddr
+ TCR
);
1897 static int check_if_running(struct net_device
*dev
)
1899 if (!netif_running(dev
))
1904 static void smc_get_drvinfo(struct net_device
*dev
, struct ethtool_drvinfo
*info
)
1906 strlcpy(info
->driver
, DRV_NAME
, sizeof(info
->driver
));
1907 strlcpy(info
->version
, DRV_VERSION
, sizeof(info
->version
));
1910 static int smc_get_settings(struct net_device
*dev
, struct ethtool_cmd
*ecmd
)
1912 struct smc_private
*smc
= netdev_priv(dev
);
1913 unsigned int ioaddr
= dev
->base_addr
;
1914 u16 saved_bank
= inw(ioaddr
+ BANK_SELECT
);
1916 unsigned long flags
;
1918 spin_lock_irqsave(&smc
->lock
, flags
);
1920 if (smc
->cfg
& CFG_MII_SELECT
)
1921 ret
= mii_ethtool_gset(&smc
->mii_if
, ecmd
);
1923 ret
= smc_netdev_get_ecmd(dev
, ecmd
);
1924 SMC_SELECT_BANK(saved_bank
);
1925 spin_unlock_irqrestore(&smc
->lock
, flags
);
1929 static int smc_set_settings(struct net_device
*dev
, struct ethtool_cmd
*ecmd
)
1931 struct smc_private
*smc
= netdev_priv(dev
);
1932 unsigned int ioaddr
= dev
->base_addr
;
1933 u16 saved_bank
= inw(ioaddr
+ BANK_SELECT
);
1935 unsigned long flags
;
1937 spin_lock_irqsave(&smc
->lock
, flags
);
1939 if (smc
->cfg
& CFG_MII_SELECT
)
1940 ret
= mii_ethtool_sset(&smc
->mii_if
, ecmd
);
1942 ret
= smc_netdev_set_ecmd(dev
, ecmd
);
1943 SMC_SELECT_BANK(saved_bank
);
1944 spin_unlock_irqrestore(&smc
->lock
, flags
);
1948 static u32
smc_get_link(struct net_device
*dev
)
1950 struct smc_private
*smc
= netdev_priv(dev
);
1951 unsigned int ioaddr
= dev
->base_addr
;
1952 u16 saved_bank
= inw(ioaddr
+ BANK_SELECT
);
1954 unsigned long flags
;
1956 spin_lock_irqsave(&smc
->lock
, flags
);
1958 ret
= smc_link_ok(dev
);
1959 SMC_SELECT_BANK(saved_bank
);
1960 spin_unlock_irqrestore(&smc
->lock
, flags
);
1964 static int smc_nway_reset(struct net_device
*dev
)
1966 struct smc_private
*smc
= netdev_priv(dev
);
1967 if (smc
->cfg
& CFG_MII_SELECT
) {
1968 unsigned int ioaddr
= dev
->base_addr
;
1969 u16 saved_bank
= inw(ioaddr
+ BANK_SELECT
);
1973 res
= mii_nway_restart(&smc
->mii_if
);
1974 SMC_SELECT_BANK(saved_bank
);
1981 static const struct ethtool_ops ethtool_ops
= {
1982 .begin
= check_if_running
,
1983 .get_drvinfo
= smc_get_drvinfo
,
1984 .get_settings
= smc_get_settings
,
1985 .set_settings
= smc_set_settings
,
1986 .get_link
= smc_get_link
,
1987 .nway_reset
= smc_nway_reset
,
1990 static int smc_ioctl (struct net_device
*dev
, struct ifreq
*rq
, int cmd
)
1992 struct smc_private
*smc
= netdev_priv(dev
);
1993 struct mii_ioctl_data
*mii
= if_mii(rq
);
1996 unsigned int ioaddr
= dev
->base_addr
;
1997 unsigned long flags
;
1999 if (!netif_running(dev
))
2002 spin_lock_irqsave(&smc
->lock
, flags
);
2003 saved_bank
= inw(ioaddr
+ BANK_SELECT
);
2005 rc
= generic_mii_ioctl(&smc
->mii_if
, mii
, cmd
, NULL
);
2006 SMC_SELECT_BANK(saved_bank
);
2007 spin_unlock_irqrestore(&smc
->lock
, flags
);
2011 static const struct pcmcia_device_id smc91c92_ids
[] = {
2012 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0109, 0x0501),
2013 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0140, 0x000a),
2014 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "CC/XJEM3288", "DATA/FAX/CELL ETHERNET MODEM", 0xf510db04, 0x04cd2988, 0x46a52d63),
2015 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "CC/XJEM3336", "DATA/FAX/CELL ETHERNET MODEM", 0xf510db04, 0x0143b773, 0x46a52d63),
2016 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "EM1144T", "PCMCIA MODEM", 0xf510db04, 0x856d66c8, 0xbd6c43ef),
2017 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "XJEM1144/CCEM1144", "PCMCIA MODEM", 0xf510db04, 0x52d21e1e, 0xbd6c43ef),
2018 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c),
2019 PCMCIA_PFC_DEVICE_PROD_ID12(0, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e),
2020 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard:Jack of Diamonds Modem+Ethernet", 0xc2f80cd, 0x656947b9),
2021 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard:Jack of Hearts Modem+Ethernet", 0xc2f80cd, 0xdc9ba5ed),
2022 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x016c, 0x0020),
2023 PCMCIA_DEVICE_MANF_CARD(0x016c, 0x0023),
2024 PCMCIA_DEVICE_PROD_ID123("BASICS by New Media Corporation", "Ethernet", "SMC91C94", 0x23c78a9d, 0x00b2e941, 0xcef397fb),
2025 PCMCIA_DEVICE_PROD_ID12("ARGOSY", "Fast Ethernet PCCard", 0x78f308dc, 0xdcea68bc),
2026 PCMCIA_DEVICE_PROD_ID12("dit Co., Ltd.", "PC Card-10/100BTX", 0xe59365c8, 0x6a2161d1),
2027 PCMCIA_DEVICE_PROD_ID12("DYNALINK", "L100C", 0x6a26d1cf, 0xc16ce9c5),
2028 PCMCIA_DEVICE_PROD_ID12("Farallon", "Farallon Enet", 0x58d93fc4, 0x244734e9),
2029 PCMCIA_DEVICE_PROD_ID12("Megahertz", "CC10BT/2", 0x33234748, 0x3c95b953),
2030 PCMCIA_DEVICE_PROD_ID12("MELCO/SMC", "LPC-TX", 0xa2cd8e6d, 0x42da662a),
2031 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard:Four of Diamonds Ethernet", 0xc2f80cd, 0xb3466314),
2032 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard:Seven of Diamonds Ethernet", 0xc2f80cd, 0x194b650a),
2033 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast Ethernet PCCard", 0x281f1c5d, 0xdcea68bc),
2034 PCMCIA_DEVICE_PROD_ID12("Psion", "10Mb Ethernet", 0x4ef00b21, 0x844be9e9),
2035 PCMCIA_DEVICE_PROD_ID12("SMC", "EtherEZ Ethernet 8020", 0xc4f8b18b, 0x4a0eeb2d),
2036 /* These conflict with other cards! */
2037 /* PCMCIA_DEVICE_MANF_CARD(0x0186, 0x0100), */
2038 /* PCMCIA_DEVICE_MANF_CARD(0x8a01, 0xc1ab), */
2041 MODULE_DEVICE_TABLE(pcmcia
, smc91c92_ids
);
2043 static struct pcmcia_driver smc91c92_cs_driver
= {
2044 .owner
= THIS_MODULE
,
2045 .name
= "smc91c92_cs",
2046 .probe
= smc91c92_probe
,
2047 .remove
= smc91c92_detach
,
2048 .id_table
= smc91c92_ids
,
2049 .suspend
= smc91c92_suspend
,
2050 .resume
= smc91c92_resume
,
2052 module_pcmcia_driver(smc91c92_cs_driver
);