34 #include <linux/kernel.h>
36 #include <linux/ptrace.h>
37 #include <linux/slab.h>
38 #include <linux/string.h>
41 #include <linux/module.h>
42 #include <linux/netdevice.h>
51 #define VERSION "arcnet: COM20020 PCMCIA support loaded.\n"
61 for (count = ioaddr; count < ioaddr + 16; count++)
75 for (count = 0; count < 256+32; count++)
109 static int com20020_config(
struct pcmcia_device *
link);
110 static void com20020_release(
struct pcmcia_device *
link);
112 static void com20020_detach(
struct pcmcia_device *p_dev);
120 static int com20020_probe(
struct pcmcia_device *p_dev)
124 struct arcnet_local *
lp;
126 dev_dbg(&p_dev->dev,
"com20020_attach()\n");
131 goto fail_alloc_info;
137 lp = netdev_priv(dev);
139 lp->backplane = backplane;
141 lp->clockm = clockm & 3;
147 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
148 p_dev->resource[0]->end = 16;
149 p_dev->config_flags |= CONF_ENABLE_IRQ;
154 return com20020_config(p_dev);
162 static void com20020_detach(
struct pcmcia_device *
link)
167 dev_dbg(&link->dev,
"detach...\n");
169 dev_dbg(&link->dev,
"com20020_detach\n");
171 dev_dbg(&link->dev,
"unregister...\n");
182 com20020_release(link);
185 dev_dbg(&link->dev,
"unlinking...\n");
191 dev_dbg(&link->dev,
"kfree...\n");
194 dev_dbg(&link->dev,
"kfree2...\n");
200 static int com20020_config(
struct pcmcia_device *link)
202 struct arcnet_local *
lp;
211 dev_dbg(&link->dev,
"config...\n");
213 dev_dbg(&link->dev,
"com20020_config\n");
215 dev_dbg(&link->dev,
"baseport1 is %Xh\n",
216 (
unsigned int) link->resource[0]->start);
221 if (!link->resource[0]->start)
223 for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10)
225 link->resource[0]->start = ioaddr;
236 dev_dbg(&link->dev,
"requestIO failed totally!\n");
240 ioaddr = dev->
base_addr = link->resource[0]->start;
241 dev_dbg(&link->dev,
"got ioaddr %Xh\n", ioaddr);
243 dev_dbg(&link->dev,
"request IRQ %d\n",
247 dev_dbg(&link->dev,
"requestIRQ failed totally!\n");
251 dev->
irq = link->irq;
263 lp = netdev_priv(dev);
264 lp->card_name =
"PCMCIA COM20020";
265 lp->card_flags = ARC_CAN_10MBIT;
272 dev_notice(&link->dev,
273 "com20020_found() failed\n");
282 dev_dbg(&link->dev,
"com20020_config failed...\n");
283 com20020_release(link);
287 static void com20020_release(
struct pcmcia_device *link)
289 dev_dbg(&link->dev,
"com20020_release\n");
293 static int com20020_suspend(
struct pcmcia_device *link)
304 static int com20020_resume(
struct pcmcia_device *link)
311 struct arcnet_local *lp = netdev_priv(dev);
319 PCMCIA_DEVICE_PROD_ID12(
"Contemporary Control Systems, Inc.",
320 "PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf),
321 PCMCIA_DEVICE_PROD_ID12(
"SoHard AG",
322 "SH ARC PCMCIA", 0xf8991729, 0x69dff0c7),
327 static struct pcmcia_driver com20020_cs_driver = {
329 .name =
"com20020_cs",
330 .probe = com20020_probe,
331 .remove = com20020_detach,
332 .id_table = com20020_ids,
333 .suspend = com20020_suspend,
334 .resume = com20020_resume,
337 static int __init init_com20020_cs(
void)
342 static void __exit exit_com20020_cs(
void)