aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/axnet_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/axnet_cs.c')
-rw-r--r--drivers/net/pcmcia/axnet_cs.c53
1 files changed, 18 insertions, 35 deletions
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 3131a59a8d3..5af2ccfdb52 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -75,16 +75,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
75MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver"); 75MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver");
76MODULE_LICENSE("GPL"); 76MODULE_LICENSE("GPL");
77 77
78#ifdef PCMCIA_DEBUG
79#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
80
81INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
82#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
83static char *version =
84"axnet_cs.c 1.28 2002/06/29 06:27:37 (David Hinds)";
85#else
86#define DEBUG(n, args...)
87#endif
88 78
89/*====================================================================*/ 79/*====================================================================*/
90 80
@@ -167,7 +157,7 @@ static int axnet_probe(struct pcmcia_device *link)
167 struct net_device *dev; 157 struct net_device *dev;
168 struct ei_device *ei_local; 158 struct ei_device *ei_local;
169 159
170 DEBUG(0, "axnet_attach()\n"); 160 dev_dbg(&link->dev, "axnet_attach()\n");
171 161
172 dev = alloc_etherdev(sizeof(struct ei_device) + sizeof(axnet_dev_t)); 162 dev = alloc_etherdev(sizeof(struct ei_device) + sizeof(axnet_dev_t));
173 if (!dev) 163 if (!dev)
@@ -205,7 +195,7 @@ static void axnet_detach(struct pcmcia_device *link)
205{ 195{
206 struct net_device *dev = link->priv; 196 struct net_device *dev = link->priv;
207 197
208 DEBUG(0, "axnet_detach(0x%p)\n", link); 198 dev_dbg(&link->dev, "axnet_detach(0x%p)\n", link);
209 199
210 if (link->dev_node) 200 if (link->dev_node)
211 unregister_netdev(dev); 201 unregister_netdev(dev);
@@ -272,9 +262,6 @@ static int get_prom(struct pcmcia_device *link)
272 262
273======================================================================*/ 263======================================================================*/
274 264
275#define CS_CHECK(fn, ret) \
276do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
277
278static int try_io_port(struct pcmcia_device *link) 265static int try_io_port(struct pcmcia_device *link)
279{ 266{
280 int j, ret; 267 int j, ret;
@@ -341,26 +328,29 @@ static int axnet_config(struct pcmcia_device *link)
341{ 328{
342 struct net_device *dev = link->priv; 329 struct net_device *dev = link->priv;
343 axnet_dev_t *info = PRIV(dev); 330 axnet_dev_t *info = PRIV(dev);
344 int i, j, j2, last_ret, last_fn; 331 int i, j, j2, ret;
345 332
346 DEBUG(0, "axnet_config(0x%p)\n", link); 333 dev_dbg(&link->dev, "axnet_config(0x%p)\n", link);
347 334
348 /* don't trust the CIS on this; Linksys got it wrong */ 335 /* don't trust the CIS on this; Linksys got it wrong */
349 link->conf.Present = 0x63; 336 link->conf.Present = 0x63;
350 last_ret = pcmcia_loop_config(link, axnet_configcheck, NULL); 337 ret = pcmcia_loop_config(link, axnet_configcheck, NULL);
351 if (last_ret != 0) { 338 if (ret != 0)
352 cs_error(link, RequestIO, last_ret);
353 goto failed; 339 goto failed;
354 }
355 340
356 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 341 ret = pcmcia_request_irq(link, &link->irq);
342 if (ret)
343 goto failed;
357 344
358 if (link->io.NumPorts2 == 8) { 345 if (link->io.NumPorts2 == 8) {
359 link->conf.Attributes |= CONF_ENABLE_SPKR; 346 link->conf.Attributes |= CONF_ENABLE_SPKR;
360 link->conf.Status = CCSR_AUDIO_ENA; 347 link->conf.Status = CCSR_AUDIO_ENA;
361 } 348 }
362 349
363 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 350 ret = pcmcia_request_configuration(link, &link->conf);
351 if (ret)
352 goto failed;
353
364 dev->irq = link->irq.AssignedIRQ; 354 dev->irq = link->irq.AssignedIRQ;
365 dev->base_addr = link->io.BasePort1; 355 dev->base_addr = link->io.BasePort1;
366 356
@@ -426,14 +416,12 @@ static int axnet_config(struct pcmcia_device *link)
426 dev->base_addr, dev->irq, 416 dev->base_addr, dev->irq,
427 dev->dev_addr); 417 dev->dev_addr);
428 if (info->phy_id != -1) { 418 if (info->phy_id != -1) {
429 DEBUG(0, " MII transceiver at index %d, status %x.\n", info->phy_id, j); 419 dev_dbg(&link->dev, " MII transceiver at index %d, status %x.\n", info->phy_id, j);
430 } else { 420 } else {
431 printk(KERN_NOTICE " No MII transceivers found!\n"); 421 printk(KERN_NOTICE " No MII transceivers found!\n");
432 } 422 }
433 return 0; 423 return 0;
434 424
435cs_failed:
436 cs_error(link, last_fn, last_ret);
437failed: 425failed:
438 axnet_release(link); 426 axnet_release(link);
439 return -ENODEV; 427 return -ENODEV;
@@ -543,7 +531,7 @@ static int axnet_open(struct net_device *dev)
543 struct pcmcia_device *link = info->p_dev; 531 struct pcmcia_device *link = info->p_dev;
544 unsigned int nic_base = dev->base_addr; 532 unsigned int nic_base = dev->base_addr;
545 533
546 DEBUG(2, "axnet_open('%s')\n", dev->name); 534 dev_dbg(&link->dev, "axnet_open('%s')\n", dev->name);
547 535
548 if (!pcmcia_dev_present(link)) 536 if (!pcmcia_dev_present(link))
549 return -ENODEV; 537 return -ENODEV;
@@ -572,7 +560,7 @@ static int axnet_close(struct net_device *dev)
572 axnet_dev_t *info = PRIV(dev); 560 axnet_dev_t *info = PRIV(dev);
573 struct pcmcia_device *link = info->p_dev; 561 struct pcmcia_device *link = info->p_dev;
574 562
575 DEBUG(2, "axnet_close('%s')\n", dev->name); 563 dev_dbg(&link->dev, "axnet_close('%s')\n", dev->name);
576 564
577 ax_close(dev); 565 ax_close(dev);
578 free_irq(dev->irq, dev); 566 free_irq(dev->irq, dev);
@@ -741,10 +729,8 @@ static void block_input(struct net_device *dev, int count,
741 int xfer_count = count; 729 int xfer_count = count;
742 char *buf = skb->data; 730 char *buf = skb->data;
743 731
744#ifdef PCMCIA_DEBUG
745 if ((ei_debug > 4) && (count != 4)) 732 if ((ei_debug > 4) && (count != 4))
746 printk(KERN_DEBUG "%s: [bi=%d]\n", dev->name, count+4); 733 pr_debug("%s: [bi=%d]\n", dev->name, count+4);
747#endif
748 outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO); 734 outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO);
749 outb_p(ring_offset >> 8, nic_base + EN0_RSARHI); 735 outb_p(ring_offset >> 8, nic_base + EN0_RSARHI);
750 outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD); 736 outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD);
@@ -762,10 +748,7 @@ static void block_output(struct net_device *dev, int count,
762{ 748{
763 unsigned int nic_base = dev->base_addr; 749 unsigned int nic_base = dev->base_addr;
764 750
765#ifdef PCMCIA_DEBUG 751 pr_debug("%s: [bo=%d]\n", dev->name, count);
766 if (ei_debug > 4)
767 printk(KERN_DEBUG "%s: [bo=%d]\n", dev->name, count);
768#endif
769 752
770 /* Round the count up for word writes. Do we need to do this? 753 /* Round the count up for word writes. Do we need to do this?
771 What effect will an odd byte count have on the 8390? 754 What effect will an odd byte count have on the 8390?