diff options
Diffstat (limited to 'drivers/net/pcmcia/pcnet_cs.c')
-rw-r--r-- | drivers/net/pcmcia/pcnet_cs.c | 162 |
1 files changed, 64 insertions, 98 deletions
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index b46e5f703efa..d090df413049 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -103,8 +103,8 @@ module_param_array(hw_addr, int, NULL, 0); | |||
103 | /*====================================================================*/ | 103 | /*====================================================================*/ |
104 | 104 | ||
105 | static void mii_phy_probe(struct net_device *dev); | 105 | static void mii_phy_probe(struct net_device *dev); |
106 | static void pcnet_config(dev_link_t *link); | 106 | static int pcnet_config(struct pcmcia_device *link); |
107 | static void pcnet_release(dev_link_t *link); | 107 | static void pcnet_release(struct pcmcia_device *link); |
108 | static int pcnet_open(struct net_device *dev); | 108 | static int pcnet_open(struct net_device *dev); |
109 | static int pcnet_close(struct net_device *dev); | 109 | static int pcnet_close(struct net_device *dev); |
110 | static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 110 | static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
@@ -113,9 +113,9 @@ static irqreturn_t ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs); | |||
113 | static void ei_watchdog(u_long arg); | 113 | static void ei_watchdog(u_long arg); |
114 | static void pcnet_reset_8390(struct net_device *dev); | 114 | static void pcnet_reset_8390(struct net_device *dev); |
115 | static int set_config(struct net_device *dev, struct ifmap *map); | 115 | static int set_config(struct net_device *dev, struct ifmap *map); |
116 | static int setup_shmem_window(dev_link_t *link, int start_pg, | 116 | static int setup_shmem_window(struct pcmcia_device *link, int start_pg, |
117 | int stop_pg, int cm_offset); | 117 | int stop_pg, int cm_offset); |
118 | static int setup_dma_config(dev_link_t *link, int start_pg, | 118 | static int setup_dma_config(struct pcmcia_device *link, int start_pg, |
119 | int stop_pg); | 119 | int stop_pg); |
120 | 120 | ||
121 | static void pcnet_detach(struct pcmcia_device *p_dev); | 121 | static void pcnet_detach(struct pcmcia_device *p_dev); |
@@ -214,7 +214,7 @@ static hw_info_t dl10019_info = { 0, 0, 0, 0, IS_DL10019|HAS_MII }; | |||
214 | static hw_info_t dl10022_info = { 0, 0, 0, 0, IS_DL10022|HAS_MII }; | 214 | static hw_info_t dl10022_info = { 0, 0, 0, 0, IS_DL10022|HAS_MII }; |
215 | 215 | ||
216 | typedef struct pcnet_dev_t { | 216 | typedef struct pcnet_dev_t { |
217 | dev_link_t link; | 217 | struct pcmcia_device *p_dev; |
218 | dev_node_t node; | 218 | dev_node_t node; |
219 | u_int flags; | 219 | u_int flags; |
220 | void __iomem *base; | 220 | void __iomem *base; |
@@ -240,10 +240,9 @@ static inline pcnet_dev_t *PRIV(struct net_device *dev) | |||
240 | 240 | ||
241 | ======================================================================*/ | 241 | ======================================================================*/ |
242 | 242 | ||
243 | static int pcnet_probe(struct pcmcia_device *p_dev) | 243 | static int pcnet_probe(struct pcmcia_device *link) |
244 | { | 244 | { |
245 | pcnet_dev_t *info; | 245 | pcnet_dev_t *info; |
246 | dev_link_t *link; | ||
247 | struct net_device *dev; | 246 | struct net_device *dev; |
248 | 247 | ||
249 | DEBUG(0, "pcnet_attach()\n"); | 248 | DEBUG(0, "pcnet_attach()\n"); |
@@ -252,7 +251,7 @@ static int pcnet_probe(struct pcmcia_device *p_dev) | |||
252 | dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); | 251 | dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); |
253 | if (!dev) return -ENOMEM; | 252 | if (!dev) return -ENOMEM; |
254 | info = PRIV(dev); | 253 | info = PRIV(dev); |
255 | link = &info->link; | 254 | info->p_dev = link; |
256 | link->priv = dev; | 255 | link->priv = dev; |
257 | 256 | ||
258 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 257 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
@@ -265,13 +264,7 @@ static int pcnet_probe(struct pcmcia_device *p_dev) | |||
265 | dev->stop = &pcnet_close; | 264 | dev->stop = &pcnet_close; |
266 | dev->set_config = &set_config; | 265 | dev->set_config = &set_config; |
267 | 266 | ||
268 | link->handle = p_dev; | 267 | return pcnet_config(link); |
269 | p_dev->instance = link; | ||
270 | |||
271 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
272 | pcnet_config(link); | ||
273 | |||
274 | return 0; | ||
275 | } /* pcnet_attach */ | 268 | } /* pcnet_attach */ |
276 | 269 | ||
277 | /*====================================================================== | 270 | /*====================================================================== |
@@ -283,18 +276,16 @@ static int pcnet_probe(struct pcmcia_device *p_dev) | |||
283 | 276 | ||
284 | ======================================================================*/ | 277 | ======================================================================*/ |
285 | 278 | ||
286 | static void pcnet_detach(struct pcmcia_device *p_dev) | 279 | static void pcnet_detach(struct pcmcia_device *link) |
287 | { | 280 | { |
288 | dev_link_t *link = dev_to_instance(p_dev); | ||
289 | struct net_device *dev = link->priv; | 281 | struct net_device *dev = link->priv; |
290 | 282 | ||
291 | DEBUG(0, "pcnet_detach(0x%p)\n", link); | 283 | DEBUG(0, "pcnet_detach(0x%p)\n", link); |
292 | 284 | ||
293 | if (link->dev) | 285 | if (link->dev_node) |
294 | unregister_netdev(dev); | 286 | unregister_netdev(dev); |
295 | 287 | ||
296 | if (link->state & DEV_CONFIG) | 288 | pcnet_release(link); |
297 | pcnet_release(link); | ||
298 | 289 | ||
299 | free_netdev(dev); | 290 | free_netdev(dev); |
300 | } /* pcnet_detach */ | 291 | } /* pcnet_detach */ |
@@ -306,7 +297,7 @@ static void pcnet_detach(struct pcmcia_device *p_dev) | |||
306 | 297 | ||
307 | ======================================================================*/ | 298 | ======================================================================*/ |
308 | 299 | ||
309 | static hw_info_t *get_hwinfo(dev_link_t *link) | 300 | static hw_info_t *get_hwinfo(struct pcmcia_device *link) |
310 | { | 301 | { |
311 | struct net_device *dev = link->priv; | 302 | struct net_device *dev = link->priv; |
312 | win_req_t req; | 303 | win_req_t req; |
@@ -318,9 +309,9 @@ static hw_info_t *get_hwinfo(dev_link_t *link) | |||
318 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 309 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
319 | req.Base = 0; req.Size = 0; | 310 | req.Base = 0; req.Size = 0; |
320 | req.AccessSpeed = 0; | 311 | req.AccessSpeed = 0; |
321 | i = pcmcia_request_window(&link->handle, &req, &link->win); | 312 | i = pcmcia_request_window(&link, &req, &link->win); |
322 | if (i != CS_SUCCESS) { | 313 | if (i != CS_SUCCESS) { |
323 | cs_error(link->handle, RequestWindow, i); | 314 | cs_error(link, RequestWindow, i); |
324 | return NULL; | 315 | return NULL; |
325 | } | 316 | } |
326 | 317 | ||
@@ -343,7 +334,7 @@ static hw_info_t *get_hwinfo(dev_link_t *link) | |||
343 | iounmap(virt); | 334 | iounmap(virt); |
344 | j = pcmcia_release_window(link->win); | 335 | j = pcmcia_release_window(link->win); |
345 | if (j != CS_SUCCESS) | 336 | if (j != CS_SUCCESS) |
346 | cs_error(link->handle, ReleaseWindow, j); | 337 | cs_error(link, ReleaseWindow, j); |
347 | return (i < NR_INFO) ? hw_info+i : NULL; | 338 | return (i < NR_INFO) ? hw_info+i : NULL; |
348 | } /* get_hwinfo */ | 339 | } /* get_hwinfo */ |
349 | 340 | ||
@@ -355,7 +346,7 @@ static hw_info_t *get_hwinfo(dev_link_t *link) | |||
355 | 346 | ||
356 | ======================================================================*/ | 347 | ======================================================================*/ |
357 | 348 | ||
358 | static hw_info_t *get_prom(dev_link_t *link) | 349 | static hw_info_t *get_prom(struct pcmcia_device *link) |
359 | { | 350 | { |
360 | struct net_device *dev = link->priv; | 351 | struct net_device *dev = link->priv; |
361 | kio_addr_t ioaddr = dev->base_addr; | 352 | kio_addr_t ioaddr = dev->base_addr; |
@@ -409,7 +400,7 @@ static hw_info_t *get_prom(dev_link_t *link) | |||
409 | 400 | ||
410 | ======================================================================*/ | 401 | ======================================================================*/ |
411 | 402 | ||
412 | static hw_info_t *get_dl10019(dev_link_t *link) | 403 | static hw_info_t *get_dl10019(struct pcmcia_device *link) |
413 | { | 404 | { |
414 | struct net_device *dev = link->priv; | 405 | struct net_device *dev = link->priv; |
415 | int i; | 406 | int i; |
@@ -431,7 +422,7 @@ static hw_info_t *get_dl10019(dev_link_t *link) | |||
431 | 422 | ||
432 | ======================================================================*/ | 423 | ======================================================================*/ |
433 | 424 | ||
434 | static hw_info_t *get_ax88190(dev_link_t *link) | 425 | static hw_info_t *get_ax88190(struct pcmcia_device *link) |
435 | { | 426 | { |
436 | struct net_device *dev = link->priv; | 427 | struct net_device *dev = link->priv; |
437 | kio_addr_t ioaddr = dev->base_addr; | 428 | kio_addr_t ioaddr = dev->base_addr; |
@@ -464,7 +455,7 @@ static hw_info_t *get_ax88190(dev_link_t *link) | |||
464 | 455 | ||
465 | ======================================================================*/ | 456 | ======================================================================*/ |
466 | 457 | ||
467 | static hw_info_t *get_hwired(dev_link_t *link) | 458 | static hw_info_t *get_hwired(struct pcmcia_device *link) |
468 | { | 459 | { |
469 | struct net_device *dev = link->priv; | 460 | struct net_device *dev = link->priv; |
470 | int i; | 461 | int i; |
@@ -491,7 +482,7 @@ static hw_info_t *get_hwired(dev_link_t *link) | |||
491 | #define CS_CHECK(fn, ret) \ | 482 | #define CS_CHECK(fn, ret) \ |
492 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 483 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
493 | 484 | ||
494 | static int try_io_port(dev_link_t *link) | 485 | static int try_io_port(struct pcmcia_device *link) |
495 | { | 486 | { |
496 | int j, ret; | 487 | int j, ret; |
497 | if (link->io.NumPorts1 == 32) { | 488 | if (link->io.NumPorts1 == 32) { |
@@ -512,18 +503,17 @@ static int try_io_port(dev_link_t *link) | |||
512 | for (j = 0; j < 0x400; j += 0x20) { | 503 | for (j = 0; j < 0x400; j += 0x20) { |
513 | link->io.BasePort1 = j ^ 0x300; | 504 | link->io.BasePort1 = j ^ 0x300; |
514 | link->io.BasePort2 = (j ^ 0x300) + 0x10; | 505 | link->io.BasePort2 = (j ^ 0x300) + 0x10; |
515 | ret = pcmcia_request_io(link->handle, &link->io); | 506 | ret = pcmcia_request_io(link, &link->io); |
516 | if (ret == CS_SUCCESS) return ret; | 507 | if (ret == CS_SUCCESS) return ret; |
517 | } | 508 | } |
518 | return ret; | 509 | return ret; |
519 | } else { | 510 | } else { |
520 | return pcmcia_request_io(link->handle, &link->io); | 511 | return pcmcia_request_io(link, &link->io); |
521 | } | 512 | } |
522 | } | 513 | } |
523 | 514 | ||
524 | static void pcnet_config(dev_link_t *link) | 515 | static int pcnet_config(struct pcmcia_device *link) |
525 | { | 516 | { |
526 | client_handle_t handle = link->handle; | ||
527 | struct net_device *dev = link->priv; | 517 | struct net_device *dev = link->priv; |
528 | pcnet_dev_t *info = PRIV(dev); | 518 | pcnet_dev_t *info = PRIV(dev); |
529 | tuple_t tuple; | 519 | tuple_t tuple; |
@@ -531,7 +521,6 @@ static void pcnet_config(dev_link_t *link) | |||
531 | int i, last_ret, last_fn, start_pg, stop_pg, cm_offset; | 521 | int i, last_ret, last_fn, start_pg, stop_pg, cm_offset; |
532 | int manfid = 0, prodid = 0, has_shmem = 0; | 522 | int manfid = 0, prodid = 0, has_shmem = 0; |
533 | u_short buf[64]; | 523 | u_short buf[64]; |
534 | config_info_t conf; | ||
535 | hw_info_t *hw_info; | 524 | hw_info_t *hw_info; |
536 | 525 | ||
537 | DEBUG(0, "pcnet_config(0x%p)\n", link); | 526 | DEBUG(0, "pcnet_config(0x%p)\n", link); |
@@ -541,36 +530,29 @@ static void pcnet_config(dev_link_t *link) | |||
541 | tuple.TupleDataMax = sizeof(buf); | 530 | tuple.TupleDataMax = sizeof(buf); |
542 | tuple.TupleOffset = 0; | 531 | tuple.TupleOffset = 0; |
543 | tuple.DesiredTuple = CISTPL_CONFIG; | 532 | tuple.DesiredTuple = CISTPL_CONFIG; |
544 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 533 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
545 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 534 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
546 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 535 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
547 | link->conf.ConfigBase = parse.config.base; | 536 | link->conf.ConfigBase = parse.config.base; |
548 | link->conf.Present = parse.config.rmask[0]; | 537 | link->conf.Present = parse.config.rmask[0]; |
549 | 538 | ||
550 | /* Configure card */ | ||
551 | link->state |= DEV_CONFIG; | ||
552 | |||
553 | /* Look up current Vcc */ | ||
554 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf)); | ||
555 | link->conf.Vcc = conf.Vcc; | ||
556 | |||
557 | tuple.DesiredTuple = CISTPL_MANFID; | 539 | tuple.DesiredTuple = CISTPL_MANFID; |
558 | tuple.Attributes = TUPLE_RETURN_COMMON; | 540 | tuple.Attributes = TUPLE_RETURN_COMMON; |
559 | if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) && | 541 | if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && |
560 | (pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS)) { | 542 | (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) { |
561 | manfid = le16_to_cpu(buf[0]); | 543 | manfid = le16_to_cpu(buf[0]); |
562 | prodid = le16_to_cpu(buf[1]); | 544 | prodid = le16_to_cpu(buf[1]); |
563 | } | 545 | } |
564 | 546 | ||
565 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 547 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
566 | tuple.Attributes = 0; | 548 | tuple.Attributes = 0; |
567 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 549 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
568 | while (last_ret == CS_SUCCESS) { | 550 | while (last_ret == CS_SUCCESS) { |
569 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | 551 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); |
570 | cistpl_io_t *io = &(parse.cftable_entry.io); | 552 | cistpl_io_t *io = &(parse.cftable_entry.io); |
571 | 553 | ||
572 | if (pcmcia_get_tuple_data(handle, &tuple) != 0 || | 554 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || |
573 | pcmcia_parse_tuple(handle, &tuple, &parse) != 0 || | 555 | pcmcia_parse_tuple(link, &tuple, &parse) != 0 || |
574 | cfg->index == 0 || cfg->io.nwin == 0) | 556 | cfg->index == 0 || cfg->io.nwin == 0) |
575 | goto next_entry; | 557 | goto next_entry; |
576 | 558 | ||
@@ -594,14 +576,14 @@ static void pcnet_config(dev_link_t *link) | |||
594 | if (last_ret == CS_SUCCESS) break; | 576 | if (last_ret == CS_SUCCESS) break; |
595 | } | 577 | } |
596 | next_entry: | 578 | next_entry: |
597 | last_ret = pcmcia_get_next_tuple(handle, &tuple); | 579 | last_ret = pcmcia_get_next_tuple(link, &tuple); |
598 | } | 580 | } |
599 | if (last_ret != CS_SUCCESS) { | 581 | if (last_ret != CS_SUCCESS) { |
600 | cs_error(handle, RequestIO, last_ret); | 582 | cs_error(link, RequestIO, last_ret); |
601 | goto failed; | 583 | goto failed; |
602 | } | 584 | } |
603 | 585 | ||
604 | CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); | 586 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
605 | 587 | ||
606 | if (link->io.NumPorts2 == 8) { | 588 | if (link->io.NumPorts2 == 8) { |
607 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 589 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
@@ -611,7 +593,7 @@ static void pcnet_config(dev_link_t *link) | |||
611 | (prodid == PRODID_IBM_HOME_AND_AWAY)) | 593 | (prodid == PRODID_IBM_HOME_AND_AWAY)) |
612 | link->conf.ConfigIndex |= 0x10; | 594 | link->conf.ConfigIndex |= 0x10; |
613 | 595 | ||
614 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); | 596 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
615 | dev->irq = link->irq.AssignedIRQ; | 597 | dev->irq = link->irq.AssignedIRQ; |
616 | dev->base_addr = link->io.BasePort1; | 598 | dev->base_addr = link->io.BasePort1; |
617 | if (info->flags & HAS_MISC_REG) { | 599 | if (info->flags & HAS_MISC_REG) { |
@@ -679,9 +661,8 @@ static void pcnet_config(dev_link_t *link) | |||
679 | info->eth_phy = 0; | 661 | info->eth_phy = 0; |
680 | } | 662 | } |
681 | 663 | ||
682 | link->dev = &info->node; | 664 | link->dev_node = &info->node; |
683 | link->state &= ~DEV_CONFIG_PENDING; | 665 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
684 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); | ||
685 | 666 | ||
686 | #ifdef CONFIG_NET_POLL_CONTROLLER | 667 | #ifdef CONFIG_NET_POLL_CONTROLLER |
687 | dev->poll_controller = ei_poll; | 668 | dev->poll_controller = ei_poll; |
@@ -689,7 +670,7 @@ static void pcnet_config(dev_link_t *link) | |||
689 | 670 | ||
690 | if (register_netdev(dev) != 0) { | 671 | if (register_netdev(dev) != 0) { |
691 | printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); | 672 | printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); |
692 | link->dev = NULL; | 673 | link->dev_node = NULL; |
693 | goto failed; | 674 | goto failed; |
694 | } | 675 | } |
695 | 676 | ||
@@ -712,14 +693,13 @@ static void pcnet_config(dev_link_t *link) | |||
712 | printk(" hw_addr "); | 693 | printk(" hw_addr "); |
713 | for (i = 0; i < 6; i++) | 694 | for (i = 0; i < 6; i++) |
714 | printk("%02X%s", dev->dev_addr[i], ((i<5) ? ":" : "\n")); | 695 | printk("%02X%s", dev->dev_addr[i], ((i<5) ? ":" : "\n")); |
715 | return; | 696 | return 0; |
716 | 697 | ||
717 | cs_failed: | 698 | cs_failed: |
718 | cs_error(link->handle, last_fn, last_ret); | 699 | cs_error(link, last_fn, last_ret); |
719 | failed: | 700 | failed: |
720 | pcnet_release(link); | 701 | pcnet_release(link); |
721 | link->state &= ~DEV_CONFIG_PENDING; | 702 | return -ENODEV; |
722 | return; | ||
723 | } /* pcnet_config */ | 703 | } /* pcnet_config */ |
724 | 704 | ||
725 | /*====================================================================== | 705 | /*====================================================================== |
@@ -730,21 +710,16 @@ failed: | |||
730 | 710 | ||
731 | ======================================================================*/ | 711 | ======================================================================*/ |
732 | 712 | ||
733 | static void pcnet_release(dev_link_t *link) | 713 | static void pcnet_release(struct pcmcia_device *link) |
734 | { | 714 | { |
735 | pcnet_dev_t *info = PRIV(link->priv); | 715 | pcnet_dev_t *info = PRIV(link->priv); |
736 | 716 | ||
737 | DEBUG(0, "pcnet_release(0x%p)\n", link); | 717 | DEBUG(0, "pcnet_release(0x%p)\n", link); |
738 | 718 | ||
739 | if (info->flags & USE_SHMEM) { | 719 | if (info->flags & USE_SHMEM) |
740 | iounmap(info->base); | 720 | iounmap(info->base); |
741 | pcmcia_release_window(link->win); | ||
742 | } | ||
743 | pcmcia_release_configuration(link->handle); | ||
744 | pcmcia_release_io(link->handle, &link->io); | ||
745 | pcmcia_release_irq(link->handle, &link->irq); | ||
746 | 721 | ||
747 | link->state &= ~DEV_CONFIG; | 722 | pcmcia_disable_device(link); |
748 | } | 723 | } |
749 | 724 | ||
750 | /*====================================================================== | 725 | /*====================================================================== |
@@ -756,34 +731,24 @@ static void pcnet_release(dev_link_t *link) | |||
756 | 731 | ||
757 | ======================================================================*/ | 732 | ======================================================================*/ |
758 | 733 | ||
759 | static int pcnet_suspend(struct pcmcia_device *p_dev) | 734 | static int pcnet_suspend(struct pcmcia_device *link) |
760 | { | 735 | { |
761 | dev_link_t *link = dev_to_instance(p_dev); | ||
762 | struct net_device *dev = link->priv; | 736 | struct net_device *dev = link->priv; |
763 | 737 | ||
764 | link->state |= DEV_SUSPEND; | 738 | if (link->open) |
765 | if (link->state & DEV_CONFIG) { | 739 | netif_device_detach(dev); |
766 | if (link->open) | ||
767 | netif_device_detach(dev); | ||
768 | pcmcia_release_configuration(link->handle); | ||
769 | } | ||
770 | 740 | ||
771 | return 0; | 741 | return 0; |
772 | } | 742 | } |
773 | 743 | ||
774 | static int pcnet_resume(struct pcmcia_device *p_dev) | 744 | static int pcnet_resume(struct pcmcia_device *link) |
775 | { | 745 | { |
776 | dev_link_t *link = dev_to_instance(p_dev); | ||
777 | struct net_device *dev = link->priv; | 746 | struct net_device *dev = link->priv; |
778 | 747 | ||
779 | link->state &= ~DEV_SUSPEND; | 748 | if (link->open) { |
780 | if (link->state & DEV_CONFIG) { | 749 | pcnet_reset_8390(dev); |
781 | pcmcia_request_configuration(link->handle, &link->conf); | 750 | NS8390_init(dev, 1); |
782 | if (link->open) { | 751 | netif_device_attach(dev); |
783 | pcnet_reset_8390(dev); | ||
784 | NS8390_init(dev, 1); | ||
785 | netif_device_attach(dev); | ||
786 | } | ||
787 | } | 752 | } |
788 | 753 | ||
789 | return 0; | 754 | return 0; |
@@ -1023,11 +988,11 @@ static void mii_phy_probe(struct net_device *dev) | |||
1023 | static int pcnet_open(struct net_device *dev) | 988 | static int pcnet_open(struct net_device *dev) |
1024 | { | 989 | { |
1025 | pcnet_dev_t *info = PRIV(dev); | 990 | pcnet_dev_t *info = PRIV(dev); |
1026 | dev_link_t *link = &info->link; | 991 | struct pcmcia_device *link = info->p_dev; |
1027 | 992 | ||
1028 | DEBUG(2, "pcnet_open('%s')\n", dev->name); | 993 | DEBUG(2, "pcnet_open('%s')\n", dev->name); |
1029 | 994 | ||
1030 | if (!DEV_OK(link)) | 995 | if (!pcmcia_dev_present(link)) |
1031 | return -ENODEV; | 996 | return -ENODEV; |
1032 | 997 | ||
1033 | link->open++; | 998 | link->open++; |
@@ -1051,7 +1016,7 @@ static int pcnet_open(struct net_device *dev) | |||
1051 | static int pcnet_close(struct net_device *dev) | 1016 | static int pcnet_close(struct net_device *dev) |
1052 | { | 1017 | { |
1053 | pcnet_dev_t *info = PRIV(dev); | 1018 | pcnet_dev_t *info = PRIV(dev); |
1054 | dev_link_t *link = &info->link; | 1019 | struct pcmcia_device *link = info->p_dev; |
1055 | 1020 | ||
1056 | DEBUG(2, "pcnet_close('%s')\n", dev->name); | 1021 | DEBUG(2, "pcnet_close('%s')\n", dev->name); |
1057 | 1022 | ||
@@ -1429,7 +1394,7 @@ static void dma_block_output(struct net_device *dev, int count, | |||
1429 | 1394 | ||
1430 | /*====================================================================*/ | 1395 | /*====================================================================*/ |
1431 | 1396 | ||
1432 | static int setup_dma_config(dev_link_t *link, int start_pg, | 1397 | static int setup_dma_config(struct pcmcia_device *link, int start_pg, |
1433 | int stop_pg) | 1398 | int stop_pg) |
1434 | { | 1399 | { |
1435 | struct net_device *dev = link->priv; | 1400 | struct net_device *dev = link->priv; |
@@ -1532,7 +1497,7 @@ static void shmem_block_output(struct net_device *dev, int count, | |||
1532 | 1497 | ||
1533 | /*====================================================================*/ | 1498 | /*====================================================================*/ |
1534 | 1499 | ||
1535 | static int setup_shmem_window(dev_link_t *link, int start_pg, | 1500 | static int setup_shmem_window(struct pcmcia_device *link, int start_pg, |
1536 | int stop_pg, int cm_offset) | 1501 | int stop_pg, int cm_offset) |
1537 | { | 1502 | { |
1538 | struct net_device *dev = link->priv; | 1503 | struct net_device *dev = link->priv; |
@@ -1554,7 +1519,7 @@ static int setup_shmem_window(dev_link_t *link, int start_pg, | |||
1554 | req.Attributes |= WIN_USE_WAIT; | 1519 | req.Attributes |= WIN_USE_WAIT; |
1555 | req.Base = 0; req.Size = window_size; | 1520 | req.Base = 0; req.Size = window_size; |
1556 | req.AccessSpeed = mem_speed; | 1521 | req.AccessSpeed = mem_speed; |
1557 | CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &link->win)); | 1522 | CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); |
1558 | 1523 | ||
1559 | mem.CardOffset = (start_pg << 8) + cm_offset; | 1524 | mem.CardOffset = (start_pg << 8) + cm_offset; |
1560 | offset = mem.CardOffset % window_size; | 1525 | offset = mem.CardOffset % window_size; |
@@ -1595,7 +1560,7 @@ static int setup_shmem_window(dev_link_t *link, int start_pg, | |||
1595 | return 0; | 1560 | return 0; |
1596 | 1561 | ||
1597 | cs_failed: | 1562 | cs_failed: |
1598 | cs_error(link->handle, last_fn, last_ret); | 1563 | cs_error(link, last_fn, last_ret); |
1599 | failed: | 1564 | failed: |
1600 | return 1; | 1565 | return 1; |
1601 | } | 1566 | } |
@@ -1674,6 +1639,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1674 | PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722), | 1639 | PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722), |
1675 | PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2), | 1640 | PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2), |
1676 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd), | 1641 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd), |
1642 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d), | ||
1677 | PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d), | 1643 | PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d), |
1678 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-T", 0x5261440f, 0x6705fcaa), | 1644 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-T", 0x5261440f, 0x6705fcaa), |
1679 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FastEther PCC-TX", 0x5261440f, 0x485e85d9), | 1645 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FastEther PCC-TX", 0x5261440f, 0x485e85d9), |