diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/pcmcia/3c574_cs.c | 14 | ||||
-rw-r--r-- | drivers/net/pcmcia/3c589_cs.c | 14 | ||||
-rw-r--r-- | drivers/net/pcmcia/axnet_cs.c | 48 | ||||
-rw-r--r-- | drivers/net/pcmcia/com20020_cs.c | 22 | ||||
-rw-r--r-- | drivers/net/pcmcia/fmvj18x_cs.c | 48 | ||||
-rw-r--r-- | drivers/net/pcmcia/ibmtr_cs.c | 29 | ||||
-rw-r--r-- | drivers/net/pcmcia/nmclan_cs.c | 32 | ||||
-rw-r--r-- | drivers/net/pcmcia/pcnet_cs.c | 63 | ||||
-rw-r--r-- | drivers/net/pcmcia/smc91c92_cs.c | 71 | ||||
-rw-r--r-- | drivers/net/pcmcia/xirc2ps_cs.c | 60 | ||||
-rw-r--r-- | drivers/net/wireless/airo_cs.c | 74 | ||||
-rw-r--r-- | drivers/net/wireless/atmel_cs.c | 25 | ||||
-rw-r--r-- | drivers/net/wireless/b43/pcmcia.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_cs.c | 136 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/if_cs.c | 16 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/orinoco_cs.c | 30 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/spectrum_cs.c | 62 | ||||
-rw-r--r-- | drivers/net/wireless/ray_cs.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/wl3501_cs.c | 24 |
19 files changed, 311 insertions, 497 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 10ee106a161..c683f77c6f4 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c @@ -87,7 +87,6 @@ earlier 3Com products. #include <linux/bitops.h> #include <linux/mii.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/cisreg.h> @@ -279,8 +278,8 @@ static int tc574_probe(struct pcmcia_device *link) lp->p_dev = link; spin_lock_init(&lp->window_lock); - link->io.NumPorts1 = 32; - link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; + link->resource[0]->end = 32; + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.IntType = INT_MEMORY_AND_IO; link->conf.ConfigIndex = 1; @@ -338,10 +337,11 @@ static int tc574_config(struct pcmcia_device *link) dev_dbg(&link->dev, "3c574_config()\n"); - link->io.IOAddrLines = 16; + link->io_lines = 16; + for (i = j = 0; j < 0x400; j += 0x20) { - link->io.BasePort1 = j ^ 0x300; - i = pcmcia_request_io(link, &link->io); + link->resource[0]->start = j ^ 0x300; + i = pcmcia_request_io(link); if (i == 0) break; } @@ -357,7 +357,7 @@ static int tc574_config(struct pcmcia_device *link) goto failed; dev->irq = link->irq; - dev->base_addr = link->io.BasePort1; + dev->base_addr = link->resource[0]->start; ioaddr = dev->base_addr; diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index ce63c3773b4..61f9cf2100f 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c @@ -41,7 +41,6 @@ #include <linux/bitops.h> #include <linux/jiffies.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/cisreg.h> @@ -214,8 +213,8 @@ static int tc589_probe(struct pcmcia_device *link) lp->p_dev = link; spin_lock_init(&lp->lock); - link->io.NumPorts1 = 16; - link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; + link->resource[0]->end = 16; + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.IntType = INT_MEMORY_AND_IO; @@ -278,12 +277,13 @@ static int tc589_config(struct pcmcia_device *link) "3Com card??\n"); multi = (link->card_id == PRODID_3COM_3C562); + link->io_lines = 16; + /* For the 3c562, the base address must be xx00-xx7f */ - link->io.IOAddrLines = 16; for (i = j = 0; j < 0x400; j += 0x10) { if (multi && (j & 0x80)) continue; - link->io.BasePort1 = j ^ 0x300; - i = pcmcia_request_io(link, &link->io); + link->resource[0]->start = j ^ 0x300; + i = pcmcia_request_io(link); if (i == 0) break; } @@ -299,7 +299,7 @@ static int tc589_config(struct pcmcia_device *link) goto failed; dev->irq = link->irq; - dev->base_addr = link->io.BasePort1; + dev->base_addr = link->resource[0]->start; ioaddr = dev->base_addr; EL3WINDOW(0); diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 33525bf2a3d..5f05ffb240c 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -39,7 +39,6 @@ #include <linux/mii.h> #include "../8390.h" -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/ciscode.h> @@ -260,28 +259,30 @@ static int get_prom(struct pcmcia_device *link) static int try_io_port(struct pcmcia_device *link) { int j, ret; - if (link->io.NumPorts1 == 32) { - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; + link->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + link->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; + if (link->resource[0]->end == 32) { + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; /* for master/slave multifunction cards */ - if (link->io.NumPorts2 > 0) - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; + if (link->resource[1]->end > 0) + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; } else { /* This should be two 16-port windows */ - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; - link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_16; } - if (link->io.BasePort1 == 0) { - link->io.IOAddrLines = 16; + if (link->resource[0]->start == 0) { for (j = 0; j < 0x400; j += 0x20) { - link->io.BasePort1 = j ^ 0x300; - link->io.BasePort2 = (j ^ 0x300) + 0x10; - ret = pcmcia_request_io(link, &link->io); + link->resource[0]->start = j ^ 0x300; + link->resource[1]->start = (j ^ 0x300) + 0x10; + link->io_lines = 16; + ret = pcmcia_request_io(link); if (ret == 0) return ret; } return ret; } else { - return pcmcia_request_io(link, &link->io); + return pcmcia_request_io(link); } } @@ -302,15 +303,15 @@ static int axnet_configcheck(struct pcmcia_device *p_dev, network function with window 0, and serial with window 1 */ if (io->nwin > 1) { i = (io->win[1].len > io->win[0].len); - p_dev->io.BasePort2 = io->win[1-i].base; - p_dev->io.NumPorts2 = io->win[1-i].len; + p_dev->resource[1]->start = io->win[1-i].base; + p_dev->resource[1]->end = io->win[1-i].len; } else { - i = p_dev->io.NumPorts2 = 0; + i = p_dev->resource[1]->end = 0; } - p_dev->io.BasePort1 = io->win[i].base; - p_dev->io.NumPorts1 = io->win[i].len; - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; - if (p_dev->io.NumPorts1 + p_dev->io.NumPorts2 >= 32) + p_dev->resource[0]->start = io->win[i].base; + p_dev->resource[0]->end = io->win[i].len; + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; + if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) return try_io_port(p_dev); return -ENODEV; @@ -333,7 +334,7 @@ static int axnet_config(struct pcmcia_device *link) if (!link->irq) goto failed; - if (link->io.NumPorts2 == 8) { + if (resource_size(link->resource[1]) == 8) { link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Status = CCSR_AUDIO_ENA; } @@ -343,7 +344,7 @@ static int axnet_config(struct pcmcia_device *link) goto failed; dev->irq = link->irq; - dev->base_addr = link->io.BasePort1; + dev->base_addr = link->resource[0]->start; if (!get_prom(link)) { printk(KERN_NOTICE "axnet_cs: this is not an AX88190 card!\n"); @@ -379,8 +380,7 @@ static int axnet_config(struct pcmcia_device *link) /* Maybe PHY is in power down mode. (PPD_SET = 1) Bit 2 of CCSR is active low. */ if (i == 32) { - conf_reg_t reg = { 0, CS_WRITE, CISREG_CCSR, 0x04 }; - pcmcia_access_configuration_register(link, ®); + pcmcia_write_config_byte(link, CISREG_CCSR, 0x04); for (i = 0; i < 32; i++) { j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1); j2 = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 2); diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index 5643f94541b..3c400cfa82a 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c @@ -43,7 +43,6 @@ #include <linux/arcdevice.h> #include <linux/com20020.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/ds.h> @@ -159,9 +158,8 @@ static int com20020_probe(struct pcmcia_device *p_dev) /* fill in our module parameters as defaults */ dev->dev_addr[0] = node; - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; - p_dev->io.NumPorts1 = 16; - p_dev->io.IOAddrLines = 16; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + p_dev->resource[0]->end = 16; p_dev->conf.Attributes = CONF_ENABLE_IRQ; p_dev->conf.IntType = INT_MEMORY_AND_IO; @@ -246,20 +244,24 @@ static int com20020_config(struct pcmcia_device *link) dev_dbg(&link->dev, "com20020_config\n"); - dev_dbg(&link->dev, "baseport1 is %Xh\n", link->io.BasePort1); + dev_dbg(&link->dev, "baseport1 is %Xh\n", + (unsigned int) link->resource[0]->start); + i = -ENODEV; - if (!link->io.BasePort1) + link->io_lines = 16; + + if (!link->resource[0]->start) { for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10) { - link->io.BasePort1 = ioaddr; - i = pcmcia_request_io(link, &link->io); + link->resource[0]->start = ioaddr; + i = pcmcia_request_io(link); if (i == 0) break; } } else - i = pcmcia_request_io(link, &link->io); + i = pcmcia_request_io(link); if (i != 0) { @@ -267,7 +269,7 @@ static int com20020_config(struct pcmcia_device *link) goto failed; } - ioaddr = dev->base_addr = link->io.BasePort1; + ioaddr = dev->base_addr = link->resource[0]->start; dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr); dev_dbg(&link->dev, "request IRQ %d\n", diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 7c27c50211a..98fffb03ecd 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c @@ -49,7 +49,6 @@ #include <linux/ioport.h> #include <linux/crc32.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/ciscode.h> @@ -249,9 +248,8 @@ static int fmvj18x_probe(struct pcmcia_device *link) lp->base = NULL; /* The io structure describes IO port mapping */ - link->io.NumPorts1 = 32; - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; - link->io.IOAddrLines = 5; + link->resource[0]->end = 32; + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; /* General socket configuration */ link->conf.Attributes = CONF_ENABLE_IRQ; @@ -289,13 +287,13 @@ static int mfc_try_io_port(struct pcmcia_device *link) { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; for (i = 0; i < 5; i++) { - link->io.BasePort2 = serial_base[i]; - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; - if (link->io.BasePort2 == 0) { - link->io.NumPorts2 = 0; + link->resource[1]->start = serial_base[i]; + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; + if (link->resource[1]->start == 0) { + link->resource[1]->end = 0; printk(KERN_NOTICE "fmvj18x_cs: out of resource for serial\n"); } - ret = pcmcia_request_io(link, &link->io); + ret = pcmcia_request_io(link); if (ret == 0) return ret; } @@ -311,12 +309,12 @@ static int ungermann_try_io_port(struct pcmcia_device *link) 0x380,0x3c0 only for ioport. */ for (ioaddr = 0x300; ioaddr < 0x3e0; ioaddr += 0x20) { - link->io.BasePort1 = ioaddr; - ret = pcmcia_request_io(link, &link->io); + link->resource[0]->start = ioaddr; + ret = pcmcia_request_io(link); if (ret == 0) { /* calculate ConfigIndex value */ link->conf.ConfigIndex = - ((link->io.BasePort1 & 0x0f0) >> 3) | 0x22; + ((link->resource[0]->start & 0x0f0) >> 3) | 0x22; return ret; } } @@ -346,6 +344,8 @@ static int fmvj18x_config(struct pcmcia_device *link) dev_dbg(&link->dev, "fmvj18x_config\n"); + link->io_lines = 5; + len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf); kfree(buf); @@ -364,20 +364,20 @@ static int fmvj18x_config(struct pcmcia_device *link) /* MultiFunction Card */ link->conf.ConfigBase = 0x800; link->conf.ConfigIndex = 0x47; - link->io.NumPorts2 = 8; + link->resource[1]->end = 8; } break; case MANFID_NEC: cardtype = NEC; /* MultiFunction Card */ link->conf.ConfigBase = 0x800; link->conf.ConfigIndex = 0x47; - link->io.NumPorts2 = 8; + link->resource[1]->end = 8; break; case MANFID_KME: cardtype = KME; /* MultiFunction Card */ link->conf.ConfigBase = 0x800; link->conf.ConfigIndex = 0x47; - link->io.NumPorts2 = 8; + link->resource[1]->end = 8; break; case MANFID_CONTEC: cardtype = CONTEC; @@ -418,14 +418,14 @@ static int fmvj18x_config(struct pcmcia_device *link) } } - if (link->io.NumPorts2 != 0) { + if (link->resource[1]->end != 0) { ret = mfc_try_io_port(link); if (ret != 0) goto failed; } else if (cardtype == UNGERMANN) { ret = ungermann_try_io_port(link); if (ret != 0) goto failed; } else { - ret = pcmcia_request_io(link, &link->io); + ret = pcmcia_request_io(link); if (ret) goto failed; } @@ -437,9 +437,9 @@ static int fmvj18x_config(struct pcmcia_device *link) goto failed; dev->irq = link->irq; - dev->base_addr = link->io.BasePort1; + dev->base_addr = link->resource[0]->start; - if (link->io.BasePort2 != 0) { + if (resource_size(link->resource[1]) != 0) { ret = fmvj18x_setup_mfc(link); if (ret != 0) goto failed; } @@ -545,7 +545,6 @@ failed: static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) { win_req_t req; - memreq_t mem; u_char __iomem *base; int i, j; @@ -558,9 +557,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) return -1; base = ioremap(req.Base, req.Size); - mem.Page = 0; - mem.CardOffset = 0; - pcmcia_map_mem_page(link, link->win, &mem); + pcmcia_map_mem_page(link, link->win, 0); /* * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format @@ -594,7 +591,6 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) static int fmvj18x_setup_mfc(struct pcmcia_device *link) { win_req_t req; - memreq_t mem; int i; struct net_device *dev = link->priv; unsigned int ioaddr; @@ -614,9 +610,7 @@ static int fmvj18x_setup_mfc(struct pcmcia_device *link) return -1; } - mem.Page = 0; - mem.CardOffset = 0; - i = pcmcia_map_mem_page(link, link->win, &mem); + i = pcmcia_map_mem_page(link, link->win, 0); if (i != 0) { iounmap(lp->base); lp->base = NULL; diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index 67ee9851a8e..b0d06a3d962 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c @@ -57,7 +57,6 @@ #include <linux/trdevice.h> #include <linux/ibmtr.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/ds.h> @@ -152,9 +151,8 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) link->priv = info; info->ti = netdev_priv(dev); - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; - link->io.NumPorts1 = 4; - link->io.IOAddrLines = 16; + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + link->resource[0]->end = 4; link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.IntType = INT_MEMORY_AND_IO; link->conf.Present = PRESENT_OPTION; @@ -213,26 +211,26 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) struct net_device *dev = info->dev; struct tok_info *ti = netdev_priv(dev); win_req_t req; - memreq_t mem; int i, ret; dev_dbg(&link->dev, "ibmtr_config\n"); link->conf.ConfigIndex = 0x61; + link->io_lines = 16; /* Determine if this is PRIMARY or ALTERNATE. */ /* Try PRIMARY card at 0xA20-0xA23 */ - link->io.BasePort1 = 0xA20; - i = pcmcia_request_io(link, &link->io); + link->resource[0]->start = 0xA20; + i = pcmcia_request_io(link); if (i != 0) { /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ - link->io.BasePort1 = 0xA24; - ret = pcmcia_request_io(link, &link->io); + link->resource[0]->start = 0xA24; + ret = pcmcia_request_io(link); if (ret) goto failed; } - dev->base_addr = link->io.BasePort1; + dev->base_addr = link->resource[0]->start; ret = pcmcia_request_exclusive_irq(link, ibmtr_interrupt); if (ret) @@ -251,9 +249,7 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) if (ret) goto failed; - mem.CardOffset = mmiobase; - mem.Page = 0; - ret = pcmcia_map_mem_page(link, link->win, &mem); + ret = pcmcia_map_mem_page(link, link->win, mmiobase); if (ret) goto failed; ti->mmio = ioremap(req.Base, req.Size); @@ -268,13 +264,11 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) if (ret) goto failed; - mem.CardOffset = srambase; - mem.Page = 0; - ret = pcmcia_map_mem_page(link, info->sram_win_handle, &mem); + ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase); if (ret) goto failed; - ti->sram_base = mem.CardOffset >> 12; + ti->sram_base = srambase >> 12; ti->sram_virt = ioremap(req.Base, req.Size); ti->sram_phys = req.Base; @@ -325,7 +319,6 @@ static void ibmtr_release(struct pcmcia_device *link) if (link->win) { struct tok_info *ti = netdev_priv(dev); iounmap(ti->mmio); - pcmcia_release_window(link, info->sram_win_handle); } pcmcia_disable_device(link); } diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 9b63dec549c..68f2deeb3ad 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c @@ -146,7 +146,6 @@ Include Files #include <linux/ioport.h> #include <linux/bitops.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cisreg.h> #include <pcmcia/cistpl.h> @@ -459,9 +458,8 @@ static int nmclan_probe(struct pcmcia_device *link) link->priv = dev; spin_lock_init(&lp->bank_lock); - link->io.NumPorts1 = 32; - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; - link->io.IOAddrLines = 5; + link->resource[0]->end = 32; + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.IntType = INT_MEMORY_AND_IO; link->conf.ConfigIndex = 1; @@ -645,7 +643,8 @@ static int nmclan_config(struct pcmcia_device *link) dev_dbg(&link->dev, "nmclan_config\n"); - ret = pcmcia_request_io(link, &link->io); + link->io_lines = 5; + ret = pcmcia_request_io(link); if (ret) goto failed; ret = pcmcia_request_exclusive_irq(link, mace_interrupt); @@ -656,7 +655,7 @@ static int nmclan_config(struct pcmcia_device *link) goto failed; dev->irq = link->irq; - dev->base_addr = link->io.BasePort1; + dev->base_addr = link->resource[0]->start; ioaddr = dev->base_addr; @@ -758,29 +757,20 @@ static void nmclan_reset(struct net_device *dev) #if RESET_XILINX struct pcmcia_device *link = &lp->link; - conf_reg_t reg; - u_long OrigCorValue; + u8 OrigCorValue; /* Save original COR value */ - reg.Function = 0; - reg.Action = CS_READ; - reg.Offset = CISREG_COR; - reg.Value = 0; - pcmcia_access_configuration_register(link, ®); - OrigCorValue = reg.Value; + pcmcia_read_config_byte(link, CISREG_COR, &OrigCorValue); /* Reset Xilinx */ - reg.Action = CS_WRITE; - reg.Offset = CISREG_COR; - dev_dbg(&link->dev, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n", + dev_dbg(&link->dev, "nmclan_reset: OrigCorValue=0x%x, resetting...\n", OrigCorValue); - reg.Value = COR_SOFT_RESET; - pcmcia_access_configuration_register(link, ®); + pcmcia_write_config_byte(link, CISREG_COR, COR_SOFT_RESET); /* Need to wait for 20 ms for PCMCIA to finish reset. */ /* Restore original COR configuration index */ - reg.Value = COR_LEVEL_REQ | (OrigCorValue & COR_CONFIG_MASK); - pcmcia_access_configuration_register(link, ®); + pcmcia_write_config_byte(link, CISREG_COR, + (COR_LEVEL_REQ | (OrigCorValue & COR_CONFIG_MASK))); /* Xilinx is now completely reset along with the MACE chip. */ lp->tx_free_frames=AM2150_MAX_TX_FRAMES; diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index bfdef72c5d5..c3edfe4c265 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -42,7 +42,6 @@ #include <linux/mii.h> #include "../8390.h" -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/ciscode.h> @@ -113,8 +112,6 @@ static int setup_dma_config(struct pcmcia_device *link, int start_pg, static void pcnet_detach(struct pcmcia_device *p_dev); -static dev_info_t dev_info = "pcnet_cs"; - /*====================================================================*/ typedef struct hw_info_t { @@ -304,7 +301,6 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) { struct net_device *dev = link->priv; win_req_t req; - memreq_t mem; u_char __iomem *base, *virt; int i, j; @@ -317,10 +313,8 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) return NULL; virt = ioremap(req.Base, req.Size); - mem.Page = 0; for (i = 0; i < NR_INFO; i++) { - mem.CardOffset = hw_info[i].offset & ~(req.Size-1); - pcmcia_map_mem_page(link, link->win, &mem); + pcmcia_map_mem_page(link, link->win, hw_info[i].offset & ~(req.Size-1)); base = &virt[hw_info[i].offset & (req.Size-1)]; if ((readb(base+0) == hw_info[i].a0) && (readb(base+2) == hw_info[i].a1) && @@ -480,29 +474,31 @@ static hw_info_t *get_hwired(struct pcmcia_device *link) static int try_io_port(struct pcmcia_device *link) { int j, ret; - if (link->io.NumPorts1 == 32) { - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; - if (link->io.NumPorts2 > 0) { + link->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + link->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; + if (link->resource[0]->end == 32) { + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; + if (link->resource[1]->end > 0) { /* for master/slave multifunction cards */ - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; } } else { /* This should be two 16-port windows */ - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; - link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_16; } - if (link->io.BasePort1 == 0) { - link->io.IOAddrLines = 16; + if (link->resource[0]->start == 0) { for (j = 0; j < 0x400; j += 0x20) { - link->io.BasePort1 = j ^ 0x300; - link->io.BasePort2 = (j ^ 0x300) + 0x10; - ret = pcmcia_request_io(link, &link->io); + link->resource[0]->start = j ^ 0x300; + link->resource[1]->start = (j ^ 0x300) + 0x10; + link->io_lines = 16; + ret = pcmcia_request_io(link); if (ret == 0) return ret; } return ret; } else { - return pcmcia_request_io(link, &link->io); + return pcmcia_request_io(link); } } @@ -523,18 +519,18 @@ static int pcnet_confcheck(struct pcmcia_device *p_dev, network function with window 0, and serial with window 1 */ if (io->nwin > 1) { i = (io->win[1].len > io->win[0].len); - p_dev->io.BasePort2 = io->win[1-i].base; - p_dev->io.NumPorts2 = io->win[1-i].len; + p_dev->resource[1]->start = io->win[1-i].base; + p_dev->resource[1]->end = io->win[1-i].len; } else { - i = p_dev->io.NumPorts2 = 0; + i = p_dev->resource[1]->end = 0; } *has_shmem = ((cfg->mem.nwin == 1) && (cfg->mem.win[0].len >= 0x4000)); - p_dev->io.BasePort1 = io->win[i].base; - p_dev->io.NumPorts1 = io->win[i].len; - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; - if (p_dev->io.NumPorts1 + p_dev->io.NumPorts2 >= 32) + p_dev->resource[0]->start = io->win[i].base; + p_dev->resource[0]->end = io->win[i].len; + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; + if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) return try_io_port(p_dev); return 0; @@ -557,7 +553,7 @@ static int pcnet_config(struct pcmcia_device *link) if (!link->irq) goto failed; - if (link->io.NumPorts2 == 8) { + if (resource_size(link->resource[1]) == 8) { link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Status = CCSR_AUDIO_ENA; } @@ -569,7 +565,7 @@ static int pcnet_config(struct pcmcia_device *link) if (ret) goto failed; dev->irq = link->irq; - dev->base_addr = link->io.BasePort1; + dev->base_addr = link->resource[0]->start; if (info->flags & HAS_MISC_REG) { if ((if_port == 1) || (if_port == 2)) dev->if_port = if_port; @@ -956,7 +952,7 @@ static int pcnet_open(struct net_device *dev) set_misc_reg(dev); outb_p(0xFF, nic_base + EN0_ISR); /* Clear bogus intr. */ - ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev); + ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev->name, dev); if (ret) return ret; @@ -1464,7 +1460,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, struct net_device *dev = link->priv; pcnet_dev_t *info = PRIV(dev); win_req_t req; - memreq_t mem; int i, window_size, offset, ret; window_size = (stop_pg - start_pg) << 8; @@ -1483,11 +1478,9 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, if (ret) goto failed; - mem.CardOffset = (start_pg << 8) + cm_offset; - offset = mem.CardOffset % window_size; - mem.CardOffset -= offset; - mem.Page = 0; - ret = pcmcia_map_mem_page(link, link->win, &mem); + offset = (start_pg << 8) + cm_offset; + offset -= offset % window_size; + ret = pcmcia_map_mem_page(link, link->win, offset); if (ret) goto failed; diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 307cd1721e9..377367d03b4 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -44,7 +44,6 @@ #include <linux/jiffies.h> #include <linux/firmware.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/cisreg.h> @@ -325,9 +324,8 @@ static int smc91c92_probe(struct pcmcia_device *link) link->priv = dev; spin_lock_init(&smc->lock); - link->io.NumPorts1 = 16; - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; - link->io.IOAddrLines = 4; + link->resource[0]->end = 16; + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.IntType = INT_MEMORY_AND_IO; @@ -428,12 +426,13 @@ static int mhz_mfc_config_check(struct pcmcia_device *p_dev, void *priv_data) { int k; - p_dev->io.BasePort2 = cf->io.win[0].base; + p_dev->resource[1]->start = cf->io.win[0].base; for (k = 0; k < 0x400; k += 0x10) { if (k & 0x80) continue; - p_dev->io.BasePort1 = k ^ 0x300; - if (!pcmcia_request_io(p_dev, &p_dev->io)) + p_dev->resource[0]->start = k ^ 0x300; + p_dev->io_lines = 16; + if (!pcmcia_request_io(p_dev)) return 0; } return -ENODEV; @@ -444,21 +443,20 @@ static int mhz_mfc_config(struct pcmcia_device *link) struct net_device *dev = link->priv; struct smc_private *smc = netdev_priv(dev); win_req_t req; - memreq_t mem; + unsigned int offset; int i; link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Status = CCSR_AUDIO_ENA; - link->io.IOAddrLines = 16; - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; - link->io.NumPorts2 = 8; + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; + link->resource[1]->end = 8; /* The Megahertz combo cards have modem-like CIS entries, so we have to explicitly try a bunch of port combinations. */ if (pcmcia_loop_config(link, mhz_mfc_config_check, NULL)) return -ENODEV; - dev->base_addr = link->io.BasePort1; + dev->base_addr = link->resource[0]->start; /* Allocate a memory window, for accessing the ISR */ 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) return -ENODEV; smc->base = ioremap(req.Base, req.Size); - mem.CardOffset = mem.Page = 0; - if (smc->manfid == MANFID_MOTOROLA) - mem.CardOffset = link->conf.ConfigBase; - i = pcmcia_map_mem_page(link, link->win, &mem); - + offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0; + i = pcmcia_map_mem_page(link, link->win, offset); if ((i == 0) && (smc->manfid == MANFID_MEGAHERTZ) && (smc->cardid == PRODID_MEGAHERTZ_EM3288)) @@ -546,7 +541,7 @@ static void mot_config(struct pcmcia_device *link) struct net_device *dev = link->priv; struct smc_private *smc = netdev_priv(dev); unsigned int ioaddr = dev->base_addr; - unsigned int iouart = link->io.BasePort2; + unsigned int iouart = link->resource[1]->start; /* Set UART base address and force map with COR bit 1 */ writeb(iouart & 0xff, smc->base + MOT_UART + CISREG_IOBASE_0); @@ -602,9 +597,9 @@ static int smc_configcheck(struct pcmcia_device *p_dev, unsigned int vcc, void *priv_data) { - p_dev->io.BasePort1 = cf->io.win[0].base; - p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; - return pcmcia_request_io(p_dev, &p_dev->io); + p_dev->resource[0]->start = cf->io.win[0].base; + p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; + return pcmcia_request_io(p_dev); } static int smc_config(struct pcmcia_device *link) @@ -612,10 +607,10 @@ static int smc_config(struct pcmcia_device *link) struct net_device *dev = link->priv; int i; - link->io.NumPorts1 = 16; + link->resource[0]->end = 16; i = pcmcia_loop_config(link, smc_configcheck, NULL); if (!i) - dev->base_addr = link->io.BasePort1; + dev->base_addr = link->resource[0]->start; return i; } @@ -647,27 +642,27 @@ static int osi_config(struct pcmcia_device *link) link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Status = CCSR_AUDIO_ENA; - link->io.NumPorts1 = 64; - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; - link->io.NumPorts2 = 8; - link->io.IOAddrLines = 16; + link->resource[0]->end = 64; + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; + link->resource[1]->end = 8; /* Enable Hard Decode, LAN, Modem */ link->conf.ConfigIndex = 0x23; + link->io_lines = 16; for (i = j = 0; j < 4; j++) { - link->io.BasePort2 = com[j]; - i = pcmcia_request_io(link, &link->io); + link->resource[1]->start = com[j]; + i = pcmcia_request_io(link); if (i == 0) break; } if (i != 0) { /* Fallback: turn off hard decode */ link->conf.ConfigIndex = 0x03; - link->io.NumPorts2 = 0; - i = pcmcia_request_io(link, &link->io); + link->resource[1]->end = 0; + i = pcmcia_request_io(link); } - dev->base_addr = link->io.BasePort1 + 0x10; + dev->base_addr = link->resource[0]->start + 0x10; return i; } @@ -684,7 +679,7 @@ static int osi_load_firmware(struct pcmcia_device *link) /* Download the Seven of Diamonds firmware */ for (i = 0; i < fw->size; i++) { - outb(fw->data[i], link->io.BasePort1 + 2); + outb(fw->data[i], link->resource[0]->start + 2); udelay(50); } release_firmware(fw); @@ -726,12 +721,12 @@ static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid) return rc; } else if (manfid == MANFID_OSITECH) { /* Make sure both functions are powered up */ - set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR); + set_bits(0x300, link->resource[0]->start + OSITECH_AUI_PWR); /* Now, turn on the interrupt for both card functions */ - set_bits(0x300, link->io.BasePort1 + OSITECH_RESET_ISR); + set_bits(0x300, link->resource[0]->start + OSITECH_RESET_ISR); dev_dbg(&link->dev, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n", - inw(link->io.BasePort1 + OSITECH_AUI_PWR), - inw(link->io.BasePort1 + OSITECH_RESET_ISR)); + inw(link->resource[0]->start + OSITECH_AUI_PWR), + inw(link->resource[0]->start + OSITECH_RESET_ISR)); } return 0; } @@ -804,7 +799,7 @@ static int check_sig(struct pcmcia_device *link) } /* Try setting bus width */ - width = (link->io.Attributes1 == IO_DATA_PATH_WIDTH_AUTO); + width = (link->resource[0]->flags == IO_DATA_PATH_WIDTH_AUTO); s = inb(ioaddr + CONFIG); if (width) s |= CFG_16BIT; diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index b6c3644888c..4eb6f986703 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -82,7 +82,6 @@ #include <linux/bitops.h> #include <linux/mii.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/cisreg.h> @@ -678,9 +677,9 @@ xirc2ps_config_modem(struct pcmcia_device *p_dev, if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { - p_dev->io.BasePort2 = cf->io.win[0].base; - p_dev->io.BasePort1 = ioaddr; - if (!pcmcia_request_io(p_dev, &p_dev->io)) + p_dev->resource[1]->start = cf->io.win[0].base; + p_dev->resource[0]->start = ioaddr; + if (!pcmcia_request_io(p_dev)) return 0; } } @@ -697,11 +696,11 @@ xirc2ps_config_check(struct pcmcia_device *p_dev, int *pass = priv_data; if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { - p_dev->io.BasePort2 = cf->io.win[0].base; - p_dev->io.BasePort1 = p_dev->io.BasePort2 + p_dev->resource[1]->start = cf->io.win[0].base; + p_dev->resource[0]->start = p_dev->resource[1]->start + (*pass ? (cf->index & 0x20 ? -24:8) : (cf->index & 0x20 ? 8:-24)); - if (!pcmcia_request_io(p_dev, &p_dev->io)) + if (!pcmcia_request_io(p_dev)) return 0; } return -ENODEV; @@ -808,8 +807,7 @@ xirc2ps_config(struct pcmcia_device * link) goto failure; } - link->io.IOAddrLines =10; - link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; if (local->modem) { int pass; @@ -817,16 +815,16 @@ xirc2ps_config(struct pcmcia_device * link) link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Status |= CCSR_AUDIO_ENA; } - link->io.NumPorts2 = 8; - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; + link->resource[1]->end = 8; + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; if (local->dingo) { /* Take the Modem IO port from the CIS and scan for a free * Ethernet port */ - link->io.NumPorts1 = 16; /* no Mako stuff anymore */ + link->resource[0]->end = 16; /* no Mako stuff anymore */ if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) goto port_found; } else { - link->io.NumPorts1 = 18; + link->resource[0]->end = 18; /* We do 2 passes here: The first one uses the regular mapping and * the second tries again, thereby considering that the 32 ports are * mirrored every 32 bytes. Actually we use a mirrored port for @@ -841,14 +839,15 @@ xirc2ps_config(struct pcmcia_device * link) } printk(KNOT_XIRC "no ports available\n"); } else { - link->io.NumPorts1 = 16; + link->io_lines = 10; + link->resource[0]->end = 16; for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { - link->io.BasePort1 = ioaddr; - if (!(err=pcmcia_request_io(link, &link->io))) + link->resource[0]->start = ioaddr; + if (!(err = pcmcia_request_io(link))) goto port_found; } - link->io.BasePort1 = 0; /* let CS decide */ - if ((err=pcmcia_request_io(link, &link->io))) + link->resource[0]->start = 0; /* let CS decide */ + if ((err = pcmcia_request_io(link))) goto config_error; } port_found: @@ -870,24 +869,21 @@ xirc2ps_config(struct pcmcia_device * link) goto config_error; if (local->dingo) { - conf_reg_t reg; win_req_t req; - memreq_t mem; /* Reset the modem's BAR to the correct value * This is necessary because in the RequestConfiguration call, * the base address of the ethernet port (BasePort1) is written * to the BAR registers of the modem. */ - reg.Action = CS_WRITE; - reg.Offset = CISREG_IOBASE_0; - reg.Value = link->io.BasePort2 & 0xff; - if ((err = pcmcia_access_configuration_register(link, ®))) + err = pcmcia_write_config_byte(link, CISREG_IOBASE_0, (u8) + link->resource[1]->start & 0xff); + if (err) goto config_error; - reg.Action = CS_WRITE; - reg.Offset = CISREG_IOBASE_1; - reg.Value = (link->io.BasePort2 >> 8) & 0xff; - if ((err = pcmcia_access_configuration_register(link, ®))) + + err = pcmcia_write_config_byte(link, CISREG_IOBASE_1, + (link->resource[1]->start >> 8) & 0xff); + if (err) goto config_error; /* There is no config entry for the Ethernet part which @@ -901,16 +897,14 @@ xirc2ps_config(struct pcmcia_device * link) goto config_error; local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; - mem.CardOffset = 0x0; - mem.Page = 0; - if ((err = pcmcia_map_mem_page(link, link->win, &mem))) + if ((err = pcmcia_map_mem_page(link, link->win, 0))) goto config_error; /* Setup the CCRs; there are no infos in the CIS about the Ethernet * part. */ writeb(0x47, local->dingo_ccr + CISREG_COR); - ioaddr = link->io.BasePort1; + ioaddr = link->resource[0]->start; writeb(ioaddr & 0xff , local->dingo_ccr + CISREG_IOBASE_0); writeb((ioaddr >> 8)&0xff , local->dingo_ccr + CISREG_IOBASE_1); @@ -957,7 +951,7 @@ xirc2ps_config(struct pcmcia_device * link) /* we can now register the device with the net subsystem */ dev->irq = link->irq; - dev->base_addr = link->io.BasePort1; + dev->base_addr = link->resource[0]->start; if (local->dingo) do_reset(dev, 1); /* a kludge to make the cem56 work */ diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 33bdc6a84e8..9a121a5b787 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -32,7 +32,6 @@ #include <linux/timer.h> #include <linux/netdevice.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/cisreg.h> @@ -155,8 +154,6 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, unsigned int vcc, void *priv_data) { - win_req_t *req = priv_data; - if (cfg->index == 0) return -ENODEV; @@ -176,52 +173,25 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, p_dev->conf.Attributes |= CONF_ENABLE_IRQ; /* IO window settings */ - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; - if (!(io->flags & CISTPL_IO_8BIT)) - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; - if (!(io->flags & CISTPL_IO_16BIT)) - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; - p_dev->io.BasePort1 = io->win[0].base; - p_dev->io.NumPorts1 = io->win[0].len; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= + pcmcia_io_cfg_data_width(io->flags); + p_dev->resource[0]->start = io->win[0].base; + p_dev->resource[0]->end = io->win[0].len; if (io->nwin > 1) { - p_dev->io.Attributes2 = p_dev->io.Attributes1; - p_dev->io.BasePort2 = io->win[1].base; - p_dev->io.NumPorts2 = io->win[1].len; + p_dev->resource[1]->flags = p_dev->resource[0]->flags; + p_dev->resource[1]->start = io->win[1].base; + p_dev->resource[1]->end = io->win[1].len; } } /* This reserves IO space but doesn't actually enable it */ - if (pcmcia_request_io(p_dev, &p_dev->io) != 0) + if (pcmcia_request_io(p_dev) != 0) return -ENODEV; - /* - Now set up a common memory window, if needed. There is room - in the struct pcmcia_device structure for one memory window handle, - but if the base addresses need to be saved, or if multiple - windows are needed, the info should go in the private data - structure for this device. - - Note that the memory window base is a physical address, and - needs to be mapped to virtual space with ioremap() before it - is used. - */ - if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { - cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; - memreq_t map; - req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; - req->Base = mem->win[0].host_addr; - req->Size = mem->win[0].len; - req->AccessSpeed = 0; - if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0) - return -ENODEV; - map.Page = 0; - map.CardOffset = mem->win[0].card_addr; - if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0) - return -ENODEV; - } /* If we got this far, we're cool! */ return 0; } @@ -230,17 +200,12 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, static int airo_config(struct pcmcia_device *link) { local_info_t *dev; - win_req_t *req; int ret; dev = link->priv; dev_dbg(&link->dev, "airo_config\n"); - req = kzalloc(sizeof(win_req_t), GFP_KERNEL); - if (!req) - return -ENOMEM; - /* * In this loop, we scan the CIS for configuration table * entries, each of which describes a valid card @@ -255,7 +220,7 @@ static int airo_config(struct pcmcia_device *link) * and most client drivers will only use the CIS to fill in * implementation-defined details. */ - ret = pcmcia_loop_config(link, airo_cs_config_check, req); + ret = pcmcia_loop_config(link, airo_cs_config_check, NULL); if (ret) goto failed; @@ -272,7 +237,7 @@ static int airo_config(struct pcmcia_device *link) goto failed; ((local_info_t *)link->priv)->eth_dev = init_airo_card(link->irq, - link->io.BasePort1, 1, &link->dev); + link->resource[0]->start, 1, &link->dev); if (!((local_info_t *)link->priv)->eth_dev) goto failed; @@ -282,22 +247,15 @@ static int airo_config(struct pcmcia_device *link) if (link->conf.Vpp) printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); printk(", irq %d", link->irq); - if (link->io.NumPorts1) - printk(", io 0x%04x-0x%04x", link->io.BasePort1, - link->io.BasePort1+link->io.NumPorts1-1); - if (link->io.NumPorts2) - printk(" & 0x%04x-0x%04x", link->io.BasePort2, - link->io.BasePort2+link->io.NumPorts2-1); - if (link->win) - printk(", mem 0x%06lx-0x%06lx", req->Base, - req->Base+req->Size-1); + if (link->resource[0]) + printk(" & %pR", link->resource[0]); + if (link->resource[1]) + printk(" & %pR", link->resource[1]); printk("\n"); - kfree(req); return 0; failed: airo_release(link); - kfree(req); return -ENODEV; } /* airo_config */ diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index c2746fc7f2b..3b632161c10 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -42,7 +42,6 @@ #include <linux/moduleparam.h> #include <linux/device.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/cisreg.h> @@ -191,25 +190,23 @@ static int atmel_config_check(struct pcmcia_device *p_dev, p_dev->conf.Attributes |= CONF_ENABLE_IRQ; /* IO window settings */ - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; - if (!(io->flags & CISTPL_IO_8BIT)) - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; - if (!(io->flags & CISTPL_IO_16BIT)) - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; - p_dev->io.BasePort1 = io->win[0].base; - p_dev->io.NumPorts1 = io->win[0].len; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= + pcmcia_io_cfg_data_width(io->flags); + p_dev->resource[0]->start = io->win[0].base; + p_dev->resource[0]->end = io->win[0].len; if (io->nwin > 1) { - p_dev->io.Attributes2 = p_dev->io.Attributes1; - p_dev->io.BasePort2 = io->win[1].base; - p_dev->io.NumPorts2 = io->win[1].len; + p_dev->resource[1]->flags = p_dev->resource[0]->flags; + p_dev->resource[1]->start = io->win[1].base; + p_dev->resource[1]->end = io->win[1].len; } } /* This reserves IO space but doesn't actually enable it */ - return pcmcia_request_io(p_dev, &p_dev->io); + return pcmcia_request_io(p_dev); } static int atmel_config(struct pcmcia_device *link) @@ -254,7 +251,7 @@ static int atmel_config(struct pcmcia_device *link) ((local_info_t*)link->priv)->eth_dev = init_atmel_card(link->irq, - link->io.BasePort1, + link->resource[0]->start, did ? did->driver_info : ATMEL_FW_TYPE_NONE, &link->dev, card_present, diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index 0e99b634267..dfbc41d431f 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c @@ -26,7 +26,6 @@ #include <linux/ssb/ssb.h> #include <linux/slab.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/ciscode.h> @@ -65,7 +64,6 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) { struct ssb_bus *ssb; win_req_t win; - memreq_t mem; int err = -ENOMEM; int res = 0; @@ -78,12 +76,7 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) dev->conf.Attributes = CONF_ENABLE_IRQ; dev->conf.IntType = INT_MEMORY_AND_IO; - dev->io.BasePort2 = 0; - dev->io.NumPorts2 = 0; - dev->io.Attributes2 = 0; - - win.Attributes = WIN_ADDR_SPACE_MEM | WIN_MEMORY_TYPE_CM | - WIN_ENABLE | WIN_DATA_WIDTH_16 | + win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 | WIN_USE_WAIT; win.Base = 0; win.Size = SSB_CORE_SIZE; @@ -92,9 +85,7 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) if (res != 0) goto err_kfree_ssb; - mem.CardOffset = 0; - mem.Page = 0; - res = pcmcia_map_mem_page(dev, dev->win, &mem); + res = pcmcia_map_mem_page(dev, dev->win, 0); if (res != 0) goto err_disable; diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 29b31a694b5..ba54d1b04d2 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -12,7 +12,6 @@ #include <linux/wireless.h> #include <net/iw_handler.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/cisreg.h> @@ -23,7 +22,7 @@ #include "hostap_wlan.h" -static dev_info_t dev_info = "hostap_cs"; +static char *dev_info = "hostap_cs"; MODULE_AUTHOR("Jouni Malinen"); MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " @@ -225,27 +224,18 @@ static int prism2_pccard_card_present(local_info_t *local) static void sandisk_set_iobase(local_info_t *local) { int res; - conf_reg_t reg; struct hostap_cs_priv *hw_priv = local->hw_priv; - reg.Function = 0; - reg.Action = CS_WRITE; - reg.Offset = 0x10; /* 0x3f0 IO base 1 */ - reg.Value = hw_priv->link->io.BasePort1 & 0x00ff; - res = pcmcia_access_configuration_register(hw_priv->link, - ®); + res = pcmcia_write_config_byte(hw_priv->link, 0x10, + hw_priv->link->resource[0]->start & 0x00ff); if (res != 0) { printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" " res=%d\n", res); } udelay(10); - reg.Function = 0; - reg.Action = CS_WRITE; - reg.Offset = 0x12; /* 0x3f2 IO base 2 */ - reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8; - res = pcmcia_access_configuration_register(hw_priv->link, - ®); + res = pcmcia_write_config_byte(hw_priv->link, 0x12, + (hw_priv->link->resource[0]->start >> 8) & 0x00ff); if (res != 0) { printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" " res=%d\n", res); @@ -271,12 +261,11 @@ static void sandisk_write_hcr(local_info_t *local, int hcr) static int sandisk_enable_wireless(struct net_device *dev) { int res, ret = 0; - conf_reg_t reg; struct hostap_interface *iface = netdev_priv(dev); local_info_t *local = iface->local; struct hostap_cs_priv *hw_priv = local->hw_priv; - if (hw_priv->link->io.NumPorts1 < 0x42) { + if (resource_size(hw_priv->link->resource[0]) < 0x42) { /* Not enough ports to be SanDisk multi-function card */ ret = -ENODEV; goto done; @@ -298,12 +287,8 @@ static int sandisk_enable_wireless(struct net_device *dev) " - using vendor-specific initialization\n", dev->name); hw_priv->sandisk_connectplus = 1; - reg.Function = 0; - reg.Action = CS_WRITE; - reg.Offset = CISREG_COR; - reg.Value = COR_SOFT_RESET; - res = pcmcia_access_configuration_register(hw_priv->link, - ®); + res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, + COR_SOFT_RESET); if (res != 0) { printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", dev->name, res); @@ -311,16 +296,13 @@ static int sandisk_enable_wireless(struct net_device *dev) } mdelay(5); - reg.Function = 0; - reg.Action = CS_WRITE; - reg.Offset = CISREG_COR; /* * Do not enable interrupts here to avoid some bogus events. Interrupts * will be enabled during the first cor_sreset call. */ - reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA; - res = pcmcia_access_configuration_register(hw_priv->link, - ®); + res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, + (COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | + COR_FUNC_ENA)); if (res != 0) { printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", dev->name, res); @@ -343,30 +325,23 @@ done: static void prism2_pccard_cor_sreset(local_info_t *local) { int res; - conf_reg_t reg; + u8 val; struct hostap_cs_priv *hw_priv = local->hw_priv; if (!prism2_pccard_card_present(local)) return; - reg.Function = 0; - reg.Action = CS_READ; - reg.Offset = CISREG_COR; - reg.Value = 0; - res = pcmcia_access_configuration_register(hw_priv->link, - ®); + res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &val); if (res != 0) { printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", res); return; } printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n", - reg.Value); + val); - reg.Action = CS_WRITE; - reg.Value |= COR_SOFT_RESET; - res = pcmcia_access_configuration_register(hw_priv->link, - ®); + val |= COR_SOFT_RESET; + res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val); if (res != 0) { printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", res); @@ -375,11 +350,10 @@ static void prism2_pccard_cor_sreset(local_info_t *local) mdelay(hw_priv->sandisk_connectplus ? 5 : 2); - reg.Value &= ~COR_SOFT_RESET; + val &= ~COR_SOFT_RESET; if (hw_priv->sandisk_connectplus) - reg.Value |= COR_IREQ_ENA; - res = pcmcia_access_configuration_register(hw_priv->link, - ®); + val |= COR_IREQ_ENA; + res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val); if (res != 0) { printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", res); @@ -396,8 +370,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local) static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) { int res; - conf_reg_t reg; - int old_cor; + u8 old_cor; struct hostap_cs_priv *hw_priv = local->hw_priv; if (!prism2_pccard_card_present(local)) @@ -408,25 +381,17 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) return; } - reg.Function = 0; - reg.Action = CS_READ; - reg.Offset = CISREG_COR; - reg.Value = 0; - res = pcmcia_access_configuration_register(hw_priv->link, - ®); + res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &old_cor); if (res != 0) { printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " "(%d)\n", res); return; } printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n", - reg.Value); - old_cor = reg.Value; + old_cor); - reg.Action = CS_WRITE; - reg.Value |= COR_SOFT_RESET; - res = pcmcia_access_configuration_register(hw_priv->link, - ®); + res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, + old_cor | COR_SOFT_RESET); if (res != 0) { printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " "(%d)\n", res); @@ -436,11 +401,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) mdelay(10); /* Setup Genesis mode */ - reg.Action = CS_WRITE; - reg.Value = hcr; - reg.Offset = CISREG_CCSR; - res = pcmcia_access_configuration_register(hw_priv->link, - ®); + res = pcmcia_write_config_byte(hw_priv->link, CISREG_CCSR, hcr); if (res != 0) { printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " "(%d)\n", res); @@ -448,11 +409,8 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) } mdelay(10); - reg.Action = CS_WRITE; - reg.Offset = CISREG_COR; - reg.Value = old_cor & ~COR_SOFT_RESET; - res = pcmcia_access_configuration_register(hw_priv->link, - ®); + res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, + old_cor & ~COR_SOFT_RESET); if (res != 0) { printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " "(%d)\n", res); @@ -561,30 +519,24 @@ static int prism2_config_check(struct pcmcia_device *p_dev, PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " "dflt->io.nwin=%d\n", cfg->io.nwin, dflt->io.nwin); - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; - PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, " - "io.base=0x%04x, len=%d\n", io->flags, - io->win[0].base, io->win[0].len); - if (!(io->flags & CISTPL_IO_8BIT)) - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; - if (!(io->flags & CISTPL_IO_16BIT)) - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; - p_dev->io.IOAddrLines = io->flags & - CISTPL_IO_LINES_MASK; - p_dev->io.BasePort1 = io->win[0].base; - p_dev->io.NumPorts1 = io->win[0].len; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= + pcmcia_io_cfg_data_width(io->flags); + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; + p_dev->resource[0]->start = io->win[0].base; + p_dev->resource[0]->end = io->win[0].len; if (io->nwin > 1) { - p_dev->io.Attributes2 = p_dev->io.Attributes1; - p_dev->io.BasePort2 = io->win[1].base; - p_dev->io.NumPorts2 = io->win[1].len; + p_dev->resource[1]->flags = p_dev->resource[0]->flags; + p_dev->resource[1]->start = io->win[1].base; + p_dev->resource[1]->end = io->win[1].len; } } /* This reserves IO space but doesn't actually enable it */ - return pcmcia_request_io(p_dev, &p_dev->io); + return pcmcia_request_io(p_dev); } static int prism2_config(struct pcmcia_device *link) @@ -646,7 +598,7 @@ static int prism2_config(struct pcmcia_device *link) goto failed_unlock; dev->irq = link->irq; - dev->base_addr = link->io.BasePort1; + dev->base_addr = link->resource[0]->start; spin_unlock_irqrestore(&local->irq_init_lock, flags); @@ -658,12 +610,10 @@ static int prism2_config(struct pcmcia_device *link) link->conf.Vpp % 10); if (link->conf.Attributes & CONF_ENABLE_IRQ) printk(", irq %d", link->irq); - if (link->io.NumPorts1) - printk(", io 0x%04x-0x%04x", link->io.BasePort1, - link->io.BasePort1+link->io.NumPorts1-1); - if (link->io.NumPorts2) - printk(" & 0x%04x-0x%04x", link->io.BasePort2, - link->io.BasePort2+link->io.NumPorts2-1); + if (link->resource[0]) + printk(" & %pR", link->resource[0]); + if (link->resource[1]) + printk(" & %pR", link->resource[1]); printk("\n"); local->shutdown = 0; diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 08e4e390800..9c298396be5 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -28,7 +28,6 @@ #include <linux/firmware.h> #include <linux/netdevice.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/ds.h> @@ -802,9 +801,9 @@ static int if_cs_ioprobe(struct pcmcia_device *p_dev, unsigned int vcc, void *priv_data) { - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; - p_dev->io.BasePort1 = cfg->io.win[0].base; - p_dev->io.NumPorts1 = cfg->io.win[0].len; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; + p_dev->resource[0]->start = cfg->io.win[0].base; + p_dev->resource[0]->end = cfg->io.win[0].len; /* Do we need to allocate an interrupt? */ p_dev->conf.Attributes |= CONF_ENABLE_IRQ; @@ -816,7 +815,7 @@ static int if_cs_ioprobe(struct pcmcia_device *p_dev, } /* This reserves IO space but doesn't actually enable it */ - return pcmcia_request_io(p_dev, &p_dev->io); + return pcmcia_request_io(p_dev); } static int if_cs_probe(struct pcmcia_device *p_dev) @@ -854,7 +853,8 @@ static int if_cs_probe(struct pcmcia_device *p_dev) goto out1; /* Initialize io access */ - card->iobase = ioport_map(p_dev->io.BasePort1, p_dev->io.NumPorts1); + card->iobase = ioport_map(p_dev->resource[0]->start, + resource_size(p_dev->resource[0])); if (!card->iobase) { lbs_pr_err("error in ioport_map\n"); ret = -EIO; @@ -873,9 +873,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev) } /* Finally, report what we've done */ - lbs_deb_cs("irq %d, io 0x%04x-0x%04x\n", - p_dev->irq, p_dev->io.BasePort1, - p_dev->io.BasePort1 + p_dev->io.NumPorts1 - 1); + lbs_deb_cs("irq %d, io %pR", p_dev->irq, p_dev->resource[0]); /* * Most of the libertas cards can do unaligned register access, but some diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index b16d5db52a4..ef46a2d8853 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c @@ -17,7 +17,6 @@ #include <linux/kernel.h> #include <linux/init.h> #include <linux/delay.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/cisreg.h> @@ -192,25 +191,23 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev, p_dev->conf.Attributes |= CONF_ENABLE_IRQ; /* IO window settings */ - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; - if (!(io->flags & CISTPL_IO_8BIT)) - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; - if (!(io->flags & CISTPL_IO_16BIT)) - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; - p_dev->io.BasePort1 = io->win[0].base; - p_dev->io.NumPorts1 = io->win[0].len; + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= + pcmcia_io_cfg_data_width(io->flags); + p_dev->resource[0]->start = io->win[0].base; + p_dev->resource[0]->end = io->win[0].len; if (io->nwin > 1) { - p_dev->io.Attributes2 = p_dev->io.Attributes1; - p_dev->io.BasePort2 = io->win[1].base; - p_dev->io.NumPorts2 = io->win[1].len; + p_dev->resource[1]->flags = p_dev->resource[0]->flags; + p_dev->resource[1]->start = io->win[1].base; + p_dev->resource[1]->end = io->win[1].len; } /* This reserves IO space but doesn't actually enable it */ - if (pcmcia_request_io(p_dev, &p_dev->io) != 0) + if (pcmcia_request_io(p_dev) != 0) goto next_entry; } return 0; @@ -258,7 +255,8 @@ orinoco_cs_config(struct pcmcia_device *link) /* We initialize the hermes structure before completing PCMCIA * configuration just in case the interrupt handler gets * called. */ - mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); + mem = ioport_map(link->resource[0]->start, + resource_size(link->resource[0])); if (!mem) goto failed; @@ -280,7 +278,7 @@ orinoco_cs_config(struct pcmcia_device *link) } /* Register an interface with the stack */ - if (orinoco_if_add(priv, link->io.BasePort1, + if (orinoco_if_add(priv, link->resource[0]->start, link->irq, NULL) != 0) { printk(KERN_ERR PFX "orinoco_if_add() failed\n"); goto failed; diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index b51a9adc80f..873877e17e1 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c @@ -25,7 +25,6 @@ #include <linux/kernel.h> #include <linux/init.h> #include <linux/delay.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/cisreg.h> @@ -80,35 +79,27 @@ static int spectrum_reset(struct pcmcia_device *link, int idle) { int ret; - conf_reg_t reg; - u_int save_cor; + u8 save_cor; + u8 ccsr; /* Doing it if hardware is gone is guaranteed crash */ if (!pcmcia_dev_present(link)) return -ENODEV; /* Save original COR value */ - reg.Function = 0; - reg.Action = CS_READ; - reg.Offset = CISREG_COR; - ret = pcmcia_access_configuration_register(link, ®); + ret = pcmcia_read_config_byte(link, CISREG_COR, &save_cor); if (ret) goto failed; - save_cor = reg.Value; /* Soft-Reset card */ - reg.Action = CS_WRITE; - reg.Offset = CISREG_COR; - reg.Value = (save_cor | COR_SOFT_RESET); - ret = pcmcia_access_configuration_register(link, ®); + ret = pcmcia_write_config_byte(link, CISREG_COR, + (save_cor | COR_SOFT_RESET)); if (ret) goto failed; udelay(1000); /* Read CCSR */ - reg.Action = CS_READ; - reg.Offset = CISREG_CCSR; - ret = pcmcia_access_configuration_register(link, ®); + ret = pcmcia_read_config_byte(link, CISREG_CCSR, &ccsr); if (ret) goto failed; @@ -116,19 +107,15 @@ spectrum_reset(struct pcmcia_device *link, int idle) * Start or stop the firmware. Memory width bit should be * preserved from the value we've just read. */ - reg.Action = CS_WRITE; - reg.Offset = CISREG_CCSR; - reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16); - ret = pcmcia_access_configuration_register(link, ®); + ccsr = (idle ? HCR_IDLE : HCR_RUN) | (ccsr & HCR_MEM16); + ret = pcmcia_write_config_byte(link, CISREG_CCSR, ccsr); if (ret) goto failed; udelay(1000); /* Restore original COR configuration index */ - reg.Action = CS_WRITE; - reg.Offset = CISREG_COR; - reg.Value = (save_cor & ~COR_SOFT_RESET); - ret = pcmcia_access_configuration_register(link, ®); + ret = pcmcia_write_config_byte(link, CISREG_COR, + (save_cor & ~COR_SOFT_RESET)); if (ret) goto failed; udelay(1000); @@ -266,25 +253,23 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev, p_dev->conf.Attributes |= CONF_ENABLE_IRQ; /* IO window settings */ - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; - if (!(io->flags & CISTPL_IO_8BIT)) - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; - if (!(io->flags & CISTPL_IO_16BIT)) - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; - p_dev->io.BasePort1 = io->win[0].base; - p_dev->io.NumPorts1 = io->win[0].len; + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= + pcmcia_io_cfg_data_width(io->flags); + p_dev->resource[0]->start = io->win[0].base; + p_dev->resource[0]->end = io->win[0].len; if (io->nwin > 1) { - p_dev->io.Attributes2 = p_dev->io.Attributes1; - p_dev->io.BasePort2 = io->win[1].base; - p_dev->io.NumPorts2 = io->win[1].len; + p_dev->resource[1]->flags = p_dev->resource[0]->flags; + p_dev->resource[1]->start = io->win[1].base; + p_dev->resource[1]->end = io->win[1].len; } /* This reserves IO space but doesn't actually enable it */ - if (pcmcia_request_io(p_dev, &p_dev->io) != 0) + if (pcmcia_request_io(p_dev) != 0) goto next_entry; } return 0; @@ -332,7 +317,8 @@ spectrum_cs_config(struct pcmcia_device *link) /* We initialize the hermes structure before completing PCMCIA * configuration just in case the interrupt handler gets * called. */ - mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); + mem = ioport_map(link->resource[0]->start, + resource_size(link->resource[0])); if (!mem) goto failed; @@ -359,7 +345,7 @@ spectrum_cs_config(struct pcmcia_device *link) } /* Register an interface with the stack */ - if (orinoco_if_add(priv, link->io.BasePort1, + if (orinoco_if_add(priv, link->resource[0]->start, link->irq, NULL) != 0) { printk(KERN_ERR PFX "orinoco_if_add() failed\n"); goto failed; diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 9c38fc331dc..88560d0ae50 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -46,7 +46,6 @@ #include <linux/ethtool.h> #include <linux/ieee80211.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/cisreg.h> @@ -315,9 +314,8 @@ static int ray_probe(struct pcmcia_device *p_dev) local->finder = p_dev; /* The io structure describes IO port mapping. None used here */ - p_dev->io.NumPorts1 = 0; - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; - p_dev->io.IOAddrLines = 5; + p_dev->resource[0]->end = 0; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; /* General socket configuration */ p_dev->conf.Attributes = CONF_ENABLE_IRQ; @@ -394,7 +392,6 @@ static int ray_config(struct pcmcia_device *link) int ret = 0; int i; win_req_t req; - memreq_t mem; struct net_device *dev = (struct net_device *)link->priv; ray_dev_t *local = netdev_priv(dev); @@ -431,9 +428,7 @@ static int ray_config(struct pcmcia_device *link) ret = pcmcia_request_window(link, &req, &link->win); if (ret) goto failed; - mem.CardOffset = 0x0000; - mem.Page = 0; - ret = pcmcia_map_mem_page(link, link->win, &mem); + ret = pcmcia_map_mem_page(link, link->win, 0); if (ret) goto failed; local->sram = ioremap(req.Base, req.Size); @@ -447,9 +442,7 @@ static int ray_config(struct pcmcia_device *link) ret = pcmcia_request_window(link, &req, &local->rmem_handle); if (ret) goto failed; - mem.CardOffset = 0x8000; - mem.Page = 0; - ret = pcmcia_map_mem_page(link, local->rmem_handle, &mem); + ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000); if (ret) goto failed; local->rmem = ioremap(req.Base, req.Size); @@ -463,9 +456,7 @@ static int ray_config(struct pcmcia_device *link) ret = pcmcia_request_window(link, &req, &local->amem_handle); if (ret) goto failed; - mem.CardOffset = 0x0000; - mem.Page = 0; - ret = pcmcia_map_mem_page(link, local->amem_handle, &mem); + ret = pcmcia_map_mem_page(link, local->amem_handle, 0); if (ret) goto failed; local->amem = ioremap(req.Base, req.Size); @@ -793,7 +784,6 @@ static void ray_release(struct pcmcia_device *link) { struct net_device *dev = link->priv; ray_dev_t *local = netdev_priv(dev); - int i; dev_dbg(&link->dev, "ray_release\n"); @@ -802,13 +792,6 @@ static void ray_release(struct pcmcia_device *link) iounmap(local->sram); iounmap(local->rmem); iounmap(local->amem); - /* Do bother checking to see if these succeed or not */ - i = pcmcia_release_window(link, local->amem_handle); - if (i != 0) - dev_dbg(&link->dev, "ReleaseWindow(local->amem) ret = %x\n", i); - i = pcmcia_release_window(link, local->rmem_handle); - if (i != 0) - dev_dbg(&link->dev, "ReleaseWindow(local->rmem) ret = %x\n", i); pcmcia_disable_device(link); dev_dbg(&link->dev, "ray_release ending\n"); diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 376c6b964a9..a1cc2d498a1 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c @@ -48,7 +48,6 @@ #include <net/iw_handler.h> -#include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/cisreg.h> @@ -89,13 +88,6 @@ static int wl3501_config(struct pcmcia_device *link); static void wl3501_release(struct pcmcia_device *link); -/* - * The dev_info variable is the "key" that is used to match up this - * device driver with appropriate cards, through the card configuration - * database. - */ -static dev_info_t wl3501_dev_info = "wl3501_cs"; - static const struct { int reg_domain; int min, max, deflt; @@ -1421,7 +1413,7 @@ static struct iw_statistics *wl3501_get_wireless_stats(struct net_device *dev) static void wl3501_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - strlcpy(info->driver, wl3501_dev_info, sizeof(info->driver)); + strlcpy(info->driver, "wl3501_cs", sizeof(info->driver)); } static const struct ethtool_ops ops = { @@ -1892,9 +1884,8 @@ static int wl3501_probe(struct pcmcia_device *p_dev) struct wl3501_card *this; /* The io structure describes IO port mapping */ - p_dev->io.NumPorts1 = 16; - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; - p_dev->io.IOAddrLines = 5; + p_dev->resource[0]->end = 16; + p_dev->resource[0]->flags = IO_DATA_PATH_WIDTH_8; /* General socket configuration */ p_dev->conf.Attributes = CONF_ENABLE_IRQ; @@ -1940,13 +1931,14 @@ static int wl3501_config(struct pcmcia_device *link) /* Try allocating IO ports. This tries a few fixed addresses. If you * want, you can also read the card's config table to pick addresses -- * see the serial driver for an example. */ + link->io_lines = 5; for (j = 0x280; j < 0x400; j += 0x20) { /* The '^0x300' is so that we probe 0x300-0x3ff first, then * 0x200-0x2ff, and so on, because this seems safer */ - link->io.BasePort1 = j; - link->io.BasePort2 = link->io.BasePort1 + 0x10; - i = pcmcia_request_io(link, &link->io); + link->resource[0]->start = j; + link->resource[1]->start = link->resource[0]->start + 0x10; + i = pcmcia_request_io(link); if (i == 0) break; } @@ -1968,7 +1960,7 @@ static int wl3501_config(struct pcmcia_device *link) goto failed; dev->irq = link->irq; - dev->base_addr = link->io.BasePort1; + dev->base_addr = link->resource[0]->start; SET_NETDEV_DEV(dev, &link->dev); if (register_netdev(dev)) { printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); |