aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/smc91c92_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/smc91c92_cs.c')
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c71
1 files changed, 33 insertions, 38 deletions
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 307cd1721e91..377367d03b41 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -44,7 +44,6 @@
44#include <linux/jiffies.h> 44#include <linux/jiffies.h>
45#include <linux/firmware.h> 45#include <linux/firmware.h>
46 46
47#include <pcmcia/cs_types.h>
48#include <pcmcia/cs.h> 47#include <pcmcia/cs.h>
49#include <pcmcia/cistpl.h> 48#include <pcmcia/cistpl.h>
50#include <pcmcia/cisreg.h> 49#include <pcmcia/cisreg.h>
@@ -325,9 +324,8 @@ static int smc91c92_probe(struct pcmcia_device *link)
325 link->priv = dev; 324 link->priv = dev;
326 325
327 spin_lock_init(&smc->lock); 326 spin_lock_init(&smc->lock);
328 link->io.NumPorts1 = 16; 327 link->resource[0]->end = 16;
329 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 328 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
330 link->io.IOAddrLines = 4;
331 link->conf.Attributes = CONF_ENABLE_IRQ; 329 link->conf.Attributes = CONF_ENABLE_IRQ;
332 link->conf.IntType = INT_MEMORY_AND_IO; 330 link->conf.IntType = INT_MEMORY_AND_IO;
333 331
@@ -428,12 +426,13 @@ static int mhz_mfc_config_check(struct pcmcia_device *p_dev,
428 void *priv_data) 426 void *priv_data)
429{ 427{
430 int k; 428 int k;
431 p_dev->io.BasePort2 = cf->io.win[0].base; 429 p_dev->resource[1]->start = cf->io.win[0].base;
432 for (k = 0; k < 0x400; k += 0x10) { 430 for (k = 0; k < 0x400; k += 0x10) {
433 if (k & 0x80) 431 if (k & 0x80)
434 continue; 432 continue;
435 p_dev->io.BasePort1 = k ^ 0x300; 433 p_dev->resource[0]->start = k ^ 0x300;
436 if (!pcmcia_request_io(p_dev, &p_dev->io)) 434 p_dev->io_lines = 16;
435 if (!pcmcia_request_io(p_dev))
437 return 0; 436 return 0;
438 } 437 }
439 return -ENODEV; 438 return -ENODEV;
@@ -444,21 +443,20 @@ static int mhz_mfc_config(struct pcmcia_device *link)
444 struct net_device *dev = link->priv; 443 struct net_device *dev = link->priv;
445 struct smc_private *smc = netdev_priv(dev); 444 struct smc_private *smc = netdev_priv(dev);
446 win_req_t req; 445 win_req_t req;
447 memreq_t mem; 446 unsigned int offset;
448 int i; 447 int i;
449 448
450 link->conf.Attributes |= CONF_ENABLE_SPKR; 449 link->conf.Attributes |= CONF_ENABLE_SPKR;
451 link->conf.Status = CCSR_AUDIO_ENA; 450 link->conf.Status = CCSR_AUDIO_ENA;
452 link->io.IOAddrLines = 16; 451 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
453 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 452 link->resource[1]->end = 8;
454 link->io.NumPorts2 = 8;
455 453
456 /* The Megahertz combo cards have modem-like CIS entries, so 454 /* The Megahertz combo cards have modem-like CIS entries, so
457 we have to explicitly try a bunch of port combinations. */ 455 we have to explicitly try a bunch of port combinations. */
458 if (pcmcia_loop_config(link, mhz_mfc_config_check, NULL)) 456 if (pcmcia_loop_config(link, mhz_mfc_config_check, NULL))
459 return -ENODEV; 457 return -ENODEV;
460 458
461 dev->base_addr = link->io.BasePort1; 459 dev->base_addr = link->resource[0]->start;
462 460
463 /* Allocate a memory window, for accessing the ISR */ 461 /* Allocate a memory window, for accessing the ISR */
464 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 462 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
@@ -469,11 +467,8 @@ static int mhz_mfc_config(struct pcmcia_device *link)
469 return -ENODEV; 467 return -ENODEV;
470 468
471 smc->base = ioremap(req.Base, req.Size); 469 smc->base = ioremap(req.Base, req.Size);
472 mem.CardOffset = mem.Page = 0; 470 offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0;
473 if (smc->manfid == MANFID_MOTOROLA) 471 i = pcmcia_map_mem_page(link, link->win, offset);
474 mem.CardOffset = link->conf.ConfigBase;
475 i = pcmcia_map_mem_page(link, link->win, &mem);
476
477 if ((i == 0) && 472 if ((i == 0) &&
478 (smc->manfid == MANFID_MEGAHERTZ) && 473 (smc->manfid == MANFID_MEGAHERTZ) &&
479 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) 474 (smc->cardid == PRODID_MEGAHERTZ_EM3288))
@@ -546,7 +541,7 @@ static void mot_config(struct pcmcia_device *link)
546 struct net_device *dev = link->priv; 541 struct net_device *dev = link->priv;
547 struct smc_private *smc = netdev_priv(dev); 542 struct smc_private *smc = netdev_priv(dev);
548 unsigned int ioaddr = dev->base_addr; 543 unsigned int ioaddr = dev->base_addr;
549 unsigned int iouart = link->io.BasePort2; 544 unsigned int iouart = link->resource[1]->start;
550 545
551 /* Set UART base address and force map with COR bit 1 */ 546 /* Set UART base address and force map with COR bit 1 */
552 writeb(iouart & 0xff, smc->base + MOT_UART + CISREG_IOBASE_0); 547 writeb(iouart & 0xff, smc->base + MOT_UART + CISREG_IOBASE_0);
@@ -602,9 +597,9 @@ static int smc_configcheck(struct pcmcia_device *p_dev,
602 unsigned int vcc, 597 unsigned int vcc,
603 void *priv_data) 598 void *priv_data)
604{ 599{
605 p_dev->io.BasePort1 = cf->io.win[0].base; 600 p_dev->resource[0]->start = cf->io.win[0].base;
606 p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; 601 p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK;
607 return pcmcia_request_io(p_dev, &p_dev->io); 602 return pcmcia_request_io(p_dev);
608} 603}
609 604
610static int smc_config(struct pcmcia_device *link) 605static int smc_config(struct pcmcia_device *link)
@@ -612,10 +607,10 @@ static int smc_config(struct pcmcia_device *link)
612 struct net_device *dev = link->priv; 607 struct net_device *dev = link->priv;
613 int i; 608 int i;
614 609
615 link->io.NumPorts1 = 16; 610 link->resource[0]->end = 16;
616 i = pcmcia_loop_config(link, smc_configcheck, NULL); 611 i = pcmcia_loop_config(link, smc_configcheck, NULL);
617 if (!i) 612 if (!i)
618 dev->base_addr = link->io.BasePort1; 613 dev->base_addr = link->resource[0]->start;
619 614
620 return i; 615 return i;
621} 616}
@@ -647,27 +642,27 @@ static int osi_config(struct pcmcia_device *link)
647 642
648 link->conf.Attributes |= CONF_ENABLE_SPKR; 643 link->conf.Attributes |= CONF_ENABLE_SPKR;
649 link->conf.Status = CCSR_AUDIO_ENA; 644 link->conf.Status = CCSR_AUDIO_ENA;
650 link->io.NumPorts1 = 64; 645 link->resource[0]->end = 64;
651 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 646 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
652 link->io.NumPorts2 = 8; 647 link->resource[1]->end = 8;
653 link->io.IOAddrLines = 16;
654 648
655 /* Enable Hard Decode, LAN, Modem */ 649 /* Enable Hard Decode, LAN, Modem */
656 link->conf.ConfigIndex = 0x23; 650 link->conf.ConfigIndex = 0x23;
651 link->io_lines = 16;
657 652
658 for (i = j = 0; j < 4; j++) { 653 for (i = j = 0; j < 4; j++) {
659 link->io.BasePort2 = com[j]; 654 link->resource[1]->start = com[j];
660 i = pcmcia_request_io(link, &link->io); 655 i = pcmcia_request_io(link);
661 if (i == 0) 656 if (i == 0)
662 break; 657 break;
663 } 658 }
664 if (i != 0) { 659 if (i != 0) {
665 /* Fallback: turn off hard decode */ 660 /* Fallback: turn off hard decode */
666 link->conf.ConfigIndex = 0x03; 661 link->conf.ConfigIndex = 0x03;
667 link->io.NumPorts2 = 0; 662 link->resource[1]->end = 0;
668 i = pcmcia_request_io(link, &link->io); 663 i = pcmcia_request_io(link);
669 } 664 }
670 dev->base_addr = link->io.BasePort1 + 0x10; 665 dev->base_addr = link->resource[0]->start + 0x10;
671 return i; 666 return i;
672} 667}
673 668
@@ -684,7 +679,7 @@ static int osi_load_firmware(struct pcmcia_device *link)
684 679
685 /* Download the Seven of Diamonds firmware */ 680 /* Download the Seven of Diamonds firmware */
686 for (i = 0; i < fw->size; i++) { 681 for (i = 0; i < fw->size; i++) {
687 outb(fw->data[i], link->io.BasePort1 + 2); 682 outb(fw->data[i], link->resource[0]->start + 2);
688 udelay(50); 683 udelay(50);
689 } 684 }
690 release_firmware(fw); 685 release_firmware(fw);
@@ -726,12 +721,12 @@ static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid)
726 return rc; 721 return rc;
727 } else if (manfid == MANFID_OSITECH) { 722 } else if (manfid == MANFID_OSITECH) {
728 /* Make sure both functions are powered up */ 723 /* Make sure both functions are powered up */
729 set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR); 724 set_bits(0x300, link->resource[0]->start + OSITECH_AUI_PWR);
730 /* Now, turn on the interrupt for both card functions */ 725 /* Now, turn on the interrupt for both card functions */
731 set_bits(0x300, link->io.BasePort1 + OSITECH_RESET_ISR); 726 set_bits(0x300, link->resource[0]->start + OSITECH_RESET_ISR);
732 dev_dbg(&link->dev, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n", 727 dev_dbg(&link->dev, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n",
733 inw(link->io.BasePort1 + OSITECH_AUI_PWR), 728 inw(link->resource[0]->start + OSITECH_AUI_PWR),
734 inw(link->io.BasePort1 + OSITECH_RESET_ISR)); 729 inw(link->resource[0]->start + OSITECH_RESET_ISR));
735 } 730 }
736 return 0; 731 return 0;
737} 732}
@@ -804,7 +799,7 @@ static int check_sig(struct pcmcia_device *link)
804 } 799 }
805 800
806 /* Try setting bus width */ 801 /* Try setting bus width */
807 width = (link->io.Attributes1 == IO_DATA_PATH_WIDTH_AUTO); 802 width = (link->resource[0]->flags == IO_DATA_PATH_WIDTH_AUTO);
808 s = inb(ioaddr + CONFIG); 803 s = inb(ioaddr + CONFIG);
809 if (width) 804 if (width)
810 s |= CFG_16BIT; 805 s |= CFG_16BIT;