diff options
Diffstat (limited to 'drivers/net/pcmcia/axnet_cs.c')
-rw-r--r-- | drivers/net/pcmcia/axnet_cs.c | 56 |
1 files changed, 19 insertions, 37 deletions
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 3131a59a8d32..800597b82d18 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>"); | |||
75 | MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver"); | 75 | MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver"); |
76 | MODULE_LICENSE("GPL"); | 76 | MODULE_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 | |||
81 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
82 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
83 | static 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) |
@@ -180,7 +170,6 @@ static int axnet_probe(struct pcmcia_device *link) | |||
180 | info->p_dev = link; | 170 | info->p_dev = link; |
181 | link->priv = dev; | 171 | link->priv = dev; |
182 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 172 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
183 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
184 | link->conf.Attributes = CONF_ENABLE_IRQ; | 173 | link->conf.Attributes = CONF_ENABLE_IRQ; |
185 | link->conf.IntType = INT_MEMORY_AND_IO; | 174 | link->conf.IntType = INT_MEMORY_AND_IO; |
186 | 175 | ||
@@ -205,7 +194,7 @@ static void axnet_detach(struct pcmcia_device *link) | |||
205 | { | 194 | { |
206 | struct net_device *dev = link->priv; | 195 | struct net_device *dev = link->priv; |
207 | 196 | ||
208 | DEBUG(0, "axnet_detach(0x%p)\n", link); | 197 | dev_dbg(&link->dev, "axnet_detach(0x%p)\n", link); |
209 | 198 | ||
210 | if (link->dev_node) | 199 | if (link->dev_node) |
211 | unregister_netdev(dev); | 200 | unregister_netdev(dev); |
@@ -272,9 +261,6 @@ static int get_prom(struct pcmcia_device *link) | |||
272 | 261 | ||
273 | ======================================================================*/ | 262 | ======================================================================*/ |
274 | 263 | ||
275 | #define CS_CHECK(fn, ret) \ | ||
276 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
277 | |||
278 | static int try_io_port(struct pcmcia_device *link) | 264 | static int try_io_port(struct pcmcia_device *link) |
279 | { | 265 | { |
280 | int j, ret; | 266 | int j, ret; |
@@ -341,26 +327,29 @@ static int axnet_config(struct pcmcia_device *link) | |||
341 | { | 327 | { |
342 | struct net_device *dev = link->priv; | 328 | struct net_device *dev = link->priv; |
343 | axnet_dev_t *info = PRIV(dev); | 329 | axnet_dev_t *info = PRIV(dev); |
344 | int i, j, j2, last_ret, last_fn; | 330 | int i, j, j2, ret; |
345 | 331 | ||
346 | DEBUG(0, "axnet_config(0x%p)\n", link); | 332 | dev_dbg(&link->dev, "axnet_config(0x%p)\n", link); |
347 | 333 | ||
348 | /* don't trust the CIS on this; Linksys got it wrong */ | 334 | /* don't trust the CIS on this; Linksys got it wrong */ |
349 | link->conf.Present = 0x63; | 335 | link->conf.Present = 0x63; |
350 | last_ret = pcmcia_loop_config(link, axnet_configcheck, NULL); | 336 | ret = pcmcia_loop_config(link, axnet_configcheck, NULL); |
351 | if (last_ret != 0) { | 337 | if (ret != 0) |
352 | cs_error(link, RequestIO, last_ret); | ||
353 | goto failed; | 338 | goto failed; |
354 | } | ||
355 | 339 | ||
356 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 340 | ret = pcmcia_request_irq(link, &link->irq); |
341 | if (ret) | ||
342 | goto failed; | ||
357 | 343 | ||
358 | if (link->io.NumPorts2 == 8) { | 344 | if (link->io.NumPorts2 == 8) { |
359 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 345 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
360 | link->conf.Status = CCSR_AUDIO_ENA; | 346 | link->conf.Status = CCSR_AUDIO_ENA; |
361 | } | 347 | } |
362 | 348 | ||
363 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 349 | ret = pcmcia_request_configuration(link, &link->conf); |
350 | if (ret) | ||
351 | goto failed; | ||
352 | |||
364 | dev->irq = link->irq.AssignedIRQ; | 353 | dev->irq = link->irq.AssignedIRQ; |
365 | dev->base_addr = link->io.BasePort1; | 354 | dev->base_addr = link->io.BasePort1; |
366 | 355 | ||
@@ -410,7 +399,7 @@ static int axnet_config(struct pcmcia_device *link) | |||
410 | 399 | ||
411 | info->phy_id = (i < 32) ? i : -1; | 400 | info->phy_id = (i < 32) ? i : -1; |
412 | link->dev_node = &info->node; | 401 | link->dev_node = &info->node; |
413 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 402 | SET_NETDEV_DEV(dev, &link->dev); |
414 | 403 | ||
415 | if (register_netdev(dev) != 0) { | 404 | if (register_netdev(dev) != 0) { |
416 | printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); | 405 | printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); |
@@ -426,14 +415,12 @@ static int axnet_config(struct pcmcia_device *link) | |||
426 | dev->base_addr, dev->irq, | 415 | dev->base_addr, dev->irq, |
427 | dev->dev_addr); | 416 | dev->dev_addr); |
428 | if (info->phy_id != -1) { | 417 | if (info->phy_id != -1) { |
429 | DEBUG(0, " MII transceiver at index %d, status %x.\n", info->phy_id, j); | 418 | dev_dbg(&link->dev, " MII transceiver at index %d, status %x.\n", info->phy_id, j); |
430 | } else { | 419 | } else { |
431 | printk(KERN_NOTICE " No MII transceivers found!\n"); | 420 | printk(KERN_NOTICE " No MII transceivers found!\n"); |
432 | } | 421 | } |
433 | return 0; | 422 | return 0; |
434 | 423 | ||
435 | cs_failed: | ||
436 | cs_error(link, last_fn, last_ret); | ||
437 | failed: | 424 | failed: |
438 | axnet_release(link); | 425 | axnet_release(link); |
439 | return -ENODEV; | 426 | return -ENODEV; |
@@ -543,7 +530,7 @@ static int axnet_open(struct net_device *dev) | |||
543 | struct pcmcia_device *link = info->p_dev; | 530 | struct pcmcia_device *link = info->p_dev; |
544 | unsigned int nic_base = dev->base_addr; | 531 | unsigned int nic_base = dev->base_addr; |
545 | 532 | ||
546 | DEBUG(2, "axnet_open('%s')\n", dev->name); | 533 | dev_dbg(&link->dev, "axnet_open('%s')\n", dev->name); |
547 | 534 | ||
548 | if (!pcmcia_dev_present(link)) | 535 | if (!pcmcia_dev_present(link)) |
549 | return -ENODEV; | 536 | return -ENODEV; |
@@ -572,7 +559,7 @@ static int axnet_close(struct net_device *dev) | |||
572 | axnet_dev_t *info = PRIV(dev); | 559 | axnet_dev_t *info = PRIV(dev); |
573 | struct pcmcia_device *link = info->p_dev; | 560 | struct pcmcia_device *link = info->p_dev; |
574 | 561 | ||
575 | DEBUG(2, "axnet_close('%s')\n", dev->name); | 562 | dev_dbg(&link->dev, "axnet_close('%s')\n", dev->name); |
576 | 563 | ||
577 | ax_close(dev); | 564 | ax_close(dev); |
578 | free_irq(dev->irq, dev); | 565 | free_irq(dev->irq, dev); |
@@ -741,10 +728,8 @@ static void block_input(struct net_device *dev, int count, | |||
741 | int xfer_count = count; | 728 | int xfer_count = count; |
742 | char *buf = skb->data; | 729 | char *buf = skb->data; |
743 | 730 | ||
744 | #ifdef PCMCIA_DEBUG | ||
745 | if ((ei_debug > 4) && (count != 4)) | 731 | if ((ei_debug > 4) && (count != 4)) |
746 | printk(KERN_DEBUG "%s: [bi=%d]\n", dev->name, count+4); | 732 | pr_debug("%s: [bi=%d]\n", dev->name, count+4); |
747 | #endif | ||
748 | outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO); | 733 | outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO); |
749 | outb_p(ring_offset >> 8, nic_base + EN0_RSARHI); | 734 | outb_p(ring_offset >> 8, nic_base + EN0_RSARHI); |
750 | outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD); | 735 | outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD); |
@@ -762,10 +747,7 @@ static void block_output(struct net_device *dev, int count, | |||
762 | { | 747 | { |
763 | unsigned int nic_base = dev->base_addr; | 748 | unsigned int nic_base = dev->base_addr; |
764 | 749 | ||
765 | #ifdef PCMCIA_DEBUG | 750 | 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 | 751 | ||
770 | /* Round the count up for word writes. Do we need to do this? | 752 | /* 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? | 753 | What effect will an odd byte count have on the 8390? |