Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (22 commits)
pcmcia: synclink_cs: fix information leak to userland
pcmcia: don't call flush_scheduled_work() spuriously
serial_cs: drop spurious flush_scheduled_work() call
pcmcia/yenta: guide users in case of problems with O2-bridges
pcmcia: fix unused function compile warning
pcmcia: vrc4173_cardu: Fix error path for pci_release_regions and pci_disable_device
pcmcia: add a few debug statements
pcmcia: remove obsolete and wrong comments
pcmcia: avoid messages on module (un)loading
pcmcia: move driver name to struct pcmcia_driver
pcmcia: remove the "Finally, report what we've done" message
pcmcia: use autoconfiguration feature for ioports and iomem
pcmcia: introduce autoconfiguration feature
pcmcia: Documentation update
pcmcia: convert pcmcia_request_configuration to pcmcia_enable_device
pcmcia: move config_{base,index,regs} to struct pcmcia_device
pcmcia: simplify IntType
pcmcia: simplify Status, ExtStatus register access
pcmcia: remove Pin, Copy configuration register access
pcmcia: move Vpp setup to struct pcmcia_device
...

+1325 -4133
+25
Documentation/pcmcia/driver-changes.txt
··· 1 1 This file details changes in 2.6 which affect PCMCIA card driver authors: 2 + * pcmcia_loop_config() and autoconfiguration (as of 2.6.36) 3 + If struct pcmcia_device *p_dev->config_flags is set accordingly, 4 + pcmcia_loop_config() now sets up certain configuration values 5 + automatically, though the driver may still override the settings 6 + in the callback function. The following autoconfiguration options 7 + are provided at the moment: 8 + CONF_AUTO_CHECK_VCC : check for matching Vcc 9 + CONF_AUTO_SET_VPP : set Vpp 10 + CONF_AUTO_AUDIO : auto-enable audio line, if required 11 + CONF_AUTO_SET_IO : set ioport resources (->resource[0,1]) 12 + CONF_AUTO_SET_IOMEM : set first iomem resource (->resource[2]) 13 + 14 + * pcmcia_request_configuration -> pcmcia_enable_device (as of 2.6.36) 15 + pcmcia_request_configuration() got renamed to pcmcia_enable_device(), 16 + as it mirrors pcmcia_disable_device(). Configuration settings are now 17 + stored in struct pcmcia_device, e.g. in the fields config_flags, 18 + config_index, config_base, vpp. 19 + 20 + * pcmcia_request_window changes (as of 2.6.36) 21 + Instead of win_req_t, drivers are now requested to fill out 22 + struct pcmcia_device *p_dev->resource[2,3,4,5] for up to four ioport 23 + ranges. After a call to pcmcia_request_window(), the regions found there 24 + are reserved and may be used immediately -- until pcmcia_release_window() 25 + is called. 26 + 2 27 * pcmcia_request_io changes (as of 2.6.36) 3 28 Instead of io_req_t, drivers are now requested to fill out 4 29 struct pcmcia_device *p_dev->resource[0,1] for up to two ioport
+26 -76
drivers/ata/pata_pcmcia.c
··· 34 34 #include <linux/ata.h> 35 35 #include <linux/libata.h> 36 36 37 - #include <pcmcia/cs.h> 38 37 #include <pcmcia/cistpl.h> 39 38 #include <pcmcia/ds.h> 40 39 #include <pcmcia/cisreg.h> ··· 167 168 }; 168 169 169 170 170 - struct pcmcia_config_check { 171 - unsigned long ctl_base; 172 - int skip_vcc; 173 - int is_kme; 174 - }; 175 - 176 - static int pcmcia_check_one_config(struct pcmcia_device *pdev, 177 - cistpl_cftable_entry_t *cfg, 178 - cistpl_cftable_entry_t *dflt, 179 - unsigned int vcc, 180 - void *priv_data) 171 + static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data) 181 172 { 182 - struct pcmcia_config_check *stk = priv_data; 173 + int *is_kme = priv_data; 183 174 184 - /* Check for matching Vcc, unless we're desperate */ 185 - if (!stk->skip_vcc) { 186 - if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { 187 - if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) 188 - return -ENODEV; 189 - } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { 190 - if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) 191 - return -ENODEV; 192 - } 175 + if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) { 176 + pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 177 + pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 193 178 } 179 + pdev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; 180 + pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 194 181 195 - if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 196 - pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 197 - else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) 198 - pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; 199 - 200 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 201 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 202 - pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 203 - pdev->resource[0]->start = io->win[0].base; 204 - if (!(io->flags & CISTPL_IO_16BIT)) { 205 - pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 206 - pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 207 - } 208 - if (io->nwin == 2) { 209 - pdev->resource[0]->end = 8; 210 - pdev->resource[1]->start = io->win[1].base; 211 - pdev->resource[1]->end = (stk->is_kme) ? 2 : 1; 212 - if (pcmcia_request_io(pdev) != 0) 213 - return -ENODEV; 214 - stk->ctl_base = pdev->resource[1]->start; 215 - } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { 216 - pdev->resource[0]->end = io->win[0].len; 217 - pdev->resource[1]->end = 0; 218 - if (pcmcia_request_io(pdev) != 0) 219 - return -ENODEV; 220 - stk->ctl_base = pdev->resource[0]->start + 0x0e; 221 - } else 182 + if (pdev->resource[1]->end) { 183 + pdev->resource[0]->end = 8; 184 + pdev->resource[1]->end = (*is_kme) ? 2 : 1; 185 + } else { 186 + if (pdev->resource[0]->end < 16) 222 187 return -ENODEV; 223 - /* If we've got this far, we're done */ 224 - return 0; 225 188 } 226 - return -ENODEV; 189 + 190 + return pcmcia_request_io(pdev); 227 191 } 228 192 229 193 /** ··· 201 239 { 202 240 struct ata_host *host; 203 241 struct ata_port *ap; 204 - struct pcmcia_config_check *stk = NULL; 205 242 int is_kme = 0, ret = -ENOMEM, p; 206 243 unsigned long io_base, ctl_base; 207 244 void __iomem *io_addr, *ctl_addr; ··· 208 247 struct ata_port_operations *ops = &pcmcia_port_ops; 209 248 210 249 /* Set up attributes in order to probe card and get resources */ 211 - pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 212 - pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 213 - pdev->conf.Attributes = CONF_ENABLE_IRQ; 214 - pdev->conf.IntType = INT_MEMORY_AND_IO; 250 + pdev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO | 251 + CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; 215 252 216 253 /* See if we have a manufacturer identifier. Use it to set is_kme for 217 254 vendor quirks */ ··· 217 258 ((pdev->card_id == PRODID_KME_KXLC005_A) || 218 259 (pdev->card_id == PRODID_KME_KXLC005_B))); 219 260 220 - /* Allocate resoure probing structures */ 221 - 222 - stk = kzalloc(sizeof(*stk), GFP_KERNEL); 223 - if (!stk) 224 - goto out1; 225 - stk->is_kme = is_kme; 226 - stk->skip_vcc = io_base = ctl_base = 0; 227 - 228 - if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) { 229 - stk->skip_vcc = 1; 230 - if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) 261 + if (pcmcia_loop_config(pdev, pcmcia_check_one_config, &is_kme)) { 262 + pdev->config_flags &= ~CONF_AUTO_CHECK_VCC; 263 + if (pcmcia_loop_config(pdev, pcmcia_check_one_config, &is_kme)) 231 264 goto failed; /* No suitable config found */ 232 265 } 233 266 io_base = pdev->resource[0]->start; 234 - ctl_base = stk->ctl_base; 267 + if (pdev->resource[1]->end) 268 + ctl_base = pdev->resource[1]->start; 269 + else 270 + ctl_base = pdev->resource[0]->start + 0x0e; 271 + 235 272 if (!pdev->irq) 236 273 goto failed; 237 274 238 - ret = pcmcia_request_configuration(pdev, &pdev->conf); 275 + ret = pcmcia_enable_device(pdev); 239 276 if (ret) 240 277 goto failed; 241 278 ··· 284 329 goto failed; 285 330 286 331 pdev->priv = host; 287 - kfree(stk); 288 332 return 0; 289 333 290 334 failed: 291 - kfree(stk); 292 335 pcmcia_disable_device(pdev); 293 - out1: 294 336 return ret; 295 337 } 296 338 ··· 382 430 383 431 static struct pcmcia_driver pcmcia_driver = { 384 432 .owner = THIS_MODULE, 385 - .drv = { 386 - .name = DRV_NAME, 387 - }, 433 + .name = DRV_NAME, 388 434 .id_table = pcmcia_devices, 389 435 .probe = pcmcia_init_one, 390 436 .remove = pcmcia_remove_one,
+4 -8
drivers/bluetooth/bluecard_cs.c
··· 39 39 #include <linux/skbuff.h> 40 40 #include <linux/io.h> 41 41 42 - #include <pcmcia/cs.h> 43 42 #include <pcmcia/cistpl.h> 44 43 #include <pcmcia/ciscode.h> 45 44 #include <pcmcia/ds.h> ··· 864 865 info->p_dev = link; 865 866 link->priv = info; 866 867 867 - link->conf.Attributes = CONF_ENABLE_IRQ; 868 - link->conf.IntType = INT_MEMORY_AND_IO; 868 + link->config_flags |= CONF_ENABLE_IRQ; 869 869 870 870 return bluecard_config(link); 871 871 } ··· 884 886 bluecard_info_t *info = link->priv; 885 887 int i, n; 886 888 887 - link->conf.ConfigIndex = 0x20; 889 + link->config_index = 0x20; 888 890 889 891 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 890 892 link->resource[0]->end = 64; ··· 904 906 if (i != 0) 905 907 goto failed; 906 908 907 - i = pcmcia_request_configuration(link, &link->conf); 909 + i = pcmcia_enable_device(link); 908 910 if (i != 0) 909 911 goto failed; 910 912 ··· 940 942 941 943 static struct pcmcia_driver bluecard_driver = { 942 944 .owner = THIS_MODULE, 943 - .drv = { 944 - .name = "bluecard_cs", 945 - }, 945 + .name = "bluecard_cs", 946 946 .probe = bluecard_probe, 947 947 .remove = bluecard_detach, 948 948 .id_table = bluecard_ids,
+28 -36
drivers/bluetooth/bt3c_cs.c
··· 45 45 #include <linux/device.h> 46 46 #include <linux/firmware.h> 47 47 48 - #include <pcmcia/cs.h> 49 48 #include <pcmcia/cistpl.h> 50 49 #include <pcmcia/ciscode.h> 51 50 #include <pcmcia/ds.h> ··· 656 657 info->p_dev = link; 657 658 link->priv = info; 658 659 659 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 660 - link->resource[0]->end = 8; 661 - 662 - link->conf.Attributes = CONF_ENABLE_IRQ; 663 - link->conf.IntType = INT_MEMORY_AND_IO; 660 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | 661 + CONF_AUTO_SET_IO; 664 662 665 663 return bt3c_config(link); 666 664 } ··· 671 675 kfree(info); 672 676 } 673 677 674 - static int bt3c_check_config(struct pcmcia_device *p_dev, 675 - cistpl_cftable_entry_t *cf, 676 - cistpl_cftable_entry_t *dflt, 677 - unsigned int vcc, 678 - void *priv_data) 678 + static int bt3c_check_config(struct pcmcia_device *p_dev, void *priv_data) 679 679 { 680 - unsigned long try = (unsigned long) priv_data; 680 + int *try = priv_data; 681 681 682 - p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 682 + if (try == 0) 683 + p_dev->io_lines = 16; 683 684 684 - if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) 685 - p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; 686 - if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && 687 - (cf->io.win[0].base != 0)) { 688 - p_dev->resource[0]->start = cf->io.win[0].base; 689 - if (!pcmcia_request_io(p_dev)) 690 - return 0; 691 - } 692 - return -ENODEV; 685 + if ((p_dev->resource[0]->end != 8) || (p_dev->resource[0]->start == 0)) 686 + return -EINVAL; 687 + 688 + p_dev->resource[0]->end = 8; 689 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 690 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 691 + 692 + return pcmcia_request_io(p_dev); 693 693 } 694 694 695 695 static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, 696 - cistpl_cftable_entry_t *cf, 697 - cistpl_cftable_entry_t *dflt, 698 - unsigned int vcc, 699 696 void *priv_data) 700 697 { 701 698 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 702 699 int j; 703 700 704 - if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { 705 - for (j = 0; j < 5; j++) { 706 - p_dev->resource[0]->start = base[j]; 707 - p_dev->io_lines = base[j] ? 16 : 3; 708 - if (!pcmcia_request_io(p_dev)) 709 - return 0; 710 - } 701 + if (p_dev->io_lines > 3) 702 + return -ENODEV; 703 + 704 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 705 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 706 + p_dev->resource[0]->end = 8; 707 + 708 + for (j = 0; j < 5; j++) { 709 + p_dev->resource[0]->start = base[j]; 710 + p_dev->io_lines = base[j] ? 16 : 3; 711 + if (!pcmcia_request_io(p_dev)) 712 + return 0; 711 713 } 712 714 return -ENODEV; 713 715 } ··· 736 742 if (i != 0) 737 743 goto failed; 738 744 739 - i = pcmcia_request_configuration(link, &link->conf); 745 + i = pcmcia_enable_device(link); 740 746 if (i != 0) 741 747 goto failed; 742 748 ··· 769 775 770 776 static struct pcmcia_driver bt3c_driver = { 771 777 .owner = THIS_MODULE, 772 - .drv = { 773 - .name = "bt3c_cs", 774 - }, 778 + .name = "bt3c_cs", 775 779 .probe = bt3c_probe, 776 780 .remove = bt3c_detach, 777 781 .id_table = bt3c_ids,
+27 -35
drivers/bluetooth/btuart_cs.c
··· 41 41 #include <asm/system.h> 42 42 #include <asm/io.h> 43 43 44 - #include <pcmcia/cs.h> 45 44 #include <pcmcia/cistpl.h> 46 45 #include <pcmcia/ciscode.h> 47 46 #include <pcmcia/ds.h> ··· 585 586 info->p_dev = link; 586 587 link->priv = info; 587 588 588 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 589 - link->resource[0]->end = 8; 590 - 591 - link->conf.Attributes = CONF_ENABLE_IRQ; 592 - link->conf.IntType = INT_MEMORY_AND_IO; 589 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | 590 + CONF_AUTO_SET_IO; 593 591 594 592 return btuart_config(link); 595 593 } ··· 600 604 kfree(info); 601 605 } 602 606 603 - static int btuart_check_config(struct pcmcia_device *p_dev, 604 - cistpl_cftable_entry_t *cf, 605 - cistpl_cftable_entry_t *dflt, 606 - unsigned int vcc, 607 - void *priv_data) 607 + static int btuart_check_config(struct pcmcia_device *p_dev, void *priv_data) 608 608 { 609 609 int *try = priv_data; 610 610 611 - p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 611 + if (try == 0) 612 + p_dev->io_lines = 16; 612 613 613 - if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) 614 - p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; 615 - if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && 616 - (cf->io.win[0].base != 0)) { 617 - p_dev->resource[0]->start = cf->io.win[0].base; 618 - if (!pcmcia_request_io(p_dev)) 619 - return 0; 620 - } 621 - return -ENODEV; 614 + if ((p_dev->resource[0]->end != 8) || (p_dev->resource[0]->start == 0)) 615 + return -EINVAL; 616 + 617 + p_dev->resource[0]->end = 8; 618 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 619 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 620 + 621 + return pcmcia_request_io(p_dev); 622 622 } 623 623 624 624 static int btuart_check_config_notpicky(struct pcmcia_device *p_dev, 625 - cistpl_cftable_entry_t *cf, 626 - cistpl_cftable_entry_t *dflt, 627 - unsigned int vcc, 628 625 void *priv_data) 629 626 { 630 627 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 631 628 int j; 632 629 633 - if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { 634 - for (j = 0; j < 5; j++) { 635 - p_dev->resource[0]->start = base[j]; 636 - p_dev->io_lines = base[j] ? 16 : 3; 637 - if (!pcmcia_request_io(p_dev)) 638 - return 0; 639 - } 630 + if (p_dev->io_lines > 3) 631 + return -ENODEV; 632 + 633 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 634 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 635 + p_dev->resource[0]->end = 8; 636 + 637 + for (j = 0; j < 5; j++) { 638 + p_dev->resource[0]->start = base[j]; 639 + p_dev->io_lines = base[j] ? 16 : 3; 640 + if (!pcmcia_request_io(p_dev)) 641 + return 0; 640 642 } 641 643 return -ENODEV; 642 644 } ··· 665 671 if (i != 0) 666 672 goto failed; 667 673 668 - i = pcmcia_request_configuration(link, &link->conf); 674 + i = pcmcia_enable_device(link); 669 675 if (i != 0) 670 676 goto failed; 671 677 ··· 697 703 698 704 static struct pcmcia_driver btuart_driver = { 699 705 .owner = THIS_MODULE, 700 - .drv = { 701 - .name = "btuart_cs", 702 - }, 706 + .name = "btuart_cs", 703 707 .probe = btuart_probe, 704 708 .remove = btuart_detach, 705 709 .id_table = btuart_ids,
+8 -19
drivers/bluetooth/dtl1_cs.c
··· 41 41 #include <asm/system.h> 42 42 #include <asm/io.h> 43 43 44 - #include <pcmcia/cs.h> 45 44 #include <pcmcia/cistpl.h> 46 45 #include <pcmcia/ciscode.h> 47 46 #include <pcmcia/ds.h> ··· 571 572 info->p_dev = link; 572 573 link->priv = info; 573 574 574 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 575 - link->resource[0]->end = 8; 576 - 577 - link->conf.Attributes = CONF_ENABLE_IRQ; 578 - link->conf.IntType = INT_MEMORY_AND_IO; 575 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 579 576 580 577 return dtl1_config(link); 581 578 } ··· 586 591 kfree(info); 587 592 } 588 593 589 - static int dtl1_confcheck(struct pcmcia_device *p_dev, 590 - cistpl_cftable_entry_t *cf, 591 - cistpl_cftable_entry_t *dflt, 592 - unsigned int vcc, 593 - void *priv_data) 594 + static int dtl1_confcheck(struct pcmcia_device *p_dev, void *priv_data) 594 595 { 595 - if ((cf->io.nwin != 1) || (cf->io.win[0].len <= 8)) 596 + if ((p_dev->resource[1]->end) || (p_dev->resource[1]->end < 8)) 596 597 return -ENODEV; 597 598 598 - p_dev->resource[0]->start = cf->io.win[0].base; 599 - p_dev->resource[0]->end = cf->io.win[0].len; /*yo */ 600 - p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; 599 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 600 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 601 + 601 602 return pcmcia_request_io(p_dev); 602 603 } 603 604 ··· 611 620 if (i != 0) 612 621 goto failed; 613 622 614 - i = pcmcia_request_configuration(link, &link->conf); 623 + i = pcmcia_enable_device(link); 615 624 if (i != 0) 616 625 goto failed; 617 626 ··· 647 656 648 657 static struct pcmcia_driver dtl1_driver = { 649 658 .owner = THIS_MODULE, 650 - .drv = { 651 - .name = "dtl1_cs", 652 - }, 659 + .name = "dtl1_cs", 653 660 .probe = dtl1_probe, 654 661 .remove = dtl1_detach, 655 662 .id_table = dtl1_ids,
+5 -26
drivers/char/pcmcia/cm4000_cs.c
··· 34 34 #include <linux/uaccess.h> 35 35 #include <linux/io.h> 36 36 37 - #include <pcmcia/cs.h> 38 37 #include <pcmcia/cistpl.h> 39 38 #include <pcmcia/cisreg.h> 40 39 #include <pcmcia/ciscode.h> ··· 53 54 dev_dbg(reader_to_dev(rdr), "%s:" x, \ 54 55 __func__ , ## args); \ 55 56 } while (0) 56 - 57 - static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte"; 58 57 59 58 #define T_1SEC (HZ) 60 59 #define T_10MSEC msecs_to_jiffies(10) ··· 1739 1742 1740 1743 /*==== Interface to PCMCIA Layer =======================================*/ 1741 1744 1742 - static int cm4000_config_check(struct pcmcia_device *p_dev, 1743 - cistpl_cftable_entry_t *cfg, 1744 - cistpl_cftable_entry_t *dflt, 1745 - unsigned int vcc, 1746 - void *priv_data) 1745 + static int cm4000_config_check(struct pcmcia_device *p_dev, void *priv_data) 1747 1746 { 1748 - if (!cfg->io.nwin) 1749 - return -ENODEV; 1750 - 1751 - p_dev->resource[0]->start = cfg->io.win[0].base; 1752 - p_dev->resource[0]->end = cfg->io.win[0].len; 1753 - p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags); 1754 - p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; 1755 - 1756 1747 return pcmcia_request_io(p_dev); 1757 1748 } 1758 1749 ··· 1748 1763 { 1749 1764 struct cm4000_dev *dev; 1750 1765 1766 + link->config_flags |= CONF_AUTO_SET_IO; 1767 + 1751 1768 /* read the config-tuples */ 1752 1769 if (pcmcia_loop_config(link, cm4000_config_check, NULL)) 1753 1770 goto cs_release; 1754 1771 1755 - link->conf.IntType = 00000002; 1756 - 1757 - if (pcmcia_request_configuration(link, &link->conf)) 1772 + if (pcmcia_enable_device(link)) 1758 1773 goto cs_release; 1759 1774 1760 1775 dev = link->priv; ··· 1814 1829 1815 1830 dev->p_dev = link; 1816 1831 link->priv = dev; 1817 - link->conf.IntType = INT_MEMORY_AND_IO; 1818 1832 dev_table[i] = link; 1819 1833 1820 1834 init_waitqueue_head(&dev->devq); ··· 1875 1891 1876 1892 static struct pcmcia_driver cm4000_driver = { 1877 1893 .owner = THIS_MODULE, 1878 - .drv = { 1879 - .name = "cm4000_cs", 1880 - }, 1894 + .name = "cm4000_cs", 1881 1895 .probe = cm4000_probe, 1882 1896 .remove = cm4000_detach, 1883 1897 .suspend = cm4000_suspend, ··· 1886 1904 static int __init cmm_init(void) 1887 1905 { 1888 1906 int rc; 1889 - 1890 - printk(KERN_INFO "%s\n", version); 1891 1907 1892 1908 cmm_class = class_create(THIS_MODULE, "cardman_4000"); 1893 1909 if (IS_ERR(cmm_class)) ··· 1911 1931 1912 1932 static void __exit cmm_exit(void) 1913 1933 { 1914 - printk(KERN_INFO MODULE_NAME ": unloading\n"); 1915 1934 pcmcia_unregister_driver(&cm4000_driver); 1916 1935 unregister_chrdev(major, DEVICE_NAME); 1917 1936 class_destroy(cmm_class);
+7 -33
drivers/char/pcmcia/cm4040_cs.c
··· 29 29 #include <asm/uaccess.h> 30 30 #include <asm/io.h> 31 31 32 - #include <pcmcia/cs.h> 33 32 #include <pcmcia/cistpl.h> 34 33 #include <pcmcia/cisreg.h> 35 34 #include <pcmcia/ciscode.h> ··· 47 48 dev_dbg(reader_to_dev(rdr), "%s:" x, \ 48 49 __func__ , ## args); \ 49 50 } while (0) 50 - 51 - static char *version = 52 - "OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte"; 53 51 54 52 #define CCID_DRIVER_BULK_DEFAULT_TIMEOUT (150*HZ) 55 53 #define CCID_DRIVER_ASYNC_POWERUP_TIMEOUT (35*HZ) ··· 512 516 return; 513 517 } 514 518 515 - static int cm4040_config_check(struct pcmcia_device *p_dev, 516 - cistpl_cftable_entry_t *cfg, 517 - cistpl_cftable_entry_t *dflt, 518 - unsigned int vcc, 519 - void *priv_data) 519 + static int cm4040_config_check(struct pcmcia_device *p_dev, void *priv_data) 520 520 { 521 - int rc; 522 - if (!cfg->io.nwin) 523 - return -ENODEV; 524 - 525 - /* Get the IOaddr */ 526 - p_dev->resource[0]->start = cfg->io.win[0].base; 527 - p_dev->resource[0]->end = cfg->io.win[0].len; 528 - p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags); 529 - p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; 530 - rc = pcmcia_request_io(p_dev); 531 - 532 - dev_printk(KERN_INFO, &p_dev->dev, 533 - "pcmcia_request_io returned 0x%x\n", rc); 534 - return rc; 521 + return pcmcia_request_io(p_dev); 535 522 } 536 523 537 524 ··· 523 544 struct reader_dev *dev; 524 545 int fail_rc; 525 546 547 + link->config_flags |= CONF_AUTO_SET_IO; 548 + 526 549 if (pcmcia_loop_config(link, cm4040_config_check, NULL)) 527 550 goto cs_release; 528 551 529 - link->conf.IntType = 00000002; 530 - 531 - fail_rc = pcmcia_request_configuration(link, &link->conf); 552 + fail_rc = pcmcia_enable_device(link); 532 553 if (fail_rc != 0) { 533 554 dev_printk(KERN_INFO, &link->dev, 534 - "pcmcia_request_configuration failed 0x%x\n", 555 + "pcmcia_enable_device failed 0x%x\n", 535 556 fail_rc); 536 557 goto cs_release; 537 558 } ··· 578 599 link->priv = dev; 579 600 dev->p_dev = link; 580 601 581 - link->conf.IntType = INT_MEMORY_AND_IO; 582 602 dev_table[i] = link; 583 603 584 604 init_waitqueue_head(&dev->devq); ··· 640 662 641 663 static struct pcmcia_driver reader_driver = { 642 664 .owner = THIS_MODULE, 643 - .drv = { 644 - .name = "cm4040_cs", 645 - }, 665 + .name = "cm4040_cs", 646 666 .probe = reader_probe, 647 667 .remove = reader_detach, 648 668 .id_table = cm4040_ids, ··· 650 674 { 651 675 int rc; 652 676 653 - printk(KERN_INFO "%s\n", version); 654 677 cmx_class = class_create(THIS_MODULE, "cardman_4040"); 655 678 if (IS_ERR(cmx_class)) 656 679 return PTR_ERR(cmx_class); ··· 674 699 675 700 static void __exit cm4040_exit(void) 676 701 { 677 - printk(KERN_INFO MODULE_NAME ": unloading\n"); 678 702 pcmcia_unregister_driver(&reader_driver); 679 703 unregister_chrdev(major, DEVICE_NAME); 680 704 class_destroy(cmx_class);
+41 -76
drivers/char/pcmcia/ipwireless/main.c
··· 32 32 #include <pcmcia/device_id.h> 33 33 #include <pcmcia/ss.h> 34 34 #include <pcmcia/ds.h> 35 - #include <pcmcia/cs.h> 36 35 37 36 static struct pcmcia_device_id ipw_ids[] = { 38 37 PCMCIA_DEVICE_MANF_CARD(0x02f2, 0x0100), ··· 75 76 schedule_work(&ipw->work_reboot); 76 77 } 77 78 78 - static int ipwireless_probe(struct pcmcia_device *p_dev, 79 - cistpl_cftable_entry_t *cfg, 80 - cistpl_cftable_entry_t *dflt, 81 - unsigned int vcc, 82 - void *priv_data) 79 + static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) 83 80 { 84 81 struct ipw_dev *ipw = priv_data; 85 82 struct resource *io_resource; 86 83 int ret; 87 84 85 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 88 86 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 89 - p_dev->resource[0]->start = cfg->io.win[0].base; 90 - p_dev->resource[0]->end = cfg->io.win[0].len; 91 87 92 88 /* 0x40 causes it to generate level mode interrupts. */ 93 89 /* 0x04 enables IREQ pin. */ 94 - p_dev->conf.ConfigIndex = cfg->index | 0x44; 90 + p_dev->config_index |= 0x44; 95 91 p_dev->io_lines = 16; 96 92 ret = pcmcia_request_io(p_dev); 97 93 if (ret) ··· 96 102 resource_size(p_dev->resource[0]), 97 103 IPWIRELESS_PCCARD_NAME); 98 104 99 - if (cfg->mem.nwin == 0) 100 - return 0; 101 - 102 - ipw->request_common_memory.Attributes = 105 + p_dev->resource[2]->flags |= 103 106 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; 104 - ipw->request_common_memory.Base = cfg->mem.win[0].host_addr; 105 - ipw->request_common_memory.Size = cfg->mem.win[0].len; 106 - if (ipw->request_common_memory.Size < 0x1000) 107 - ipw->request_common_memory.Size = 0x1000; 108 - ipw->request_common_memory.AccessSpeed = 0; 109 107 110 - ret = pcmcia_request_window(p_dev, &ipw->request_common_memory, 111 - &ipw->handle_common_memory); 112 - 108 + ret = pcmcia_request_window(p_dev, p_dev->resource[2], 0); 113 109 if (ret != 0) 114 110 goto exit1; 115 111 116 - ret = pcmcia_map_mem_page(p_dev, ipw->handle_common_memory, 117 - cfg->mem.win[0].card_addr); 118 - 112 + ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], p_dev->card_addr); 119 113 if (ret != 0) 120 114 goto exit2; 121 115 122 - ipw->is_v2_card = cfg->mem.win[0].len == 0x100; 116 + ipw->is_v2_card = resource_size(p_dev->resource[2]) == 0x100; 123 117 124 - ipw->common_memory = ioremap(ipw->request_common_memory.Base, 125 - ipw->request_common_memory.Size); 126 - request_mem_region(ipw->request_common_memory.Base, 127 - ipw->request_common_memory.Size, 118 + ipw->attr_memory = ioremap(p_dev->resource[2]->start, 119 + resource_size(p_dev->resource[2])); 120 + request_mem_region(p_dev->resource[2]->start, 121 + resource_size(p_dev->resource[2]), 128 122 IPWIRELESS_PCCARD_NAME); 129 123 130 - ipw->request_attr_memory.Attributes = 131 - WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | WIN_ENABLE; 132 - ipw->request_attr_memory.Base = 0; 133 - ipw->request_attr_memory.Size = 0; /* this used to be 0x1000 */ 134 - ipw->request_attr_memory.AccessSpeed = 0; 135 - 136 - ret = pcmcia_request_window(p_dev, &ipw->request_attr_memory, 137 - &ipw->handle_attr_memory); 138 - 124 + p_dev->resource[3]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | 125 + WIN_ENABLE; 126 + p_dev->resource[3]->end = 0; /* this used to be 0x1000 */ 127 + ret = pcmcia_request_window(p_dev, p_dev->resource[3], 0); 139 128 if (ret != 0) 140 129 goto exit2; 141 130 142 - ret = pcmcia_map_mem_page(p_dev, ipw->handle_attr_memory, 0); 131 + ret = pcmcia_map_mem_page(p_dev, p_dev->resource[3], 0); 143 132 if (ret != 0) 144 133 goto exit3; 145 134 146 - ipw->attr_memory = ioremap(ipw->request_attr_memory.Base, 147 - ipw->request_attr_memory.Size); 148 - request_mem_region(ipw->request_attr_memory.Base, 149 - ipw->request_attr_memory.Size, IPWIRELESS_PCCARD_NAME); 135 + ipw->attr_memory = ioremap(p_dev->resource[3]->start, 136 + resource_size(p_dev->resource[3])); 137 + request_mem_region(p_dev->resource[3]->start, 138 + resource_size(p_dev->resource[3]), 139 + IPWIRELESS_PCCARD_NAME); 150 140 151 141 return 0; 152 142 153 143 exit3: 154 144 exit2: 155 145 if (ipw->common_memory) { 156 - release_mem_region(ipw->request_common_memory.Base, 157 - ipw->request_common_memory.Size); 146 + release_mem_region(p_dev->resource[2]->start, 147 + resource_size(p_dev->resource[2])); 158 148 iounmap(ipw->common_memory); 159 149 } 160 150 exit1: ··· 153 175 int ret = 0; 154 176 155 177 ipw->is_v2_card = 0; 178 + link->config_flags |= CONF_AUTO_SET_IO | CONF_AUTO_SET_IOMEM | 179 + CONF_ENABLE_IRQ; 156 180 157 181 ret = pcmcia_loop_config(link, ipwireless_probe, ipw); 158 182 if (ret != 0) 159 183 return ret; 160 - 161 - link->conf.Attributes = CONF_ENABLE_IRQ; 162 - link->conf.IntType = INT_MEMORY_AND_IO; 163 184 164 185 INIT_WORK(&ipw->work_reboot, signalled_reboot_work); 165 186 ··· 178 201 (unsigned int) link->irq); 179 202 if (ipw->attr_memory && ipw->common_memory) 180 203 printk(KERN_INFO IPWIRELESS_PCCARD_NAME 181 - ": attr memory 0x%08lx-0x%08lx, common memory 0x%08lx-0x%08lx\n", 182 - ipw->request_attr_memory.Base, 183 - ipw->request_attr_memory.Base 184 - + ipw->request_attr_memory.Size - 1, 185 - ipw->request_common_memory.Base, 186 - ipw->request_common_memory.Base 187 - + ipw->request_common_memory.Size - 1); 204 + ": attr memory %pR, common memory %pR\n", 205 + link->resource[3], 206 + link->resource[2]); 188 207 189 208 ipw->network = ipwireless_network_create(ipw->hardware); 190 209 if (!ipw->network) ··· 196 223 * Do the RequestConfiguration last, because it enables interrupts. 197 224 * Then we don't get any interrupts before we're ready for them. 198 225 */ 199 - ret = pcmcia_request_configuration(link, &link->conf); 200 - 226 + ret = pcmcia_enable_device(link); 201 227 if (ret != 0) 202 228 goto exit; 203 229 204 230 return 0; 205 231 206 232 exit: 207 - if (ipw->attr_memory) { 208 - release_mem_region(ipw->request_attr_memory.Base, 209 - ipw->request_attr_memory.Size); 210 - iounmap(ipw->attr_memory); 211 - 212 - } 213 233 if (ipw->common_memory) { 214 - release_mem_region(ipw->request_common_memory.Base, 215 - ipw->request_common_memory.Size); 234 + release_mem_region(link->resource[2]->start, 235 + resource_size(link->resource[2])); 216 236 iounmap(ipw->common_memory); 237 + } 238 + if (ipw->attr_memory) { 239 + release_mem_region(link->resource[3]->start, 240 + resource_size(link->resource[3])); 241 + iounmap(ipw->attr_memory); 217 242 } 218 243 pcmcia_disable_device(link); 219 244 return -1; ··· 220 249 static void release_ipwireless(struct ipw_dev *ipw) 221 250 { 222 251 if (ipw->common_memory) { 223 - release_mem_region(ipw->request_common_memory.Base, 224 - ipw->request_common_memory.Size); 252 + release_mem_region(ipw->link->resource[2]->start, 253 + resource_size(ipw->link->resource[2])); 225 254 iounmap(ipw->common_memory); 226 255 } 227 256 if (ipw->attr_memory) { 228 - release_mem_region(ipw->request_attr_memory.Base, 229 - ipw->request_attr_memory.Size); 257 + release_mem_region(ipw->link->resource[3]->start, 258 + resource_size(ipw->link->resource[3])); 230 259 iounmap(ipw->attr_memory); 231 260 } 232 261 pcmcia_disable_device(ipw->link); ··· 295 324 .owner = THIS_MODULE, 296 325 .probe = ipwireless_attach, 297 326 .remove = ipwireless_detach, 298 - .drv = { .name = IPWIRELESS_PCCARD_NAME }, 327 + .name = IPWIRELESS_PCCARD_NAME, 299 328 .id_table = ipw_ids 300 329 }; 301 330 ··· 306 335 static int __init init_ipwireless(void) 307 336 { 308 337 int ret; 309 - 310 - printk(KERN_INFO IPWIRELESS_PCCARD_NAME " " 311 - IPWIRELESS_PCMCIA_VERSION " by " IPWIRELESS_PCMCIA_AUTHOR "\n"); 312 338 313 339 ret = ipwireless_tty_init(); 314 340 if (ret != 0) ··· 323 355 */ 324 356 static void __exit exit_ipwireless(void) 325 357 { 326 - printk(KERN_INFO IPWIRELESS_PCCARD_NAME " " 327 - IPWIRELESS_PCMCIA_VERSION " removed\n"); 328 - 329 358 pcmcia_unregister_driver(&me); 330 359 ipwireless_tty_release(); 331 360 }
-5
drivers/char/pcmcia/ipwireless/main.h
··· 21 21 #include <linux/sched.h> 22 22 #include <linux/types.h> 23 23 24 - #include <pcmcia/cs.h> 25 24 #include <pcmcia/cistpl.h> 26 25 #include <pcmcia/ds.h> 27 26 ··· 44 45 struct pcmcia_device *link; 45 46 int is_v2_card; 46 47 47 - window_handle_t handle_attr_memory; 48 48 void __iomem *attr_memory; 49 - win_req_t request_attr_memory; 50 49 51 - window_handle_t handle_common_memory; 52 50 void __iomem *common_memory; 53 - win_req_t request_common_memory; 54 51 55 52 /* Reference to attribute memory, containing CIS data */ 56 53 void *attribute_memory;
-1
drivers/char/pcmcia/ipwireless/tty.h
··· 21 21 #include <linux/types.h> 22 22 #include <linux/sched.h> 23 23 24 - #include <pcmcia/cs.h> 25 24 #include <pcmcia/cistpl.h> 26 25 #include <pcmcia/ds.h> 27 26
+27 -125
drivers/ide/ide-cs.c
··· 43 43 #include <asm/io.h> 44 44 #include <asm/system.h> 45 45 46 - #include <pcmcia/cs.h> 47 46 #include <pcmcia/cistpl.h> 48 47 #include <pcmcia/ds.h> 49 48 #include <pcmcia/cisreg.h> ··· 71 72 72 73 static void ide_detach(struct pcmcia_device *p_dev); 73 74 74 - 75 - 76 - 77 - /*====================================================================== 78 - 79 - ide_attach() creates an "instance" of the driver, allocating 80 - local data structures for one device. The device is registered 81 - with Card Services. 82 - 83 - ======================================================================*/ 84 - 85 75 static int ide_probe(struct pcmcia_device *link) 86 76 { 87 77 ide_info_t *info; ··· 85 97 info->p_dev = link; 86 98 link->priv = info; 87 99 88 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 89 - link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 90 - link->conf.Attributes = CONF_ENABLE_IRQ; 91 - link->conf.IntType = INT_MEMORY_AND_IO; 100 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO | 101 + CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; 92 102 93 103 return ide_config(link); 94 104 } /* ide_attach */ 95 - 96 - /*====================================================================== 97 - 98 - This deletes a driver "instance". The device is de-registered 99 - with Card Services. If it has been released, all local data 100 - structures are freed. Otherwise, the structures will be freed 101 - when the device is released. 102 - 103 - ======================================================================*/ 104 105 105 106 static void ide_detach(struct pcmcia_device *link) 106 107 { ··· 164 187 return NULL; 165 188 } 166 189 167 - /*====================================================================== 168 - 169 - ide_config() is scheduled to run after a CARD_INSERTION event 170 - is received, to configure the PCMCIA socket, and to make the 171 - ide device available to the system. 172 - 173 - ======================================================================*/ 174 - 175 - struct pcmcia_config_check { 176 - unsigned long ctl_base; 177 - int skip_vcc; 178 - int is_kme; 179 - }; 180 - 181 - static int pcmcia_check_one_config(struct pcmcia_device *pdev, 182 - cistpl_cftable_entry_t *cfg, 183 - cistpl_cftable_entry_t *dflt, 184 - unsigned int vcc, 185 - void *priv_data) 190 + static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data) 186 191 { 187 - struct pcmcia_config_check *stk = priv_data; 192 + int *is_kme = priv_data; 188 193 189 - /* Check for matching Vcc, unless we're desperate */ 190 - if (!stk->skip_vcc) { 191 - if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { 192 - if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) 193 - return -ENODEV; 194 - } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { 195 - if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) 196 - return -ENODEV; 197 - } 194 + if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) { 195 + pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 196 + pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 198 197 } 198 + pdev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; 199 + pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 199 200 200 - if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 201 - pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 202 - else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) 203 - pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; 204 - 205 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 206 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 207 - pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 208 - 209 - pdev->conf.ConfigIndex = cfg->index; 210 - pdev->resource[0]->start = io->win[0].base; 211 - if (!(io->flags & CISTPL_IO_16BIT)) { 212 - pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 213 - pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 214 - } 215 - if (io->nwin == 2) { 216 - pdev->resource[0]->end = 8; 217 - pdev->resource[1]->start = io->win[1].base; 218 - pdev->resource[1]->end = (stk->is_kme) ? 2 : 1; 219 - if (pcmcia_request_io(pdev) != 0) 220 - return -ENODEV; 221 - stk->ctl_base = pdev->resource[1]->start; 222 - } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { 223 - pdev->resource[0]->end = io->win[0].len; 224 - pdev->resource[1]->end = 0; 225 - if (pcmcia_request_io(pdev) != 0) 226 - return -ENODEV; 227 - stk->ctl_base = pdev->resource[0]->start + 0x0e; 228 - } else 201 + if (pdev->resource[1]->end) { 202 + pdev->resource[0]->end = 8; 203 + pdev->resource[1]->end = (*is_kme) ? 2 : 1; 204 + } else { 205 + if (pdev->resource[0]->end < 16) 229 206 return -ENODEV; 230 - /* If we've got this far, we're done */ 231 - return 0; 232 207 } 233 - return -ENODEV; 208 + 209 + return pcmcia_request_io(pdev); 234 210 } 235 211 236 212 static int ide_config(struct pcmcia_device *link) 237 213 { 238 214 ide_info_t *info = link->priv; 239 - struct pcmcia_config_check *stk = NULL; 240 215 int ret = 0, is_kme = 0; 241 216 unsigned long io_base, ctl_base; 242 217 struct ide_host *host; ··· 199 270 ((link->card_id == PRODID_KME_KXLC005_A) || 200 271 (link->card_id == PRODID_KME_KXLC005_B))); 201 272 202 - stk = kzalloc(sizeof(*stk), GFP_KERNEL); 203 - if (!stk) 204 - goto err_mem; 205 - stk->is_kme = is_kme; 206 - stk->skip_vcc = io_base = ctl_base = 0; 207 - 208 - if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) { 209 - stk->skip_vcc = 1; 210 - if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) 273 + if (pcmcia_loop_config(link, pcmcia_check_one_config, &is_kme)) { 274 + link->config_flags &= ~CONF_AUTO_CHECK_VCC; 275 + if (pcmcia_loop_config(link, pcmcia_check_one_config, &is_kme)) 211 276 goto failed; /* No suitable config found */ 212 277 } 213 278 io_base = link->resource[0]->start; 214 - ctl_base = stk->ctl_base; 279 + if (link->resource[1]->end) 280 + ctl_base = link->resource[1]->start; 281 + else 282 + ctl_base = link->resource[0]->start + 0x0e; 215 283 216 284 if (!link->irq) 217 285 goto failed; 218 - ret = pcmcia_request_configuration(link, &link->conf); 286 + 287 + ret = pcmcia_enable_device(link); 219 288 if (ret) 220 289 goto failed; 221 290 ··· 238 311 info->host = host; 239 312 dev_info(&link->dev, "ide-cs: hd%c: Vpp = %d.%d\n", 240 313 'a' + host->ports[0]->index * 2, 241 - link->conf.Vpp / 10, link->conf.Vpp % 10); 314 + link->vpp / 10, link->vpp % 10); 242 315 243 - kfree(stk); 244 316 return 0; 245 317 246 - err_mem: 247 - printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n"); 248 - goto failed; 249 - 250 318 failed: 251 - kfree(stk); 252 319 ide_release(link); 253 320 return -ENODEV; 254 321 } /* ide_config */ 255 - 256 - /*====================================================================== 257 - 258 - After a card is removed, ide_release() will unregister the net 259 - device, and release the PCMCIA configuration. If the device is 260 - still open, this will be postponed until it is closed. 261 - 262 - ======================================================================*/ 263 322 264 323 static void ide_release(struct pcmcia_device *link) 265 324 { ··· 271 358 pcmcia_disable_device(link); 272 359 } /* ide_release */ 273 360 274 - 275 - /*====================================================================== 276 - 277 - The card status event handler. Mostly, this schedules other 278 - stuff to run after an event is received. A CARD_REMOVAL event 279 - also sets some flags to discourage the ide drivers from 280 - talking to the ports. 281 - 282 - ======================================================================*/ 283 361 284 362 static struct pcmcia_device_id ide_ids[] = { 285 363 PCMCIA_DEVICE_FUNC_ID(4), ··· 344 440 345 441 static struct pcmcia_driver ide_cs_driver = { 346 442 .owner = THIS_MODULE, 347 - .drv = { 348 - .name = "ide-cs", 349 - }, 443 + .name = "ide-cs", 350 444 .probe = ide_probe, 351 445 .remove = ide_detach, 352 446 .id_table = ide_ids,
+9 -74
drivers/isdn/hardware/avm/avm_cs.c
··· 20 20 #include <asm/io.h> 21 21 #include <asm/system.h> 22 22 23 - #include <pcmcia/cs.h> 24 23 #include <pcmcia/cistpl.h> 25 24 #include <pcmcia/ciscode.h> 26 25 #include <pcmcia/ds.h> ··· 38 39 39 40 /*====================================================================*/ 40 41 41 - /* 42 - The event() function is this driver's Card Services event handler. 43 - It will be called by Card Services when an appropriate card status 44 - event is received. The config() and release() entry points are 45 - used to configure or release a socket, in response to card insertion 46 - and ejection events. They are invoked from the skeleton event 47 - handler. 48 - */ 49 - 50 42 static int avmcs_config(struct pcmcia_device *link); 51 43 static void avmcs_release(struct pcmcia_device *link); 52 - 53 - /* 54 - The attach() and detach() entry points are used to create and destroy 55 - "instances" of the driver, where each instance represents everything 56 - needed to manage one actual PCMCIA card. 57 - */ 58 - 59 44 static void avmcs_detach(struct pcmcia_device *p_dev); 60 - 61 - /*====================================================================== 62 - 63 - avmcs_attach() creates an "instance" of the driver, allocating 64 - local data structures for one device. The device is registered 65 - with Card Services. 66 - 67 - The dev_link structure is initialized, but we don't actually 68 - configure the card at this point -- we wait until we receive a 69 - card insertion event. 70 - 71 - ======================================================================*/ 72 45 73 46 static int avmcs_probe(struct pcmcia_device *p_dev) 74 47 { 75 - 76 - /* The io structure describes IO port mapping */ 77 - p_dev->resource[0]->end = 16; 78 - p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 79 - 80 48 /* General socket configuration */ 81 - p_dev->conf.Attributes = CONF_ENABLE_IRQ; 82 - p_dev->conf.IntType = INT_MEMORY_AND_IO; 83 - p_dev->conf.ConfigIndex = 1; 84 - p_dev->conf.Present = PRESENT_OPTION; 49 + p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 50 + p_dev->config_index = 1; 51 + p_dev->config_regs = PRESENT_OPTION; 85 52 86 53 return avmcs_config(p_dev); 87 54 } /* avmcs_attach */ 88 55 89 - /*====================================================================== 90 - 91 - This deletes a driver "instance". The device is de-registered 92 - with Card Services. If it has been released, all local data 93 - structures are freed. Otherwise, the structures will be freed 94 - when the device is released. 95 - 96 - ======================================================================*/ 97 56 98 57 static void avmcs_detach(struct pcmcia_device *link) 99 58 { 100 59 avmcs_release(link); 101 60 } /* avmcs_detach */ 102 61 103 - /*====================================================================== 104 - 105 - avmcs_config() is scheduled to run after a CARD_INSERTION event 106 - is received, to configure the PCMCIA socket, and to make the 107 - ethernet device available to the system. 108 - 109 - ======================================================================*/ 110 - 111 - static int avmcs_configcheck(struct pcmcia_device *p_dev, 112 - cistpl_cftable_entry_t *cf, 113 - cistpl_cftable_entry_t *dflt, 114 - unsigned int vcc, 115 - void *priv_data) 62 + static int avmcs_configcheck(struct pcmcia_device *p_dev, void *priv_data) 116 63 { 117 - if (cf->io.nwin <= 0) 118 - return -ENODEV; 64 + p_dev->resource[0]->end = 16; 65 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 66 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 119 67 120 - p_dev->resource[0]->start = cf->io.win[0].base; 121 - p_dev->resource[0]->end = cf->io.win[0].len; 122 68 return pcmcia_request_io(p_dev); 123 69 } 124 70 ··· 94 150 /* 95 151 * configure the PCMCIA socket 96 152 */ 97 - i = pcmcia_request_configuration(link, &link->conf); 153 + i = pcmcia_enable_device(link); 98 154 if (i != 0) { 99 155 pcmcia_disable_device(link); 100 156 break; ··· 141 197 142 198 } /* avmcs_config */ 143 199 144 - /*====================================================================== 145 - 146 - After a card is removed, avmcs_release() will unregister the net 147 - device, and release the PCMCIA configuration. If the device is 148 - still open, this will be postponed until it is closed. 149 - 150 - ======================================================================*/ 151 200 152 201 static void avmcs_release(struct pcmcia_device *link) 153 202 { ··· 159 222 160 223 static struct pcmcia_driver avmcs_driver = { 161 224 .owner = THIS_MODULE, 162 - .drv = { 163 - .name = "avm_cs", 164 - }, 225 + .name = "avm_cs", 165 226 .probe = avmcs_probe, 166 227 .remove = avmcs_detach, 167 228 .id_table = avmcs_ids,
+11 -86
drivers/isdn/hisax/avma1_cs.c
··· 20 20 #include <asm/io.h> 21 21 #include <asm/system.h> 22 22 23 - #include <pcmcia/cs.h> 24 23 #include <pcmcia/cistpl.h> 25 24 #include <pcmcia/ds.h> 26 25 #include "hisax_cfg.h" ··· 39 40 40 41 /*====================================================================*/ 41 42 42 - /* 43 - The event() function is this driver's Card Services event handler. 44 - It will be called by Card Services when an appropriate card status 45 - event is received. The config() and release() entry points are 46 - used to configure or release a socket, in response to card insertion 47 - and ejection events. They are invoked from the skeleton event 48 - handler. 49 - */ 50 - 51 43 static int avma1cs_config(struct pcmcia_device *link) __devinit ; 52 44 static void avma1cs_release(struct pcmcia_device *link); 53 - 54 - /* 55 - The attach() and detach() entry points are used to create and destroy 56 - "instances" of the driver, where each instance represents everything 57 - needed to manage one actual PCMCIA card. 58 - */ 59 - 60 45 static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit ; 61 - 62 - 63 - /*====================================================================== 64 - 65 - avma1cs_attach() creates an "instance" of the driver, allocating 66 - local data structures for one device. The device is registered 67 - with Card Services. 68 - 69 - The dev_link structure is initialized, but we don't actually 70 - configure the card at this point -- we wait until we receive a 71 - card insertion event. 72 - 73 - ======================================================================*/ 74 46 75 47 static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) 76 48 { 77 49 dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); 78 50 79 - /* The io structure describes IO port mapping */ 80 - p_dev->resource[0]->end = 16; 81 - p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 82 - p_dev->resource[1]->end = 16; 83 - p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_16; 84 - 85 51 /* General socket configuration */ 86 - p_dev->conf.Attributes = CONF_ENABLE_IRQ; 87 - p_dev->conf.IntType = INT_MEMORY_AND_IO; 88 - p_dev->conf.ConfigIndex = 1; 89 - p_dev->conf.Present = PRESENT_OPTION; 52 + p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 53 + p_dev->config_index = 1; 54 + p_dev->config_regs = PRESENT_OPTION; 90 55 91 56 return avma1cs_config(p_dev); 92 57 } /* avma1cs_attach */ 93 - 94 - /*====================================================================== 95 - 96 - This deletes a driver "instance". The device is de-registered 97 - with Card Services. If it has been released, all local data 98 - structures are freed. Otherwise, the structures will be freed 99 - when the device is released. 100 - 101 - ======================================================================*/ 102 58 103 59 static void __devexit avma1cs_detach(struct pcmcia_device *link) 104 60 { ··· 62 108 kfree(link->priv); 63 109 } /* avma1cs_detach */ 64 110 65 - /*====================================================================== 66 - 67 - avma1cs_config() is scheduled to run after a CARD_INSERTION event 68 - is received, to configure the PCMCIA socket, and to make the 69 - ethernet device available to the system. 70 - 71 - ======================================================================*/ 72 - 73 - static int avma1cs_configcheck(struct pcmcia_device *p_dev, 74 - cistpl_cftable_entry_t *cf, 75 - cistpl_cftable_entry_t *dflt, 76 - unsigned int vcc, 77 - void *priv_data) 111 + static int avma1cs_configcheck(struct pcmcia_device *p_dev, void *priv_data) 78 112 { 79 - if (cf->io.nwin <= 0) 80 - return -ENODEV; 81 - 82 - p_dev->resource[0]->start = cf->io.win[0].base; 83 - p_dev->resource[0]->end = cf->io.win[0].len; 113 + p_dev->resource[0]->end = 16; 114 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 115 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 84 116 p_dev->io_lines = 5; 117 + 85 118 return pcmcia_request_io(p_dev); 86 119 } 87 120 ··· 102 161 /* 103 162 * configure the PCMCIA socket 104 163 */ 105 - i = pcmcia_request_configuration(link, &link->conf); 164 + i = pcmcia_enable_device(link); 106 165 if (i != 0) { 107 166 pcmcia_disable_device(link); 108 167 break; ··· 115 174 avma1cs_release(link); 116 175 return -ENODEV; 117 176 } 118 - 119 - printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n", 120 - (unsigned int) link->resource[0]->start, link->irq); 121 177 122 178 icard.para[0] = link->irq; 123 179 icard.para[1] = link->resource[0]->start; ··· 134 196 return 0; 135 197 } /* avma1cs_config */ 136 198 137 - /*====================================================================== 138 - 139 - After a card is removed, avma1cs_release() will unregister the net 140 - device, and release the PCMCIA configuration. If the device is 141 - still open, this will be postponed until it is closed. 142 - 143 - ======================================================================*/ 144 - 145 199 static void avma1cs_release(struct pcmcia_device *link) 146 200 { 147 201 unsigned long minor = (unsigned long) link->priv; ··· 146 216 pcmcia_disable_device(link); 147 217 } /* avma1cs_release */ 148 218 149 - 150 219 static struct pcmcia_device_id avma1cs_ids[] = { 151 220 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb), 152 221 PCMCIA_DEVICE_PROD_ID12("ISDN", "CARD", 0x8d9761c8, 0x01c5aa7b), ··· 155 226 156 227 static struct pcmcia_driver avma1cs_driver = { 157 228 .owner = THIS_MODULE, 158 - .drv = { 159 - .name = "avma1_cs", 160 - }, 229 + .name = "avma1_cs", 161 230 .probe = avma1cs_probe, 162 231 .remove = __devexit_p(avma1cs_detach), 163 232 .id_table = avma1cs_ids, 164 233 }; 165 234 166 - /*====================================================================*/ 167 - 168 235 static int __init init_avma1_cs(void) 169 236 { 170 - return(pcmcia_register_driver(&avma1cs_driver)); 237 + return pcmcia_register_driver(&avma1cs_driver); 171 238 } 172 239 173 240 static void __exit exit_avma1_cs(void)
+9 -91
drivers/isdn/hisax/elsa_cs.c
··· 46 46 #include <asm/io.h> 47 47 #include <asm/system.h> 48 48 49 - #include <pcmcia/cs.h> 50 49 #include <pcmcia/cistpl.h> 51 50 #include <pcmcia/cisreg.h> 52 51 #include <pcmcia/ds.h> ··· 63 64 static int protocol = 2; /* EURO-ISDN Default */ 64 65 module_param(protocol, int, 0); 65 66 66 - /*====================================================================*/ 67 - 68 - /* 69 - The event() function is this driver's Card Services event handler. 70 - It will be called by Card Services when an appropriate card status 71 - event is received. The config() and release() entry points are 72 - used to configure or release a socket, in response to card insertion 73 - and ejection events. They are invoked from the elsa_cs event 74 - handler. 75 - */ 76 - 77 67 static int elsa_cs_config(struct pcmcia_device *link) __devinit ; 78 68 static void elsa_cs_release(struct pcmcia_device *link); 79 - 80 - /* 81 - The attach() and detach() entry points are used to create and destroy 82 - "instances" of the driver, where each instance represents everything 83 - needed to manage one actual PCMCIA card. 84 - */ 85 - 86 69 static void elsa_cs_detach(struct pcmcia_device *p_dev) __devexit; 87 70 88 71 typedef struct local_info_t { ··· 72 91 int busy; 73 92 int cardnr; 74 93 } local_info_t; 75 - 76 - /*====================================================================== 77 - 78 - elsa_cs_attach() creates an "instance" of the driver, allocatingx 79 - local data structures for one device. The device is registered 80 - with Card Services. 81 - 82 - The dev_link structure is initialized, but we don't actually 83 - configure the card at this point -- we wait until we receive a 84 - card insertion event. 85 - 86 - ======================================================================*/ 87 94 88 95 static int __devinit elsa_cs_probe(struct pcmcia_device *link) 89 96 { ··· 88 119 89 120 local->cardnr = -1; 90 121 91 - /* 92 - General socket configuration defaults can go here. In this 93 - client, we assume very little, and rely on the CIS for almost 94 - everything. In most clients, many details (i.e., number, sizes, 95 - and attributes of IO windows) are fixed by the nature of the 96 - device, and can be hard-wired here. 97 - */ 98 - link->resource[0]->end = 8; 99 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 100 - 101 - link->conf.Attributes = CONF_ENABLE_IRQ; 102 - link->conf.IntType = INT_MEMORY_AND_IO; 103 - 104 122 return elsa_cs_config(link); 105 123 } /* elsa_cs_attach */ 106 - 107 - /*====================================================================== 108 - 109 - This deletes a driver "instance". The device is de-registered 110 - with Card Services. If it has been released, all local data 111 - structures are freed. Otherwise, the structures will be freed 112 - when the device is released. 113 - 114 - ======================================================================*/ 115 124 116 125 static void __devexit elsa_cs_detach(struct pcmcia_device *link) 117 126 { ··· 103 156 kfree(info); 104 157 } /* elsa_cs_detach */ 105 158 106 - /*====================================================================== 107 - 108 - elsa_cs_config() is scheduled to run after a CARD_INSERTION event 109 - is received, to configure the PCMCIA socket, and to make the 110 - device available to the system. 111 - 112 - ======================================================================*/ 113 - 114 - static int elsa_cs_configcheck(struct pcmcia_device *p_dev, 115 - cistpl_cftable_entry_t *cf, 116 - cistpl_cftable_entry_t *dflt, 117 - unsigned int vcc, 118 - void *priv_data) 159 + static int elsa_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data) 119 160 { 120 161 int j; 121 162 122 163 p_dev->io_lines = 3; 164 + p_dev->resource[0]->end = 8; 165 + p_dev->resource[0]->flags &= IO_DATA_PATH_WIDTH; 166 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 123 167 124 - if ((cf->io.nwin > 0) && cf->io.win[0].base) { 168 + if ((p_dev->resource[0]->end) && p_dev->resource[0]->start) { 125 169 printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); 126 - p_dev->resource[0]->start = cf->io.win[0].base; 127 170 if (!pcmcia_request_io(p_dev)) 128 171 return 0; 129 172 } else { ··· 136 199 dev_dbg(&link->dev, "elsa_config(0x%p)\n", link); 137 200 dev = link->priv; 138 201 202 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 203 + 139 204 i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL); 140 205 if (i != 0) 141 206 goto failed; ··· 145 206 if (!link->irq) 146 207 goto failed; 147 208 148 - i = pcmcia_request_configuration(link, &link->conf); 209 + i = pcmcia_enable_device(link); 149 210 if (i != 0) 150 211 goto failed; 151 - 152 - /* Finally, report what we've done */ 153 - dev_info(&link->dev, "index 0x%02x: ", 154 - link->conf.ConfigIndex); 155 - if (link->conf.Attributes & CONF_ENABLE_IRQ) 156 - printk(", irq %d", link->irq); 157 - if (link->resource[0]) 158 - printk(" & %pR", link->resource[0]); 159 - if (link->resource[1]) 160 - printk(" & %pR", link->resource[1]); 161 - printk("\n"); 162 212 163 213 icard.para[0] = link->irq; 164 214 icard.para[1] = link->resource[0]->start; ··· 167 239 elsa_cs_release(link); 168 240 return -ENODEV; 169 241 } /* elsa_cs_config */ 170 - 171 - /*====================================================================== 172 - 173 - After a card is removed, elsa_cs_release() will unregister the net 174 - device, and release the PCMCIA configuration. If the device is 175 - still open, this will be postponed until it is closed. 176 - 177 - ======================================================================*/ 178 242 179 243 static void elsa_cs_release(struct pcmcia_device *link) 180 244 { ··· 211 291 212 292 static struct pcmcia_driver elsa_cs_driver = { 213 293 .owner = THIS_MODULE, 214 - .drv = { 215 - .name = "elsa_cs", 216 - }, 294 + .name = "elsa_cs", 217 295 .probe = elsa_cs_probe, 218 296 .remove = __devexit_p(elsa_cs_detach), 219 297 .id_table = elsa_ids,
+9 -157
drivers/isdn/hisax/sedlbauer_cs.c
··· 46 46 #include <asm/io.h> 47 47 #include <asm/system.h> 48 48 49 - #include <pcmcia/cs.h> 50 49 #include <pcmcia/cistpl.h> 51 50 #include <pcmcia/cisreg.h> 52 51 #include <pcmcia/ds.h> ··· 63 64 static int protocol = 2; /* EURO-ISDN Default */ 64 65 module_param(protocol, int, 0); 65 66 66 - /*====================================================================*/ 67 - 68 - /* 69 - The event() function is this driver's Card Services event handler. 70 - It will be called by Card Services when an appropriate card status 71 - event is received. The config() and release() entry points are 72 - used to configure or release a socket, in response to card 73 - insertion and ejection events. They are invoked from the sedlbauer 74 - event handler. 75 - */ 76 - 77 67 static int sedlbauer_config(struct pcmcia_device *link) __devinit ; 78 68 static void sedlbauer_release(struct pcmcia_device *link); 79 - 80 - /* 81 - The attach() and detach() entry points are used to create and destroy 82 - "instances" of the driver, where each instance represents everything 83 - needed to manage one actual PCMCIA card. 84 - */ 85 69 86 70 static void sedlbauer_detach(struct pcmcia_device *p_dev) __devexit; 87 71 ··· 73 91 int stop; 74 92 int cardnr; 75 93 } local_info_t; 76 - 77 - /*====================================================================== 78 - 79 - sedlbauer_attach() creates an "instance" of the driver, allocating 80 - local data structures for one device. The device is registered 81 - with Card Services. 82 - 83 - The dev_link structure is initialized, but we don't actually 84 - configure the card at this point -- we wait until we receive a 85 - card insertion event. 86 - 87 - ======================================================================*/ 88 94 89 95 static int __devinit sedlbauer_probe(struct pcmcia_device *link) 90 96 { ··· 88 118 local->p_dev = link; 89 119 link->priv = local; 90 120 91 - /* 92 - General socket configuration defaults can go here. In this 93 - client, we assume very little, and rely on the CIS for almost 94 - everything. In most clients, many details (i.e., number, sizes, 95 - and attributes of IO windows) are fixed by the nature of the 96 - device, and can be hard-wired here. 97 - */ 98 - 99 - /* from old sedl_cs 100 - */ 101 - /* The io structure describes IO port mapping */ 102 - link->resource[0]->end = 8; 103 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 104 - 105 - link->conf.Attributes = 0; 106 - link->conf.IntType = INT_MEMORY_AND_IO; 107 - 108 121 return sedlbauer_config(link); 109 122 } /* sedlbauer_attach */ 110 - 111 - /*====================================================================== 112 - 113 - This deletes a driver "instance". The device is de-registered 114 - with Card Services. If it has been released, all local data 115 - structures are freed. Otherwise, the structures will be freed 116 - when the device is released. 117 - 118 - ======================================================================*/ 119 123 120 124 static void __devexit sedlbauer_detach(struct pcmcia_device *link) 121 125 { ··· 102 158 kfree(link->priv); 103 159 } /* sedlbauer_detach */ 104 160 105 - /*====================================================================== 106 - 107 - sedlbauer_config() is scheduled to run after a CARD_INSERTION event 108 - is received, to configure the PCMCIA socket, and to make the 109 - device available to the system. 110 - 111 - ======================================================================*/ 112 - static int sedlbauer_config_check(struct pcmcia_device *p_dev, 113 - cistpl_cftable_entry_t *cfg, 114 - cistpl_cftable_entry_t *dflt, 115 - unsigned int vcc, 116 - void *priv_data) 161 + static int sedlbauer_config_check(struct pcmcia_device *p_dev, void *priv_data) 117 162 { 118 - if (cfg->index == 0) 119 - return -ENODEV; 163 + if (p_dev->config_index == 0) 164 + return -EINVAL; 120 165 121 - /* Does this card need audio output? */ 122 - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { 123 - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; 124 - p_dev->conf.Status = CCSR_AUDIO_ENA; 125 - } 126 - 127 - /* Use power settings for Vcc and Vpp if present */ 128 - /* Note that the CIS values need to be rescaled */ 129 - if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { 130 - if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) 131 - return -ENODEV; 132 - } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { 133 - if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000) 134 - return -ENODEV; 135 - } 136 - 137 - if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) 138 - p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; 139 - else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM)) 140 - p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; 141 - 142 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 143 - 144 - /* IO window settings */ 145 - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 146 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 147 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 148 - p_dev->resource[0]->start = io->win[0].base; 149 - p_dev->resource[0]->end = io->win[0].len; 150 - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 151 - p_dev->resource[0]->flags |= 152 - pcmcia_io_cfg_data_width(io->flags); 153 - if (io->nwin > 1) { 154 - p_dev->resource[1]->flags = p_dev->resource[0]->flags; 155 - p_dev->resource[1]->start = io->win[1].base; 156 - p_dev->resource[1]->end = io->win[1].len; 157 - } 158 - /* This reserves IO space but doesn't actually enable it */ 159 - p_dev->io_lines = 3; 160 - if (pcmcia_request_io(p_dev) != 0) 161 - return -ENODEV; 162 - } 163 - 164 - return 0; 166 + p_dev->io_lines = 3; 167 + return pcmcia_request_io(p_dev); 165 168 } 166 - 167 - 168 169 169 170 static int __devinit sedlbauer_config(struct pcmcia_device *link) 170 171 { ··· 118 229 119 230 dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); 120 231 121 - /* 122 - In this loop, we scan the CIS for configuration table entries, 123 - each of which describes a valid card configuration, including 124 - voltage, IO window, memory window, and interrupt settings. 232 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_CHECK_VCC | 233 + CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; 125 234 126 - We make no assumptions about the card to be configured: we use 127 - just the information available in the CIS. In an ideal world, 128 - this would work for any PCMCIA card, but it requires a complete 129 - and accurate CIS. In practice, a driver usually "knows" most of 130 - these things without consulting the CIS, and most client drivers 131 - will only use the CIS to fill in implementation-defined details. 132 - */ 133 235 ret = pcmcia_loop_config(link, sedlbauer_config_check, NULL); 134 236 if (ret) 135 237 goto failed; 136 238 137 - /* 138 - This actually configures the PCMCIA socket -- setting up 139 - the I/O windows and the interrupt mapping, and putting the 140 - card and host interface into "Memory and IO" mode. 141 - */ 142 - ret = pcmcia_request_configuration(link, &link->conf); 239 + ret = pcmcia_enable_device(link); 143 240 if (ret) 144 241 goto failed; 145 - 146 - /* Finally, report what we've done */ 147 - dev_info(&link->dev, "index 0x%02x:", 148 - link->conf.ConfigIndex); 149 - if (link->conf.Vpp) 150 - printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); 151 - if (link->conf.Attributes & CONF_ENABLE_IRQ) 152 - printk(", irq %d", link->irq); 153 - if (link->resource[0]) 154 - printk(" & %pR", link->resource[0]); 155 - if (link->resource[1]) 156 - printk(" & %pR", link->resource[1]); 157 - printk("\n"); 158 242 159 243 icard.para[0] = link->irq; 160 244 icard.para[1] = link->resource[0]->start; ··· 151 289 return -ENODEV; 152 290 153 291 } /* sedlbauer_config */ 154 - 155 - /*====================================================================== 156 - 157 - After a card is removed, sedlbauer_release() will unregister the 158 - device, and release the PCMCIA configuration. If the device is 159 - still open, this will be postponed until it is closed. 160 - 161 - ======================================================================*/ 162 292 163 293 static void sedlbauer_release(struct pcmcia_device *link) 164 294 { ··· 200 346 201 347 static struct pcmcia_driver sedlbauer_driver = { 202 348 .owner = THIS_MODULE, 203 - .drv = { 204 - .name = "sedlbauer_cs", 205 - }, 349 + .name = "sedlbauer_cs", 206 350 .probe = sedlbauer_probe, 207 351 .remove = __devexit_p(sedlbauer_detach), 208 352 .id_table = sedlbauer_ids,
+8 -90
drivers/isdn/hisax/teles_cs.c
··· 27 27 #include <asm/io.h> 28 28 #include <asm/system.h> 29 29 30 - #include <pcmcia/cs.h> 31 30 #include <pcmcia/cistpl.h> 32 31 #include <pcmcia/cisreg.h> 33 32 #include <pcmcia/ds.h> ··· 44 45 static int protocol = 2; /* EURO-ISDN Default */ 45 46 module_param(protocol, int, 0); 46 47 47 - /*====================================================================*/ 48 - 49 - /* 50 - The event() function is this driver's Card Services event handler. 51 - It will be called by Card Services when an appropriate card status 52 - event is received. The config() and release() entry points are 53 - used to configure or release a socket, in response to card insertion 54 - and ejection events. They are invoked from the teles_cs event 55 - handler. 56 - */ 57 - 58 48 static int teles_cs_config(struct pcmcia_device *link) __devinit ; 59 49 static void teles_cs_release(struct pcmcia_device *link); 60 - 61 - /* 62 - The attach() and detach() entry points are used to create and destroy 63 - "instances" of the driver, where each instance represents everything 64 - needed to manage one actual PCMCIA card. 65 - */ 66 - 67 50 static void teles_detach(struct pcmcia_device *p_dev) __devexit ; 68 51 69 52 typedef struct local_info_t { ··· 53 72 int busy; 54 73 int cardnr; 55 74 } local_info_t; 56 - 57 - /*====================================================================== 58 - 59 - teles_attach() creates an "instance" of the driver, allocatingx 60 - local data structures for one device. The device is registered 61 - with Card Services. 62 - 63 - The dev_link structure is initialized, but we don't actually 64 - configure the card at this point -- we wait until we receive a 65 - card insertion event. 66 - 67 - ======================================================================*/ 68 75 69 76 static int __devinit teles_probe(struct pcmcia_device *link) 70 77 { ··· 68 99 local->p_dev = link; 69 100 link->priv = local; 70 101 71 - /* 72 - General socket configuration defaults can go here. In this 73 - client, we assume very little, and rely on the CIS for almost 74 - everything. In most clients, many details (i.e., number, sizes, 75 - and attributes of IO windows) are fixed by the nature of the 76 - device, and can be hard-wired here. 77 - */ 78 - link->resource[0]->end = 96; 79 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 80 - 81 - link->conf.Attributes = CONF_ENABLE_IRQ; 82 - link->conf.IntType = INT_MEMORY_AND_IO; 102 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 83 103 84 104 return teles_cs_config(link); 85 105 } /* teles_attach */ 86 - 87 - /*====================================================================== 88 - 89 - This deletes a driver "instance". The device is de-registered 90 - with Card Services. If it has been released, all local data 91 - structures are freed. Otherwise, the structures will be freed 92 - when the device is released. 93 - 94 - ======================================================================*/ 95 106 96 107 static void __devexit teles_detach(struct pcmcia_device *link) 97 108 { ··· 85 136 kfree(info); 86 137 } /* teles_detach */ 87 138 88 - /*====================================================================== 89 - 90 - teles_cs_config() is scheduled to run after a CARD_INSERTION event 91 - is received, to configure the PCMCIA socket, and to make the 92 - device available to the system. 93 - 94 - ======================================================================*/ 95 - 96 - static int teles_cs_configcheck(struct pcmcia_device *p_dev, 97 - cistpl_cftable_entry_t *cf, 98 - cistpl_cftable_entry_t *dflt, 99 - unsigned int vcc, 100 - void *priv_data) 139 + static int teles_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data) 101 140 { 102 141 int j; 103 142 104 143 p_dev->io_lines = 5; 144 + p_dev->resource[0]->end = 96; 145 + p_dev->resource[0]->flags &= IO_DATA_PATH_WIDTH; 146 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 105 147 106 - if ((cf->io.nwin > 0) && cf->io.win[0].base) { 148 + if ((p_dev->resource[0]->end) && p_dev->resource[0]->start) { 107 149 printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); 108 - p_dev->resource[0]->start = cf->io.win[0].base; 109 150 if (!pcmcia_request_io(p_dev)) 110 151 return 0; 111 152 } else { ··· 125 186 if (!link->irq) 126 187 goto cs_failed; 127 188 128 - i = pcmcia_request_configuration(link, &link->conf); 189 + i = pcmcia_enable_device(link); 129 190 if (i != 0) 130 191 goto cs_failed; 131 - 132 - /* Finally, report what we've done */ 133 - dev_info(&link->dev, "index 0x%02x:", 134 - link->conf.ConfigIndex); 135 - if (link->conf.Attributes & CONF_ENABLE_IRQ) 136 - printk(", irq %d", link->irq); 137 - if (link->resource[0]) 138 - printk(" & %pR", link->resource[0]); 139 - if (link->resource[1]) 140 - printk(" & %pR", link->resource[1]); 141 - printk("\n"); 142 192 143 193 icard.para[0] = link->irq; 144 194 icard.para[1] = link->resource[0]->start; ··· 149 221 teles_cs_release(link); 150 222 return -ENODEV; 151 223 } /* teles_cs_config */ 152 - 153 - /*====================================================================== 154 - 155 - After a card is removed, teles_cs_release() will unregister the net 156 - device, and release the PCMCIA configuration. If the device is 157 - still open, this will be postponed until it is closed. 158 - 159 - ======================================================================*/ 160 224 161 225 static void teles_cs_release(struct pcmcia_device *link) 162 226 { ··· 193 273 194 274 static struct pcmcia_driver teles_cs_driver = { 195 275 .owner = THIS_MODULE, 196 - .drv = { 197 - .name = "teles_cs", 198 - }, 276 + .name = "teles_cs", 199 277 .probe = teles_probe, 200 278 .remove = __devexit_p(teles_detach), 201 279 .id_table = teles_ids,
+1 -4
drivers/mmc/host/sdricoh_cs.c
··· 30 30 #include <linux/ioport.h> 31 31 #include <linux/scatterlist.h> 32 32 33 - #include <pcmcia/cs.h> 34 33 #include <pcmcia/cistpl.h> 35 34 #include <pcmcia/ds.h> 36 35 #include <linux/io.h> ··· 535 536 #endif 536 537 537 538 static struct pcmcia_driver sdricoh_driver = { 538 - .drv = { 539 - .name = DRIVER_NAME, 540 - }, 539 + .name = DRIVER_NAME, 541 540 .probe = sdricoh_pcmcia_probe, 542 541 .remove = sdricoh_pcmcia_detach, 543 542 .id_table = pcmcia_ids,
+35 -67
drivers/mtd/maps/pcmciamtd.c
··· 16 16 #include <asm/io.h> 17 17 #include <asm/system.h> 18 18 19 - #include <pcmcia/cs.h> 20 19 #include <pcmcia/cistpl.h> 21 20 #include <pcmcia/ds.h> 22 21 ··· 100 101 static caddr_t remap_window(struct map_info *map, unsigned long to) 101 102 { 102 103 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; 103 - window_handle_t win = (window_handle_t)map->map_priv_2; 104 + struct resource *win = (struct resource *) map->map_priv_2; 104 105 unsigned int offset; 105 106 int ret; 106 107 ··· 315 316 { 316 317 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; 317 318 struct pcmcia_device *link = dev->p_dev; 318 - modconf_t mod; 319 - int ret; 320 - 321 - mod.Attributes = CONF_VPP1_CHANGE_VALID | CONF_VPP2_CHANGE_VALID; 322 - mod.Vcc = 0; 323 - mod.Vpp1 = mod.Vpp2 = on ? dev->vpp : 0; 324 319 325 320 DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); 326 - ret = pcmcia_modify_configuration(link, &mod); 321 + pcmcia_fixup_vpp(link, on ? dev->vpp : 0); 327 322 } 328 323 329 - 330 - /* After a card is removed, pcmciamtd_release() will unregister the 331 - * device, and release the PCMCIA configuration. If the device is 332 - * still open, this will be postponed until it is closed. 333 - */ 334 324 335 325 static void pcmciamtd_release(struct pcmcia_device *link) 336 326 { ··· 327 339 328 340 DEBUG(3, "link = 0x%p", link); 329 341 330 - if (link->win) { 342 + if (link->resource[2]->end) { 331 343 if(dev->win_base) { 332 344 iounmap(dev->win_base); 333 345 dev->win_base = NULL; ··· 470 482 } 471 483 472 484 473 - /* pcmciamtd_config() is scheduled to run after a CARD_INSERTION event 474 - * is received, to configure the PCMCIA socket, and to make the 475 - * MTD device available to the system. 476 - */ 477 - 478 485 static int pcmciamtd_config(struct pcmcia_device *link) 479 486 { 480 487 struct pcmciamtd_dev *dev = link->priv; 481 488 struct mtd_info *mtd = NULL; 482 - win_req_t req; 483 489 int ret; 484 - int i; 490 + int i, j = 0; 485 491 static char *probes[] = { "jedec_probe", "cfi_probe" }; 486 492 int new_name = 0; 487 493 ··· 502 520 * smaller windows until we succeed 503 521 */ 504 522 505 - req.Attributes = WIN_MEMORY_TYPE_CM | WIN_ENABLE; 506 - req.Attributes |= (dev->pcmcia_map.bankwidth == 1) ? WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; 507 - req.Base = 0; 508 - req.AccessSpeed = mem_speed; 509 - link->win = (window_handle_t)link; 510 - req.Size = (force_size) ? force_size << 20 : MAX_PCMCIA_ADDR; 523 + link->resource[2]->flags |= WIN_MEMORY_TYPE_CM | WIN_ENABLE; 524 + link->resource[2]->flags |= (dev->pcmcia_map.bankwidth == 1) ? 525 + WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; 526 + link->resource[2]->start = 0; 527 + link->resource[2]->end = (force_size) ? force_size << 20 : 528 + MAX_PCMCIA_ADDR; 511 529 dev->win_size = 0; 512 530 513 531 do { 514 532 int ret; 515 - DEBUG(2, "requesting window with size = %dKiB memspeed = %d", 516 - req.Size >> 10, req.AccessSpeed); 517 - ret = pcmcia_request_window(link, &req, &link->win); 533 + DEBUG(2, "requesting window with size = %luKiB memspeed = %d", 534 + (unsigned long) resource_size(link->resource[2]) >> 10, 535 + mem_speed); 536 + ret = pcmcia_request_window(link, link->resource[2], mem_speed); 518 537 DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); 519 538 if(ret) { 520 - req.Size >>= 1; 539 + j++; 540 + link->resource[2]->start = 0; 541 + link->resource[2]->end = (force_size) ? 542 + force_size << 20 : MAX_PCMCIA_ADDR; 543 + link->resource[2]->end >>= j; 521 544 } else { 522 - DEBUG(2, "Got window of size %dKiB", req.Size >> 10); 523 - dev->win_size = req.Size; 545 + DEBUG(2, "Got window of size %luKiB", (unsigned long) 546 + resource_size(link->resource[2]) >> 10); 547 + dev->win_size = resource_size(link->resource[2]); 524 548 break; 525 549 } 526 - } while(req.Size >= 0x1000); 550 + } while (link->resource[2]->end >= 0x1000); 527 551 528 552 DEBUG(2, "dev->win_size = %d", dev->win_size); 529 553 ··· 541 553 DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); 542 554 543 555 /* Get write protect status */ 544 - DEBUG(2, "window handle = 0x%8.8lx", (unsigned long)link->win); 545 - dev->win_base = ioremap(req.Base, req.Size); 556 + dev->win_base = ioremap(link->resource[2]->start, 557 + resource_size(link->resource[2])); 546 558 if(!dev->win_base) { 547 - dev_err(&dev->p_dev->dev, "ioremap(%lu, %u) failed\n", 548 - req.Base, req.Size); 559 + dev_err(&dev->p_dev->dev, "ioremap(%pR) failed\n", 560 + link->resource[2]); 549 561 pcmciamtd_release(link); 550 562 return -ENODEV; 551 563 } 552 - DEBUG(1, "mapped window dev = %p req.base = 0x%lx base = %p size = 0x%x", 553 - dev, req.Base, dev->win_base, req.Size); 564 + DEBUG(1, "mapped window dev = %p @ %pR, base = %p", 565 + dev, link->resource[2], dev->win_base); 554 566 555 567 dev->offset = 0; 556 568 dev->pcmcia_map.map_priv_1 = (unsigned long)dev; 557 - dev->pcmcia_map.map_priv_2 = (unsigned long)link->win; 569 + dev->pcmcia_map.map_priv_2 = (unsigned long)link->resource[2]; 558 570 559 571 dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp; 560 - link->conf.Attributes = 0; 561 572 if(setvpp == 2) { 562 - link->conf.Vpp = dev->vpp; 573 + link->vpp = dev->vpp; 563 574 } else { 564 - link->conf.Vpp = 0; 575 + link->vpp = 0; 565 576 } 566 577 567 - link->conf.IntType = INT_MEMORY; 568 - link->conf.ConfigIndex = 0; 578 + link->config_index = 0; 569 579 DEBUG(2, "Setting Configuration"); 570 - ret = pcmcia_request_configuration(link, &link->conf); 580 + ret = pcmcia_enable_device(link); 571 581 if (ret != 0) { 572 582 if (dev->win_base) { 573 583 iounmap(dev->win_base); ··· 666 680 } 667 681 668 682 669 - /* This deletes a driver "instance". The device is de-registered 670 - * with Card Services. If it has been released, all local data 671 - * structures are freed. Otherwise, the structures will be freed 672 - * when the device is released. 673 - */ 674 - 675 683 static void pcmciamtd_detach(struct pcmcia_device *link) 676 684 { 677 685 struct pcmciamtd_dev *dev = link->priv; ··· 683 703 } 684 704 685 705 686 - /* pcmciamtd_attach() creates an "instance" of the driver, allocating 687 - * local data structures for one device. The device is registered 688 - * with Card Services. 689 - */ 690 - 691 706 static int pcmciamtd_probe(struct pcmcia_device *link) 692 707 { 693 708 struct pcmciamtd_dev *dev; ··· 694 719 695 720 dev->p_dev = link; 696 721 link->priv = dev; 697 - 698 - link->conf.Attributes = 0; 699 - link->conf.IntType = INT_MEMORY; 700 722 701 723 return pcmciamtd_config(link); 702 724 } ··· 729 757 MODULE_DEVICE_TABLE(pcmcia, pcmciamtd_ids); 730 758 731 759 static struct pcmcia_driver pcmciamtd_driver = { 732 - .drv = { 733 - .name = "pcmciamtd" 734 - }, 760 + .name = "pcmciamtd", 735 761 .probe = pcmciamtd_probe, 736 762 .remove = pcmciamtd_detach, 737 763 .owner = THIS_MODULE, ··· 741 771 742 772 static int __init init_pcmciamtd(void) 743 773 { 744 - info(DRIVER_DESC); 745 - 746 774 if(bankwidth && bankwidth != 1 && bankwidth != 2) { 747 775 info("bad bankwidth (%d), using default", bankwidth); 748 776 bankwidth = 2;
+5 -30
drivers/net/pcmcia/3c574_cs.c
··· 87 87 #include <linux/bitops.h> 88 88 #include <linux/mii.h> 89 89 90 - #include <pcmcia/cs.h> 91 90 #include <pcmcia/cistpl.h> 92 91 #include <pcmcia/cisreg.h> 93 92 #include <pcmcia/ciscode.h> ··· 279 280 spin_lock_init(&lp->window_lock); 280 281 link->resource[0]->end = 32; 281 282 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 282 - link->conf.Attributes = CONF_ENABLE_IRQ; 283 - link->conf.IntType = INT_MEMORY_AND_IO; 284 - link->conf.ConfigIndex = 1; 283 + link->config_flags |= CONF_ENABLE_IRQ; 284 + link->config_index = 1; 285 285 286 286 dev->netdev_ops = &el3_netdev_ops; 287 287 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 288 288 dev->watchdog_timeo = TX_TIMEOUT; 289 289 290 290 return tc574_config(link); 291 - } /* tc574_attach */ 292 - 293 - /* 294 - 295 - This deletes a driver "instance". The device is de-registered 296 - with Card Services. If it has been released, all local data 297 - structures are freed. Otherwise, the structures will be freed 298 - when the device is released. 299 - 300 - */ 291 + } 301 292 302 293 static void tc574_detach(struct pcmcia_device *link) 303 294 { ··· 301 312 302 313 free_netdev(dev); 303 314 } /* tc574_detach */ 304 - 305 - /* 306 - tc574_config() is scheduled to run after a CARD_INSERTION event 307 - is received, to configure the PCMCIA socket, and to make the 308 - ethernet device available to the system. 309 - */ 310 315 311 316 static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; 312 317 ··· 335 352 if (ret) 336 353 goto failed; 337 354 338 - ret = pcmcia_request_configuration(link, &link->conf); 355 + ret = pcmcia_enable_device(link); 339 356 if (ret) 340 357 goto failed; 341 358 ··· 447 464 return -ENODEV; 448 465 449 466 } /* tc574_config */ 450 - 451 - /* 452 - After a card is removed, tc574_release() will unregister the net 453 - device, and release the PCMCIA configuration. If the device is 454 - still open, this will be postponed until it is closed. 455 - */ 456 467 457 468 static void tc574_release(struct pcmcia_device *link) 458 469 { ··· 1175 1198 1176 1199 static struct pcmcia_driver tc574_driver = { 1177 1200 .owner = THIS_MODULE, 1178 - .drv = { 1179 - .name = "3c574_cs", 1180 - }, 1201 + .name = "3c574_cs", 1181 1202 .probe = tc574_probe, 1182 1203 .remove = tc574_detach, 1183 1204 .id_table = tc574_ids,
+5 -42
drivers/net/pcmcia/3c589_cs.c
··· 41 41 #include <linux/bitops.h> 42 42 #include <linux/jiffies.h> 43 43 44 - #include <pcmcia/cs.h> 45 44 #include <pcmcia/cistpl.h> 46 45 #include <pcmcia/cisreg.h> 47 46 #include <pcmcia/ciscode.h> ··· 175 176 176 177 static void tc589_detach(struct pcmcia_device *p_dev); 177 178 178 - /*====================================================================== 179 - 180 - tc589_attach() creates an "instance" of the driver, allocating 181 - local data structures for one device. The device is registered 182 - with Card Services. 183 - 184 - ======================================================================*/ 185 - 186 179 static const struct net_device_ops el3_netdev_ops = { 187 180 .ndo_open = el3_open, 188 181 .ndo_stop = el3_close, ··· 207 216 link->resource[0]->end = 16; 208 217 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 209 218 210 - link->conf.Attributes = CONF_ENABLE_IRQ; 211 - link->conf.IntType = INT_MEMORY_AND_IO; 212 - link->conf.ConfigIndex = 1; 219 + link->config_flags |= CONF_ENABLE_IRQ; 220 + link->config_index = 1; 213 221 214 222 dev->netdev_ops = &el3_netdev_ops; 215 223 dev->watchdog_timeo = TX_TIMEOUT; ··· 216 226 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 217 227 218 228 return tc589_config(link); 219 - } /* tc589_attach */ 220 - 221 - /*====================================================================== 222 - 223 - This deletes a driver "instance". The device is de-registered 224 - with Card Services. If it has been released, all local data 225 - structures are freed. Otherwise, the structures will be freed 226 - when the device is released. 227 - 228 - ======================================================================*/ 229 + } 229 230 230 231 static void tc589_detach(struct pcmcia_device *link) 231 232 { ··· 230 249 231 250 free_netdev(dev); 232 251 } /* tc589_detach */ 233 - 234 - /*====================================================================== 235 - 236 - tc589_config() is scheduled to run after a CARD_INSERTION event 237 - is received, to configure the PCMCIA socket, and to make the 238 - ethernet device available to the system. 239 - 240 - ======================================================================*/ 241 252 242 253 static int tc589_config(struct pcmcia_device *link) 243 254 { ··· 267 294 if (ret) 268 295 goto failed; 269 296 270 - ret = pcmcia_request_configuration(link, &link->conf); 297 + ret = pcmcia_enable_device(link); 271 298 if (ret) 272 299 goto failed; 273 300 ··· 324 351 tc589_release(link); 325 352 return -ENODEV; 326 353 } /* tc589_config */ 327 - 328 - /*====================================================================== 329 - 330 - After a card is removed, tc589_release() will unregister the net 331 - device, and release the PCMCIA configuration. If the device is 332 - still open, this will be postponed until it is closed. 333 - 334 - ======================================================================*/ 335 354 336 355 static void tc589_release(struct pcmcia_device *link) 337 356 { ··· 920 955 921 956 static struct pcmcia_driver tc589_driver = { 922 957 .owner = THIS_MODULE, 923 - .drv = { 924 - .name = "3c589_cs", 925 - }, 958 + .name = "3c589_cs", 926 959 .probe = tc589_probe, 927 960 .remove = tc589_detach, 928 961 .id_table = tc589_ids,
+15 -72
drivers/net/pcmcia/axnet_cs.c
··· 39 39 #include <linux/mii.h> 40 40 #include "../8390.h" 41 41 42 - #include <pcmcia/cs.h> 43 42 #include <pcmcia/cistpl.h> 44 43 #include <pcmcia/ciscode.h> 45 44 #include <pcmcia/ds.h> ··· 139 140 .ndo_validate_addr = eth_validate_addr, 140 141 }; 141 142 142 - /*====================================================================== 143 - 144 - axnet_attach() creates an "instance" of the driver, allocating 145 - local data structures for one device. The device is registered 146 - with Card Services. 147 - 148 - ======================================================================*/ 149 - 150 143 static int axnet_probe(struct pcmcia_device *link) 151 144 { 152 145 axnet_dev_t *info; ··· 157 166 info = PRIV(dev); 158 167 info->p_dev = link; 159 168 link->priv = dev; 160 - link->conf.Attributes = CONF_ENABLE_IRQ; 161 - link->conf.IntType = INT_MEMORY_AND_IO; 169 + link->config_flags |= CONF_ENABLE_IRQ; 162 170 163 171 dev->netdev_ops = &axnet_netdev_ops; 164 172 ··· 166 176 167 177 return axnet_config(link); 168 178 } /* axnet_attach */ 169 - 170 - /*====================================================================== 171 - 172 - This deletes a driver "instance". The device is de-registered 173 - with Card Services. If it has been released, all local data 174 - structures are freed. Otherwise, the structures will be freed 175 - when the device is released. 176 - 177 - ======================================================================*/ 178 179 179 180 static void axnet_detach(struct pcmcia_device *link) 180 181 { ··· 212 231 }; 213 232 214 233 /* Not much of a test, but the alternatives are messy */ 215 - if (link->conf.ConfigBase != 0x03c0) 234 + if (link->config_base != 0x03c0) 216 235 return 0; 217 236 218 237 axnet_reset_8390(dev); ··· 228 247 } 229 248 return 1; 230 249 } /* get_prom */ 231 - 232 - /*====================================================================== 233 - 234 - axnet_config() is scheduled to run after a CARD_INSERTION event 235 - is received, to configure the PCMCIA socket, and to make the 236 - ethernet device available to the system. 237 - 238 - ======================================================================*/ 239 250 240 251 static int try_io_port(struct pcmcia_device *link) 241 252 { ··· 259 286 } 260 287 } 261 288 262 - static int axnet_configcheck(struct pcmcia_device *p_dev, 263 - cistpl_cftable_entry_t *cfg, 264 - cistpl_cftable_entry_t *dflt, 265 - unsigned int vcc, 266 - void *priv_data) 289 + static int axnet_configcheck(struct pcmcia_device *p_dev, void *priv_data) 267 290 { 268 - int i; 269 - cistpl_io_t *io = &cfg->io; 291 + if (p_dev->config_index == 0) 292 + return -EINVAL; 270 293 271 - if (cfg->index == 0 || cfg->io.nwin == 0) 294 + p_dev->config_index = 0x05; 295 + if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32) 272 296 return -ENODEV; 273 297 274 - p_dev->conf.ConfigIndex = 0x05; 275 - /* For multifunction cards, by convention, we configure the 276 - network function with window 0, and serial with window 1 */ 277 - if (io->nwin > 1) { 278 - i = (io->win[1].len > io->win[0].len); 279 - p_dev->resource[1]->start = io->win[1-i].base; 280 - p_dev->resource[1]->end = io->win[1-i].len; 281 - } else { 282 - i = p_dev->resource[1]->end = 0; 283 - } 284 - p_dev->resource[0]->start = io->win[i].base; 285 - p_dev->resource[0]->end = io->win[i].len; 286 - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 287 - if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) 288 - return try_io_port(p_dev); 289 - 290 - return -ENODEV; 298 + return try_io_port(p_dev); 291 299 } 292 300 293 301 static int axnet_config(struct pcmcia_device *link) ··· 280 326 dev_dbg(&link->dev, "axnet_config(0x%p)\n", link); 281 327 282 328 /* don't trust the CIS on this; Linksys got it wrong */ 283 - link->conf.Present = 0x63; 329 + link->config_regs = 0x63; 330 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 284 331 ret = pcmcia_loop_config(link, axnet_configcheck, NULL); 285 332 if (ret != 0) 286 333 goto failed; 287 334 288 335 if (!link->irq) 289 336 goto failed; 337 + 338 + if (resource_size(link->resource[1]) == 8) 339 + link->config_flags |= CONF_ENABLE_SPKR; 290 340 291 - if (resource_size(link->resource[1]) == 8) { 292 - link->conf.Attributes |= CONF_ENABLE_SPKR; 293 - link->conf.Status = CCSR_AUDIO_ENA; 294 - } 295 - 296 - ret = pcmcia_request_configuration(link, &link->conf); 341 + ret = pcmcia_enable_device(link); 297 342 if (ret) 298 343 goto failed; 299 344 ··· 366 413 axnet_release(link); 367 414 return -ENODEV; 368 415 } /* axnet_config */ 369 - 370 - /*====================================================================== 371 - 372 - After a card is removed, axnet_release() will unregister the net 373 - device, and release the PCMCIA configuration. If the device is 374 - still open, this will be postponed until it is closed. 375 - 376 - ======================================================================*/ 377 416 378 417 static void axnet_release(struct pcmcia_device *link) 379 418 { ··· 728 783 729 784 static struct pcmcia_driver axnet_cs_driver = { 730 785 .owner = THIS_MODULE, 731 - .drv = { 732 - .name = "axnet_cs", 733 - }, 786 + .name = "axnet_cs", 734 787 .probe = axnet_probe, 735 788 .remove = axnet_detach, 736 789 .id_table = axnet_ids,
+3 -40
drivers/net/pcmcia/com20020_cs.c
··· 43 43 #include <linux/arcdevice.h> 44 44 #include <linux/com20020.h> 45 45 46 - #include <pcmcia/cs.h> 47 46 #include <pcmcia/cistpl.h> 48 47 #include <pcmcia/ds.h> 49 48 ··· 122 123 struct net_device *dev; 123 124 } com20020_dev_t; 124 125 125 - /*====================================================================== 126 - 127 - com20020_attach() creates an "instance" of the driver, allocating 128 - local data structures for one device. The device is registered 129 - with Card Services. 130 - 131 - ======================================================================*/ 132 - 133 126 static int com20020_probe(struct pcmcia_device *p_dev) 134 127 { 135 128 com20020_dev_t *info; ··· 151 160 152 161 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 153 162 p_dev->resource[0]->end = 16; 154 - p_dev->conf.Attributes = CONF_ENABLE_IRQ; 155 - p_dev->conf.IntType = INT_MEMORY_AND_IO; 163 + p_dev->config_flags |= CONF_ENABLE_IRQ; 156 164 157 165 info->dev = dev; 158 166 p_dev->priv = info; ··· 163 173 fail_alloc_info: 164 174 return -ENOMEM; 165 175 } /* com20020_attach */ 166 - 167 - /*====================================================================== 168 - 169 - This deletes a driver "instance". The device is de-registered 170 - with Card Services. If it has been released, all local data 171 - structures are freed. Otherwise, the structures will be freed 172 - when the device is released. 173 - 174 - ======================================================================*/ 175 176 176 177 static void com20020_detach(struct pcmcia_device *link) 177 178 { ··· 201 220 } 202 221 203 222 } /* com20020_detach */ 204 - 205 - /*====================================================================== 206 - 207 - com20020_config() is scheduled to run after a CARD_INSERTION event 208 - is received, to configure the PCMCIA socket, and to make the 209 - device available to the system. 210 - 211 - ======================================================================*/ 212 223 213 224 static int com20020_config(struct pcmcia_device *link) 214 225 { ··· 255 282 256 283 dev->irq = link->irq; 257 284 258 - ret = pcmcia_request_configuration(link, &link->conf); 285 + ret = pcmcia_enable_device(link); 259 286 if (ret) 260 287 goto failed; 261 288 ··· 288 315 com20020_release(link); 289 316 return -ENODEV; 290 317 } /* com20020_config */ 291 - 292 - /*====================================================================== 293 - 294 - After a card is removed, com20020_release() will unregister the net 295 - device, and release the PCMCIA configuration. If the device is 296 - still open, this will be postponed until it is closed. 297 - 298 - ======================================================================*/ 299 318 300 319 static void com20020_release(struct pcmcia_device *link) 301 320 { ··· 331 366 332 367 static struct pcmcia_driver com20020_cs_driver = { 333 368 .owner = THIS_MODULE, 334 - .drv = { 335 - .name = "com20020_cs", 336 - }, 369 + .name = "com20020_cs", 337 370 .probe = com20020_probe, 338 371 .remove = com20020_detach, 339 372 .id_table = com20020_ids,
+27 -40
drivers/net/pcmcia/fmvj18x_cs.c
··· 49 49 #include <linux/ioport.h> 50 50 #include <linux/crc32.h> 51 51 52 - #include <pcmcia/cs.h> 53 52 #include <pcmcia/cistpl.h> 54 53 #include <pcmcia/ciscode.h> 55 54 #include <pcmcia/ds.h> ··· 251 252 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 252 253 253 254 /* General socket configuration */ 254 - link->conf.Attributes = CONF_ENABLE_IRQ; 255 - link->conf.IntType = INT_MEMORY_AND_IO; 255 + link->config_flags |= CONF_ENABLE_IRQ; 256 256 257 257 dev->netdev_ops = &fjn_netdev_ops; 258 258 dev->watchdog_timeo = TX_TIMEOUT; ··· 311 313 ret = pcmcia_request_io(link); 312 314 if (ret == 0) { 313 315 /* calculate ConfigIndex value */ 314 - link->conf.ConfigIndex = 316 + link->config_index = 315 317 ((link->resource[0]->start & 0x0f0) >> 3) | 0x22; 316 318 return ret; 317 319 } ··· 319 321 return ret; /* RequestIO failed */ 320 322 } 321 323 322 - static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, 323 - cistpl_cftable_entry_t *cfg, 324 - cistpl_cftable_entry_t *dflt, 325 - unsigned int vcc, 326 - void *priv_data) 324 + static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, void *priv_data) 327 325 { 328 326 return 0; /* strange, but that's what the code did already before... */ 329 327 } ··· 356 362 link->card_id == PRODID_TDK_NP9610 || 357 363 link->card_id == PRODID_TDK_MN3200) { 358 364 /* MultiFunction Card */ 359 - link->conf.ConfigBase = 0x800; 360 - link->conf.ConfigIndex = 0x47; 365 + link->config_base = 0x800; 366 + link->config_index = 0x47; 361 367 link->resource[1]->end = 8; 362 368 } 363 369 break; 364 370 case MANFID_NEC: 365 371 cardtype = NEC; /* MultiFunction Card */ 366 - link->conf.ConfigBase = 0x800; 367 - link->conf.ConfigIndex = 0x47; 372 + link->config_base = 0x800; 373 + link->config_index = 0x47; 368 374 link->resource[1]->end = 8; 369 375 break; 370 376 case MANFID_KME: 371 377 cardtype = KME; /* MultiFunction Card */ 372 - link->conf.ConfigBase = 0x800; 373 - link->conf.ConfigIndex = 0x47; 378 + link->config_base = 0x800; 379 + link->config_index = 0x47; 374 380 link->resource[1]->end = 8; 375 381 break; 376 382 case MANFID_CONTEC: 377 383 cardtype = CONTEC; 378 384 break; 379 385 case MANFID_FUJITSU: 380 - if (link->conf.ConfigBase == 0x0fe0) 386 + if (link->config_base == 0x0fe0) 381 387 cardtype = MBH10302; 382 388 else if (link->card_id == PRODID_FUJITSU_MBH10302) 383 389 /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), ··· 397 403 case MANFID_FUJITSU: 398 404 if (link->card_id == PRODID_FUJITSU_MBH10304) { 399 405 cardtype = XXX10304; /* MBH10304 with buggy CIS */ 400 - link->conf.ConfigIndex = 0x20; 406 + link->config_index = 0x20; 401 407 } else { 402 408 cardtype = MBH10302; /* NextCom NC5310, etc. */ 403 - link->conf.ConfigIndex = 1; 409 + link->config_index = 1; 404 410 } 405 411 break; 406 412 case MANFID_UNGERMANN: ··· 408 414 break; 409 415 default: 410 416 cardtype = MBH10302; 411 - link->conf.ConfigIndex = 1; 417 + link->config_index = 1; 412 418 } 413 419 } 414 420 ··· 426 432 ret = pcmcia_request_irq(link, fjn_interrupt); 427 433 if (ret) 428 434 goto failed; 429 - ret = pcmcia_request_configuration(link, &link->conf); 435 + ret = pcmcia_enable_device(link); 430 436 if (ret) 431 437 goto failed; 432 438 ··· 538 544 539 545 static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) 540 546 { 541 - win_req_t req; 542 547 u_char __iomem *base; 543 548 int i, j; 544 549 545 550 /* Allocate a small memory window */ 546 - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 547 - req.Base = 0; req.Size = 0; 548 - req.AccessSpeed = 0; 549 - i = pcmcia_request_window(link, &req, &link->win); 551 + link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 552 + link->resource[2]->start = 0; link->resource[2]->end = 0; 553 + i = pcmcia_request_window(link, link->resource[2], 0); 550 554 if (i != 0) 551 555 return -1; 552 556 553 - base = ioremap(req.Base, req.Size); 554 - pcmcia_map_mem_page(link, link->win, 0); 557 + base = ioremap(link->resource[2]->start, resource_size(link->resource[2])); 558 + pcmcia_map_mem_page(link, link->resource[2], 0); 555 559 556 560 /* 557 561 * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format ··· 574 582 } 575 583 576 584 iounmap(base); 577 - j = pcmcia_release_window(link, link->win); 585 + j = pcmcia_release_window(link, link->resource[2]); 578 586 return (i != 0x200) ? 0 : -1; 579 587 580 588 } /* fmvj18x_get_hwinfo */ ··· 582 590 583 591 static int fmvj18x_setup_mfc(struct pcmcia_device *link) 584 592 { 585 - win_req_t req; 586 593 int i; 587 594 struct net_device *dev = link->priv; 588 595 unsigned int ioaddr; 589 596 local_info_t *lp = netdev_priv(dev); 590 597 591 598 /* Allocate a small memory window */ 592 - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 593 - req.Base = 0; req.Size = 0; 594 - req.AccessSpeed = 0; 595 - i = pcmcia_request_window(link, &req, &link->win); 599 + link->resource[3]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 600 + link->resource[3]->start = link->resource[3]->end = 0; 601 + i = pcmcia_request_window(link, link->resource[3], 0); 596 602 if (i != 0) 597 603 return -1; 598 604 599 - lp->base = ioremap(req.Base, req.Size); 605 + lp->base = ioremap(link->resource[3]->start, 606 + resource_size(link->resource[3])); 600 607 if (lp->base == NULL) { 601 608 printk(KERN_NOTICE "fmvj18x_cs: ioremap failed\n"); 602 609 return -1; 603 610 } 604 611 605 - i = pcmcia_map_mem_page(link, link->win, 0); 612 + i = pcmcia_map_mem_page(link, link->resource[3], 0); 606 613 if (i != 0) { 607 614 iounmap(lp->base); 608 615 lp->base = NULL; ··· 629 638 struct net_device *dev = link->priv; 630 639 local_info_t *lp = netdev_priv(dev); 631 640 u_char __iomem *tmp; 632 - int j; 633 641 634 642 dev_dbg(&link->dev, "fmvj18x_release\n"); 635 643 ··· 636 646 tmp = lp->base; 637 647 lp->base = NULL; /* set NULL before iounmap */ 638 648 iounmap(tmp); 639 - j = pcmcia_release_window(link, link->win); 640 649 } 641 650 642 651 pcmcia_disable_device(link); ··· 697 708 698 709 static struct pcmcia_driver fmvj18x_cs_driver = { 699 710 .owner = THIS_MODULE, 700 - .drv = { 701 - .name = "fmvj18x_cs", 702 - }, 711 + .name = "fmvj18x_cs", 703 712 .probe = fmvj18x_probe, 704 713 .remove = fmvj18x_detach, 705 714 .id_table = fmvj18x_ids,
+25 -64
drivers/net/pcmcia/ibmtr_cs.c
··· 57 57 #include <linux/trdevice.h> 58 58 #include <linux/ibmtr.h> 59 59 60 - #include <pcmcia/cs.h> 61 60 #include <pcmcia/cistpl.h> 62 61 #include <pcmcia/ds.h> 63 62 ··· 101 102 102 103 typedef struct ibmtr_dev_t { 103 104 struct pcmcia_device *p_dev; 104 - struct net_device *dev; 105 - window_handle_t sram_win_handle; 106 - struct tok_info *ti; 105 + struct net_device *dev; 106 + struct tok_info *ti; 107 107 } ibmtr_dev_t; 108 108 109 109 static void netdev_get_drvinfo(struct net_device *dev, ··· 120 122 struct net_device *dev = info->dev; 121 123 return tok_interrupt(irq, dev); 122 124 }; 123 - 124 - /*====================================================================== 125 - 126 - ibmtr_attach() creates an "instance" of the driver, allocating 127 - local data structures for one device. The device is registered 128 - with Card Services. 129 - 130 - ======================================================================*/ 131 125 132 126 static int __devinit ibmtr_attach(struct pcmcia_device *link) 133 127 { ··· 143 153 144 154 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 145 155 link->resource[0]->end = 4; 146 - link->conf.Attributes = CONF_ENABLE_IRQ; 147 - link->conf.IntType = INT_MEMORY_AND_IO; 148 - link->conf.Present = PRESENT_OPTION; 156 + link->config_flags |= CONF_ENABLE_IRQ; 157 + link->config_regs = PRESENT_OPTION; 149 158 150 159 info->dev = dev; 151 160 ··· 152 163 153 164 return ibmtr_config(link); 154 165 } /* ibmtr_attach */ 155 - 156 - /*====================================================================== 157 - 158 - This deletes a driver "instance". The device is de-registered 159 - with Card Services. If it has been released, all local data 160 - structures are freed. Otherwise, the structures will be freed 161 - when the device is released. 162 - 163 - ======================================================================*/ 164 166 165 167 static void ibmtr_detach(struct pcmcia_device *link) 166 168 { ··· 177 197 kfree(info); 178 198 } /* ibmtr_detach */ 179 199 180 - /*====================================================================== 181 - 182 - ibmtr_config() is scheduled to run after a CARD_INSERTION event 183 - is received, to configure the PCMCIA socket, and to make the 184 - token-ring device available to the system. 185 - 186 - ======================================================================*/ 187 - 188 200 static int __devinit ibmtr_config(struct pcmcia_device *link) 189 201 { 190 202 ibmtr_dev_t *info = link->priv; 191 203 struct net_device *dev = info->dev; 192 204 struct tok_info *ti = netdev_priv(dev); 193 - win_req_t req; 194 205 int i, ret; 195 206 196 207 dev_dbg(&link->dev, "ibmtr_config\n"); 197 208 198 - link->conf.ConfigIndex = 0x61; 199 209 link->io_lines = 16; 210 + link->config_index = 0x61; 200 211 201 212 /* Determine if this is PRIMARY or ALTERNATE. */ 202 213 ··· 211 240 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); 212 241 213 242 /* Allocate the MMIO memory window */ 214 - req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 215 - req.Attributes |= WIN_USE_WAIT; 216 - req.Base = 0; 217 - req.Size = 0x2000; 218 - req.AccessSpeed = 250; 219 - ret = pcmcia_request_window(link, &req, &link->win); 243 + link->resource[2]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 244 + link->resource[2]->flags |= WIN_USE_WAIT; 245 + link->resource[2]->start = 0; 246 + link->resource[2]->end = 0x2000; 247 + ret = pcmcia_request_window(link, link->resource[2], 250); 220 248 if (ret) 221 249 goto failed; 222 250 223 - ret = pcmcia_map_mem_page(link, link->win, mmiobase); 251 + ret = pcmcia_map_mem_page(link, link->resource[2], mmiobase); 224 252 if (ret) 225 253 goto failed; 226 - ti->mmio = ioremap(req.Base, req.Size); 254 + ti->mmio = ioremap(link->resource[2]->start, 255 + resource_size(link->resource[2])); 227 256 228 257 /* Allocate the SRAM memory window */ 229 - req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 230 - req.Attributes |= WIN_USE_WAIT; 231 - req.Base = 0; 232 - req.Size = sramsize * 1024; 233 - req.AccessSpeed = 250; 234 - ret = pcmcia_request_window(link, &req, &info->sram_win_handle); 258 + link->resource[3]->flags = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 259 + link->resource[3]->flags |= WIN_USE_WAIT; 260 + link->resource[3]->start = 0; 261 + link->resource[3]->end = sramsize * 1024; 262 + ret = pcmcia_request_window(link, link->resource[3], 250); 235 263 if (ret) 236 264 goto failed; 237 265 238 - ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase); 266 + ret = pcmcia_map_mem_page(link, link->resource[3], srambase); 239 267 if (ret) 240 268 goto failed; 241 269 242 270 ti->sram_base = srambase >> 12; 243 - ti->sram_virt = ioremap(req.Base, req.Size); 244 - ti->sram_phys = req.Base; 271 + ti->sram_virt = ioremap(link->resource[3]->start, 272 + resource_size(link->resource[3])); 273 + ti->sram_phys = link->resource[3]->start; 245 274 246 - ret = pcmcia_request_configuration(link, &link->conf); 275 + ret = pcmcia_enable_device(link); 247 276 if (ret) 248 277 goto failed; 249 278 ··· 272 301 return -ENODEV; 273 302 } /* ibmtr_config */ 274 303 275 - /*====================================================================== 276 - 277 - After a card is removed, ibmtr_release() will unregister the net 278 - device, and release the PCMCIA configuration. If the device is 279 - still open, this will be postponed until it is closed. 280 - 281 - ======================================================================*/ 282 - 283 304 static void ibmtr_release(struct pcmcia_device *link) 284 305 { 285 306 ibmtr_dev_t *info = link->priv; ··· 279 316 280 317 dev_dbg(&link->dev, "ibmtr_release\n"); 281 318 282 - if (link->win) { 319 + if (link->resource[2]->end) { 283 320 struct tok_info *ti = netdev_priv(dev); 284 321 iounmap(ti->mmio); 285 322 } ··· 361 398 362 399 static struct pcmcia_driver ibmtr_cs_driver = { 363 400 .owner = THIS_MODULE, 364 - .drv = { 365 - .name = "ibmtr_cs", 366 - }, 401 + .name = "ibmtr_cs", 367 402 .probe = ibmtr_attach, 368 403 .remove = ibmtr_detach, 369 404 .id_table = ibmtr_ids,
+5 -37
drivers/net/pcmcia/nmclan_cs.c
··· 146 146 #include <linux/ioport.h> 147 147 #include <linux/bitops.h> 148 148 149 - #include <pcmcia/cs.h> 150 149 #include <pcmcia/cisreg.h> 151 150 #include <pcmcia/cistpl.h> 152 151 #include <pcmcia/ds.h> ··· 434 435 .ndo_validate_addr = eth_validate_addr, 435 436 }; 436 437 437 - /* ---------------------------------------------------------------------------- 438 - nmclan_attach 439 - Creates an "instance" of the driver, allocating local data 440 - structures for one device. The device is registered with Card 441 - Services. 442 - ---------------------------------------------------------------------------- */ 443 - 444 438 static int nmclan_probe(struct pcmcia_device *link) 445 439 { 446 440 mace_private *lp; ··· 452 460 spin_lock_init(&lp->bank_lock); 453 461 link->resource[0]->end = 32; 454 462 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 455 - link->conf.Attributes = CONF_ENABLE_IRQ; 456 - link->conf.IntType = INT_MEMORY_AND_IO; 457 - link->conf.ConfigIndex = 1; 458 - link->conf.Present = PRESENT_OPTION; 463 + link->config_flags |= CONF_ENABLE_IRQ; 464 + link->config_index = 1; 465 + link->config_regs = PRESENT_OPTION; 459 466 460 467 lp->tx_free_frames=AM2150_MAX_TX_FRAMES; 461 468 ··· 464 473 465 474 return nmclan_config(link); 466 475 } /* nmclan_attach */ 467 - 468 - /* ---------------------------------------------------------------------------- 469 - nmclan_detach 470 - This deletes a driver "instance". The device is de-registered 471 - with Card Services. If it has been released, all local data 472 - structures are freed. Otherwise, the structures will be freed 473 - when the device is released. 474 - ---------------------------------------------------------------------------- */ 475 476 476 477 static void nmclan_detach(struct pcmcia_device *link) 477 478 { ··· 608 625 return 0; 609 626 } /* mace_init */ 610 627 611 - /* ---------------------------------------------------------------------------- 612 - nmclan_config 613 - This routine is scheduled to run after a CARD_INSERTION event 614 - is received, to configure the PCMCIA socket, and to make the 615 - ethernet device available to the system. 616 - ---------------------------------------------------------------------------- */ 617 - 618 628 static int nmclan_config(struct pcmcia_device *link) 619 629 { 620 630 struct net_device *dev = link->priv; ··· 626 650 ret = pcmcia_request_exclusive_irq(link, mace_interrupt); 627 651 if (ret) 628 652 goto failed; 629 - ret = pcmcia_request_configuration(link, &link->conf); 653 + ret = pcmcia_enable_device(link); 630 654 if (ret) 631 655 goto failed; 632 656 ··· 688 712 return -ENODEV; 689 713 } /* nmclan_config */ 690 714 691 - /* ---------------------------------------------------------------------------- 692 - nmclan_release 693 - After a card is removed, nmclan_release() will unregister the 694 - net device, and release the PCMCIA configuration. If the device 695 - is still open, this will be postponed until it is closed. 696 - ---------------------------------------------------------------------------- */ 697 715 static void nmclan_release(struct pcmcia_device *link) 698 716 { 699 717 dev_dbg(&link->dev, "nmclan_release\n"); ··· 1505 1535 1506 1536 static struct pcmcia_driver nmclan_cs_driver = { 1507 1537 .owner = THIS_MODULE, 1508 - .drv = { 1509 - .name = "nmclan_cs", 1510 - }, 1538 + .name = "nmclan_cs", 1511 1539 .probe = nmclan_probe, 1512 1540 .remove = nmclan_detach, 1513 1541 .id_table = nmclan_ids,
+39 -107
drivers/net/pcmcia/pcnet_cs.c
··· 42 42 #include <linux/mii.h> 43 43 #include "../8390.h" 44 44 45 - #include <pcmcia/cs.h> 46 45 #include <pcmcia/cistpl.h> 47 46 #include <pcmcia/ciscode.h> 48 47 #include <pcmcia/ds.h> ··· 237 238 #endif 238 239 }; 239 240 240 - /*====================================================================== 241 - 242 - pcnet_attach() creates an "instance" of the driver, allocating 243 - local data structures for one device. The device is registered 244 - with Card Services. 245 - 246 - ======================================================================*/ 247 - 248 241 static int pcnet_probe(struct pcmcia_device *link) 249 242 { 250 243 pcnet_dev_t *info; ··· 251 260 info->p_dev = link; 252 261 link->priv = dev; 253 262 254 - link->conf.Attributes = CONF_ENABLE_IRQ; 255 - link->conf.IntType = INT_MEMORY_AND_IO; 263 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 256 264 257 265 dev->netdev_ops = &pcnet_netdev_ops; 258 266 259 267 return pcnet_config(link); 260 268 } /* pcnet_attach */ 261 - 262 - /*====================================================================== 263 - 264 - This deletes a driver "instance". The device is de-registered 265 - with Card Services. If it has been released, all local data 266 - structures are freed. Otherwise, the structures will be freed 267 - when the device is released. 268 - 269 - ======================================================================*/ 270 269 271 270 static void pcnet_detach(struct pcmcia_device *link) 272 271 { ··· 281 300 static hw_info_t *get_hwinfo(struct pcmcia_device *link) 282 301 { 283 302 struct net_device *dev = link->priv; 284 - win_req_t req; 285 303 u_char __iomem *base, *virt; 286 304 int i, j; 287 305 288 306 /* Allocate a small memory window */ 289 - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 290 - req.Base = 0; req.Size = 0; 291 - req.AccessSpeed = 0; 292 - i = pcmcia_request_window(link, &req, &link->win); 307 + link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 308 + link->resource[2]->start = 0; link->resource[2]->end = 0; 309 + i = pcmcia_request_window(link, link->resource[2], 0); 293 310 if (i != 0) 294 311 return NULL; 295 312 296 - virt = ioremap(req.Base, req.Size); 313 + virt = ioremap(link->resource[2]->start, 314 + resource_size(link->resource[2])); 297 315 for (i = 0; i < NR_INFO; i++) { 298 - pcmcia_map_mem_page(link, link->win, hw_info[i].offset & ~(req.Size-1)); 299 - base = &virt[hw_info[i].offset & (req.Size-1)]; 316 + pcmcia_map_mem_page(link, link->resource[2], 317 + hw_info[i].offset & ~(resource_size(link->resource[2])-1)); 318 + base = &virt[hw_info[i].offset & (resource_size(link->resource[2])-1)]; 300 319 if ((readb(base+0) == hw_info[i].a0) && 301 320 (readb(base+2) == hw_info[i].a1) && 302 321 (readb(base+4) == hw_info[i].a2)) { ··· 307 326 } 308 327 309 328 iounmap(virt); 310 - j = pcmcia_release_window(link, link->win); 329 + j = pcmcia_release_window(link, link->resource[2]); 311 330 return (i < NR_INFO) ? hw_info+i : NULL; 312 331 } /* get_hwinfo */ 313 332 ··· 402 421 int i, j; 403 422 404 423 /* Not much of a test, but the alternatives are messy */ 405 - if (link->conf.ConfigBase != 0x03c0) 424 + if (link->config_base != 0x03c0) 406 425 return NULL; 407 426 408 427 outb_p(0x01, ioaddr + EN0_DCFG); /* Set word-wide access. */ ··· 444 463 return &default_info; 445 464 } /* get_hwired */ 446 465 447 - /*====================================================================== 448 - 449 - pcnet_config() is scheduled to run after a CARD_INSERTION event 450 - is received, to configure the PCMCIA socket, and to make the 451 - ethernet device available to the system. 452 - 453 - ======================================================================*/ 454 - 455 466 static int try_io_port(struct pcmcia_device *link) 456 467 { 457 468 int j, ret; ··· 475 502 } 476 503 } 477 504 478 - static int pcnet_confcheck(struct pcmcia_device *p_dev, 479 - cistpl_cftable_entry_t *cfg, 480 - cistpl_cftable_entry_t *dflt, 481 - unsigned int vcc, 482 - void *priv_data) 505 + static int pcnet_confcheck(struct pcmcia_device *p_dev, void *priv_data) 483 506 { 484 507 int *priv = priv_data; 485 508 int try = (*priv & 0x1); 486 - int i; 487 - cistpl_io_t *io = &cfg->io; 488 509 489 - if (cfg->index == 0 || cfg->io.nwin == 0) 510 + *priv &= (p_dev->resource[2]->end >= 0x4000) ? 0x10 : ~0x10; 511 + 512 + if (p_dev->config_index == 0) 490 513 return -EINVAL; 491 514 492 - /* For multifunction cards, by convention, we configure the 493 - network function with window 0, and serial with window 1 */ 494 - if (io->nwin > 1) { 495 - i = (io->win[1].len > io->win[0].len); 496 - p_dev->resource[1]->start = io->win[1-i].base; 497 - p_dev->resource[1]->end = io->win[1-i].len; 498 - } else { 499 - i = p_dev->resource[1]->end = 0; 500 - } 515 + if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32) 516 + return -EINVAL; 501 517 502 - *priv &= ((cfg->mem.nwin == 1) && 503 - (cfg->mem.win[0].len >= 0x4000)) ? 0x10 : ~0x10; 504 - 505 - p_dev->resource[0]->start = io->win[i].base; 506 - p_dev->resource[0]->end = io->win[i].len; 507 - if (!try) 508 - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 509 - else 518 + if (try) 510 519 p_dev->io_lines = 16; 511 - if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) 512 - return try_io_port(p_dev); 513 - 514 - return -EINVAL; 520 + return try_io_port(p_dev); 515 521 } 516 522 517 523 static hw_info_t *pcnet_try_config(struct pcmcia_device *link, ··· 512 560 if (!link->irq) 513 561 return NULL; 514 562 515 - if (resource_size(link->resource[1]) == 8) { 516 - link->conf.Attributes |= CONF_ENABLE_SPKR; 517 - link->conf.Status = CCSR_AUDIO_ENA; 518 - } 563 + if (resource_size(link->resource[1]) == 8) 564 + link->config_flags |= CONF_ENABLE_SPKR; 565 + 519 566 if ((link->manf_id == MANFID_IBM) && 520 567 (link->card_id == PRODID_IBM_HOME_AND_AWAY)) 521 - link->conf.ConfigIndex |= 0x10; 568 + link->config_index |= 0x10; 522 569 523 - ret = pcmcia_request_configuration(link, &link->conf); 570 + ret = pcmcia_enable_device(link); 524 571 if (ret) 525 572 return NULL; 526 573 ··· 534 583 } else 535 584 dev->if_port = 0; 536 585 537 - if ((link->conf.ConfigBase == 0x03c0) && 586 + if ((link->config_base == 0x03c0) && 538 587 (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) { 539 588 dev_info(&link->dev, 540 589 "this is an AX88190 card - use axnet_cs instead.\n"); ··· 640 689 return -ENODEV; 641 690 } /* pcnet_config */ 642 691 643 - /*====================================================================== 644 - 645 - After a card is removed, pcnet_release() will unregister the net 646 - device, and release the PCMCIA configuration. If the device is 647 - still open, this will be postponed until it is closed. 648 - 649 - ======================================================================*/ 650 - 651 692 static void pcnet_release(struct pcmcia_device *link) 652 693 { 653 694 pcnet_dev_t *info = PRIV(link->priv); ··· 651 708 652 709 pcmcia_disable_device(link); 653 710 } 654 - 655 - /*====================================================================== 656 - 657 - The card status event handler. Mostly, this schedules other 658 - stuff to run after an event is received. A CARD_REMOVAL event 659 - also sets some flags to discourage the net drivers from trying 660 - to talk to the card any more. 661 - 662 - ======================================================================*/ 663 711 664 712 static int pcnet_suspend(struct pcmcia_device *link) 665 713 { ··· 1420 1486 { 1421 1487 struct net_device *dev = link->priv; 1422 1488 pcnet_dev_t *info = PRIV(dev); 1423 - win_req_t req; 1424 1489 int i, window_size, offset, ret; 1425 1490 1426 1491 window_size = (stop_pg - start_pg) << 8; ··· 1430 1497 window_size = roundup_pow_of_two(window_size); 1431 1498 1432 1499 /* Allocate a memory window */ 1433 - req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 1434 - req.Attributes |= WIN_USE_WAIT; 1435 - req.Base = 0; req.Size = window_size; 1436 - req.AccessSpeed = mem_speed; 1437 - ret = pcmcia_request_window(link, &req, &link->win); 1500 + link->resource[3]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 1501 + link->resource[3]->flags |= WIN_USE_WAIT; 1502 + link->resource[3]->start = 0; link->resource[3]->end = window_size; 1503 + ret = pcmcia_request_window(link, link->resource[3], mem_speed); 1438 1504 if (ret) 1439 1505 goto failed; 1440 1506 1441 1507 offset = (start_pg << 8) + cm_offset; 1442 1508 offset -= offset % window_size; 1443 - ret = pcmcia_map_mem_page(link, link->win, offset); 1509 + ret = pcmcia_map_mem_page(link, link->resource[3], offset); 1444 1510 if (ret) 1445 1511 goto failed; 1446 1512 1447 1513 /* Try scribbling on the buffer */ 1448 - info->base = ioremap(req.Base, window_size); 1514 + info->base = ioremap(link->resource[3]->start, 1515 + resource_size(link->resource[3])); 1449 1516 for (i = 0; i < (TX_PAGES<<8); i += 2) 1450 1517 __raw_writew((i>>1), info->base+offset+i); 1451 1518 udelay(100); ··· 1454 1521 pcnet_reset_8390(dev); 1455 1522 if (i != (TX_PAGES<<8)) { 1456 1523 iounmap(info->base); 1457 - pcmcia_release_window(link, link->win); 1458 - info->base = NULL; link->win = 0; 1524 + pcmcia_release_window(link, link->resource[3]); 1525 + info->base = NULL; 1459 1526 goto failed; 1460 1527 } 1461 1528 1462 1529 ei_status.mem = info->base + offset; 1463 - ei_status.priv = req.Size; 1530 + ei_status.priv = resource_size(link->resource[3]); 1464 1531 dev->mem_start = (u_long)ei_status.mem; 1465 - dev->mem_end = dev->mem_start + req.Size; 1532 + dev->mem_end = dev->mem_start + resource_size(link->resource[3]); 1466 1533 1467 1534 ei_status.tx_start_page = start_pg; 1468 1535 ei_status.rx_start_page = start_pg + TX_PAGES; 1469 - ei_status.stop_page = start_pg + ((req.Size - offset) >> 8); 1536 + ei_status.stop_page = start_pg + ( 1537 + (resource_size(link->resource[3]) - offset) >> 8); 1470 1538 1471 1539 /* set up block i/o functions */ 1472 1540 ei_status.get_8390_hdr = &shmem_get_8390_hdr; ··· 1706 1772 MODULE_FIRMWARE("cis/tamarack.cis"); 1707 1773 1708 1774 static struct pcmcia_driver pcnet_driver = { 1709 - .drv = { 1710 - .name = "pcnet_cs", 1711 - }, 1775 + .name = "pcnet_cs", 1712 1776 .probe = pcnet_probe, 1713 1777 .remove = pcnet_detach, 1714 1778 .owner = THIS_MODULE,
+34 -80
drivers/net/pcmcia/smc91c92_cs.c
··· 44 44 #include <linux/jiffies.h> 45 45 #include <linux/firmware.h> 46 46 47 - #include <pcmcia/cs.h> 48 47 #include <pcmcia/cistpl.h> 49 48 #include <pcmcia/cisreg.h> 50 49 #include <pcmcia/ciscode.h> ··· 299 300 .ndo_validate_addr = eth_validate_addr, 300 301 }; 301 302 302 - /*====================================================================== 303 - 304 - smc91c92_attach() creates an "instance" of the driver, allocating 305 - local data structures for one device. The device is registered 306 - with Card Services. 307 - 308 - ======================================================================*/ 309 - 310 303 static int smc91c92_probe(struct pcmcia_device *link) 311 304 { 312 305 struct smc_private *smc; ··· 315 324 link->priv = dev; 316 325 317 326 spin_lock_init(&smc->lock); 318 - link->resource[0]->end = 16; 319 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 320 - link->conf.Attributes = CONF_ENABLE_IRQ; 321 - link->conf.IntType = INT_MEMORY_AND_IO; 322 327 323 328 /* The SMC91c92-specific entries in the device structure. */ 324 329 dev->netdev_ops = &smc_netdev_ops; ··· 329 342 330 343 return smc91c92_config(link); 331 344 } /* smc91c92_attach */ 332 - 333 - /*====================================================================== 334 - 335 - This deletes a driver "instance". The device is de-registered 336 - with Card Services. If it has been released, all local data 337 - structures are freed. Otherwise, the structures will be freed 338 - when the device is released. 339 - 340 - ======================================================================*/ 341 345 342 346 static void smc91c92_detach(struct pcmcia_device *link) 343 347 { ··· 390 412 mdelay(200); 391 413 392 414 /* Now read and write the COR... */ 393 - tmp = readb(smc->base + link->conf.ConfigBase + CISREG_COR); 415 + tmp = readb(smc->base + link->config_base + CISREG_COR); 394 416 udelay(5); 395 - writeb(tmp, smc->base + link->conf.ConfigBase + CISREG_COR); 417 + writeb(tmp, smc->base + link->config_base + CISREG_COR); 396 418 397 419 return 0; 398 420 } 399 421 400 - static int mhz_mfc_config_check(struct pcmcia_device *p_dev, 401 - cistpl_cftable_entry_t *cf, 402 - cistpl_cftable_entry_t *dflt, 403 - unsigned int vcc, 404 - void *priv_data) 422 + static int mhz_mfc_config_check(struct pcmcia_device *p_dev, void *priv_data) 405 423 { 406 424 int k; 407 - p_dev->resource[1]->start = cf->io.win[0].base; 425 + p_dev->io_lines = 16; 426 + p_dev->resource[1]->start = p_dev->resource[0]->start; 427 + p_dev->resource[1]->end = 8; 428 + p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; 429 + p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 430 + p_dev->resource[0]->end = 16; 431 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 432 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 408 433 for (k = 0; k < 0x400; k += 0x10) { 409 434 if (k & 0x80) 410 435 continue; 411 436 p_dev->resource[0]->start = k ^ 0x300; 412 - p_dev->io_lines = 16; 413 437 if (!pcmcia_request_io(p_dev)) 414 438 return 0; 415 439 } ··· 422 442 { 423 443 struct net_device *dev = link->priv; 424 444 struct smc_private *smc = netdev_priv(dev); 425 - win_req_t req; 426 445 unsigned int offset; 427 446 int i; 428 447 429 - link->conf.Attributes |= CONF_ENABLE_SPKR; 430 - link->conf.Status = CCSR_AUDIO_ENA; 431 - link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 432 - link->resource[1]->end = 8; 448 + link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ | 449 + CONF_AUTO_SET_IO; 433 450 434 451 /* The Megahertz combo cards have modem-like CIS entries, so 435 452 we have to explicitly try a bunch of port combinations. */ ··· 436 459 dev->base_addr = link->resource[0]->start; 437 460 438 461 /* Allocate a memory window, for accessing the ISR */ 439 - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 440 - req.Base = req.Size = 0; 441 - req.AccessSpeed = 0; 442 - i = pcmcia_request_window(link, &req, &link->win); 462 + link->resource[2]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 463 + link->resource[2]->start = link->resource[2]->end = 0; 464 + i = pcmcia_request_window(link, link->resource[2], 0); 443 465 if (i != 0) 444 466 return -ENODEV; 445 467 446 - smc->base = ioremap(req.Base, req.Size); 447 - offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0; 448 - i = pcmcia_map_mem_page(link, link->win, offset); 468 + smc->base = ioremap(link->resource[2]->start, 469 + resource_size(link->resource[2])); 470 + offset = (smc->manfid == MANFID_MOTOROLA) ? link->config_base : 0; 471 + i = pcmcia_map_mem_page(link, link->resource[2], offset); 449 472 if ((i == 0) && 450 473 (smc->manfid == MANFID_MEGAHERTZ) && 451 474 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) ··· 568 591 569 592 /*====================================================================*/ 570 593 571 - static int smc_configcheck(struct pcmcia_device *p_dev, 572 - cistpl_cftable_entry_t *cf, 573 - cistpl_cftable_entry_t *dflt, 574 - unsigned int vcc, 575 - void *priv_data) 594 + static int smc_configcheck(struct pcmcia_device *p_dev, void *priv_data) 576 595 { 577 - p_dev->resource[0]->start = cf->io.win[0].base; 578 - p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; 596 + p_dev->resource[0]->end = 16; 597 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 598 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 599 + 579 600 return pcmcia_request_io(p_dev); 580 601 } 581 602 ··· 582 607 struct net_device *dev = link->priv; 583 608 int i; 584 609 585 - link->resource[0]->end = 16; 610 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 611 + 586 612 i = pcmcia_loop_config(link, smc_configcheck, NULL); 587 613 if (!i) 588 614 dev->base_addr = link->resource[0]->start; ··· 616 640 static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; 617 641 int i, j; 618 642 619 - link->conf.Attributes |= CONF_ENABLE_SPKR; 620 - link->conf.Status = CCSR_AUDIO_ENA; 643 + link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ; 621 644 link->resource[0]->end = 64; 622 645 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 623 646 link->resource[1]->end = 8; 624 647 625 648 /* Enable Hard Decode, LAN, Modem */ 626 - link->conf.ConfigIndex = 0x23; 627 649 link->io_lines = 16; 650 + link->config_index = 0x23; 628 651 629 652 for (i = j = 0; j < 4; j++) { 630 653 link->resource[1]->start = com[j]; ··· 633 658 } 634 659 if (i != 0) { 635 660 /* Fallback: turn off hard decode */ 636 - link->conf.ConfigIndex = 0x03; 661 + link->config_index = 0x03; 637 662 link->resource[1]->end = 0; 638 663 i = pcmcia_request_io(link); 639 664 } ··· 792 817 } 793 818 794 819 if (width) { 795 - modconf_t mod = { 796 - .Attributes = CONF_IO_CHANGE_WIDTH, 797 - }; 798 820 printk(KERN_INFO "smc91c92_cs: using 8-bit IO window.\n"); 799 821 800 822 smc91c92_suspend(link); 801 - pcmcia_modify_configuration(link, &mod); 823 + pcmcia_fixup_iowidth(link); 802 824 smc91c92_resume(link); 803 825 return check_sig(link); 804 826 } 805 827 return -ENODEV; 806 828 } 807 - 808 - /*====================================================================== 809 - 810 - smc91c92_config() is scheduled to run after a CARD_INSERTION event 811 - is received, to configure the PCMCIA socket, and to make the 812 - ethernet device available to the system. 813 - 814 - ======================================================================*/ 815 829 816 830 static int smc91c92_config(struct pcmcia_device *link) 817 831 { ··· 833 869 i = pcmcia_request_irq(link, smc_interrupt); 834 870 if (i) 835 871 goto config_failed; 836 - i = pcmcia_request_configuration(link, &link->conf); 872 + i = pcmcia_enable_device(link); 837 873 if (i) 838 874 goto config_failed; 839 875 ··· 952 988 return -ENODEV; 953 989 } /* smc91c92_config */ 954 990 955 - /*====================================================================== 956 - 957 - After a card is removed, smc91c92_release() will unregister the net 958 - device, and release the PCMCIA configuration. If the device is 959 - still open, this will be postponed until it is closed. 960 - 961 - ======================================================================*/ 962 - 963 991 static void smc91c92_release(struct pcmcia_device *link) 964 992 { 965 993 dev_dbg(&link->dev, "smc91c92_release\n"); 966 - if (link->win) { 994 + if (link->resource[2]->end) { 967 995 struct net_device *dev = link->priv; 968 996 struct smc_private *smc = netdev_priv(dev); 969 997 iounmap(smc->base); ··· 2057 2101 2058 2102 static struct pcmcia_driver smc91c92_cs_driver = { 2059 2103 .owner = THIS_MODULE, 2060 - .drv = { 2061 - .name = "smc91c92_cs", 2062 - }, 2104 + .name = "smc91c92_cs", 2063 2105 .probe = smc91c92_probe, 2064 2106 .remove = smc91c92_detach, 2065 2107 .id_table = smc91c92_ids,
+54 -107
drivers/net/pcmcia/xirc2ps_cs.c
··· 82 82 #include <linux/bitops.h> 83 83 #include <linux/mii.h> 84 84 85 - #include <pcmcia/cs.h> 86 85 #include <pcmcia/cistpl.h> 87 86 #include <pcmcia/cisreg.h> 88 87 #include <pcmcia/ciscode.h> ··· 266 267 static void mii_wr(unsigned int ioaddr, u_char phyaddr, u_char phyreg, 267 268 unsigned data, int len); 268 269 269 - /* 270 - * The event() function is this driver's Card Services event handler. 271 - * It will be called by Card Services when an appropriate card status 272 - * event is received. The config() and release() entry points are 273 - * used to configure or release a socket, in response to card insertion 274 - * and ejection events. They are invoked from the event handler. 275 - */ 276 - 277 270 static int has_ce2_string(struct pcmcia_device * link); 278 271 static int xirc2ps_config(struct pcmcia_device * link); 279 272 static void xirc2ps_release(struct pcmcia_device * link); 280 - 281 - /**************** 282 - * The attach() and detach() entry points are used to create and destroy 283 - * "instances" of the driver, where each instance represents everything 284 - * needed to manage one actual PCMCIA card. 285 - */ 286 - 287 273 static void xirc2ps_detach(struct pcmcia_device *p_dev); 288 - 289 - /**************** 290 - * You'll also need to prototype all the functions that will actually 291 - * be used to talk to your device. See 'pcmem_cs' for a good example 292 - * of a fully self-sufficient driver; the other drivers rely more or 293 - * less on other parts of the kernel. 294 - */ 295 274 296 275 static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id); 297 276 ··· 478 501 .ndo_validate_addr = eth_validate_addr, 479 502 }; 480 503 481 - /**************** 482 - * xirc2ps_attach() creates an "instance" of the driver, allocating 483 - * local data structures for one device. The device is registered 484 - * with Card Services. 485 - * 486 - * The dev_link structure is initialized, but we don't actually 487 - * configure the card at this point -- we wait until we receive a 488 - * card insertion event. 489 - */ 490 - 491 504 static int 492 505 xirc2ps_probe(struct pcmcia_device *link) 493 506 { ··· 496 529 link->priv = dev; 497 530 498 531 /* General socket configuration */ 499 - link->conf.Attributes = CONF_ENABLE_IRQ; 500 - link->conf.IntType = INT_MEMORY_AND_IO; 501 - link->conf.ConfigIndex = 1; 532 + link->config_index = 1; 502 533 503 534 /* Fill in card specific entries */ 504 535 dev->netdev_ops = &netdev_ops; ··· 506 541 507 542 return xirc2ps_config(link); 508 543 } /* xirc2ps_attach */ 509 - 510 - /**************** 511 - * This deletes a driver "instance". The device is de-registered 512 - * with Card Services. If it has been released, all local data 513 - * structures are freed. Otherwise, the structures will be freed 514 - * when the device is released. 515 - */ 516 544 517 545 static void 518 546 xirc2ps_detach(struct pcmcia_device *link) ··· 625 667 } 626 668 627 669 static int 628 - xirc2ps_config_modem(struct pcmcia_device *p_dev, 629 - cistpl_cftable_entry_t *cf, 630 - cistpl_cftable_entry_t *dflt, 631 - unsigned int vcc, 632 - void *priv_data) 670 + xirc2ps_config_modem(struct pcmcia_device *p_dev, void *priv_data) 633 671 { 634 672 unsigned int ioaddr; 635 673 636 - if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { 637 - for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 638 - p_dev->resource[1]->start = cf->io.win[0].base; 639 - p_dev->resource[0]->start = ioaddr; 640 - if (!pcmcia_request_io(p_dev)) 641 - return 0; 642 - } 674 + if ((p_dev->resource[0]->start & 0xf) == 8) 675 + return -ENODEV; 676 + 677 + p_dev->resource[0]->end = 16; 678 + p_dev->resource[1]->end = 8; 679 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 680 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 681 + p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; 682 + p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 683 + p_dev->io_lines = 10; 684 + 685 + p_dev->resource[1]->start = p_dev->resource[0]->start; 686 + for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 687 + p_dev->resource[0]->start = ioaddr; 688 + if (!pcmcia_request_io(p_dev)) 689 + return 0; 643 690 } 644 691 return -ENODEV; 645 692 } 646 693 647 694 static int 648 - xirc2ps_config_check(struct pcmcia_device *p_dev, 649 - cistpl_cftable_entry_t *cf, 650 - cistpl_cftable_entry_t *dflt, 651 - unsigned int vcc, 652 - void *priv_data) 695 + xirc2ps_config_check(struct pcmcia_device *p_dev, void *priv_data) 653 696 { 654 697 int *pass = priv_data; 698 + resource_size_t tmp = p_dev->resource[1]->start; 655 699 656 - if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { 657 - p_dev->resource[1]->start = cf->io.win[0].base; 658 - p_dev->resource[0]->start = p_dev->resource[1]->start 659 - + (*pass ? (cf->index & 0x20 ? -24:8) 660 - : (cf->index & 0x20 ? 8:-24)); 661 - if (!pcmcia_request_io(p_dev)) 662 - return 0; 663 - } 664 - return -ENODEV; 700 + tmp += (*pass ? (p_dev->config_index & 0x20 ? -24 : 8) 701 + : (p_dev->config_index & 0x20 ? 8 : -24)); 665 702 703 + if ((p_dev->resource[0]->start & 0xf) == 8) 704 + return -ENODEV; 705 + 706 + p_dev->resource[0]->end = 18; 707 + p_dev->resource[1]->end = 8; 708 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 709 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 710 + p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; 711 + p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 712 + p_dev->io_lines = 10; 713 + 714 + p_dev->resource[1]->start = p_dev->resource[0]->start; 715 + p_dev->resource[0]->start = tmp; 716 + return pcmcia_request_io(p_dev); 666 717 } 667 718 668 719 ··· 694 727 }; 695 728 696 729 697 - /**************** 698 - * xirc2ps_config() is scheduled to run after a CARD_INSERTION event 699 - * is received, to configure the PCMCIA socket, and to make the 700 - * ethernet device available to the system. 701 - */ 702 730 static int 703 731 xirc2ps_config(struct pcmcia_device * link) 704 732 { ··· 769 807 goto failure; 770 808 } 771 809 772 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 773 - link->io_lines = 10; 774 810 if (local->modem) { 775 811 int pass; 812 + link->config_flags |= CONF_AUTO_SET_IO; 776 813 777 - if (do_sound) { 778 - link->conf.Attributes |= CONF_ENABLE_SPKR; 779 - link->conf.Status |= CCSR_AUDIO_ENA; 780 - } 781 - link->resource[1]->end = 8; 782 - link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 783 814 if (local->dingo) { 784 815 /* Take the Modem IO port from the CIS and scan for a free 785 816 * Ethernet port */ 786 - link->resource[0]->end = 16; /* no Mako stuff anymore */ 787 817 if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) 788 818 goto port_found; 789 819 } else { 790 - link->resource[0]->end = 18; 791 820 /* We do 2 passes here: The first one uses the regular mapping and 792 821 * the second tries again, thereby considering that the 32 ports are 793 822 * mirrored every 32 bytes. Actually we use a mirrored port for 794 823 * the Mako if (on the first pass) the COR bit 5 is set. 795 824 */ 796 825 for (pass=0; pass < 2; pass++) 797 - if (!pcmcia_loop_config(link, xirc2ps_config_check, &pass)) 826 + if (!pcmcia_loop_config(link, xirc2ps_config_check, 827 + &pass)) 798 828 goto port_found; 799 829 /* if special option: 800 830 * try to configure as Ethernet only. ··· 794 840 } 795 841 printk(KNOT_XIRC "no ports available\n"); 796 842 } else { 843 + link->io_lines = 10; 797 844 link->resource[0]->end = 16; 845 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 798 846 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 799 847 link->resource[0]->start = ioaddr; 800 848 if (!(err = pcmcia_request_io(link))) ··· 817 861 if ((err=pcmcia_request_irq(link, xirc2ps_interrupt))) 818 862 goto config_error; 819 863 820 - /**************** 821 - * This actually configures the PCMCIA socket -- setting up 822 - * the I/O windows and the interrupt mapping. 823 - */ 824 - if ((err=pcmcia_request_configuration(link, &link->conf))) 864 + link->config_flags |= CONF_ENABLE_IRQ; 865 + if (do_sound) 866 + link->config_flags |= CONF_ENABLE_SPKR; 867 + 868 + if ((err = pcmcia_enable_device(link))) 825 869 goto config_error; 826 870 827 871 if (local->dingo) { 828 - win_req_t req; 829 - 830 872 /* Reset the modem's BAR to the correct value 831 873 * This is necessary because in the RequestConfiguration call, 832 874 * the base address of the ethernet port (BasePort1) is written ··· 844 890 * is at 0x0800. So we allocate a window into the attribute 845 891 * memory and write direct to the CIS registers 846 892 */ 847 - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 848 - req.Base = req.Size = 0; 849 - req.AccessSpeed = 0; 850 - if ((err = pcmcia_request_window(link, &req, &link->win))) 893 + link->resource[2]->flags = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | 894 + WIN_ENABLE; 895 + link->resource[2]->start = link->resource[2]->end = 0; 896 + if ((err = pcmcia_request_window(link, link->resource[2], 0))) 851 897 goto config_error; 852 898 853 - local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; 854 - if ((err = pcmcia_map_mem_page(link, link->win, 0))) 899 + local->dingo_ccr = ioremap(link->resource[2]->start, 0x1000) + 0x0800; 900 + if ((err = pcmcia_map_mem_page(link, link->resource[2], 0))) 855 901 goto config_error; 856 902 857 903 /* Setup the CCRs; there are no infos in the CIS about the Ethernet ··· 932 978 return -ENODEV; 933 979 } /* xirc2ps_config */ 934 980 935 - /**************** 936 - * After a card is removed, xirc2ps_release() will unregister the net 937 - * device, and release the PCMCIA configuration. If the device is 938 - * still open, this will be postponed until it is closed. 939 - */ 940 981 static void 941 982 xirc2ps_release(struct pcmcia_device *link) 942 983 { 943 984 dev_dbg(&link->dev, "release\n"); 944 985 945 - if (link->win) { 986 + if (link->resource[2]->end) { 946 987 struct net_device *dev = link->priv; 947 988 local_info_t *local = netdev_priv(dev); 948 989 if (local->dingo) ··· 1779 1830 1780 1831 static struct pcmcia_driver xirc2ps_cs_driver = { 1781 1832 .owner = THIS_MODULE, 1782 - .drv = { 1783 - .name = "xirc2ps_cs", 1784 - }, 1833 + .name = "xirc2ps_cs", 1785 1834 .probe = xirc2ps_probe, 1786 1835 .remove = xirc2ps_detach, 1787 1836 .id_table = xirc2ps_ids,
+11 -143
drivers/net/wireless/airo_cs.c
··· 32 32 #include <linux/timer.h> 33 33 #include <linux/netdevice.h> 34 34 35 - #include <pcmcia/cs.h> 36 35 #include <pcmcia/cistpl.h> 37 36 #include <pcmcia/cisreg.h> 38 37 #include <pcmcia/ds.h> ··· 53 54 54 55 /*====================================================================*/ 55 56 56 - /* 57 - The event() function is this driver's Card Services event handler. 58 - It will be called by Card Services when an appropriate card status 59 - event is received. The config() and release() entry points are 60 - used to configure or release a socket, in response to card 61 - insertion and ejection events. They are invoked from the airo_cs 62 - event handler. 63 - */ 64 - 65 57 static int airo_config(struct pcmcia_device *link); 66 58 static void airo_release(struct pcmcia_device *link); 67 - 68 - /* 69 - The attach() and detach() entry points are used to create and destroy 70 - "instances" of the driver, where each instance represents everything 71 - needed to manage one actual PCMCIA card. 72 - */ 73 59 74 60 static void airo_detach(struct pcmcia_device *p_dev); 75 61 ··· 62 78 struct net_device *eth_dev; 63 79 } local_info_t; 64 80 65 - /*====================================================================== 66 - 67 - airo_attach() creates an "instance" of the driver, allocating 68 - local data structures for one device. The device is registered 69 - with Card Services. 70 - 71 - The dev_link structure is initialized, but we don't actually 72 - configure the card at this point -- we wait until we receive a 73 - card insertion event. 74 - 75 - ======================================================================*/ 76 - 77 81 static int airo_probe(struct pcmcia_device *p_dev) 78 82 { 79 83 local_info_t *local; 80 84 81 85 dev_dbg(&p_dev->dev, "airo_attach()\n"); 82 - 83 - /* 84 - General socket configuration defaults can go here. In this 85 - client, we assume very little, and rely on the CIS for almost 86 - everything. In most clients, many details (i.e., number, sizes, 87 - and attributes of IO windows) are fixed by the nature of the 88 - device, and can be hard-wired here. 89 - */ 90 - p_dev->conf.Attributes = 0; 91 - p_dev->conf.IntType = INT_MEMORY_AND_IO; 92 86 93 87 /* Allocate space for private device-specific data */ 94 88 local = kzalloc(sizeof(local_info_t), GFP_KERNEL); ··· 78 116 79 117 return airo_config(p_dev); 80 118 } /* airo_attach */ 81 - 82 - /*====================================================================== 83 - 84 - This deletes a driver "instance". The device is de-registered 85 - with Card Services. If it has been released, all local data 86 - structures are freed. Otherwise, the structures will be freed 87 - when the device is released. 88 - 89 - ======================================================================*/ 90 119 91 120 static void airo_detach(struct pcmcia_device *link) 92 121 { ··· 93 140 kfree(link->priv); 94 141 } /* airo_detach */ 95 142 96 - /*====================================================================== 97 - 98 - airo_config() is scheduled to run after a CARD_INSERTION event 99 - is received, to configure the PCMCIA socket, and to make the 100 - device available to the system. 101 - 102 - ======================================================================*/ 103 - 104 - static int airo_cs_config_check(struct pcmcia_device *p_dev, 105 - cistpl_cftable_entry_t *cfg, 106 - cistpl_cftable_entry_t *dflt, 107 - unsigned int vcc, 108 - void *priv_data) 143 + static int airo_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) 109 144 { 110 - if (cfg->index == 0) 111 - return -ENODEV; 145 + if (p_dev->config_index == 0) 146 + return -EINVAL; 112 147 113 - /* Does this card need audio output? */ 114 - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { 115 - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; 116 - p_dev->conf.Status = CCSR_AUDIO_ENA; 117 - } 118 - 119 - /* Use power settings for Vcc and Vpp if present */ 120 - /* Note that the CIS values need to be rescaled */ 121 - if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) 122 - p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; 123 - else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM)) 124 - p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; 125 - 126 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 127 - 128 - /* IO window settings */ 129 - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 130 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 131 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 132 - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 133 - p_dev->resource[0]->flags |= 134 - pcmcia_io_cfg_data_width(io->flags); 135 - p_dev->resource[0]->start = io->win[0].base; 136 - p_dev->resource[0]->end = io->win[0].len; 137 - if (io->nwin > 1) { 138 - p_dev->resource[1]->flags = p_dev->resource[0]->flags; 139 - p_dev->resource[1]->start = io->win[1].base; 140 - p_dev->resource[1]->end = io->win[1].len; 141 - } 142 - } 143 - 144 - /* This reserves IO space but doesn't actually enable it */ 145 - if (pcmcia_request_io(p_dev) != 0) 146 - return -ENODEV; 147 - 148 - /* If we got this far, we're cool! */ 149 - return 0; 148 + return pcmcia_request_io(p_dev); 150 149 } 151 150 152 151 ··· 111 206 112 207 dev_dbg(&link->dev, "airo_config\n"); 113 208 114 - /* 115 - * In this loop, we scan the CIS for configuration table 116 - * entries, each of which describes a valid card 117 - * configuration, including voltage, IO window, memory window, 118 - * and interrupt settings. 119 - * 120 - * We make no assumptions about the card to be configured: we 121 - * use just the information available in the CIS. In an ideal 122 - * world, this would work for any PCMCIA card, but it requires 123 - * a complete and accurate CIS. In practice, a driver usually 124 - * "knows" most of these things without consulting the CIS, 125 - * and most client drivers will only use the CIS to fill in 126 - * implementation-defined details. 127 - */ 209 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | 210 + CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; 211 + 128 212 ret = pcmcia_loop_config(link, airo_cs_config_check, NULL); 129 213 if (ret) 130 214 goto failed; ··· 121 227 if (!link->irq) 122 228 goto failed; 123 229 124 - /* 125 - This actually configures the PCMCIA socket -- setting up 126 - the I/O windows and the interrupt mapping, and putting the 127 - card and host interface into "Memory and IO" mode. 128 - */ 129 - ret = pcmcia_request_configuration(link, &link->conf); 230 + ret = pcmcia_enable_device(link); 130 231 if (ret) 131 232 goto failed; 132 233 ((local_info_t *)link->priv)->eth_dev = ··· 130 241 if (!((local_info_t *)link->priv)->eth_dev) 131 242 goto failed; 132 243 133 - /* Finally, report what we've done */ 134 - dev_info(&link->dev, "index 0x%02x: ", 135 - link->conf.ConfigIndex); 136 - if (link->conf.Vpp) 137 - printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); 138 - printk(", irq %d", link->irq); 139 - if (link->resource[0]) 140 - printk(" & %pR", link->resource[0]); 141 - if (link->resource[1]) 142 - printk(" & %pR", link->resource[1]); 143 - printk("\n"); 144 244 return 0; 145 245 146 246 failed: 147 247 airo_release(link); 148 248 return -ENODEV; 149 249 } /* airo_config */ 150 - 151 - /*====================================================================== 152 - 153 - After a card is removed, airo_release() will unregister the 154 - device, and release the PCMCIA configuration. If the device is 155 - still open, this will be postponed until it is closed. 156 - 157 - ======================================================================*/ 158 250 159 251 static void airo_release(struct pcmcia_device *link) 160 252 { ··· 175 305 176 306 static struct pcmcia_driver airo_driver = { 177 307 .owner = THIS_MODULE, 178 - .drv = { 179 - .name = "airo_cs", 180 - }, 308 + .name = "airo_cs", 181 309 .probe = airo_probe, 182 310 .remove = airo_detach, 183 311 .id_table = airo_ids, ··· 183 315 .resume = airo_resume, 184 316 }; 185 317 186 - static int airo_cs_init(void) 318 + static int __init airo_cs_init(void) 187 319 { 188 320 return pcmcia_register_driver(&airo_driver); 189 321 } 190 322 191 - static void airo_cs_cleanup(void) 323 + static void __exit airo_cs_cleanup(void) 192 324 { 193 325 pcmcia_unregister_driver(&airo_driver); 194 326 }
+9 -124
drivers/net/wireless/atmel_cs.c
··· 42 42 #include <linux/moduleparam.h> 43 43 #include <linux/device.h> 44 44 45 - #include <pcmcia/cs.h> 46 45 #include <pcmcia/cistpl.h> 47 46 #include <pcmcia/cisreg.h> 48 47 #include <pcmcia/ds.h> ··· 63 64 64 65 /*====================================================================*/ 65 66 66 - /* 67 - The event() function is this driver's Card Services event handler. 68 - It will be called by Card Services when an appropriate card status 69 - event is received. The config() and release() entry points are 70 - used to configure or release a socket, in response to card 71 - insertion and ejection events. They are invoked from the atmel_cs 72 - event handler. 73 - */ 74 - 75 67 static int atmel_config(struct pcmcia_device *link); 76 68 static void atmel_release(struct pcmcia_device *link); 77 - 78 - /* 79 - The attach() and detach() entry points are used to create and destroy 80 - "instances" of the driver, where each instance represents everything 81 - needed to manage one actual PCMCIA card. 82 - */ 83 69 84 70 static void atmel_detach(struct pcmcia_device *p_dev); 85 71 ··· 72 88 struct net_device *eth_dev; 73 89 } local_info_t; 74 90 75 - /*====================================================================== 76 - 77 - atmel_attach() creates an "instance" of the driver, allocating 78 - local data structures for one device. The device is registered 79 - with Card Services. 80 - 81 - The dev_link structure is initialized, but we don't actually 82 - configure the card at this point -- we wait until we receive a 83 - card insertion event. 84 - 85 - ======================================================================*/ 86 - 87 91 static int atmel_probe(struct pcmcia_device *p_dev) 88 92 { 89 93 local_info_t *local; 90 94 91 95 dev_dbg(&p_dev->dev, "atmel_attach()\n"); 92 - 93 - /* 94 - General socket configuration defaults can go here. In this 95 - client, we assume very little, and rely on the CIS for almost 96 - everything. In most clients, many details (i.e., number, sizes, 97 - and attributes of IO windows) are fixed by the nature of the 98 - device, and can be hard-wired here. 99 - */ 100 - p_dev->conf.Attributes = 0; 101 - p_dev->conf.IntType = INT_MEMORY_AND_IO; 102 96 103 97 /* Allocate space for private device-specific data */ 104 98 local = kzalloc(sizeof(local_info_t), GFP_KERNEL); ··· 89 127 return atmel_config(p_dev); 90 128 } /* atmel_attach */ 91 129 92 - /*====================================================================== 93 - 94 - This deletes a driver "instance". The device is de-registered 95 - with Card Services. If it has been released, all local data 96 - structures are freed. Otherwise, the structures will be freed 97 - when the device is released. 98 - 99 - ======================================================================*/ 100 - 101 130 static void atmel_detach(struct pcmcia_device *link) 102 131 { 103 132 dev_dbg(&link->dev, "atmel_detach\n"); ··· 97 144 98 145 kfree(link->priv); 99 146 } 100 - 101 - /*====================================================================== 102 - 103 - atmel_config() is scheduled to run after a CARD_INSERTION event 104 - is received, to configure the PCMCIA socket, and to make the 105 - device available to the system. 106 - 107 - ======================================================================*/ 108 147 109 148 /* Call-back function to interrogate PCMCIA-specific information 110 149 about the current existance of the card */ ··· 110 165 return 0; 111 166 } 112 167 113 - static int atmel_config_check(struct pcmcia_device *p_dev, 114 - cistpl_cftable_entry_t *cfg, 115 - cistpl_cftable_entry_t *dflt, 116 - unsigned int vcc, 117 - void *priv_data) 168 + static int atmel_config_check(struct pcmcia_device *p_dev, void *priv_data) 118 169 { 119 - if (cfg->index == 0) 120 - return -ENODEV; 170 + if (p_dev->config_index == 0) 171 + return -EINVAL; 121 172 122 - /* Does this card need audio output? */ 123 - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { 124 - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; 125 - p_dev->conf.Status = CCSR_AUDIO_ENA; 126 - } 127 - 128 - /* Use power settings for Vcc and Vpp if present */ 129 - /* Note that the CIS values need to be rescaled */ 130 - if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) 131 - p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; 132 - else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM)) 133 - p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; 134 - 135 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 136 - 137 - /* IO window settings */ 138 - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 139 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 140 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 141 - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 142 - p_dev->resource[0]->flags |= 143 - pcmcia_io_cfg_data_width(io->flags); 144 - p_dev->resource[0]->start = io->win[0].base; 145 - p_dev->resource[0]->end = io->win[0].len; 146 - if (io->nwin > 1) { 147 - p_dev->resource[1]->flags = p_dev->resource[0]->flags; 148 - p_dev->resource[1]->start = io->win[1].base; 149 - p_dev->resource[1]->end = io->win[1].len; 150 - } 151 - } 152 - 153 - /* This reserves IO space but doesn't actually enable it */ 154 173 return pcmcia_request_io(p_dev); 155 174 } 156 175 ··· 129 220 130 221 dev_dbg(&link->dev, "atmel_config\n"); 131 222 132 - /* 133 - In this loop, we scan the CIS for configuration table entries, 134 - each of which describes a valid card configuration, including 135 - voltage, IO window, memory window, and interrupt settings. 223 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | 224 + CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; 136 225 137 - We make no assumptions about the card to be configured: we use 138 - just the information available in the CIS. In an ideal world, 139 - this would work for any PCMCIA card, but it requires a complete 140 - and accurate CIS. In practice, a driver usually "knows" most of 141 - these things without consulting the CIS, and most client drivers 142 - will only use the CIS to fill in implementation-defined details. 143 - */ 144 226 if (pcmcia_loop_config(link, atmel_config_check, NULL)) 145 227 goto failed; 146 228 ··· 140 240 goto failed; 141 241 } 142 242 143 - /* 144 - This actually configures the PCMCIA socket -- setting up 145 - the I/O windows and the interrupt mapping, and putting the 146 - card and host interface into "Memory and IO" mode. 147 - */ 148 - ret = pcmcia_request_configuration(link, &link->conf); 243 + ret = pcmcia_enable_device(link); 149 244 if (ret) 150 245 goto failed; 151 246 ··· 161 266 atmel_release(link); 162 267 return -ENODEV; 163 268 } 164 - 165 - /*====================================================================== 166 - 167 - After a card is removed, atmel_release() will unregister the 168 - device, and release the PCMCIA configuration. If the device is 169 - still open, this will be postponed until it is closed. 170 - 171 - ======================================================================*/ 172 269 173 270 static void atmel_release(struct pcmcia_device *link) 174 271 { ··· 240 353 241 354 static struct pcmcia_driver atmel_driver = { 242 355 .owner = THIS_MODULE, 243 - .drv = { 244 - .name = "atmel_cs", 245 - }, 356 + .name = "atmel_cs", 246 357 .probe = atmel_probe, 247 358 .remove = atmel_detach, 248 359 .id_table = atmel_ids, ··· 248 363 .resume = atmel_resume, 249 364 }; 250 365 251 - static int atmel_cs_init(void) 366 + static int __init atmel_cs_init(void) 252 367 { 253 368 return pcmcia_register_driver(&atmel_driver); 254 369 } 255 370 256 - static void atmel_cs_cleanup(void) 371 + static void __exit atmel_cs_cleanup(void) 257 372 { 258 373 pcmcia_unregister_driver(&atmel_driver); 259 374 }
+9 -15
drivers/net/wireless/b43/pcmcia.c
··· 26 26 #include <linux/ssb/ssb.h> 27 27 #include <linux/slab.h> 28 28 29 - #include <pcmcia/cs.h> 30 29 #include <pcmcia/cistpl.h> 31 30 #include <pcmcia/ciscode.h> 32 31 #include <pcmcia/ds.h> ··· 62 63 static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) 63 64 { 64 65 struct ssb_bus *ssb; 65 - win_req_t win; 66 66 int err = -ENOMEM; 67 67 int res = 0; 68 68 ··· 71 73 72 74 err = -ENODEV; 73 75 74 - dev->conf.Attributes = CONF_ENABLE_IRQ; 75 - dev->conf.IntType = INT_MEMORY_AND_IO; 76 + dev->config_flags |= CONF_ENABLE_IRQ; 76 77 77 - win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 | 78 + dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 | 78 79 WIN_USE_WAIT; 79 - win.Base = 0; 80 - win.Size = SSB_CORE_SIZE; 81 - win.AccessSpeed = 250; 82 - res = pcmcia_request_window(dev, &win, &dev->win); 80 + dev->resource[2]->start = 0; 81 + dev->resource[2]->end = SSB_CORE_SIZE; 82 + res = pcmcia_request_window(dev, dev->resource[2], 250); 83 83 if (res != 0) 84 84 goto err_kfree_ssb; 85 85 86 - res = pcmcia_map_mem_page(dev, dev->win, 0); 86 + res = pcmcia_map_mem_page(dev, dev->resource[2], 0); 87 87 if (res != 0) 88 88 goto err_disable; 89 89 90 90 if (!dev->irq) 91 91 goto err_disable; 92 92 93 - res = pcmcia_request_configuration(dev, &dev->conf); 93 + res = pcmcia_enable_device(dev); 94 94 if (res != 0) 95 95 goto err_disable; 96 96 97 - err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); 97 + err = ssb_bus_pcmciabus_register(ssb, dev, dev->resource[2]->start); 98 98 if (err) 99 99 goto err_disable; 100 100 dev->priv = ssb; ··· 121 125 122 126 static struct pcmcia_driver b43_pcmcia_driver = { 123 127 .owner = THIS_MODULE, 124 - .drv = { 125 - .name = "b43-pcmcia", 126 - }, 128 + .name = "b43-pcmcia", 127 129 .id_table = b43_pcmcia_tbl, 128 130 .probe = b43_pcmcia_probe, 129 131 .remove = __devexit_p(b43_pcmcia_remove),
+10 -92
drivers/net/wireless/hostap/hostap_cs.c
··· 12 12 #include <linux/wireless.h> 13 13 #include <net/iw_handler.h> 14 14 15 - #include <pcmcia/cs.h> 16 15 #include <pcmcia/cistpl.h> 17 16 #include <pcmcia/cisreg.h> 18 17 #include <pcmcia/ds.h> ··· 436 437 int ret; 437 438 438 439 PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); 439 - p_dev->conf.IntType = INT_MEMORY_AND_IO; 440 440 441 441 ret = prism2_config(p_dev); 442 442 if (ret) { ··· 466 468 } 467 469 468 470 469 - /* run after a CARD_INSERTION event is received to configure the PCMCIA 470 - * socket and make the device available to the system */ 471 - 472 - static int prism2_config_check(struct pcmcia_device *p_dev, 473 - cistpl_cftable_entry_t *cfg, 474 - cistpl_cftable_entry_t *dflt, 475 - unsigned int vcc, 476 - void *priv_data) 471 + static int prism2_config_check(struct pcmcia_device *p_dev, void *priv_data) 477 472 { 478 - if (cfg->index == 0) 479 - return -ENODEV; 473 + if (p_dev->config_index == 0) 474 + return -EINVAL; 480 475 481 - PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X " 482 - "(default 0x%02X)\n", cfg->index, dflt->index); 483 - 484 - /* Does this card need audio output? */ 485 - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { 486 - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; 487 - p_dev->conf.Status = CCSR_AUDIO_ENA; 488 - } 489 - 490 - /* Use power settings for Vcc and Vpp if present */ 491 - /* Note that the CIS values need to be rescaled */ 492 - if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { 493 - if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 494 - 10000 && !ignore_cis_vcc) { 495 - PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping" 496 - " this entry\n"); 497 - return -ENODEV; 498 - } 499 - } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { 500 - if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 501 - 10000 && !ignore_cis_vcc) { 502 - PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch " 503 - "- skipping this entry\n"); 504 - return -ENODEV; 505 - } 506 - } 507 - 508 - if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 509 - p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 510 - else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) 511 - p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; 512 - 513 - /* Do we need to allocate an interrupt? */ 514 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 515 - 516 - /* IO window settings */ 517 - PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " 518 - "dflt->io.nwin=%d\n", 519 - cfg->io.nwin, dflt->io.nwin); 520 - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 521 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 522 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 523 - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 524 - p_dev->resource[0]->flags |= 525 - pcmcia_io_cfg_data_width(io->flags); 526 - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 527 - p_dev->resource[0]->start = io->win[0].base; 528 - p_dev->resource[0]->end = io->win[0].len; 529 - if (io->nwin > 1) { 530 - p_dev->resource[1]->flags = p_dev->resource[0]->flags; 531 - p_dev->resource[1]->start = io->win[1].base; 532 - p_dev->resource[1]->end = io->win[1].len; 533 - } 534 - } 535 - 536 - /* This reserves IO space but doesn't actually enable it */ 537 476 return pcmcia_request_io(p_dev); 538 477 } 539 478 ··· 492 557 } 493 558 494 559 /* Look for an appropriate configuration table entry in the CIS */ 560 + link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | 561 + CONF_AUTO_CHECK_VCC | CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; 562 + if (ignore_cis_vcc) 563 + link->config_flags &= ~CONF_AUTO_CHECK_VCC; 495 564 ret = pcmcia_loop_config(link, prism2_config_check, NULL); 496 565 if (ret) { 497 566 if (!ignore_cis_vcc) ··· 527 588 if (ret) 528 589 goto failed_unlock; 529 590 530 - /* 531 - * This actually configures the PCMCIA socket -- setting up 532 - * the I/O windows and the interrupt mapping, and putting the 533 - * card and host interface into "Memory and IO" mode. 534 - */ 535 - ret = pcmcia_request_configuration(link, &link->conf); 591 + ret = pcmcia_enable_device(link); 536 592 if (ret) 537 593 goto failed_unlock; 538 594 ··· 535 601 dev->base_addr = link->resource[0]->start; 536 602 537 603 spin_unlock_irqrestore(&local->irq_init_lock, flags); 538 - 539 - /* Finally, report what we've done */ 540 - printk(KERN_INFO "%s: index 0x%02x: ", 541 - dev_info, link->conf.ConfigIndex); 542 - if (link->conf.Vpp) 543 - printk(", Vpp %d.%d", link->conf.Vpp / 10, 544 - link->conf.Vpp % 10); 545 - if (link->conf.Attributes & CONF_ENABLE_IRQ) 546 - printk(", irq %d", link->irq); 547 - if (link->resource[0]) 548 - printk(" & %pR", link->resource[0]); 549 - if (link->resource[1]) 550 - printk(" & %pR", link->resource[1]); 551 - printk("\n"); 552 604 553 605 local->shutdown = 0; 554 606 ··· 547 627 return ret; 548 628 549 629 failed_unlock: 550 - spin_unlock_irqrestore(&local->irq_init_lock, flags); 630 + spin_unlock_irqrestore(&local->irq_init_lock, flags); 551 631 failed: 552 632 kfree(hw_priv); 553 633 prism2_release((u_long)link); ··· 699 779 700 780 701 781 static struct pcmcia_driver hostap_driver = { 702 - .drv = { 703 - .name = "hostap_cs", 704 - }, 782 + .name = "hostap_cs", 705 783 .probe = hostap_cs_probe, 706 784 .remove = prism2_detach, 707 785 .owner = THIS_MODULE,
+7 -51
drivers/net/wireless/libertas/if_cs.c
··· 28 28 #include <linux/firmware.h> 29 29 #include <linux/netdevice.h> 30 30 31 - #include <pcmcia/cs.h> 32 31 #include <pcmcia/cistpl.h> 33 32 #include <pcmcia/ds.h> 34 33 ··· 760 761 } 761 762 762 763 763 - /********************************************************************/ 764 - /* Card Services */ 765 - /********************************************************************/ 766 - 767 - /* 768 - * After a card is removed, if_cs_release() will unregister the 769 - * device, and release the PCMCIA configuration. If the device is 770 - * still open, this will be postponed until it is closed. 771 - */ 772 764 static void if_cs_release(struct pcmcia_device *p_dev) 773 765 { 774 766 struct if_cs_card *card = p_dev->priv; ··· 775 785 } 776 786 777 787 778 - /* 779 - * This creates an "instance" of the driver, allocating local data 780 - * structures for one device. The device is registered with Card 781 - * Services. 782 - * 783 - * The dev_link structure is initialized, but we don't actually 784 - * configure the card at this point -- we wait until we receive a card 785 - * insertion event. 786 - */ 787 - 788 - static int if_cs_ioprobe(struct pcmcia_device *p_dev, 789 - cistpl_cftable_entry_t *cfg, 790 - cistpl_cftable_entry_t *dflt, 791 - unsigned int vcc, 792 - void *priv_data) 788 + static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data) 793 789 { 790 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 794 791 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 795 - p_dev->resource[0]->start = cfg->io.win[0].base; 796 - p_dev->resource[0]->end = cfg->io.win[0].len; 797 792 798 - /* Do we need to allocate an interrupt? */ 799 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 800 - 801 - /* IO window settings */ 802 - if (cfg->io.nwin != 1) { 793 + if (p_dev->resource[1]->end) { 803 794 lbs_pr_err("wrong CIS (check number of IO windows)\n"); 804 795 return -ENODEV; 805 796 } ··· 806 835 card->p_dev = p_dev; 807 836 p_dev->priv = card; 808 837 809 - p_dev->conf.Attributes = 0; 810 - p_dev->conf.IntType = INT_MEMORY_AND_IO; 838 + p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 811 839 812 840 if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { 813 841 lbs_pr_err("error in pcmcia_loop_config\n"); 814 842 goto out1; 815 843 } 816 - 817 844 818 845 /* 819 846 * Allocate an interrupt line. Note that this does not assign ··· 830 861 goto out1; 831 862 } 832 863 833 - /* 834 - * This actually configures the PCMCIA socket -- setting up 835 - * the I/O windows and the interrupt mapping, and putting the 836 - * card and host interface into "Memory and IO" mode. 837 - */ 838 - ret = pcmcia_request_configuration(p_dev, &p_dev->conf); 864 + ret = pcmcia_enable_device(p_dev); 839 865 if (ret) { 840 - lbs_pr_err("error in pcmcia_request_configuration\n"); 866 + lbs_pr_err("error in pcmcia_enable_device\n"); 841 867 goto out2; 842 868 } 843 869 ··· 926 962 } 927 963 928 964 929 - /* 930 - * This deletes a driver "instance". The device is de-registered with 931 - * Card Services. If it has been released, all local data structures 932 - * are freed. Otherwise, the structures will be freed when the device 933 - * is released. 934 - */ 935 965 static void if_cs_detach(struct pcmcia_device *p_dev) 936 966 { 937 967 struct if_cs_card *card = p_dev->priv; ··· 958 1000 959 1001 static struct pcmcia_driver lbs_driver = { 960 1002 .owner = THIS_MODULE, 961 - .drv = { 962 - .name = DRV_NAME, 963 - }, 1003 + .name = DRV_NAME, 964 1004 .probe = if_cs_probe, 965 1005 .remove = if_cs_detach, 966 1006 .id_table = if_cs_ids,
+10 -127
drivers/net/wireless/orinoco/orinoco_cs.c
··· 17 17 #include <linux/kernel.h> 18 18 #include <linux/init.h> 19 19 #include <linux/delay.h> 20 - #include <pcmcia/cs.h> 21 20 #include <pcmcia/cistpl.h> 22 21 #include <pcmcia/cisreg.h> 23 22 #include <pcmcia/ds.h> ··· 92 93 /* PCMCIA stuff */ 93 94 /********************************************************************/ 94 95 95 - /* 96 - * This creates an "instance" of the driver, allocating local data 97 - * structures for one device. The device is registered with Card 98 - * Services. 99 - * 100 - * The dev_link structure is initialized, but we don't actually 101 - * configure the card at this point -- we wait until we receive a card 102 - * insertion event. */ 103 96 static int 104 97 orinoco_cs_probe(struct pcmcia_device *link) 105 98 { ··· 108 117 card->p_dev = link; 109 118 link->priv = priv; 110 119 111 - /* General socket configuration defaults can go here. In this 112 - * client, we assume very little, and rely on the CIS for 113 - * almost everything. In most clients, many details (i.e., 114 - * number, sizes, and attributes of IO windows) are fixed by 115 - * the nature of the device, and can be hard-wired here. */ 116 - link->conf.Attributes = 0; 117 - link->conf.IntType = INT_MEMORY_AND_IO; 118 - 119 120 return orinoco_cs_config(link); 120 121 } /* orinoco_cs_attach */ 121 122 122 - /* 123 - * This deletes a driver "instance". The device is de-registered with 124 - * Card Services. If it has been released, all local data structures 125 - * are freed. Otherwise, the structures will be freed when the device 126 - * is released. 127 - */ 128 123 static void orinoco_cs_detach(struct pcmcia_device *link) 129 124 { 130 125 struct orinoco_private *priv = link->priv; ··· 122 145 free_orinocodev(priv); 123 146 } /* orinoco_cs_detach */ 124 147 125 - /* 126 - * orinoco_cs_config() is scheduled to run after a CARD_INSERTION 127 - * event is received, to configure the PCMCIA socket, and to make the 128 - * device available to the system. 129 - */ 130 - 131 - static int orinoco_cs_config_check(struct pcmcia_device *p_dev, 132 - cistpl_cftable_entry_t *cfg, 133 - cistpl_cftable_entry_t *dflt, 134 - unsigned int vcc, 135 - void *priv_data) 148 + static int orinoco_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) 136 149 { 137 - if (cfg->index == 0) 138 - goto next_entry; 150 + if (p_dev->config_index == 0) 151 + return -EINVAL; 139 152 140 - /* Use power settings for Vcc and Vpp if present */ 141 - /* Note that the CIS values need to be rescaled */ 142 - if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { 143 - if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { 144 - DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n", 145 - __func__, vcc, 146 - cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); 147 - if (!ignore_cis_vcc) 148 - goto next_entry; 149 - } 150 - } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { 151 - if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { 152 - DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n", 153 - __func__, vcc, 154 - dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); 155 - if (!ignore_cis_vcc) 156 - goto next_entry; 157 - } 158 - } 159 - 160 - if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 161 - p_dev->conf.Vpp = 162 - cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 163 - else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) 164 - p_dev->conf.Vpp = 165 - dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; 166 - 167 - /* Do we need to allocate an interrupt? */ 168 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 169 - 170 - /* IO window settings */ 171 - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 172 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 173 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 174 - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 175 - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 176 - p_dev->resource[0]->flags |= 177 - pcmcia_io_cfg_data_width(io->flags); 178 - p_dev->resource[0]->start = io->win[0].base; 179 - p_dev->resource[0]->end = io->win[0].len; 180 - if (io->nwin > 1) { 181 - p_dev->resource[1]->flags = p_dev->resource[0]->flags; 182 - p_dev->resource[1]->start = io->win[1].base; 183 - p_dev->resource[1]->end = io->win[1].len; 184 - } 185 - 186 - /* This reserves IO space but doesn't actually enable it */ 187 - if (pcmcia_request_io(p_dev) != 0) 188 - goto next_entry; 189 - } 190 - return 0; 191 - 192 - next_entry: 193 - pcmcia_disable_device(p_dev); 194 - return -ENODEV; 153 + return pcmcia_request_io(p_dev); 195 154 }; 196 155 197 156 static int ··· 138 225 int ret; 139 226 void __iomem *mem; 140 227 141 - /* 142 - * In this loop, we scan the CIS for configuration table 143 - * entries, each of which describes a valid card 144 - * configuration, including voltage, IO window, memory window, 145 - * and interrupt settings. 146 - * 147 - * We make no assumptions about the card to be configured: we 148 - * use just the information available in the CIS. In an ideal 149 - * world, this would work for any PCMCIA card, but it requires 150 - * a complete and accurate CIS. In practice, a driver usually 151 - * "knows" most of these things without consulting the CIS, 152 - * and most client drivers will only use the CIS to fill in 153 - * implementation-defined details. 154 - */ 228 + link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC | 229 + CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; 230 + if (ignore_cis_vcc) 231 + link->config_flags &= ~CONF_AUTO_CHECK_VCC; 155 232 ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); 156 233 if (ret) { 157 234 if (!ignore_cis_vcc) ··· 165 262 166 263 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 167 264 168 - /* 169 - * This actually configures the PCMCIA socket -- setting up 170 - * the I/O windows and the interrupt mapping, and putting the 171 - * card and host interface into "Memory and IO" mode. 172 - */ 173 - ret = pcmcia_request_configuration(link, &link->conf); 265 + ret = pcmcia_enable_device(link); 174 266 if (ret) 175 267 goto failed; 176 268 ··· 189 291 return -ENODEV; 190 292 } /* orinoco_cs_config */ 191 293 192 - /* 193 - * After a card is removed, orinoco_cs_release() will unregister the 194 - * device, and release the PCMCIA configuration. If the device is 195 - * still open, this will be postponed until it is closed. 196 - */ 197 294 static void 198 295 orinoco_cs_release(struct pcmcia_device *link) 199 296 { ··· 236 343 /********************************************************************/ 237 344 /* Module initialization */ 238 345 /********************************************************************/ 239 - 240 - /* Can't be declared "const" or the whole __initdata section will 241 - * become const */ 242 - static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION 243 - " (David Gibson <hermes@gibson.dropbear.id.au>, " 244 - "Pavel Roskin <proski@gnu.org>, et al)"; 245 346 246 347 static struct pcmcia_device_id orinoco_cs_ids[] = { 247 348 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), /* 3Com AirConnect PCI 777A */ ··· 328 441 329 442 static struct pcmcia_driver orinoco_driver = { 330 443 .owner = THIS_MODULE, 331 - .drv = { 332 - .name = DRIVER_NAME, 333 - }, 444 + .name = DRIVER_NAME, 334 445 .probe = orinoco_cs_probe, 335 446 .remove = orinoco_cs_detach, 336 447 .id_table = orinoco_cs_ids, ··· 339 454 static int __init 340 455 init_orinoco_cs(void) 341 456 { 342 - printk(KERN_DEBUG "%s\n", version); 343 - 344 457 return pcmcia_register_driver(&orinoco_driver); 345 458 } 346 459
+9 -125
drivers/net/wireless/orinoco/spectrum_cs.c
··· 25 25 #include <linux/kernel.h> 26 26 #include <linux/init.h> 27 27 #include <linux/delay.h> 28 - #include <pcmcia/cs.h> 29 28 #include <pcmcia/cistpl.h> 30 29 #include <pcmcia/cisreg.h> 31 30 #include <pcmcia/ds.h> ··· 153 154 /* PCMCIA stuff */ 154 155 /********************************************************************/ 155 156 156 - /* 157 - * This creates an "instance" of the driver, allocating local data 158 - * structures for one device. The device is registered with Card 159 - * Services. 160 - * 161 - * The dev_link structure is initialized, but we don't actually 162 - * configure the card at this point -- we wait until we receive a card 163 - * insertion event. */ 164 157 static int 165 158 spectrum_cs_probe(struct pcmcia_device *link) 166 159 { ··· 170 179 card->p_dev = link; 171 180 link->priv = priv; 172 181 173 - /* General socket configuration defaults can go here. In this 174 - * client, we assume very little, and rely on the CIS for 175 - * almost everything. In most clients, many details (i.e., 176 - * number, sizes, and attributes of IO windows) are fixed by 177 - * the nature of the device, and can be hard-wired here. */ 178 - link->conf.Attributes = 0; 179 - link->conf.IntType = INT_MEMORY_AND_IO; 180 - 181 182 return spectrum_cs_config(link); 182 183 } /* spectrum_cs_attach */ 183 184 184 - /* 185 - * This deletes a driver "instance". The device is de-registered with 186 - * Card Services. If it has been released, all local data structures 187 - * are freed. Otherwise, the structures will be freed when the device 188 - * is released. 189 - */ 190 185 static void spectrum_cs_detach(struct pcmcia_device *link) 191 186 { 192 187 struct orinoco_private *priv = link->priv; ··· 184 207 free_orinocodev(priv); 185 208 } /* spectrum_cs_detach */ 186 209 187 - /* 188 - * spectrum_cs_config() is scheduled to run after a CARD_INSERTION 189 - * event is received, to configure the PCMCIA socket, and to make the 190 - * device available to the system. 191 - */ 192 - 193 210 static int spectrum_cs_config_check(struct pcmcia_device *p_dev, 194 - cistpl_cftable_entry_t *cfg, 195 - cistpl_cftable_entry_t *dflt, 196 - unsigned int vcc, 197 211 void *priv_data) 198 212 { 199 - if (cfg->index == 0) 200 - goto next_entry; 213 + if (p_dev->config_index == 0) 214 + return -EINVAL; 201 215 202 - /* Use power settings for Vcc and Vpp if present */ 203 - /* Note that the CIS values need to be rescaled */ 204 - if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { 205 - if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { 206 - DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n", 207 - __func__, vcc, 208 - cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); 209 - if (!ignore_cis_vcc) 210 - goto next_entry; 211 - } 212 - } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { 213 - if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { 214 - DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n", 215 - __func__, vcc, 216 - dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); 217 - if (!ignore_cis_vcc) 218 - goto next_entry; 219 - } 220 - } 221 - 222 - if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 223 - p_dev->conf.Vpp = 224 - cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 225 - else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) 226 - p_dev->conf.Vpp = 227 - dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; 228 - 229 - /* Do we need to allocate an interrupt? */ 230 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 231 - 232 - /* IO window settings */ 233 - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 234 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 235 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 236 - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 237 - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 238 - p_dev->resource[0]->flags |= 239 - pcmcia_io_cfg_data_width(io->flags); 240 - p_dev->resource[0]->start = io->win[0].base; 241 - p_dev->resource[0]->end = io->win[0].len; 242 - if (io->nwin > 1) { 243 - p_dev->resource[1]->flags = p_dev->resource[0]->flags; 244 - p_dev->resource[1]->start = io->win[1].base; 245 - p_dev->resource[1]->end = io->win[1].len; 246 - } 247 - 248 - /* This reserves IO space but doesn't actually enable it */ 249 - if (pcmcia_request_io(p_dev) != 0) 250 - goto next_entry; 251 - } 252 - return 0; 253 - 254 - next_entry: 255 - pcmcia_disable_device(p_dev); 256 - return -ENODEV; 216 + return pcmcia_request_io(p_dev); 257 217 }; 258 218 259 219 static int ··· 201 287 int ret; 202 288 void __iomem *mem; 203 289 204 - /* 205 - * In this loop, we scan the CIS for configuration table 206 - * entries, each of which describes a valid card 207 - * configuration, including voltage, IO window, memory window, 208 - * and interrupt settings. 209 - * 210 - * We make no assumptions about the card to be configured: we 211 - * use just the information available in the CIS. In an ideal 212 - * world, this would work for any PCMCIA card, but it requires 213 - * a complete and accurate CIS. In practice, a driver usually 214 - * "knows" most of these things without consulting the CIS, 215 - * and most client drivers will only use the CIS to fill in 216 - * implementation-defined details. 217 - */ 290 + link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC | 291 + CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; 292 + if (ignore_cis_vcc) 293 + link->config_flags &= ~CONF_AUTO_CHECK_VCC; 218 294 ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); 219 295 if (ret) { 220 296 if (!ignore_cis_vcc) ··· 229 325 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 230 326 hw->eeprom_pda = true; 231 327 232 - /* 233 - * This actually configures the PCMCIA socket -- setting up 234 - * the I/O windows and the interrupt mapping, and putting the 235 - * card and host interface into "Memory and IO" mode. 236 - */ 237 - ret = pcmcia_request_configuration(link, &link->conf); 328 + ret = pcmcia_enable_device(link); 238 329 if (ret) 239 330 goto failed; 240 331 ··· 257 358 return -ENODEV; 258 359 } /* spectrum_cs_config */ 259 360 260 - /* 261 - * After a card is removed, spectrum_cs_release() will unregister the 262 - * device, and release the PCMCIA configuration. If the device is 263 - * still open, this will be postponed until it is closed. 264 - */ 265 361 static void 266 362 spectrum_cs_release(struct pcmcia_device *link) 267 363 { ··· 301 407 /* Module initialization */ 302 408 /********************************************************************/ 303 409 304 - /* Can't be declared "const" or the whole __initdata section will 305 - * become const */ 306 - static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION 307 - " (Pavel Roskin <proski@gnu.org>," 308 - " David Gibson <hermes@gibson.dropbear.id.au>, et al)"; 309 - 310 410 static struct pcmcia_device_id spectrum_cs_ids[] = { 311 411 PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4137 */ 312 412 PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ ··· 311 423 312 424 static struct pcmcia_driver orinoco_driver = { 313 425 .owner = THIS_MODULE, 314 - .drv = { 315 - .name = DRIVER_NAME, 316 - }, 426 + .name = DRIVER_NAME, 317 427 .probe = spectrum_cs_probe, 318 428 .remove = spectrum_cs_detach, 319 429 .suspend = spectrum_cs_suspend, ··· 322 436 static int __init 323 437 init_spectrum_cs(void) 324 438 { 325 - printk(KERN_DEBUG "%s\n", version); 326 - 327 439 return pcmcia_register_driver(&orinoco_driver); 328 440 } 329 441
+26 -65
drivers/net/wireless/ray_cs.c
··· 46 46 #include <linux/ethtool.h> 47 47 #include <linux/ieee80211.h> 48 48 49 - #include <pcmcia/cs.h> 50 49 #include <pcmcia/cistpl.h> 51 50 #include <pcmcia/cisreg.h> 52 51 #include <pcmcia/ds.h> ··· 168 169 */ 169 170 static char *phy_addr = NULL; 170 171 171 - 172 - /* A struct pcmcia_device structure has fields for most things that are needed 173 - to keep track of a socket, but there will usually be some device 174 - specific information that also needs to be kept track of. The 175 - 'priv' pointer in a struct pcmcia_device structure can be used to point to 176 - a device-specific private data structure, like this. 177 - */ 178 172 static unsigned int ray_mem_speed = 500; 179 173 180 174 /* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */ ··· 282 290 .ndo_validate_addr = eth_validate_addr, 283 291 }; 284 292 285 - /*============================================================================= 286 - ray_attach() creates an "instance" of the driver, allocating 287 - local data structures for one device. The device is registered 288 - with Card Services. 289 - The dev_link structure is initialized, but we don't actually 290 - configure the card at this point -- we wait until we receive a 291 - card insertion event. 292 - =============================================================================*/ 293 293 static int ray_probe(struct pcmcia_device *p_dev) 294 294 { 295 295 ray_dev_t *local; ··· 302 318 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 303 319 304 320 /* General socket configuration */ 305 - p_dev->conf.Attributes = CONF_ENABLE_IRQ; 306 - p_dev->conf.IntType = INT_MEMORY_AND_IO; 307 - p_dev->conf.ConfigIndex = 1; 321 + p_dev->config_flags |= CONF_ENABLE_IRQ; 322 + p_dev->config_index = 1; 308 323 309 324 p_dev->priv = dev; 310 325 ··· 336 353 return -ENOMEM; 337 354 } /* ray_attach */ 338 355 339 - /*============================================================================= 340 - This deletes a driver "instance". The device is de-registered 341 - with Card Services. If it has been released, all local data 342 - structures are freed. Otherwise, the structures will be freed 343 - when the device is released. 344 - =============================================================================*/ 345 356 static void ray_detach(struct pcmcia_device *link) 346 357 { 347 358 struct net_device *dev; ··· 358 381 dev_dbg(&link->dev, "ray_cs ray_detach ending\n"); 359 382 } /* ray_detach */ 360 383 361 - /*============================================================================= 362 - ray_config() is run after a CARD_INSERTION event 363 - is received, to configure the PCMCIA socket, and to make the 364 - ethernet device available to the system. 365 - =============================================================================*/ 366 384 #define MAX_TUPLE_SIZE 128 367 385 static int ray_config(struct pcmcia_device *link) 368 386 { 369 387 int ret = 0; 370 388 int i; 371 - win_req_t req; 372 389 struct net_device *dev = (struct net_device *)link->priv; 373 390 ray_dev_t *local = netdev_priv(dev); 374 391 ··· 383 412 goto failed; 384 413 dev->irq = link->irq; 385 414 386 - /* This actually configures the PCMCIA socket -- setting up 387 - the I/O windows and the interrupt mapping. 388 - */ 389 - ret = pcmcia_request_configuration(link, &link->conf); 415 + ret = pcmcia_enable_device(link); 390 416 if (ret) 391 417 goto failed; 392 418 393 419 /*** Set up 32k window for shared memory (transmit and control) ************/ 394 - req.Attributes = 395 - WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; 396 - req.Base = 0; 397 - req.Size = 0x8000; 398 - req.AccessSpeed = ray_mem_speed; 399 - ret = pcmcia_request_window(link, &req, &link->win); 420 + link->resource[2]->flags |= WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; 421 + link->resource[2]->start = 0; 422 + link->resource[2]->end = 0x8000; 423 + ret = pcmcia_request_window(link, link->resource[2], ray_mem_speed); 400 424 if (ret) 401 425 goto failed; 402 - ret = pcmcia_map_mem_page(link, link->win, 0); 426 + ret = pcmcia_map_mem_page(link, link->resource[2], 0); 403 427 if (ret) 404 428 goto failed; 405 - local->sram = ioremap(req.Base, req.Size); 429 + local->sram = ioremap(link->resource[2]->start, 430 + resource_size(link->resource[2])); 406 431 407 432 /*** Set up 16k window for shared memory (receive buffer) ***************/ 408 - req.Attributes = 433 + link->resource[3]->flags |= 409 434 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; 410 - req.Base = 0; 411 - req.Size = 0x4000; 412 - req.AccessSpeed = ray_mem_speed; 413 - ret = pcmcia_request_window(link, &req, &local->rmem_handle); 435 + link->resource[3]->start = 0; 436 + link->resource[3]->end = 0x4000; 437 + ret = pcmcia_request_window(link, link->resource[3], ray_mem_speed); 414 438 if (ret) 415 439 goto failed; 416 - ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000); 440 + ret = pcmcia_map_mem_page(link, link->resource[3], 0x8000); 417 441 if (ret) 418 442 goto failed; 419 - local->rmem = ioremap(req.Base, req.Size); 443 + local->rmem = ioremap(link->resource[3]->start, 444 + resource_size(link->resource[3])); 420 445 421 446 /*** Set up window for attribute memory ***********************************/ 422 - req.Attributes = 447 + link->resource[4]->flags |= 423 448 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT; 424 - req.Base = 0; 425 - req.Size = 0x1000; 426 - req.AccessSpeed = ray_mem_speed; 427 - ret = pcmcia_request_window(link, &req, &local->amem_handle); 449 + link->resource[4]->start = 0; 450 + link->resource[4]->end = 0x1000; 451 + ret = pcmcia_request_window(link, link->resource[4], ray_mem_speed); 428 452 if (ret) 429 453 goto failed; 430 - ret = pcmcia_map_mem_page(link, local->amem_handle, 0); 454 + ret = pcmcia_map_mem_page(link, link->resource[4], 0); 431 455 if (ret) 432 456 goto failed; 433 - local->amem = ioremap(req.Base, req.Size); 457 + local->amem = ioremap(link->resource[4]->start, 458 + resource_size(link->resource[4])); 434 459 435 460 dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); 436 461 dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); ··· 742 775 local->card_status = CARD_DOING_ACQ; 743 776 } 744 777 745 - /*============================================================================ 746 - After a card is removed, ray_release() will unregister the net 747 - device, and release the PCMCIA configuration. If the device is 748 - still open, this will be postponed until it is closed. 749 - =============================================================================*/ 778 + 750 779 static void ray_release(struct pcmcia_device *link) 751 780 { 752 781 struct net_device *dev = link->priv; ··· 2810 2847 2811 2848 static struct pcmcia_driver ray_driver = { 2812 2849 .owner = THIS_MODULE, 2813 - .drv = { 2814 - .name = "ray_cs", 2815 - }, 2850 + .name = "ray_cs", 2816 2851 .probe = ray_probe, 2817 2852 .remove = ray_detach, 2818 2853 .id_table = ray_ids,
-2
drivers/net/wireless/ray_cs.h
··· 25 25 typedef struct ray_dev_t { 26 26 int card_status; 27 27 int authentication_state; 28 - window_handle_t amem_handle; /* handle to window for attribute memory */ 29 - window_handle_t rmem_handle; /* handle to window for rx buffer on card */ 30 28 void __iomem *sram; /* pointer to beginning of shared RAM */ 31 29 void __iomem *amem; /* pointer to attribute mem window */ 32 30 void __iomem *rmem; /* pointer to receive buffer window */
+4 -43
drivers/net/wireless/wl3501_cs.c
··· 48 48 49 49 #include <net/iw_handler.h> 50 50 51 - #include <pcmcia/cs.h> 52 51 #include <pcmcia/cistpl.h> 53 52 #include <pcmcia/cisreg.h> 54 53 #include <pcmcia/ds.h> ··· 77 78 #define WL3501_RESUME 0 78 79 #define WL3501_SUSPEND 1 79 80 80 - /* 81 - * The event() function is this driver's Card Services event handler. It will 82 - * be called by Card Services when an appropriate card status event is 83 - * received. The config() and release() entry points are used to configure or 84 - * release a socket, in response to card insertion and ejection events. They 85 - * are invoked from the wl24 event handler. 86 - */ 87 81 static int wl3501_config(struct pcmcia_device *link); 88 82 static void wl3501_release(struct pcmcia_device *link); 89 83 ··· 1861 1869 .ndo_validate_addr = eth_validate_addr, 1862 1870 }; 1863 1871 1864 - /** 1865 - * wl3501_attach - creates an "instance" of the driver 1866 - * 1867 - * Creates an "instance" of the driver, allocating local data structures for 1868 - * one device. The device is registered with Card Services. 1869 - * 1870 - * The dev_link structure is initialized, but we don't actually configure the 1871 - * card at this point -- we wait until we receive a card insertion event. 1872 - */ 1873 1872 static int wl3501_probe(struct pcmcia_device *p_dev) 1874 1873 { 1875 1874 struct net_device *dev; ··· 1871 1888 p_dev->resource[0]->flags = IO_DATA_PATH_WIDTH_8; 1872 1889 1873 1890 /* General socket configuration */ 1874 - p_dev->conf.Attributes = CONF_ENABLE_IRQ; 1875 - p_dev->conf.IntType = INT_MEMORY_AND_IO; 1876 - p_dev->conf.ConfigIndex = 1; 1891 + p_dev->config_flags = CONF_ENABLE_IRQ; 1892 + p_dev->config_index = 1; 1877 1893 1878 1894 dev = alloc_etherdev(sizeof(struct wl3501_card)); 1879 1895 if (!dev) ··· 1896 1914 return -ENOMEM; 1897 1915 } 1898 1916 1899 - /** 1900 - * wl3501_config - configure the PCMCIA socket and make eth device available 1901 - * @link - FILL_IN 1902 - * 1903 - * wl3501_config() is scheduled to run after a CARD_INSERTION event is 1904 - * received, to configure the PCMCIA socket, and to make the ethernet device 1905 - * available to the system. 1906 - */ 1907 1917 static int wl3501_config(struct pcmcia_device *link) 1908 1918 { 1909 1919 struct net_device *dev = link->priv; ··· 1926 1952 if (ret) 1927 1953 goto failed; 1928 1954 1929 - /* This actually configures the PCMCIA socket -- setting up the I/O 1930 - * windows and the interrupt mapping. */ 1931 - 1932 - ret = pcmcia_request_configuration(link, &link->conf); 1955 + ret = pcmcia_enable_device(link); 1933 1956 if (ret) 1934 1957 goto failed; 1935 1958 ··· 1981 2010 return -ENODEV; 1982 2011 } 1983 2012 1984 - /** 1985 - * wl3501_release - unregister the net, release PCMCIA configuration 1986 - * @arg - link 1987 - * 1988 - * After a card is removed, wl3501_release() will unregister the net device, 1989 - * and release the PCMCIA configuration. If the device is still open, this 1990 - * will be postponed until it is closed. 1991 - */ 1992 2013 static void wl3501_release(struct pcmcia_device *link) 1993 2014 { 1994 2015 pcmcia_disable_device(link); ··· 2019 2056 2020 2057 static struct pcmcia_driver wl3501_driver = { 2021 2058 .owner = THIS_MODULE, 2022 - .drv = { 2023 - .name = "wl3501_cs", 2024 - }, 2059 + .name = "wl3501_cs", 2025 2060 .probe = wl3501_probe, 2026 2061 .remove = wl3501_detach, 2027 2062 .id_table = wl3501_ids,
+13 -63
drivers/parport/parport_cs.c
··· 48 48 #include <linux/parport.h> 49 49 #include <linux/parport_pc.h> 50 50 51 - #include <pcmcia/cs.h> 52 51 #include <pcmcia/cistpl.h> 53 52 #include <pcmcia/ds.h> 54 53 #include <pcmcia/cisreg.h> ··· 80 81 static int parport_config(struct pcmcia_device *link); 81 82 static void parport_cs_release(struct pcmcia_device *); 82 83 83 - /*====================================================================== 84 - 85 - parport_attach() creates an "instance" of the driver, allocating 86 - local data structures for one device. The device is registered 87 - with Card Services. 88 - 89 - ======================================================================*/ 90 - 91 84 static int parport_probe(struct pcmcia_device *link) 92 85 { 93 86 parport_info_t *info; ··· 92 101 link->priv = info; 93 102 info->p_dev = link; 94 103 95 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 96 - link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 97 - link->conf.Attributes = CONF_ENABLE_IRQ; 98 - link->conf.IntType = INT_MEMORY_AND_IO; 104 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 99 105 100 106 return parport_config(link); 101 107 } /* parport_attach */ 102 - 103 - /*====================================================================== 104 - 105 - This deletes a driver "instance". The device is de-registered 106 - with Card Services. If it has been released, all local data 107 - structures are freed. Otherwise, the structures will be freed 108 - when the device is released. 109 - 110 - ======================================================================*/ 111 108 112 109 static void parport_detach(struct pcmcia_device *link) 113 110 { ··· 106 127 kfree(link->priv); 107 128 } /* parport_detach */ 108 129 109 - /*====================================================================== 110 - 111 - parport_config() is scheduled to run after a CARD_INSERTION event 112 - is received, to configure the PCMCIA socket, and to make the 113 - parport device available to the system. 114 - 115 - ======================================================================*/ 116 - 117 - static int parport_config_check(struct pcmcia_device *p_dev, 118 - cistpl_cftable_entry_t *cfg, 119 - cistpl_cftable_entry_t *dflt, 120 - unsigned int vcc, 121 - void *priv_data) 130 + static int parport_config_check(struct pcmcia_device *p_dev, void *priv_data) 122 131 { 123 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 124 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 125 - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 126 - if (epp_mode) 127 - p_dev->conf.ConfigIndex |= FORCE_EPP_MODE; 128 - p_dev->resource[0]->start = io->win[0].base; 129 - p_dev->resource[0]->end = io->win[0].len; 130 - if (io->nwin == 2) { 131 - p_dev->resource[1]->start = io->win[1].base; 132 - p_dev->resource[1]->end = io->win[1].len; 133 - } 134 - if (pcmcia_request_io(p_dev) != 0) 135 - return -ENODEV; 136 - return 0; 137 - } 138 - return -ENODEV; 132 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 133 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 134 + p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; 135 + p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 136 + 137 + return pcmcia_request_io(p_dev); 139 138 } 140 139 141 140 static int parport_config(struct pcmcia_device *link) ··· 124 167 125 168 dev_dbg(&link->dev, "parport_config\n"); 126 169 170 + if (epp_mode) 171 + link->config_index |= FORCE_EPP_MODE; 172 + 127 173 ret = pcmcia_loop_config(link, parport_config_check, NULL); 128 174 if (ret) 129 175 goto failed; 130 176 131 177 if (!link->irq) 132 178 goto failed; 133 - ret = pcmcia_request_configuration(link, &link->conf); 179 + ret = pcmcia_enable_device(link); 134 180 if (ret) 135 181 goto failed; 136 182 ··· 162 202 return -ENODEV; 163 203 } /* parport_config */ 164 204 165 - /*====================================================================== 166 - 167 - After a card is removed, parport_cs_release() will unregister the 168 - device, and release the PCMCIA configuration. If the device is 169 - still open, this will be postponed until it is closed. 170 - 171 - ======================================================================*/ 172 - 173 205 static void parport_cs_release(struct pcmcia_device *link) 174 206 { 175 207 parport_info_t *info = link->priv; ··· 188 236 189 237 static struct pcmcia_driver parport_cs_driver = { 190 238 .owner = THIS_MODULE, 191 - .drv = { 192 - .name = "parport_cs", 193 - }, 239 + .name = "parport_cs", 194 240 .probe = parport_probe, 195 241 .remove = parport_detach, 196 242 .id_table = parport_ids,
-3
drivers/pcmcia/au1000_generic.c
··· 441 441 442 442 443 443 out_err: 444 - flush_scheduled_work(); 445 444 ops->hw_shutdown(skt); 446 445 while (i-- > 0) { 447 446 skt = PCMCIA_SOCKET(i); 448 447 449 448 del_timer_sync(&skt->poll_timer); 450 449 pcmcia_unregister_socket(&skt->socket); 451 - flush_scheduled_work(); 452 450 if (i == 0) { 453 451 iounmap(skt->virt_io + (u32)mips_io_port_base); 454 452 skt->virt_io = NULL; ··· 478 480 479 481 del_timer_sync(&skt->poll_timer); 480 482 pcmcia_unregister_socket(&skt->socket); 481 - flush_scheduled_work(); 482 483 skt->ops->hw_shutdown(skt); 483 484 au1x00_pcmcia_config_skt(skt, &dead_socket); 484 485 iounmap(skt->virt_io + (u32)mips_io_port_base);
-1
drivers/pcmcia/au1000_generic.h
··· 23 23 24 24 /* include the world */ 25 25 26 - #include <pcmcia/cs.h> 27 26 #include <pcmcia/ss.h> 28 27 #include <pcmcia/cistpl.h> 29 28 #include "cs_internal.h"
-1
drivers/pcmcia/au1000_pb1x00.c
··· 31 31 #include <linux/proc_fs.h> 32 32 #include <linux/types.h> 33 33 34 - #include <pcmcia/cs.h> 35 34 #include <pcmcia/ss.h> 36 35 #include <pcmcia/cistpl.h> 37 36
-1
drivers/pcmcia/cistpl.c
··· 28 28 #include <asm/unaligned.h> 29 29 30 30 #include <pcmcia/ss.h> 31 - #include <pcmcia/cs.h> 32 31 #include <pcmcia/cisreg.h> 33 32 #include <pcmcia/cistpl.h> 34 33 #include "cs_internal.h"
+1 -2
drivers/pcmcia/cs.c
··· 33 33 #include <asm/irq.h> 34 34 35 35 #include <pcmcia/ss.h> 36 - #include <pcmcia/cs.h> 37 36 #include <pcmcia/cistpl.h> 38 37 #include <pcmcia/cisreg.h> 39 38 #include <pcmcia/ds.h> ··· 844 845 return __pcmcia_pm_op(dev, socket_early_resume); 845 846 } 846 847 847 - static int pcmcia_socket_dev_resume(struct device *dev) 848 + static int __used pcmcia_socket_dev_resume(struct device *dev) 848 849 { 849 850 return __pcmcia_pm_op(dev, socket_late_resume); 850 851 }
-9
drivers/pcmcia/cs_internal.h
··· 33 33 typedef struct config_t { 34 34 struct kref ref; 35 35 unsigned int state; 36 - unsigned int Attributes; 37 - unsigned int IntType; 38 - unsigned int ConfigBase; 39 - unsigned char Status, Pin, Copy, Option, ExtStatus; 40 - unsigned int CardValues; 41 36 42 37 struct resource io[MAX_IO_WIN]; /* io ports */ 43 38 struct resource mem[MAX_WIN]; /* mem areas */ 44 - 45 - struct { 46 - u_int Attributes; 47 - } irq; 48 39 } config_t; 49 40 50 41
+22 -15
drivers/pcmcia/ds.c
··· 26 26 #include <linux/dma-mapping.h> 27 27 #include <linux/slab.h> 28 28 29 - #include <pcmcia/cs.h> 30 29 #include <pcmcia/cistpl.h> 31 30 #include <pcmcia/ds.h> 32 31 #include <pcmcia/ss.h> ··· 51 52 52 53 if (!p_drv->probe || !p_drv->remove) 53 54 printk(KERN_DEBUG "pcmcia: %s lacks a requisite callback " 54 - "function\n", p_drv->drv.name); 55 + "function\n", p_drv->name); 55 56 56 57 while (did && did->match_flags) { 57 58 for (i = 0; i < 4; i++) { ··· 64 65 65 66 printk(KERN_DEBUG "pcmcia: %s: invalid hash for " 66 67 "product string \"%s\": is 0x%x, should " 67 - "be 0x%x\n", p_drv->drv.name, did->prod_id[i], 68 + "be 0x%x\n", p_drv->name, did->prod_id[i], 68 69 did->prod_id_hash[i], hash); 69 70 printk(KERN_DEBUG "pcmcia: see " 70 71 "Documentation/pcmcia/devicetable.txt for " ··· 179 180 /* initialize common fields */ 180 181 driver->drv.bus = &pcmcia_bus_type; 181 182 driver->drv.owner = driver->owner; 183 + driver->drv.name = driver->name; 182 184 mutex_init(&driver->dynids.lock); 183 185 INIT_LIST_HEAD(&driver->dynids.list); 184 186 185 - pr_debug("registering driver %s\n", driver->drv.name); 187 + pr_debug("registering driver %s\n", driver->name); 186 188 187 189 error = driver_register(&driver->drv); 188 190 if (error < 0) ··· 203 203 */ 204 204 void pcmcia_unregister_driver(struct pcmcia_driver *driver) 205 205 { 206 - pr_debug("unregistering driver %s\n", driver->drv.name); 206 + pr_debug("unregistering driver %s\n", driver->name); 207 207 driver_unregister(&driver->drv); 208 208 pcmcia_free_dynids(driver); 209 209 } ··· 264 264 p_drv = to_pcmcia_drv(dev->driver); 265 265 s = p_dev->socket; 266 266 267 - dev_dbg(dev, "trying to bind to %s\n", p_drv->drv.name); 267 + dev_dbg(dev, "trying to bind to %s\n", p_drv->name); 268 268 269 269 if ((!p_drv->probe) || (!p_dev->function_config) || 270 270 (!try_module_get(p_drv->owner))) { ··· 276 276 ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG, 277 277 &cis_config); 278 278 if (!ret) { 279 - p_dev->conf.ConfigBase = cis_config.base; 280 - p_dev->conf.Present = cis_config.rmask[0]; 279 + p_dev->config_base = cis_config.base; 280 + p_dev->config_regs = cis_config.rmask[0]; 281 + dev_dbg(dev, "base %x, regs %x", p_dev->config_base, 282 + p_dev->config_regs); 281 283 } else { 282 284 dev_printk(KERN_INFO, dev, 283 285 "pcmcia: could not parse base and rmask0 of CIS\n"); 284 - p_dev->conf.ConfigBase = 0; 285 - p_dev->conf.Present = 0; 286 + p_dev->config_base = 0; 287 + p_dev->config_regs = 0; 286 288 } 287 289 288 290 ret = p_drv->probe(p_dev); 289 291 if (ret) { 290 292 dev_dbg(dev, "binding to %s failed with %d\n", 291 - p_drv->drv.name, ret); 293 + p_drv->name, ret); 292 294 goto put_module; 293 295 } 296 + dev_dbg(dev, "%s bound: Vpp %d.%d, idx %x, IRQ %d", p_drv->name, 297 + p_dev->vpp/10, p_dev->vpp%10, p_dev->config_index, p_dev->irq); 298 + dev_dbg(dev, "resources: ioport %pR %pR iomem %pR %pR %pR", 299 + p_dev->resource[0], p_dev->resource[1], p_dev->resource[2], 300 + p_dev->resource[3], p_dev->resource[4]); 294 301 295 302 mutex_lock(&s->ops_mutex); 296 303 if ((s->pcmcia_pfc) && ··· 381 374 if (p_dev->_irq || p_dev->_io || p_dev->_locked) 382 375 dev_printk(KERN_INFO, dev, 383 376 "pcmcia: driver %s did not release config properly\n", 384 - p_drv->drv.name); 377 + p_drv->name); 385 378 386 379 for (i = 0; i < MAX_WIN; i++) 387 380 if (p_dev->_win & CLIENT_WIN_REQ(i)) 388 381 dev_printk(KERN_INFO, dev, 389 382 "pcmcia: driver %s did not release window properly\n", 390 - p_drv->drv.name); 383 + p_drv->name); 391 384 392 385 /* references from pcmcia_probe_device */ 393 386 pcmcia_put_dev(p_dev); ··· 1143 1136 dev_printk(KERN_ERR, dev, 1144 1137 "pcmcia: device %s (driver %s) did " 1145 1138 "not want to go to sleep (%d)\n", 1146 - p_dev->devname, p_drv->drv.name, ret); 1139 + p_dev->devname, p_drv->name, ret); 1147 1140 mutex_lock(&p_dev->socket->ops_mutex); 1148 1141 p_dev->suspended = 0; 1149 1142 mutex_unlock(&p_dev->socket->ops_mutex); ··· 1185 1178 1186 1179 if (p_dev->device_no == p_dev->func) { 1187 1180 dev_dbg(dev, "requesting configuration\n"); 1188 - ret = pcmcia_request_configuration(p_dev, &p_dev->conf); 1181 + ret = pcmcia_enable_device(p_dev); 1189 1182 if (ret) 1190 1183 goto out; 1191 1184 }
-1
drivers/pcmcia/i82092.c
··· 16 16 #include <linux/device.h> 17 17 18 18 #include <pcmcia/ss.h> 19 - #include <pcmcia/cs.h> 20 19 21 20 #include <asm/system.h> 22 21 #include <asm/io.h>
-1
drivers/pcmcia/i82365.c
··· 51 51 #include <asm/system.h> 52 52 53 53 #include <pcmcia/ss.h> 54 - #include <pcmcia/cs.h> 55 54 56 55 #include <linux/isapnp.h> 57 56
-1
drivers/pcmcia/m32r_cfc.c
··· 27 27 #include <asm/system.h> 28 28 29 29 #include <pcmcia/ss.h> 30 - #include <pcmcia/cs.h> 31 30 32 31 #undef MAX_IO_WIN /* FIXME */ 33 32 #define MAX_IO_WIN 1
-1
drivers/pcmcia/m32r_pcc.c
··· 28 28 #include <asm/addrspace.h> 29 29 30 30 #include <pcmcia/ss.h> 31 - #include <pcmcia/cs.h> 32 31 33 32 /* XXX: should be moved into asm/irq.h */ 34 33 #define PCC0_IRQ 24
-1
drivers/pcmcia/m8xx_pcmcia.c
··· 59 59 #include <asm/irq.h> 60 60 #include <asm/fs_pd.h> 61 61 62 - #include <pcmcia/cs.h> 63 62 #include <pcmcia/ss.h> 64 63 65 64 #define pcmcia_info(args...) printk(KERN_INFO "m8xx_pcmcia: "args)
+2 -2
drivers/pcmcia/o2micro.h
··· 153 153 154 154 if (use_speedup) { 155 155 dev_info(&socket->dev->dev, 156 - "O2: enabling read prefetch/write burst\n"); 156 + "O2: enabling read prefetch/write burst. If you experience problems or performance issues, use the yenta_socket parameter 'o2_speedup=off'\n"); 157 157 config_writeb(socket, O2_RESERVED1, 158 158 a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST); 159 159 config_writeb(socket, O2_RESERVED2, 160 160 b | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST); 161 161 } else { 162 162 dev_info(&socket->dev->dev, 163 - "O2: disabling read prefetch/write burst\n"); 163 + "O2: disabling read prefetch/write burst. If you experience problems or performance issues, use the yenta_socket parameter 'o2_speedup=on'\n"); 164 164 config_writeb(socket, O2_RESERVED1, 165 165 a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST)); 166 166 config_writeb(socket, O2_RESERVED2,
+100 -17
drivers/pcmcia/pcmcia_cis.c
··· 6 6 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 7 7 * 8 8 * Copyright (C) 1999 David A. Hinds 9 - * Copyright (C) 2004-2009 Dominik Brodowski 9 + * Copyright (C) 2004-2010 Dominik Brodowski 10 10 * 11 11 * This program is free software; you can redistribute it and/or modify 12 12 * it under the terms of the GNU General Public License version 2 as ··· 22 22 #include <pcmcia/cisreg.h> 23 23 #include <pcmcia/cistpl.h> 24 24 #include <pcmcia/ss.h> 25 - #include <pcmcia/cs.h> 26 25 #include <pcmcia/ds.h> 27 26 #include "cs_internal.h" 28 27 ··· 125 126 return ret; 126 127 } 127 128 129 + 130 + /** 131 + * pcmcia_io_cfg_data_width() - convert cfgtable to data path width parameter 132 + */ 133 + static int pcmcia_io_cfg_data_width(unsigned int flags) 134 + { 135 + if (!(flags & CISTPL_IO_8BIT)) 136 + return IO_DATA_PATH_WIDTH_16; 137 + if (!(flags & CISTPL_IO_16BIT)) 138 + return IO_DATA_PATH_WIDTH_8; 139 + return IO_DATA_PATH_WIDTH_AUTO; 140 + } 141 + 142 + 128 143 struct pcmcia_cfg_mem { 129 144 struct pcmcia_device *p_dev; 145 + int (*conf_check) (struct pcmcia_device *p_dev, void *priv_data); 130 146 void *priv_data; 131 - int (*conf_check) (struct pcmcia_device *p_dev, 132 - cistpl_cftable_entry_t *cfg, 133 - cistpl_cftable_entry_t *dflt, 134 - unsigned int vcc, 135 - void *priv_data); 136 147 cisparse_t parse; 137 148 cistpl_cftable_entry_t dflt; 138 149 }; ··· 156 147 */ 157 148 static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv) 158 149 { 159 - cistpl_cftable_entry_t *cfg = &parse->cftable_entry; 160 150 struct pcmcia_cfg_mem *cfg_mem = priv; 151 + struct pcmcia_device *p_dev = cfg_mem->p_dev; 152 + cistpl_cftable_entry_t *cfg = &parse->cftable_entry; 153 + cistpl_cftable_entry_t *dflt = &cfg_mem->dflt; 154 + unsigned int flags = p_dev->config_flags; 155 + unsigned int vcc = p_dev->socket->socket.Vcc; 156 + 157 + dev_dbg(&p_dev->dev, "testing configuration %x, autoconf %x\n", 158 + cfg->index, flags); 161 159 162 160 /* default values */ 163 - cfg_mem->p_dev->conf.ConfigIndex = cfg->index; 161 + cfg_mem->p_dev->config_index = cfg->index; 164 162 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) 165 163 cfg_mem->dflt = *cfg; 166 164 167 - return cfg_mem->conf_check(cfg_mem->p_dev, cfg, &cfg_mem->dflt, 168 - cfg_mem->p_dev->socket->socket.Vcc, 169 - cfg_mem->priv_data); 165 + /* check for matching Vcc? */ 166 + if (flags & CONF_AUTO_CHECK_VCC) { 167 + if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { 168 + if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) 169 + return -ENODEV; 170 + } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { 171 + if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) 172 + return -ENODEV; 173 + } 174 + } 175 + 176 + /* set Vpp? */ 177 + if (flags & CONF_AUTO_SET_VPP) { 178 + if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 179 + p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 180 + else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) 181 + p_dev->vpp = 182 + dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; 183 + } 184 + 185 + /* enable audio? */ 186 + if ((flags & CONF_AUTO_AUDIO) && (cfg->flags & CISTPL_CFTABLE_AUDIO)) 187 + p_dev->config_flags |= CONF_ENABLE_SPKR; 188 + 189 + 190 + /* IO window settings? */ 191 + if (flags & CONF_AUTO_SET_IO) { 192 + cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 193 + int i = 0; 194 + 195 + p_dev->resource[0]->start = p_dev->resource[0]->end = 0; 196 + p_dev->resource[1]->start = p_dev->resource[1]->end = 0; 197 + if (io->nwin == 0) 198 + return -ENODEV; 199 + 200 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 201 + p_dev->resource[0]->flags |= 202 + pcmcia_io_cfg_data_width(io->flags); 203 + if (io->nwin > 1) { 204 + /* For multifunction cards, by convention, we 205 + * configure the network function with window 0, 206 + * and serial with window 1 */ 207 + i = (io->win[1].len > io->win[0].len); 208 + p_dev->resource[1]->flags = p_dev->resource[0]->flags; 209 + p_dev->resource[1]->start = io->win[1-i].base; 210 + p_dev->resource[1]->end = io->win[1-i].len; 211 + } 212 + p_dev->resource[0]->start = io->win[i].base; 213 + p_dev->resource[0]->end = io->win[i].len; 214 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 215 + } 216 + 217 + /* MEM window settings? */ 218 + if (flags & CONF_AUTO_SET_IOMEM) { 219 + /* so far, we only set one memory window */ 220 + cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; 221 + 222 + p_dev->resource[2]->start = p_dev->resource[2]->end = 0; 223 + if (mem->nwin == 0) 224 + return -ENODEV; 225 + 226 + p_dev->resource[2]->start = mem->win[0].host_addr; 227 + p_dev->resource[2]->end = mem->win[0].len; 228 + if (p_dev->resource[2]->end < 0x1000) 229 + p_dev->resource[2]->end = 0x1000; 230 + p_dev->card_addr = mem->win[0].card_addr; 231 + } 232 + 233 + dev_dbg(&p_dev->dev, 234 + "checking configuration %x: %pr %pr %pr (%d lines)\n", 235 + p_dev->config_index, p_dev->resource[0], p_dev->resource[1], 236 + p_dev->resource[2], p_dev->io_lines); 237 + 238 + return cfg_mem->conf_check(p_dev, cfg_mem->priv_data); 170 239 } 171 240 172 241 /** 173 242 * pcmcia_loop_config() - loop over configuration options 174 243 * @p_dev: the struct pcmcia_device which we need to loop for. 175 244 * @conf_check: function to call for each configuration option. 176 - * It gets passed the struct pcmcia_device, the CIS data 177 - * describing the configuration option, and private data 245 + * It gets passed the struct pcmcia_device and private data 178 246 * being passed to pcmcia_loop_config() 179 247 * @priv_data: private data to be passed to the conf_check function. 180 248 * ··· 261 175 */ 262 176 int pcmcia_loop_config(struct pcmcia_device *p_dev, 263 177 int (*conf_check) (struct pcmcia_device *p_dev, 264 - cistpl_cftable_entry_t *cfg, 265 - cistpl_cftable_entry_t *dflt, 266 - unsigned int vcc, 267 178 void *priv_data), 268 179 void *priv_data) 269 180 {
+252 -167
drivers/pcmcia/pcmcia_resource.c
··· 6 6 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 7 7 * 8 8 * Copyright (C) 1999 David A. Hinds 9 - * Copyright (C) 2004-2005 Dominik Brodowski 9 + * Copyright (C) 2004-2010 Dominik Brodowski 10 10 * 11 11 * This program is free software; you can redistribute it and/or modify 12 12 * it under the terms of the GNU General Public License version 2 as ··· 26 26 #include <asm/irq.h> 27 27 28 28 #include <pcmcia/ss.h> 29 - #include <pcmcia/cs.h> 30 29 #include <pcmcia/cistpl.h> 31 30 #include <pcmcia/cisreg.h> 32 31 #include <pcmcia/ds.h> ··· 55 56 } 56 57 57 58 59 + /** 60 + * release_io_space() - release IO ports allocated with alloc_io_space() 61 + * @s: pcmcia socket 62 + * @res: resource to release 63 + * 64 + */ 58 65 static void release_io_space(struct pcmcia_socket *s, struct resource *res) 59 66 { 60 67 resource_size_t num = resource_size(res); ··· 86 81 } 87 82 } 88 83 } 89 - } /* release_io_space */ 84 + } 90 85 91 - /** alloc_io_space 86 + 87 + /** 88 + * alloc_io_space() - allocate IO ports for use by a PCMCIA device 89 + * @s: pcmcia socket 90 + * @res: resource to allocate (begin: begin, end: size) 91 + * @lines: number of IO lines decoded by the PCMCIA card 92 92 * 93 93 * Special stuff for managing IO windows, because they are scarce 94 94 */ ··· 145 135 } 146 136 dev_dbg(&s->dev, "alloc_io_space request result %d: %pR\n", ret, res); 147 137 return ret; 148 - } /* alloc_io_space */ 138 + } 149 139 150 140 151 141 /** ··· 178 168 return -EACCES; 179 169 } 180 170 181 - addr = (c->ConfigBase + where) >> 1; 171 + addr = (p_dev->config_base + where) >> 1; 182 172 183 173 ret = accessf(s, 1, addr, 1, val); 184 174 185 175 mutex_unlock(&s->ops_mutex); 186 176 187 177 return ret; 188 - } /* pcmcia_access_config */ 178 + } 189 179 190 180 191 181 /** ··· 214 204 EXPORT_SYMBOL(pcmcia_write_config_byte); 215 205 216 206 217 - int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, 207 + /** 208 + * pcmcia_map_mem_page() - modify iomem window to point to a different offset 209 + * @p_dev: pcmcia device 210 + * @res: iomem resource already enabled by pcmcia_request_window() 211 + * @offset: card_offset to map 212 + * 213 + * pcmcia_map_mem_page() modifies what can be read and written by accessing 214 + * an iomem range previously enabled by pcmcia_request_window(), by setting 215 + * the card_offset value to @offset. 216 + */ 217 + int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, 218 218 unsigned int offset) 219 219 { 220 220 struct pcmcia_socket *s = p_dev->socket; 221 - struct resource *res = wh; 222 221 unsigned int w; 223 222 int ret; 224 223 ··· 242 223 dev_warn(&p_dev->dev, "failed to set_mem_map\n"); 243 224 mutex_unlock(&s->ops_mutex); 244 225 return ret; 245 - } /* pcmcia_map_mem_page */ 226 + } 246 227 EXPORT_SYMBOL(pcmcia_map_mem_page); 247 228 248 229 249 - /** pcmcia_modify_configuration 230 + /** 231 + * pcmcia_fixup_iowidth() - reduce io width to 8bit 232 + * @p_dev: pcmcia device 250 233 * 251 - * Modify a locked socket configuration 234 + * pcmcia_fixup_iowidth() allows a PCMCIA device driver to reduce the 235 + * IO width to 8bit after having called pcmcia_enable_device() 236 + * previously. 252 237 */ 253 - int pcmcia_modify_configuration(struct pcmcia_device *p_dev, 254 - modconf_t *mod) 238 + int pcmcia_fixup_iowidth(struct pcmcia_device *p_dev) 255 239 { 256 - struct pcmcia_socket *s; 257 - config_t *c; 258 - int ret; 259 - 260 - s = p_dev->socket; 240 + struct pcmcia_socket *s = p_dev->socket; 241 + pccard_io_map io_off = { 0, 0, 0, 0, 1 }; 242 + pccard_io_map io_on; 243 + int i, ret = 0; 261 244 262 245 mutex_lock(&s->ops_mutex); 263 - c = p_dev->function_config; 264 246 265 - if (!(s->state & SOCKET_PRESENT)) { 266 - dev_dbg(&p_dev->dev, "No card present\n"); 267 - ret = -ENODEV; 268 - goto unlock; 269 - } 270 - if (!(c->state & CONFIG_LOCKED)) { 271 - dev_dbg(&p_dev->dev, "Configuration isnt't locked\n"); 247 + dev_dbg(&p_dev->dev, "fixup iowidth to 8bit\n"); 248 + 249 + if (!(s->state & SOCKET_PRESENT) || 250 + !(p_dev->function_config->state & CONFIG_LOCKED)) { 251 + dev_dbg(&p_dev->dev, "No card? Config not locked?\n"); 272 252 ret = -EACCES; 273 253 goto unlock; 274 254 } 275 255 276 - if (mod->Attributes & (CONF_IRQ_CHANGE_VALID | CONF_VCC_CHANGE_VALID)) { 277 - dev_dbg(&p_dev->dev, 278 - "changing Vcc or IRQ is not allowed at this time\n"); 279 - ret = -EINVAL; 280 - goto unlock; 256 + io_on.speed = io_speed; 257 + for (i = 0; i < MAX_IO_WIN; i++) { 258 + if (!s->io[i].res) 259 + continue; 260 + io_off.map = i; 261 + io_on.map = i; 262 + 263 + io_on.flags = MAP_ACTIVE | IO_DATA_PATH_WIDTH_8; 264 + io_on.start = s->io[i].res->start; 265 + io_on.stop = s->io[i].res->end; 266 + 267 + s->ops->set_io_map(s, &io_off); 268 + mdelay(40); 269 + s->ops->set_io_map(s, &io_on); 281 270 } 282 - 283 - /* We only allow changing Vpp1 and Vpp2 to the same value */ 284 - if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) && 285 - (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { 286 - if (mod->Vpp1 != mod->Vpp2) { 287 - dev_dbg(&p_dev->dev, 288 - "Vpp1 and Vpp2 must be the same\n"); 289 - ret = -EINVAL; 290 - goto unlock; 291 - } 292 - s->socket.Vpp = mod->Vpp1; 293 - if (s->ops->set_socket(s, &s->socket)) { 294 - dev_printk(KERN_WARNING, &p_dev->dev, 295 - "Unable to set VPP\n"); 296 - ret = -EIO; 297 - goto unlock; 298 - } 299 - } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) || 300 - (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { 301 - dev_dbg(&p_dev->dev, 302 - "changing Vcc is not allowed at this time\n"); 303 - ret = -EINVAL; 304 - goto unlock; 305 - } 306 - 307 - if (mod->Attributes & CONF_IO_CHANGE_WIDTH) { 308 - pccard_io_map io_off = { 0, 0, 0, 0, 1 }; 309 - pccard_io_map io_on; 310 - int i; 311 - 312 - io_on.speed = io_speed; 313 - for (i = 0; i < MAX_IO_WIN; i++) { 314 - if (!s->io[i].res) 315 - continue; 316 - io_off.map = i; 317 - io_on.map = i; 318 - 319 - io_on.flags = MAP_ACTIVE | IO_DATA_PATH_WIDTH_8; 320 - io_on.start = s->io[i].res->start; 321 - io_on.stop = s->io[i].res->end; 322 - 323 - s->ops->set_io_map(s, &io_off); 324 - mdelay(40); 325 - s->ops->set_io_map(s, &io_on); 326 - } 327 - } 328 - ret = 0; 329 271 unlock: 330 272 mutex_unlock(&s->ops_mutex); 331 273 332 274 return ret; 333 - } /* modify_configuration */ 334 - EXPORT_SYMBOL(pcmcia_modify_configuration); 275 + } 276 + EXPORT_SYMBOL(pcmcia_fixup_iowidth); 335 277 336 278 279 + /** 280 + * pcmcia_fixup_vpp() - set Vpp to a new voltage level 281 + * @p_dev: pcmcia device 282 + * @new_vpp: new Vpp voltage 283 + * 284 + * pcmcia_fixup_vpp() allows a PCMCIA device driver to set Vpp to 285 + * a new voltage level between calls to pcmcia_enable_device() 286 + * and pcmcia_disable_device(). 287 + */ 288 + int pcmcia_fixup_vpp(struct pcmcia_device *p_dev, unsigned char new_vpp) 289 + { 290 + struct pcmcia_socket *s = p_dev->socket; 291 + int ret = 0; 292 + 293 + mutex_lock(&s->ops_mutex); 294 + 295 + dev_dbg(&p_dev->dev, "fixup Vpp to %d\n", new_vpp); 296 + 297 + if (!(s->state & SOCKET_PRESENT) || 298 + !(p_dev->function_config->state & CONFIG_LOCKED)) { 299 + dev_dbg(&p_dev->dev, "No card? Config not locked?\n"); 300 + ret = -EACCES; 301 + goto unlock; 302 + } 303 + 304 + s->socket.Vpp = new_vpp; 305 + if (s->ops->set_socket(s, &s->socket)) { 306 + dev_warn(&p_dev->dev, "Unable to set VPP\n"); 307 + ret = -EIO; 308 + goto unlock; 309 + } 310 + p_dev->vpp = new_vpp; 311 + 312 + unlock: 313 + mutex_unlock(&s->ops_mutex); 314 + 315 + return ret; 316 + } 317 + EXPORT_SYMBOL(pcmcia_fixup_vpp); 318 + 319 + 320 + /** 321 + * pcmcia_release_configuration() - physically disable a PCMCIA device 322 + * @p_dev: pcmcia device 323 + * 324 + * pcmcia_release_configuration() is the 1:1 counterpart to 325 + * pcmcia_enable_device(): If a PCMCIA device is no longer used by any 326 + * driver, the Vpp voltage is set to 0, IRQs will no longer be generated, 327 + * and I/O ranges will be disabled. As pcmcia_release_io() and 328 + * pcmcia_release_window() still need to be called, device drivers are 329 + * expected to call pcmcia_disable_device() instead. 330 + */ 337 331 int pcmcia_release_configuration(struct pcmcia_device *p_dev) 338 332 { 339 333 pccard_io_map io = { 0, 0, 0, 0, 1 }; ··· 359 327 if (p_dev->_locked) { 360 328 p_dev->_locked = 0; 361 329 if (--(s->lock_count) == 0) { 362 - s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ 330 + s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ 363 331 s->socket.Vpp = 0; 364 332 s->socket.io_irq = 0; 365 333 s->ops->set_socket(s, &s->socket); ··· 381 349 mutex_unlock(&s->ops_mutex); 382 350 383 351 return 0; 384 - } /* pcmcia_release_configuration */ 352 + } 385 353 386 354 387 - /** pcmcia_release_io 355 + /** 356 + * pcmcia_release_io() - release I/O allocated by a PCMCIA device 357 + * @p_dev: pcmcia device 388 358 * 389 - * Release_io() releases the I/O ranges allocated by a client. This 390 - * may be invoked some time after a card ejection has already dumped 391 - * the actual socket configuration, so if the client is "stale", we 392 - * don't bother checking the port ranges against the current socket 393 - * values. 359 + * pcmcia_release_io() releases the I/O ranges allocated by a PCMCIA 360 + * device. This may be invoked some time after a card ejection has 361 + * already dumped the actual socket configuration, so if the client is 362 + * "stale", we don't bother checking the port ranges against the 363 + * current socket values. 394 364 */ 395 365 static int pcmcia_release_io(struct pcmcia_device *p_dev) 396 366 { ··· 421 387 } /* pcmcia_release_io */ 422 388 423 389 390 + /** 391 + * pcmcia_release_window() - release reserved iomem for PCMCIA devices 392 + * @p_dev: pcmcia device 393 + * @res: iomem resource to release 394 + * 395 + * pcmcia_release_window() releases &struct resource *res which was 396 + * previously reserved by calling pcmcia_request_window(). 397 + */ 424 398 int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) 425 399 { 426 400 struct pcmcia_socket *s = p_dev->socket; ··· 462 420 kfree(win->res); 463 421 win->res = NULL; 464 422 } 423 + res->start = res->end = 0; 424 + res->flags = IORESOURCE_MEM; 465 425 p_dev->_win &= ~CLIENT_WIN_REQ(w); 466 426 mutex_unlock(&s->ops_mutex); 467 427 ··· 472 428 EXPORT_SYMBOL(pcmcia_release_window); 473 429 474 430 475 - int pcmcia_request_configuration(struct pcmcia_device *p_dev, 476 - config_req_t *req) 431 + /** 432 + * pcmcia_enable_device() - set up and activate a PCMCIA device 433 + * @p_dev: the associated PCMCIA device 434 + * 435 + * pcmcia_enable_device() physically enables a PCMCIA device. It parses 436 + * the flags passed to in @flags and stored in @p_dev->flags and sets up 437 + * the Vpp voltage, enables the speaker line, I/O ports and store proper 438 + * values to configuration registers. 439 + */ 440 + int pcmcia_enable_device(struct pcmcia_device *p_dev) 477 441 { 478 442 int i; 479 - u_int base; 443 + unsigned int base; 480 444 struct pcmcia_socket *s = p_dev->socket; 481 445 config_t *c; 482 446 pccard_io_map iomap; 447 + unsigned char status = 0; 448 + unsigned char ext_status = 0; 449 + unsigned char option = 0; 450 + unsigned int flags = p_dev->config_flags; 483 451 484 452 if (!(s->state & SOCKET_PRESENT)) 485 453 return -ENODEV; 486 - 487 - if (req->IntType & INT_CARDBUS) { 488 - dev_dbg(&p_dev->dev, "IntType may not be INT_CARDBUS\n"); 489 - return -EINVAL; 490 - } 491 454 492 455 mutex_lock(&s->ops_mutex); 493 456 c = p_dev->function_config; ··· 505 454 } 506 455 507 456 /* Do power control. We don't allow changes in Vcc. */ 508 - s->socket.Vpp = req->Vpp; 457 + s->socket.Vpp = p_dev->vpp; 509 458 if (s->ops->set_socket(s, &s->socket)) { 510 459 mutex_unlock(&s->ops_mutex); 511 460 dev_printk(KERN_WARNING, &p_dev->dev, ··· 514 463 } 515 464 516 465 /* Pick memory or I/O card, DMA mode, interrupt */ 517 - c->IntType = req->IntType; 518 - c->Attributes = req->Attributes; 519 - if (req->IntType & INT_MEMORY_AND_IO) 466 + if (p_dev->_io) 520 467 s->socket.flags |= SS_IOCARD; 521 - if (req->IntType & INT_ZOOMED_VIDEO) 522 - s->socket.flags |= SS_ZVCARD | SS_IOCARD; 523 - if (req->Attributes & CONF_ENABLE_DMA) 524 - s->socket.flags |= SS_DMA_MODE; 525 - if (req->Attributes & CONF_ENABLE_SPKR) 468 + if (flags & CONF_ENABLE_SPKR) { 526 469 s->socket.flags |= SS_SPKR_ENA; 527 - if (req->Attributes & CONF_ENABLE_IRQ) 470 + status = CCSR_AUDIO_ENA; 471 + if (!(p_dev->config_regs & PRESENT_STATUS)) 472 + dev_warn(&p_dev->dev, "speaker requested, but " 473 + "PRESENT_STATUS not set!\n"); 474 + } 475 + if (flags & CONF_ENABLE_IRQ) 528 476 s->socket.io_irq = s->pcmcia_irq; 529 477 else 530 478 s->socket.io_irq = 0; 479 + if (flags & CONF_ENABLE_ESR) { 480 + p_dev->config_regs |= PRESENT_EXT_STATUS; 481 + ext_status = ESR_REQ_ATTN_ENA; 482 + } 531 483 s->ops->set_socket(s, &s->socket); 532 484 s->lock_count++; 533 485 486 + dev_dbg(&p_dev->dev, 487 + "enable_device: V %d, flags %x, base %x, regs %x, idx %x\n", 488 + p_dev->vpp, flags, p_dev->config_base, p_dev->config_regs, 489 + p_dev->config_index); 490 + 534 491 /* Set up CIS configuration registers */ 535 - base = c->ConfigBase = req->ConfigBase; 536 - c->CardValues = req->Present; 537 - if (req->Present & PRESENT_COPY) { 538 - c->Copy = req->Copy; 539 - pcmcia_write_cis_mem(s, 1, (base + CISREG_SCR)>>1, 1, &c->Copy); 492 + base = p_dev->config_base; 493 + if (p_dev->config_regs & PRESENT_COPY) { 494 + u16 tmp = 0; 495 + dev_dbg(&p_dev->dev, "clearing CISREG_SCR\n"); 496 + pcmcia_write_cis_mem(s, 1, (base + CISREG_SCR)>>1, 1, &tmp); 540 497 } 541 - if (req->Present & PRESENT_OPTION) { 498 + if (p_dev->config_regs & PRESENT_PIN_REPLACE) { 499 + u16 tmp = 0; 500 + dev_dbg(&p_dev->dev, "clearing CISREG_PRR\n"); 501 + pcmcia_write_cis_mem(s, 1, (base + CISREG_PRR)>>1, 1, &tmp); 502 + } 503 + if (p_dev->config_regs & PRESENT_OPTION) { 542 504 if (s->functions == 1) { 543 - c->Option = req->ConfigIndex & COR_CONFIG_MASK; 505 + option = p_dev->config_index & COR_CONFIG_MASK; 544 506 } else { 545 - c->Option = req->ConfigIndex & COR_MFC_CONFIG_MASK; 546 - c->Option |= COR_FUNC_ENA|COR_IREQ_ENA; 547 - if (req->Present & PRESENT_IOBASE_0) 548 - c->Option |= COR_ADDR_DECODE; 507 + option = p_dev->config_index & COR_MFC_CONFIG_MASK; 508 + option |= COR_FUNC_ENA|COR_IREQ_ENA; 509 + if (p_dev->config_regs & PRESENT_IOBASE_0) 510 + option |= COR_ADDR_DECODE; 549 511 } 550 - if ((req->Attributes & CONF_ENABLE_IRQ) && 551 - !(req->Attributes & CONF_ENABLE_PULSE_IRQ)) 552 - c->Option |= COR_LEVEL_REQ; 553 - pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &c->Option); 512 + if ((flags & CONF_ENABLE_IRQ) && 513 + !(flags & CONF_ENABLE_PULSE_IRQ)) 514 + option |= COR_LEVEL_REQ; 515 + pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &option); 554 516 mdelay(40); 555 517 } 556 - if (req->Present & PRESENT_STATUS) { 557 - c->Status = req->Status; 558 - pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &c->Status); 559 - } 560 - if (req->Present & PRESENT_PIN_REPLACE) { 561 - c->Pin = req->Pin; 562 - pcmcia_write_cis_mem(s, 1, (base + CISREG_PRR)>>1, 1, &c->Pin); 563 - } 564 - if (req->Present & PRESENT_EXT_STATUS) { 565 - c->ExtStatus = req->ExtStatus; 566 - pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &c->ExtStatus); 567 - } 568 - if (req->Present & PRESENT_IOBASE_0) { 518 + if (p_dev->config_regs & PRESENT_STATUS) 519 + pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &status); 520 + 521 + if (p_dev->config_regs & PRESENT_EXT_STATUS) 522 + pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, 523 + &ext_status); 524 + 525 + if (p_dev->config_regs & PRESENT_IOBASE_0) { 569 526 u8 b = c->io[0].start & 0xff; 570 527 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); 571 528 b = (c->io[0].start >> 8) & 0xff; 572 529 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b); 573 530 } 574 - if (req->Present & PRESENT_IOSIZE) { 531 + if (p_dev->config_regs & PRESENT_IOSIZE) { 575 532 u8 b = resource_size(&c->io[0]) + resource_size(&c->io[1]) - 1; 576 533 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b); 577 534 } ··· 610 551 p_dev->_locked = 1; 611 552 mutex_unlock(&s->ops_mutex); 612 553 return 0; 613 - } /* pcmcia_request_configuration */ 614 - EXPORT_SYMBOL(pcmcia_request_configuration); 554 + } /* pcmcia_enable_device */ 555 + EXPORT_SYMBOL(pcmcia_enable_device); 615 556 616 557 617 558 /** 618 559 * pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices 560 + * @p_dev: the associated PCMCIA device 619 561 * 620 - * pcmcia_request_io() attepts to reserve the IO port ranges specified in 562 + * pcmcia_request_io() attempts to reserve the IO port ranges specified in 621 563 * &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The 622 564 * "start" value is the requested start of the IO port resource; "end" 623 565 * reflects the number of ports requested. The number of IO lines requested ··· 682 622 683 623 /** 684 624 * pcmcia_request_irq() - attempt to request a IRQ for a PCMCIA device 625 + * @p_dev: the associated PCMCIA device 626 + * @handler: IRQ handler to register 685 627 * 686 - * pcmcia_request_irq() is a wrapper around request_irq which will allow 628 + * pcmcia_request_irq() is a wrapper around request_irq() which allows 687 629 * the PCMCIA core to clean up the registration in pcmcia_disable_device(). 688 630 * Drivers are free to use request_irq() directly, but then they need to 689 - * call free_irq themselfves, too. Also, only IRQF_SHARED capable IRQ 631 + * call free_irq() themselfves, too. Also, only %IRQF_SHARED capable IRQ 690 632 * handlers are allowed. 691 633 */ 692 634 int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, ··· 711 649 712 650 /** 713 651 * pcmcia_request_exclusive_irq() - attempt to request an exclusive IRQ first 652 + * @p_dev: the associated PCMCIA device 653 + * @handler: IRQ handler to register 714 654 * 715 - * pcmcia_request_exclusive_irq() is a wrapper around request_irq which 655 + * pcmcia_request_exclusive_irq() is a wrapper around request_irq() which 716 656 * attempts first to request an exclusive IRQ. If it fails, it also accepts 717 657 * a shared IRQ, but prints out a warning. PCMCIA drivers should allow for 718 658 * IRQ sharing and either use request_irq directly (then they need to call 719 - * free_irq themselves, too), or the pcmcia_request_irq() function. 659 + * free_irq() themselves, too), or the pcmcia_request_irq() function. 720 660 */ 721 661 int __must_check 722 662 __pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev, ··· 859 795 } 860 796 861 797 862 - /** pcmcia_request_window 798 + /** 799 + * pcmcia_request_window() - attempt to reserve iomem for PCMCIA devices 800 + * @p_dev: the associated PCMCIA device 801 + * @res: &struct resource pointing to p_dev->resource[2..5] 802 + * @speed: access speed 863 803 * 864 - * Request_window() establishes a mapping between card memory space 865 - * and system memory space. 804 + * pcmcia_request_window() attepts to reserve an iomem ranges specified in 805 + * &struct resource @res pointing to one of the entries in 806 + * &struct pcmcia_device @p_dev->resource[2..5]. The "start" value is the 807 + * requested start of the IO mem resource; "end" reflects the size 808 + * requested. 866 809 */ 867 - int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_handle_t *wh) 810 + int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, 811 + unsigned int speed) 868 812 { 869 813 struct pcmcia_socket *s = p_dev->socket; 870 814 pccard_mem_map *win; 871 815 u_long align; 872 - struct resource *res; 873 816 int w; 817 + 818 + dev_dbg(&p_dev->dev, "request_window %pR %d\n", res, speed); 874 819 875 820 if (!(s->state & SOCKET_PRESENT)) { 876 821 dev_dbg(&p_dev->dev, "No card present\n"); ··· 887 814 } 888 815 889 816 /* Window size defaults to smallest available */ 890 - if (req->Size == 0) 891 - req->Size = s->map_size; 892 - align = (s->features & SS_CAP_MEM_ALIGN) ? req->Size : s->map_size; 893 - if (req->Size & (s->map_size-1)) { 817 + if (res->end == 0) 818 + res->end = s->map_size; 819 + align = (s->features & SS_CAP_MEM_ALIGN) ? res->end : s->map_size; 820 + if (res->end & (s->map_size-1)) { 894 821 dev_dbg(&p_dev->dev, "invalid map size\n"); 895 822 return -EINVAL; 896 823 } 897 - if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || 898 - (req->Base & (align-1))) { 824 + if ((res->start && (s->features & SS_CAP_STATIC_MAP)) || 825 + (res->start & (align-1))) { 899 826 dev_dbg(&p_dev->dev, "invalid base address\n"); 900 827 return -EINVAL; 901 828 } 902 - if (req->Base) 829 + if (res->start) 903 830 align = 0; 904 831 905 832 /* Allocate system memory window */ ··· 916 843 win = &s->win[w]; 917 844 918 845 if (!(s->features & SS_CAP_STATIC_MAP)) { 919 - win->res = pcmcia_find_mem_region(req->Base, req->Size, align, 846 + win->res = pcmcia_find_mem_region(res->start, res->end, align, 920 847 0, s); 921 848 if (!win->res) { 922 849 dev_dbg(&p_dev->dev, "allocating mem region failed\n"); ··· 928 855 929 856 /* Configure the socket controller */ 930 857 win->map = w+1; 931 - win->flags = req->Attributes; 932 - win->speed = req->AccessSpeed; 858 + win->flags = res->flags & WIN_FLAGS_MAP; 859 + win->speed = speed; 933 860 win->card_start = 0; 934 861 935 862 if (s->ops->set_mem_map(s, win) != 0) { ··· 941 868 942 869 /* Return window handle */ 943 870 if (s->features & SS_CAP_STATIC_MAP) 944 - req->Base = win->static_start; 871 + res->start = win->static_start; 945 872 else 946 - req->Base = win->res->start; 873 + res->start = win->res->start; 947 874 948 875 /* convert to new-style resources */ 949 - res = p_dev->resource[w + MAX_IO_WIN]; 950 - res->start = req->Base; 951 - res->end = req->Base + req->Size - 1; 952 - res->flags &= ~IORESOURCE_BITS; 953 - res->flags |= (req->Attributes & WIN_FLAGS_MAP) | (win->map << 2); 954 - res->flags |= IORESOURCE_MEM; 876 + res->end += res->start - 1; 877 + res->flags &= ~WIN_FLAGS_REQ; 878 + res->flags |= (win->map << 2) | IORESOURCE_MEM; 955 879 res->parent = win->res; 956 880 if (win->res) 957 881 request_resource(&iomem_resource, res); ··· 956 886 dev_dbg(&p_dev->dev, "request_window results in %pR\n", res); 957 887 958 888 mutex_unlock(&s->ops_mutex); 959 - *wh = res; 960 889 961 890 return 0; 962 891 } /* pcmcia_request_window */ 963 892 EXPORT_SYMBOL(pcmcia_request_window); 964 893 894 + 895 + /** 896 + * pcmcia_disable_device() - disable and clean up a PCMCIA device 897 + * @p_dev: the associated PCMCIA device 898 + * 899 + * pcmcia_disable_device() is the driver-callable counterpart to 900 + * pcmcia_enable_device(): If a PCMCIA device is no longer used, 901 + * drivers are expected to clean up and disable the device by calling 902 + * this function. Any I/O ranges (iomem and ioports) will be released, 903 + * the Vpp voltage will be set to 0, and IRQs will no longer be 904 + * generated -- at least if there is no other card function (of 905 + * multifunction devices) being used. 906 + */ 965 907 void pcmcia_disable_device(struct pcmcia_device *p_dev) 966 908 { 967 909 int i; 910 + 911 + dev_dbg(&p_dev->dev, "disabling device\n"); 912 + 968 913 for (i = 0; i < MAX_WIN; i++) { 969 914 struct resource *res = p_dev->resource[MAX_IO_WIN + i]; 970 915 if (res->flags & WIN_FLAGS_REQ)
-1
drivers/pcmcia/pd6729.c
··· 18 18 #include <linux/io.h> 19 19 20 20 #include <pcmcia/ss.h> 21 - #include <pcmcia/cs.h> 22 21 23 22 #include <asm/system.h> 24 23
-1
drivers/pcmcia/rsrc_iodyn.c
··· 17 17 #include <linux/kernel.h> 18 18 19 19 #include <pcmcia/ss.h> 20 - #include <pcmcia/cs.h> 21 20 #include <pcmcia/cistpl.h> 22 21 #include "cs_internal.h" 23 22
-1
drivers/pcmcia/rsrc_mgr.c
··· 17 17 #include <linux/kernel.h> 18 18 19 19 #include <pcmcia/ss.h> 20 - #include <pcmcia/cs.h> 21 20 #include <pcmcia/cistpl.h> 22 21 #include "cs_internal.h" 23 22
-1
drivers/pcmcia/rsrc_nonstatic.c
··· 29 29 #include <asm/irq.h> 30 30 31 31 #include <pcmcia/ss.h> 32 - #include <pcmcia/cs.h> 33 32 #include <pcmcia/cistpl.h> 34 33 #include "cs_internal.h" 35 34
-1
drivers/pcmcia/sa1100_generic.c
··· 35 35 #include <linux/slab.h> 36 36 #include <linux/platform_device.h> 37 37 38 - #include <pcmcia/cs.h> 39 38 #include <pcmcia/ss.h> 40 39 41 40 #include <asm/hardware/scoop.h>
-4
drivers/pcmcia/soc_common.c
··· 627 627 628 628 pcmcia_unregister_socket(&skt->socket); 629 629 630 - flush_scheduled_work(); 631 - 632 630 skt->ops->hw_shutdown(skt); 633 631 634 632 soc_common_pcmcia_config_skt(skt, &dead_socket); ··· 718 720 pcmcia_unregister_socket(&skt->socket); 719 721 720 722 out_err_7: 721 - flush_scheduled_work(); 722 - 723 723 skt->ops->hw_shutdown(skt); 724 724 out_err_6: 725 725 list_del(&skt->node);
-1
drivers/pcmcia/soc_common.h
··· 11 11 12 12 /* include the world */ 13 13 #include <linux/cpufreq.h> 14 - #include <pcmcia/cs.h> 15 14 #include <pcmcia/ss.h> 16 15 #include <pcmcia/cistpl.h> 17 16
-1
drivers/pcmcia/socket_sysfs.c
··· 27 27 #include <asm/irq.h> 28 28 29 29 #include <pcmcia/ss.h> 30 - #include <pcmcia/cs.h> 31 30 #include <pcmcia/cistpl.h> 32 31 #include <pcmcia/cisreg.h> 33 32 #include <pcmcia/ds.h>
-1
drivers/pcmcia/tcic.c
··· 49 49 #include <asm/io.h> 50 50 #include <asm/system.h> 51 51 52 - #include <pcmcia/cs.h> 53 52 #include <pcmcia/ss.h> 54 53 #include "tcic.h" 55 54
+39 -19
drivers/pcmcia/vrc4173_cardu.c
··· 461 461 { 462 462 vrc4173_socket_t *socket; 463 463 unsigned long start, len, flags; 464 - int slot, err; 464 + int slot, err, ret; 465 465 466 466 slot = vrc4173_cardu_slots++; 467 467 socket = &cardu_sockets[slot]; ··· 474 474 return err; 475 475 476 476 start = pci_resource_start(dev, 0); 477 - if (start == 0) 478 - return -ENODEV; 477 + if (start == 0) { 478 + ret = -ENODEV; 479 + goto disable; 480 + } 479 481 480 482 len = pci_resource_len(dev, 0); 481 - if (len == 0) 482 - return -ENODEV; 483 + if (len == 0) { 484 + ret = -ENODEV; 485 + goto disable; 486 + } 483 487 484 - if (((flags = pci_resource_flags(dev, 0)) & IORESOURCE_MEM) == 0) 485 - return -EBUSY; 488 + flags = pci_resource_flags(dev, 0); 489 + if ((flags & IORESOURCE_MEM) == 0) { 490 + ret = -EBUSY; 491 + goto disable; 492 + } 486 493 487 - if ((err = pci_request_regions(dev, socket->name)) < 0) 488 - return err; 494 + err = pci_request_regions(dev, socket->name); 495 + if (err < 0) { 496 + ret = err; 497 + goto disable; 498 + } 489 499 490 500 socket->base = ioremap(start, len); 491 - if (socket->base == NULL) 492 - return -ENODEV; 501 + if (socket->base == NULL) { 502 + ret = -ENODEV; 503 + goto release; 504 + } 493 505 494 506 socket->dev = dev; 495 507 496 508 socket->pcmcia_socket = pcmcia_register_socket(slot, &cardu_operations, 1); 497 509 if (socket->pcmcia_socket == NULL) { 498 - iounmap(socket->base); 499 - socket->base = NULL; 500 - return -ENOMEM; 510 + ret = -ENOMEM; 511 + goto unmap; 501 512 } 502 513 503 514 if (request_irq(dev->irq, cardu_interrupt, IRQF_SHARED, socket->name, socket) < 0) { 504 - pcmcia_unregister_socket(socket->pcmcia_socket); 505 - socket->pcmcia_socket = NULL; 506 - iounmap(socket->base); 507 - socket->base = NULL; 508 - return -EBUSY; 515 + ret = -EBUSY; 516 + goto unregister; 509 517 } 510 518 511 519 printk(KERN_INFO "%s at %#08lx, IRQ %d\n", socket->name, start, dev->irq); 512 520 513 521 return 0; 522 + 523 + unregister: 524 + pcmcia_unregister_socket(socket->pcmcia_socket); 525 + socket->pcmcia_socket = NULL; 526 + unmap: 527 + iounmap(socket->base); 528 + socket->base = NULL; 529 + release: 530 + pci_release_regions(dev); 531 + disable: 532 + pci_disable_device(dev); 533 + return ret; 514 534 } 515 535 516 536 static int __devinit vrc4173_cardu_setup(char *options)
-1
drivers/pcmcia/xxs1500_ss.c
··· 17 17 #include <linux/slab.h> 18 18 #include <linux/spinlock.h> 19 19 20 - #include <pcmcia/cs.h> 21 20 #include <pcmcia/ss.h> 22 21 #include <pcmcia/cistpl.h> 23 22
-1
drivers/pcmcia/yenta_socket.c
··· 20 20 #include <linux/slab.h> 21 21 22 22 #include <pcmcia/ss.h> 23 - #include <pcmcia/cs.h> 24 23 25 24 #include "yenta_socket.h" 26 25 #include "i82365.h"
+19 -29
drivers/scsi/pcmcia/aha152x_stub.c
··· 49 49 #include <scsi/scsi_host.h> 50 50 #include "aha152x.h" 51 51 52 - #include <pcmcia/cs.h> 53 52 #include <pcmcia/cistpl.h> 54 53 #include <pcmcia/ds.h> 55 54 ··· 85 86 static void aha152x_detach(struct pcmcia_device *p_dev); 86 87 static int aha152x_config_cs(struct pcmcia_device *link); 87 88 88 - static struct pcmcia_device *dev_list; 89 - 90 89 static int aha152x_probe(struct pcmcia_device *link) 91 90 { 92 91 scsi_info_t *info; ··· 97 100 info->p_dev = link; 98 101 link->priv = info; 99 102 100 - link->resource[0]->end = 0x20; 101 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 102 - link->conf.Attributes = CONF_ENABLE_IRQ; 103 - link->conf.IntType = INT_MEMORY_AND_IO; 104 - link->conf.Present = PRESENT_OPTION; 103 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 104 + link->config_regs = PRESENT_OPTION; 105 105 106 106 return aha152x_config_cs(link); 107 107 } /* aha152x_attach */ ··· 117 123 118 124 /*====================================================================*/ 119 125 120 - static int aha152x_config_check(struct pcmcia_device *p_dev, 121 - cistpl_cftable_entry_t *cfg, 122 - cistpl_cftable_entry_t *dflt, 123 - unsigned int vcc, 124 - void *priv_data) 126 + static int aha152x_config_check(struct pcmcia_device *p_dev, void *priv_data) 125 127 { 126 128 p_dev->io_lines = 10; 129 + 127 130 /* For New Media T&J, look for a SCSI window */ 128 - if (cfg->io.win[0].len >= 0x20) 129 - p_dev->resource[0]->start = cfg->io.win[0].base; 130 - else if ((cfg->io.nwin > 1) && 131 - (cfg->io.win[1].len >= 0x20)) 132 - p_dev->resource[0]->start = cfg->io.win[1].base; 133 - if ((cfg->io.nwin > 0) && 134 - (p_dev->resource[0]->start < 0xffff)) { 135 - if (!pcmcia_request_io(p_dev)) 136 - return 0; 137 - } 138 - return -EINVAL; 131 + if ((p_dev->resource[0]->end < 0x20) && 132 + (p_dev->resource[1]->end >= 0x20)) 133 + p_dev->resource[0]->start = p_dev->resource[1]->start; 134 + 135 + if (p_dev->resource[0]->start >= 0xffff) 136 + return -EINVAL; 137 + 138 + p_dev->resource[1]->start = p_dev->resource[1]->end = 0; 139 + p_dev->resource[0]->end = 0x20; 140 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 141 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 142 + 143 + return pcmcia_request_io(p_dev); 139 144 } 140 145 141 146 static int aha152x_config_cs(struct pcmcia_device *link) ··· 153 160 if (!link->irq) 154 161 goto failed; 155 162 156 - ret = pcmcia_request_configuration(link, &link->conf); 163 + ret = pcmcia_enable_device(link); 157 164 if (ret) 158 165 goto failed; 159 166 ··· 214 221 215 222 static struct pcmcia_driver aha152x_cs_driver = { 216 223 .owner = THIS_MODULE, 217 - .drv = { 218 - .name = "aha152x_cs", 219 - }, 224 + .name = "aha152x_cs", 220 225 .probe = aha152x_probe, 221 226 .remove = aha152x_detach, 222 227 .id_table = aha152x_ids, ··· 229 238 static void __exit exit_aha152x_cs(void) 230 239 { 231 240 pcmcia_unregister_driver(&aha152x_cs_driver); 232 - BUG_ON(dev_list != NULL); 233 241 } 234 242 235 243 module_init(init_aha152x_cs);
+8 -16
drivers/scsi/pcmcia/fdomain_stub.c
··· 46 46 #include <scsi/scsi_host.h> 47 47 #include "fdomain.h" 48 48 49 - #include <pcmcia/cs.h> 50 49 #include <pcmcia/cistpl.h> 51 50 #include <pcmcia/ds.h> 52 51 ··· 82 83 83 84 info->p_dev = link; 84 85 link->priv = info; 85 - link->resource[0]->end = 0x10; 86 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 87 - link->conf.Attributes = CONF_ENABLE_IRQ; 88 - link->conf.IntType = INT_MEMORY_AND_IO; 89 - link->conf.Present = PRESENT_OPTION; 86 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 87 + link->config_regs = PRESENT_OPTION; 90 88 91 89 return fdomain_config(link); 92 90 } /* fdomain_attach */ ··· 101 105 102 106 /*====================================================================*/ 103 107 104 - static int fdomain_config_check(struct pcmcia_device *p_dev, 105 - cistpl_cftable_entry_t *cfg, 106 - cistpl_cftable_entry_t *dflt, 107 - unsigned int vcc, 108 - void *priv_data) 108 + static int fdomain_config_check(struct pcmcia_device *p_dev, void *priv_data) 109 109 { 110 110 p_dev->io_lines = 10; 111 - p_dev->resource[0]->start = cfg->io.win[0].base; 111 + p_dev->resource[0]->end = 0x10; 112 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 113 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 112 114 return pcmcia_request_io(p_dev); 113 115 } 114 116 ··· 126 132 127 133 if (!link->irq) 128 134 goto failed; 129 - ret = pcmcia_request_configuration(link, &link->conf); 135 + ret = pcmcia_enable_device(link); 130 136 if (ret) 131 137 goto failed; 132 138 ··· 188 194 189 195 static struct pcmcia_driver fdomain_cs_driver = { 190 196 .owner = THIS_MODULE, 191 - .drv = { 192 - .name = "fdomain_cs", 193 - }, 197 + .name = "fdomain_cs", 194 198 .probe = fdomain_probe, 195 199 .remove = fdomain_detach, 196 200 .id_table = fdomain_ids,
+32 -150
drivers/scsi/pcmcia/nsp_cs.c
··· 47 47 #include <scsi/scsi.h> 48 48 #include <scsi/scsi_ioctl.h> 49 49 50 - #include <pcmcia/cs.h> 51 50 #include <pcmcia/cistpl.h> 52 51 #include <pcmcia/cisreg.h> 53 52 #include <pcmcia/ds.h> ··· 1530 1531 PCMCIA functions 1531 1532 **********************************************************************/ 1532 1533 1533 - /*====================================================================== 1534 - nsp_cs_attach() creates an "instance" of the driver, allocating 1535 - local data structures for one device. The device is registered 1536 - with Card Services. 1537 - 1538 - The dev_link structure is initialized, but we don't actually 1539 - configure the card at this point -- we wait until we receive a 1540 - card insertion event. 1541 - ======================================================================*/ 1542 1534 static int nsp_cs_probe(struct pcmcia_device *link) 1543 1535 { 1544 1536 scsi_info_t *info; ··· 1547 1557 1548 1558 nsp_dbg(NSP_DEBUG_INIT, "info=0x%p", info); 1549 1559 1550 - /* The io structure describes IO port mapping */ 1551 - link->resource[0]->end = 0x10; 1552 - link->resource[0]->flags = IO_DATA_PATH_WIDTH_AUTO; 1553 - 1554 - /* General socket configuration */ 1555 - link->conf.Attributes = CONF_ENABLE_IRQ; 1556 - link->conf.IntType = INT_MEMORY_AND_IO; 1557 - 1558 1560 ret = nsp_cs_config(link); 1559 1561 1560 1562 nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link); ··· 1554 1572 } /* nsp_cs_attach */ 1555 1573 1556 1574 1557 - /*====================================================================== 1558 - This deletes a driver "instance". The device is de-registered 1559 - with Card Services. If it has been released, all local data 1560 - structures are freed. Otherwise, the structures will be freed 1561 - when the device is released. 1562 - ======================================================================*/ 1563 1575 static void nsp_cs_detach(struct pcmcia_device *link) 1564 1576 { 1565 1577 nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link); ··· 1566 1590 } /* nsp_cs_detach */ 1567 1591 1568 1592 1569 - /*====================================================================== 1570 - nsp_cs_config() is scheduled to run after a CARD_INSERTION event 1571 - is received, to configure the PCMCIA socket, and to make the 1572 - ethernet device available to the system. 1573 - ======================================================================*/ 1574 - 1575 - struct nsp_cs_configdata { 1576 - nsp_hw_data *data; 1577 - win_req_t req; 1578 - }; 1579 - 1580 - static int nsp_cs_config_check(struct pcmcia_device *p_dev, 1581 - cistpl_cftable_entry_t *cfg, 1582 - cistpl_cftable_entry_t *dflt, 1583 - unsigned int vcc, 1584 - void *priv_data) 1593 + static int nsp_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) 1585 1594 { 1586 - struct nsp_cs_configdata *cfg_mem = priv_data; 1595 + nsp_hw_data *data = priv_data; 1587 1596 1588 - if (cfg->index == 0) 1597 + if (p_dev->config_index == 0) 1589 1598 return -ENODEV; 1590 1599 1591 - /* Does this card need audio output? */ 1592 - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { 1593 - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; 1594 - p_dev->conf.Status = CCSR_AUDIO_ENA; 1600 + /* This reserves IO space but doesn't actually enable it */ 1601 + if (pcmcia_request_io(p_dev) != 0) 1602 + goto next_entry; 1603 + 1604 + if (resource_size(p_dev->resource[2])) { 1605 + p_dev->resource[2]->flags |= (WIN_DATA_WIDTH_16 | 1606 + WIN_MEMORY_TYPE_CM | 1607 + WIN_ENABLE); 1608 + if (p_dev->resource[2]->end < 0x1000) 1609 + p_dev->resource[2]->end = 0x1000; 1610 + if (pcmcia_request_window(p_dev, p_dev->resource[2], 0) != 0) 1611 + goto next_entry; 1612 + if (pcmcia_map_mem_page(p_dev, p_dev->resource[2], 1613 + p_dev->card_addr) != 0) 1614 + goto next_entry; 1615 + 1616 + data->MmioAddress = (unsigned long) 1617 + ioremap_nocache(p_dev->resource[2]->start, 1618 + resource_size(p_dev->resource[2])); 1619 + data->MmioLength = resource_size(p_dev->resource[2]); 1595 1620 } 1596 - 1597 - /* Use power settings for Vcc and Vpp if present */ 1598 - /* Note that the CIS values need to be rescaled */ 1599 - if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { 1600 - if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) 1601 - return -ENODEV; 1602 - else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { 1603 - if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000) 1604 - return -ENODEV; 1605 - } 1606 - 1607 - if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) { 1608 - p_dev->conf.Vpp = 1609 - cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 1610 - } else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) { 1611 - p_dev->conf.Vpp = 1612 - dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; 1613 - } 1614 - 1615 - /* Do we need to allocate an interrupt? */ 1616 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 1617 - 1618 - /* IO window settings */ 1619 - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 1620 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 1621 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 1622 - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 1623 - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 1624 - p_dev->resource[0]->flags |= 1625 - pcmcia_io_cfg_data_width(io->flags); 1626 - p_dev->resource[0]->start = io->win[0].base; 1627 - p_dev->resource[0]->end = io->win[0].len; 1628 - if (io->nwin > 1) { 1629 - p_dev->resource[1]->flags = 1630 - p_dev->resource[0]->flags; 1631 - p_dev->resource[1]->start = io->win[1].base; 1632 - p_dev->resource[1]->end = io->win[1].len; 1633 - } 1634 - /* This reserves IO space but doesn't actually enable it */ 1635 - if (pcmcia_request_io(p_dev) != 0) 1636 - goto next_entry; 1637 - } 1638 - 1639 - if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { 1640 - cistpl_mem_t *mem = 1641 - (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; 1642 - cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; 1643 - cfg_mem->req.Attributes |= WIN_ENABLE; 1644 - cfg_mem->req.Base = mem->win[0].host_addr; 1645 - cfg_mem->req.Size = mem->win[0].len; 1646 - if (cfg_mem->req.Size < 0x1000) 1647 - cfg_mem->req.Size = 0x1000; 1648 - cfg_mem->req.AccessSpeed = 0; 1649 - if (pcmcia_request_window(p_dev, &cfg_mem->req, &p_dev->win) != 0) 1650 - goto next_entry; 1651 - if (pcmcia_map_mem_page(p_dev, p_dev->win, 1652 - mem->win[0].card_addr) != 0) 1653 - goto next_entry; 1654 - 1655 - cfg_mem->data->MmioAddress = (unsigned long) ioremap_nocache(cfg_mem->req.Base, cfg_mem->req.Size); 1656 - cfg_mem->data->MmioLength = cfg_mem->req.Size; 1657 - } 1658 - /* If we got this far, we're cool! */ 1659 - return 0; 1660 - } 1621 + /* If we got this far, we're cool! */ 1622 + return 0; 1661 1623 1662 1624 next_entry: 1663 1625 nsp_dbg(NSP_DEBUG_INIT, "next"); ··· 1607 1693 { 1608 1694 int ret; 1609 1695 scsi_info_t *info = link->priv; 1610 - struct nsp_cs_configdata *cfg_mem; 1611 1696 struct Scsi_Host *host; 1612 1697 nsp_hw_data *data = &nsp_data_base; 1613 1698 1614 1699 nsp_dbg(NSP_DEBUG_INIT, "in"); 1615 1700 1616 - cfg_mem = kzalloc(sizeof(*cfg_mem), GFP_KERNEL); 1617 - if (!cfg_mem) 1618 - return -ENOMEM; 1619 - cfg_mem->data = data; 1701 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_CHECK_VCC | 1702 + CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | CONF_AUTO_SET_IOMEM | 1703 + CONF_AUTO_SET_IO; 1620 1704 1621 - ret = pcmcia_loop_config(link, nsp_cs_config_check, cfg_mem); 1705 + ret = pcmcia_loop_config(link, nsp_cs_config_check, data); 1622 1706 if (ret) 1623 1707 goto cs_failed; 1624 1708 1625 1709 if (pcmcia_request_irq(link, nspintr)) 1626 1710 goto cs_failed; 1627 1711 1628 - ret = pcmcia_request_configuration(link, &link->conf); 1712 + ret = pcmcia_enable_device(link); 1629 1713 if (ret) 1630 1714 goto cs_failed; 1631 1715 ··· 1666 1754 1667 1755 info->host = host; 1668 1756 1669 - /* Finally, report what we've done */ 1670 - printk(KERN_INFO "nsp_cs: index 0x%02x: ", 1671 - link->conf.ConfigIndex); 1672 - if (link->conf.Vpp) { 1673 - printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); 1674 - } 1675 - if (link->conf.Attributes & CONF_ENABLE_IRQ) { 1676 - printk(", irq %d", link->irq); 1677 - } 1678 - if (link->resource[0]) 1679 - printk(", io %pR", link->resource[0]); 1680 - if (link->resource[1]) 1681 - printk(" & %pR", link->resource[1]); 1682 - if (link->win) 1683 - printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base, 1684 - cfg_mem->req.Base+cfg_mem->req.Size-1); 1685 - printk("\n"); 1686 - 1687 - kfree(cfg_mem); 1688 1757 return 0; 1689 1758 1690 1759 cs_failed: 1691 1760 nsp_dbg(NSP_DEBUG_INIT, "config fail"); 1692 1761 nsp_cs_release(link); 1693 - kfree(cfg_mem); 1694 1762 1695 1763 return -ENODEV; 1696 1764 } /* nsp_cs_config */ 1697 1765 1698 1766 1699 - /*====================================================================== 1700 - After a card is removed, nsp_cs_release() will unregister the net 1701 - device, and release the PCMCIA configuration. If the device is 1702 - still open, this will be postponed until it is closed. 1703 - ======================================================================*/ 1704 1767 static void nsp_cs_release(struct pcmcia_device *link) 1705 1768 { 1706 1769 scsi_info_t *info = link->priv; ··· 1694 1807 scsi_remove_host(info->host); 1695 1808 } 1696 1809 1697 - if (link->win) { 1810 + if (resource_size(link->resource[2])) { 1698 1811 if (data != NULL) { 1699 1812 iounmap((void *)(data->MmioAddress)); 1700 1813 } ··· 1764 1877 1765 1878 static struct pcmcia_driver nsp_driver = { 1766 1879 .owner = THIS_MODULE, 1767 - .drv = { 1768 - .name = "nsp_cs", 1769 - }, 1880 + .name = "nsp_cs", 1770 1881 .probe = nsp_cs_probe, 1771 1882 .remove = nsp_cs_detach, 1772 1883 .id_table = nsp_cs_ids, ··· 1774 1889 1775 1890 static int __init nsp_cs_init(void) 1776 1891 { 1777 - nsp_msg(KERN_INFO, "loading..."); 1778 - 1779 1892 return pcmcia_register_driver(&nsp_driver); 1780 1893 } 1781 1894 1782 1895 static void __exit nsp_cs_exit(void) 1783 1896 { 1784 - nsp_msg(KERN_INFO, "unloading..."); 1785 1897 pcmcia_unregister_driver(&nsp_driver); 1786 1898 } 1787 1899
+7 -17
drivers/scsi/pcmcia/qlogic_stub.c
··· 48 48 #include <scsi/scsi_host.h> 49 49 #include "../qlogicfas408.h" 50 50 51 - #include <pcmcia/cs.h> 52 51 #include <pcmcia/cistpl.h> 53 52 #include <pcmcia/ds.h> 54 53 #include <pcmcia/ciscode.h> ··· 155 156 return -ENOMEM; 156 157 info->p_dev = link; 157 158 link->priv = info; 158 - link->resource[0]->end = 16; 159 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 160 - link->conf.Attributes = CONF_ENABLE_IRQ; 161 - link->conf.IntType = INT_MEMORY_AND_IO; 162 - link->conf.Present = PRESENT_OPTION; 159 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 160 + link->config_regs = PRESENT_OPTION; 163 161 164 162 return qlogic_config(link); 165 163 } /* qlogic_attach */ ··· 174 178 175 179 /*====================================================================*/ 176 180 177 - static int qlogic_config_check(struct pcmcia_device *p_dev, 178 - cistpl_cftable_entry_t *cfg, 179 - cistpl_cftable_entry_t *dflt, 180 - unsigned int vcc, 181 - void *priv_data) 181 + static int qlogic_config_check(struct pcmcia_device *p_dev, void *priv_data) 182 182 { 183 183 p_dev->io_lines = 10; 184 - p_dev->resource[0]->start = cfg->io.win[0].base; 185 - p_dev->resource[0]->end = cfg->io.win[0].len; 184 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 185 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 186 186 187 187 if (p_dev->resource[0]->start == 0) 188 188 return -ENODEV; ··· 201 209 if (!link->irq) 202 210 goto failed; 203 211 204 - ret = pcmcia_request_configuration(link, &link->conf); 212 + ret = pcmcia_enable_device(link); 205 213 if (ret) 206 214 goto failed; 207 215 ··· 256 264 { 257 265 scsi_info_t *info = link->priv; 258 266 259 - pcmcia_request_configuration(link, &link->conf); 267 + pcmcia_enable_device(link); 260 268 if ((info->manf_id == MANFID_MACNICA) || 261 269 (info->manf_id == MANFID_PIONEER) || 262 270 (info->manf_id == 0x0098)) { ··· 294 302 295 303 static struct pcmcia_driver qlogic_cs_driver = { 296 304 .owner = THIS_MODULE, 297 - .drv = { 298 305 .name = "qlogic_cs", 299 - }, 300 306 .probe = qlogic_probe, 301 307 .remove = qlogic_detach, 302 308 .id_table = qlogic_ids,
+6 -16
drivers/scsi/pcmcia/sym53c500_cs.c
··· 71 71 #include <scsi/scsi.h> 72 72 #include <scsi/scsi_host.h> 73 73 74 - #include <pcmcia/cs.h> 75 74 #include <pcmcia/cistpl.h> 76 75 #include <pcmcia/ds.h> 77 76 #include <pcmcia/ciscode.h> ··· 683 684 .shost_attrs = SYM53C500_shost_attrs 684 685 }; 685 686 686 - static int SYM53C500_config_check(struct pcmcia_device *p_dev, 687 - cistpl_cftable_entry_t *cfg, 688 - cistpl_cftable_entry_t *dflt, 689 - unsigned int vcc, 690 - void *priv_data) 687 + static int SYM53C500_config_check(struct pcmcia_device *p_dev, void *priv_data) 691 688 { 692 689 p_dev->io_lines = 10; 693 - p_dev->resource[0]->start = cfg->io.win[0].base; 694 - p_dev->resource[0]->end = cfg->io.win[0].len; 690 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 691 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 695 692 696 693 if (p_dev->resource[0]->start == 0) 697 694 return -ENODEV; ··· 716 721 if (!link->irq) 717 722 goto failed; 718 723 719 - ret = pcmcia_request_configuration(link, &link->conf); 724 + ret = pcmcia_enable_device(link); 720 725 if (ret) 721 726 goto failed; 722 727 ··· 854 859 return -ENOMEM; 855 860 info->p_dev = link; 856 861 link->priv = info; 857 - link->resource[0]->end = 16; 858 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 859 - link->conf.Attributes = CONF_ENABLE_IRQ; 860 - link->conf.IntType = INT_MEMORY_AND_IO; 862 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 861 863 862 864 return SYM53C500_config(link); 863 865 } /* SYM53C500_attach */ ··· 873 881 874 882 static struct pcmcia_driver sym53c500_cs_driver = { 875 883 .owner = THIS_MODULE, 876 - .drv = { 877 - .name = "sym53c500_cs", 878 - }, 884 + .name = "sym53c500_cs", 879 885 .probe = SYM53C500_probe, 880 886 .remove = SYM53C500_detach, 881 887 .id_table = sym53c500_ids,
+77 -128
drivers/serial/serial_cs.c
··· 45 45 #include <asm/io.h> 46 46 #include <asm/system.h> 47 47 48 - #include <pcmcia/cs.h> 49 48 #include <pcmcia/cistpl.h> 50 49 #include <pcmcia/ciscode.h> 51 50 #include <pcmcia/ds.h> ··· 182 183 { 183 184 struct serial_info *info = link->priv; 184 185 185 - if (info->multi) { 186 - link->conf.Present |= PRESENT_EXT_STATUS; 187 - link->conf.ExtStatus = ESR_REQ_ATTN_ENA; 188 - } 186 + if (info->multi) 187 + link->config_flags |= CONF_ENABLE_ESR; 189 188 } 190 189 191 190 static const struct serial_quirk quirks[] = { ··· 262 265 static int serial_config(struct pcmcia_device * link); 263 266 264 267 265 - /*====================================================================== 266 - 267 - After a card is removed, serial_remove() will unregister 268 - the serial device(s), and release the PCMCIA configuration. 269 - 270 - ======================================================================*/ 271 - 272 268 static void serial_remove(struct pcmcia_device *link) 273 269 { 274 270 struct serial_info *info = link->priv; ··· 304 314 return 0; 305 315 } 306 316 307 - /*====================================================================== 308 - 309 - serial_attach() creates an "instance" of the driver, allocating 310 - local data structures for one device. The device is registered 311 - with Card Services. 312 - 313 - ======================================================================*/ 314 - 315 317 static int serial_probe(struct pcmcia_device *link) 316 318 { 317 319 struct serial_info *info; ··· 317 335 info->p_dev = link; 318 336 link->priv = info; 319 337 320 - link->conf.Attributes = CONF_ENABLE_IRQ; 321 - if (do_sound) { 322 - link->conf.Attributes |= CONF_ENABLE_SPKR; 323 - link->conf.Status = CCSR_AUDIO_ENA; 324 - } 325 - link->conf.IntType = INT_MEMORY_AND_IO; 338 + link->config_flags |= CONF_ENABLE_IRQ; 339 + if (do_sound) 340 + link->config_flags |= CONF_ENABLE_SPKR; 326 341 327 342 return serial_config(link); 328 343 } 329 - 330 - /*====================================================================== 331 - 332 - This deletes a driver "instance". The device is de-registered 333 - with Card Services. If it has been released, all local data 334 - structures are freed. Otherwise, the structures will be freed 335 - when the device is released. 336 - 337 - ======================================================================*/ 338 344 339 345 static void serial_detach(struct pcmcia_device *link) 340 346 { 341 347 struct serial_info *info = link->priv; 342 348 343 349 dev_dbg(&link->dev, "serial_detach\n"); 344 - 345 - /* 346 - * Ensure any outstanding scheduled tasks are completed. 347 - */ 348 - flush_scheduled_work(); 349 350 350 351 /* 351 352 * Ensure that the ports have been released. ··· 395 430 return -ENODEV; 396 431 } 397 432 398 - static int simple_config_check(struct pcmcia_device *p_dev, 399 - cistpl_cftable_entry_t *cf, 400 - cistpl_cftable_entry_t *dflt, 401 - unsigned int vcc, 402 - void *priv_data) 433 + static int simple_config_check(struct pcmcia_device *p_dev, void *priv_data) 403 434 { 404 435 static const int size_table[2] = { 8, 16 }; 405 436 int *try = priv_data; 406 437 407 - if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) 408 - p_dev->conf.Vpp = 409 - cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; 438 + if (p_dev->resource[0]->start == 0) 439 + return -ENODEV; 410 440 411 - p_dev->io_lines = ((*try & 0x1) == 0) ? 412 - 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 441 + if ((*try & 0x1) == 0) 442 + p_dev->io_lines = 16; 413 443 414 - if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)]) 415 - && (cf->io.win[0].base != 0)) { 416 - p_dev->resource[0]->start = cf->io.win[0].base; 417 - if (!pcmcia_request_io(p_dev)) 418 - return 0; 419 - } 420 - return -EINVAL; 444 + if (p_dev->resource[0]->end != size_table[(*try >> 1)]) 445 + return -ENODEV; 446 + 447 + p_dev->resource[0]->end = 8; 448 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 449 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 450 + 451 + return pcmcia_request_io(p_dev); 421 452 } 422 453 423 454 static int simple_config_check_notpicky(struct pcmcia_device *p_dev, 424 - cistpl_cftable_entry_t *cf, 425 - cistpl_cftable_entry_t *dflt, 426 - unsigned int vcc, 427 455 void *priv_data) 428 456 { 429 457 static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 430 458 int j; 431 459 432 - if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { 433 - for (j = 0; j < 5; j++) { 434 - p_dev->resource[0]->start = base[j]; 435 - p_dev->io_lines = base[j] ? 16 : 3; 436 - if (!pcmcia_request_io(p_dev)) 437 - return 0; 438 - } 460 + if (p_dev->io_lines > 3) 461 + return -ENODEV; 462 + 463 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 464 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 465 + p_dev->resource[0]->end = 8; 466 + 467 + for (j = 0; j < 5; j++) { 468 + p_dev->resource[0]->start = base[j]; 469 + p_dev->io_lines = base[j] ? 16 : 3; 470 + if (!pcmcia_request_io(p_dev)) 471 + return 0; 439 472 } 440 473 return -ENODEV; 441 474 } ··· 443 480 struct serial_info *info = link->priv; 444 481 int i = -ENODEV, try; 445 482 446 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 447 - link->resource[0]->end = 8; 448 - 449 483 /* First pass: look for a config entry that looks normal. 450 484 * Two tries: without IO aliases, then with aliases */ 485 + link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_SET_IO; 451 486 for (try = 0; try < 4; try++) 452 487 if (!pcmcia_loop_config(link, simple_config_check, &try)) 453 488 goto found_port; ··· 461 500 462 501 found_port: 463 502 if (info->multi && (info->manfid == MANFID_3COM)) 464 - link->conf.ConfigIndex &= ~(0x08); 503 + link->config_index &= ~(0x08); 465 504 466 505 /* 467 506 * Apply any configuration quirks. ··· 469 508 if (info->quirk && info->quirk->config) 470 509 info->quirk->config(link); 471 510 472 - i = pcmcia_request_configuration(link, &link->conf); 511 + i = pcmcia_enable_device(link); 473 512 if (i != 0) 474 513 return -1; 475 514 return setup_serial(link, info, link->resource[0]->start, link->irq); 476 515 } 477 516 478 - static int multi_config_check(struct pcmcia_device *p_dev, 479 - cistpl_cftable_entry_t *cf, 480 - cistpl_cftable_entry_t *dflt, 481 - unsigned int vcc, 482 - void *priv_data) 517 + static int multi_config_check(struct pcmcia_device *p_dev, void *priv_data) 483 518 { 484 - int *base2 = priv_data; 519 + int *multi = priv_data; 520 + 521 + if (p_dev->resource[1]->end) 522 + return -EINVAL; 485 523 486 524 /* The quad port cards have bad CIS's, so just look for a 487 525 window larger than 8 ports and assume it will be right */ 488 - if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { 489 - p_dev->resource[0]->start = cf->io.win[0].base; 490 - p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; 491 - if (!pcmcia_request_io(p_dev)) { 492 - *base2 = p_dev->resource[0]->start + 8; 493 - return 0; 494 - } 495 - } 496 - return -ENODEV; 526 + if (p_dev->resource[0]->end <= 8) 527 + return -EINVAL; 528 + 529 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 530 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 531 + p_dev->resource[0]->end = *multi * 8; 532 + 533 + if (pcmcia_request_io(p_dev)) 534 + return -ENODEV; 535 + return 0; 497 536 } 498 537 499 538 static int multi_config_check_notpicky(struct pcmcia_device *p_dev, 500 - cistpl_cftable_entry_t *cf, 501 - cistpl_cftable_entry_t *dflt, 502 - unsigned int vcc, 503 539 void *priv_data) 504 540 { 505 541 int *base2 = priv_data; 506 542 507 - if (cf->io.nwin == 2) { 508 - p_dev->resource[0]->start = cf->io.win[0].base; 509 - p_dev->resource[1]->start = cf->io.win[1].base; 510 - p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; 511 - if (!pcmcia_request_io(p_dev)) { 512 - *base2 = p_dev->resource[1]->start; 513 - return 0; 514 - } 515 - } 516 - return -ENODEV; 543 + if (!p_dev->resource[0]->end || !p_dev->resource[1]->end) 544 + return -ENODEV; 545 + 546 + p_dev->resource[0]->end = p_dev->resource[1]->end = 8; 547 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 548 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 549 + 550 + if (pcmcia_request_io(p_dev)) 551 + return -ENODEV; 552 + 553 + *base2 = p_dev->resource[0]->start + 8; 554 + return 0; 517 555 } 518 556 519 557 static int multi_config(struct pcmcia_device *link) ··· 520 560 struct serial_info *info = link->priv; 521 561 int i, base2 = 0; 522 562 563 + link->config_flags |= CONF_AUTO_SET_IO; 523 564 /* First, look for a generic full-sized window */ 524 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 525 - link->resource[0]->end = info->multi * 8; 526 - if (pcmcia_loop_config(link, multi_config_check, &base2)) { 565 + if (!pcmcia_loop_config(link, multi_config_check, &info->multi)) 566 + base2 = link->resource[0]->start + 8; 567 + else { 527 568 /* If that didn't work, look for two windows */ 528 - link->resource[0]->end = link->resource[1]->end = 8; 529 569 info->multi = 2; 530 570 if (pcmcia_loop_config(link, multi_config_check_notpicky, 531 571 &base2)) { ··· 544 584 if (info->quirk && info->quirk->config) 545 585 info->quirk->config(link); 546 586 547 - i = pcmcia_request_configuration(link, &link->conf); 587 + i = pcmcia_enable_device(link); 548 588 if (i != 0) 549 589 return -ENODEV; 550 590 ··· 556 596 info->prodid == PRODID_POSSIO_GCC)) { 557 597 int err; 558 598 559 - if (link->conf.ConfigIndex == 1 || 560 - link->conf.ConfigIndex == 3) { 599 + if (link->config_index == 1 || 600 + link->config_index == 3) { 561 601 err = setup_serial(link, info, base2, 562 602 link->irq); 563 - base2 = link->resource[0]->start;; 603 + base2 = link->resource[0]->start; 564 604 } else { 565 605 err = setup_serial(link, info, link->resource[0]->start, 566 606 link->irq); ··· 584 624 return 0; 585 625 } 586 626 587 - static int serial_check_for_multi(struct pcmcia_device *p_dev, 588 - cistpl_cftable_entry_t *cf, 589 - cistpl_cftable_entry_t *dflt, 590 - unsigned int vcc, 591 - void *priv_data) 627 + static int serial_check_for_multi(struct pcmcia_device *p_dev, void *priv_data) 592 628 { 593 629 struct serial_info *info = p_dev->priv; 594 630 595 - if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) 596 - info->multi = cf->io.win[0].len >> 3; 631 + if (!p_dev->resource[0]->end) 632 + return -EINVAL; 597 633 598 - if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) && 599 - (cf->io.win[1].len == 8)) 634 + if ((!p_dev->resource[1]->end) && (p_dev->resource[0]->end % 8 == 0)) 635 + info->multi = p_dev->resource[0]->end >> 3; 636 + 637 + if ((p_dev->resource[1]->end) && (p_dev->resource[0]->end == 8) 638 + && (p_dev->resource[1]->end == 8)) 600 639 info->multi = 2; 601 640 602 641 return 0; /* break */ 603 642 } 604 643 605 - 606 - /*====================================================================== 607 - 608 - serial_config() is scheduled to run after a CARD_INSERTION event 609 - is received, to configure the PCMCIA socket, and to make the 610 - serial device available to the system. 611 - 612 - ======================================================================*/ 613 644 614 645 static int serial_config(struct pcmcia_device * link) 615 646 { ··· 845 894 846 895 static struct pcmcia_driver serial_cs_driver = { 847 896 .owner = THIS_MODULE, 848 - .drv = { 849 - .name = "serial_cs", 850 - }, 897 + .name = "serial_cs", 851 898 .probe = serial_probe, 852 899 .remove = serial_detach, 853 900 .id_table = serial_ids,
-1
drivers/ssb/main.c
··· 20 20 #include <linux/mmc/sdio_func.h> 21 21 #include <linux/slab.h> 22 22 23 - #include <pcmcia/cs.h> 24 23 #include <pcmcia/cistpl.h> 25 24 #include <pcmcia/ds.h> 26 25
-1
drivers/ssb/pcmcia.c
··· 13 13 #include <linux/io.h> 14 14 #include <linux/etherdevice.h> 15 15 16 - #include <pcmcia/cs.h> 17 16 #include <pcmcia/cistpl.h> 18 17 #include <pcmcia/ciscode.h> 19 18 #include <pcmcia/ds.h>
-1
drivers/ssb/scan.c
··· 17 17 #include <linux/pci.h> 18 18 #include <linux/io.h> 19 19 20 - #include <pcmcia/cs.h> 21 20 #include <pcmcia/cistpl.h> 22 21 #include <pcmcia/ds.h> 23 22
+7 -51
drivers/staging/comedi/drivers/cb_das16_cs.c
··· 37 37 #include <linux/delay.h> 38 38 #include <linux/pci.h> 39 39 40 - #include <pcmcia/cs.h> 41 40 #include <pcmcia/cistpl.h> 42 41 #include <pcmcia/ds.h> 43 42 ··· 691 692 local->link = link; 692 693 link->priv = local; 693 694 694 - /* Initialize the pcmcia_device structure */ 695 - link->conf.Attributes = 0; 696 - link->conf.IntType = INT_MEMORY_AND_IO; 697 - 698 695 cur_dev = link; 699 696 700 697 das16cs_pcmcia_config(link); ··· 710 715 711 716 712 717 static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, 713 - cistpl_cftable_entry_t *cfg, 714 - cistpl_cftable_entry_t *dflt, 715 - unsigned int vcc, 716 718 void *priv_data) 717 719 { 718 - if (cfg->index == 0) 720 + if (p_dev->config_index == 0) 719 721 return -EINVAL; 720 722 721 - /* Do we need to allocate an interrupt? */ 722 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 723 - 724 - /* IO window settings */ 725 - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 726 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 727 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 728 - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 729 - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 730 - p_dev->resource[0]->flags |= 731 - pcmcia_io_cfg_data_width(io->flags); 732 - p_dev->resource[0]->start = io->win[0].base; 733 - p_dev->resource[0]->end = io->win[0].len; 734 - if (io->nwin > 1) { 735 - p_dev->resource[1]->flags = p_dev->resource[0]->flags; 736 - p_dev->resource[1]->start = io->win[1].base; 737 - p_dev->resource[1]->end = io->win[1].len; 738 - } 739 - /* This reserves IO space but doesn't actually enable it */ 740 - return pcmcia_request_io(p_dev); 741 - } 742 - 743 - return 0; 723 + return pcmcia_request_io(p_dev); 744 724 } 745 725 746 726 static void das16cs_pcmcia_config(struct pcmcia_device *link) ··· 723 753 int ret; 724 754 725 755 dev_dbg(&link->dev, "das16cs_pcmcia_config\n"); 756 + 757 + /* Do we need to allocate an interrupt? */ 758 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 726 759 727 760 ret = pcmcia_loop_config(link, das16cs_pcmcia_config_loop, NULL); 728 761 if (ret) { ··· 736 763 if (!link->irq) 737 764 goto failed; 738 765 739 - /* 740 - This actually configures the PCMCIA socket -- setting up 741 - the I/O windows and the interrupt mapping, and putting the 742 - card and host interface into "Memory and IO" mode. 743 - */ 744 - ret = pcmcia_request_configuration(link, &link->conf); 766 + ret = pcmcia_enable_device(link); 745 767 if (ret) 746 768 goto failed; 747 - 748 - /* Finally, report what we've done */ 749 - dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); 750 - if (link->conf.Attributes & CONF_ENABLE_IRQ) 751 - printk(", irq %u", link->irq); 752 - if (link->resource[0]) 753 - printk(", io %pR", link->resource[0]); 754 - if (link->resource[1]) 755 - printk(", io %pR", link->resource[1]); 756 - printk("\n"); 757 769 758 770 return; 759 771 ··· 790 832 .resume = das16cs_pcmcia_resume, 791 833 .id_table = das16cs_id_table, 792 834 .owner = THIS_MODULE, 793 - .drv = { 794 - .name = "cb_das16_cs", 795 - }, 835 + .name = "cb_das16_cs", 796 836 }; 797 837 798 838 static int __init init_das16cs_pcmcia_cs(void)
+7 -120
drivers/staging/comedi/drivers/das08_cs.c
··· 48 48 #include "das08.h" 49 49 50 50 /* pcmcia includes */ 51 - #include <pcmcia/cs.h> 52 51 #include <pcmcia/cistpl.h> 53 52 #include <pcmcia/ds.h> 54 53 ··· 114 115 static int das08_pcmcia_suspend(struct pcmcia_device *p_dev); 115 116 static int das08_pcmcia_resume(struct pcmcia_device *p_dev); 116 117 117 - /* 118 - The attach() and detach() entry points are used to create and destroy 119 - "instances" of the driver, where each instance represents everything 120 - needed to manage one actual PCMCIA card. 121 - */ 122 - 123 118 static int das08_pcmcia_attach(struct pcmcia_device *); 124 119 static void das08_pcmcia_detach(struct pcmcia_device *); 125 - 126 - /* 127 - You'll also need to prototype all the functions that will actually 128 - be used to talk to your device. See 'memory_cs' for a good example 129 - of a fully self-sufficient driver; the other drivers rely more or 130 - less on other parts of the kernel. 131 - */ 132 120 133 121 struct local_info_t { 134 122 struct pcmcia_device *link; 135 123 int stop; 136 124 struct bus_operations *bus; 137 125 }; 138 - 139 - /*====================================================================== 140 - 141 - das08_pcmcia_attach() creates an "instance" of the driver, allocating 142 - local data structures for one device. The device is registered 143 - with Card Services. 144 - 145 - The dev_link structure is initialized, but we don't actually 146 - configure the card at this point -- we wait until we receive a 147 - card insertion event. 148 - 149 - ======================================================================*/ 150 126 151 127 static int das08_pcmcia_attach(struct pcmcia_device *link) 152 128 { ··· 136 162 local->link = link; 137 163 link->priv = local; 138 164 139 - /* 140 - General socket configuration defaults can go here. In this 141 - client, we assume very little, and rely on the CIS for almost 142 - everything. In most clients, many details (i.e., number, sizes, 143 - and attributes of IO windows) are fixed by the nature of the 144 - device, and can be hard-wired here. 145 - */ 146 - link->conf.Attributes = 0; 147 - link->conf.IntType = INT_MEMORY_AND_IO; 148 - 149 165 cur_dev = link; 150 166 151 167 das08_pcmcia_config(link); 152 168 153 169 return 0; 154 170 } /* das08_pcmcia_attach */ 155 - 156 - /*====================================================================== 157 - 158 - This deletes a driver "instance". The device is de-registered 159 - with Card Services. If it has been released, all local data 160 - structures are freed. Otherwise, the structures will be freed 161 - when the device is released. 162 - 163 - ======================================================================*/ 164 171 165 172 static void das08_pcmcia_detach(struct pcmcia_device *link) 166 173 { ··· 158 203 159 204 160 205 static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, 161 - cistpl_cftable_entry_t *cfg, 162 - cistpl_cftable_entry_t *dflt, 163 - unsigned int vcc, 164 206 void *priv_data) 165 207 { 166 - if (cfg->index == 0) 167 - return -ENODEV; 208 + if (p_dev->config_index == 0) 209 + return -EINVAL; 168 210 169 - /* Do we need to allocate an interrupt? */ 170 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 171 - 172 - /* IO window settings */ 173 - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 174 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 175 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 176 - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 177 - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 178 - p_dev->resource[0]->flags |= 179 - pcmcia_io_cfg_data_width(io->flags); 180 - p_dev->resource[0]->start = io->win[0].base; 181 - p_dev->resource[0]->end = io->win[0].len; 182 - if (io->nwin > 1) { 183 - p_dev->resource[1]->flags = p_dev->resource[0]->flags; 184 - p_dev->resource[1]->start = io->win[1].base; 185 - p_dev->resource[1]->end = io->win[1].len; 186 - } 187 - /* This reserves IO space but doesn't actually enable it */ 188 - return pcmcia_request_io(p_dev); 189 - } 190 - return 0; 211 + return pcmcia_request_io(p_dev); 191 212 } 192 - 193 - 194 - /*====================================================================== 195 - 196 - das08_pcmcia_config() is scheduled to run after a CARD_INSERTION event 197 - is received, to configure the PCMCIA socket, and to make the 198 - device available to the system. 199 - 200 - ======================================================================*/ 201 213 202 214 static void das08_pcmcia_config(struct pcmcia_device *link) 203 215 { 204 216 int ret; 205 217 206 218 dev_dbg(&link->dev, "das08_pcmcia_config\n"); 219 + 220 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 207 221 208 222 ret = pcmcia_loop_config(link, das08_pcmcia_config_loop, NULL); 209 223 if (ret) { ··· 183 259 if (!link->irq) 184 260 goto failed; 185 261 186 - /* 187 - This actually configures the PCMCIA socket -- setting up 188 - the I/O windows and the interrupt mapping, and putting the 189 - card and host interface into "Memory and IO" mode. 190 - */ 191 - ret = pcmcia_request_configuration(link, &link->conf); 262 + ret = pcmcia_enable_device(link); 192 263 if (ret) 193 264 goto failed; 194 - 195 - /* Finally, report what we've done */ 196 - dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); 197 - if (link->conf.Attributes & CONF_ENABLE_IRQ) 198 - printk(", irq %u", link->irq); 199 - if (link->resource[0]) 200 - printk(", io %pR", link->resource[0]); 201 - if (link->resource[1]) 202 - printk(" & %pR", link->resource[1]); 203 - printk("\n"); 204 265 205 266 return; 206 267 ··· 194 285 195 286 } /* das08_pcmcia_config */ 196 287 197 - /*====================================================================== 198 - 199 - After a card is removed, das08_pcmcia_release() will unregister the 200 - device, and release the PCMCIA configuration. If the device is 201 - still open, this will be postponed until it is closed. 202 - 203 - ======================================================================*/ 204 - 205 288 static void das08_pcmcia_release(struct pcmcia_device *link) 206 289 { 207 290 dev_dbg(&link->dev, "das08_pcmcia_release\n"); 208 291 pcmcia_disable_device(link); 209 292 } /* das08_pcmcia_release */ 210 - 211 - /*====================================================================== 212 - 213 - The card status event handler. Mostly, this schedules other 214 - stuff to run after an event is received. 215 - 216 - When a CARD_REMOVAL event is received, we immediately set a 217 - private flag to block future accesses to this device. All the 218 - functions that actually access the device should check this flag 219 - to make sure the card is still present. 220 - 221 - ======================================================================*/ 222 293 223 294 static int das08_pcmcia_suspend(struct pcmcia_device *link) 224 295 { ··· 237 348 .resume = das08_pcmcia_resume, 238 349 .id_table = das08_cs_id_table, 239 350 .owner = THIS_MODULE, 240 - .drv = { 241 - .name = "pcm-das08", 242 - }, 351 + .name = "pcm-das08", 243 352 }; 244 353 245 354 static int __init init_das08_pcmcia_cs(void)
+8 -122
drivers/staging/comedi/drivers/ni_daq_700.c
··· 47 47 48 48 #include <linux/ioport.h> 49 49 50 - #include <pcmcia/cs.h> 51 50 #include <pcmcia/cistpl.h> 52 51 #include <pcmcia/cisreg.h> 53 52 #include <pcmcia/ds.h> ··· 434 435 return 0; 435 436 }; 436 437 437 - /* PCMCIA crap -- watch your words, please! */ 438 - 439 438 static void dio700_config(struct pcmcia_device *link); 440 439 static void dio700_release(struct pcmcia_device *link); 441 440 static int dio700_cs_suspend(struct pcmcia_device *p_dev); 442 441 static int dio700_cs_resume(struct pcmcia_device *p_dev); 443 442 444 - /* 445 - The attach() and detach() entry points are used to create and destroy 446 - "instances" of the driver, where each instance represents everything 447 - needed to manage one actual PCMCIA card. 448 - */ 449 - 450 443 static int dio700_cs_attach(struct pcmcia_device *); 451 444 static void dio700_cs_detach(struct pcmcia_device *); 452 - 453 - /* 454 - You'll also need to prototype all the functions that will actually 455 - be used to talk to your device. See 'memory_cs' for a good example 456 - of a fully self-sufficient driver; the other drivers rely more or 457 - less on other parts of the kernel. 458 - */ 459 445 460 446 struct local_info_t { 461 447 struct pcmcia_device *link; 462 448 int stop; 463 449 struct bus_operations *bus; 464 450 }; 465 - 466 - /*====================================================================== 467 - 468 - dio700_cs_attach() creates an "instance" of the driver, allocating 469 - local data structures for one device. The device is registered 470 - with Card Services. 471 - 472 - The dev_link structure is initialized, but we don't actually 473 - configure the card at this point -- we wait until we receive a 474 - card insertion event. 475 - 476 - ======================================================================*/ 477 451 478 452 static int dio700_cs_attach(struct pcmcia_device *link) 479 453 { ··· 463 491 local->link = link; 464 492 link->priv = local; 465 493 466 - /* 467 - General socket configuration defaults can go here. In this 468 - client, we assume very little, and rely on the CIS for almost 469 - everything. In most clients, many details (i.e., number, sizes, 470 - and attributes of IO windows) are fixed by the nature of the 471 - device, and can be hard-wired here. 472 - */ 473 - link->conf.Attributes = 0; 474 - link->conf.IntType = INT_MEMORY_AND_IO; 475 - 476 494 pcmcia_cur_dev = link; 477 495 478 496 dio700_config(link); 479 497 480 498 return 0; 481 499 } /* dio700_cs_attach */ 482 - 483 - /*====================================================================== 484 - 485 - This deletes a driver "instance". The device is de-registered 486 - with Card Services. If it has been released, all local data 487 - structures are freed. Otherwise, the structures will be freed 488 - when the device is released. 489 - 490 - ======================================================================*/ 491 500 492 501 static void dio700_cs_detach(struct pcmcia_device *link) 493 502 { ··· 485 532 486 533 } /* dio700_cs_detach */ 487 534 488 - /*====================================================================== 489 - 490 - dio700_config() is scheduled to run after a CARD_INSERTION event 491 - is received, to configure the PCMCIA socket, and to make the 492 - device available to the system. 493 - 494 - ======================================================================*/ 495 - 496 535 static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, 497 - cistpl_cftable_entry_t *cfg, 498 - cistpl_cftable_entry_t *dflt, 499 - unsigned int vcc, 500 536 void *priv_data) 501 537 { 502 - if (cfg->index == 0) 503 - return -ENODEV; 538 + if (p_dev->config_index == 0) 539 + return -EINVAL; 504 540 505 - /* Does this card need audio output? */ 506 - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { 507 - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; 508 - p_dev->conf.Status = CCSR_AUDIO_ENA; 509 - } 510 - 511 - /* Do we need to allocate an interrupt? */ 512 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 513 - 514 - /* IO window settings */ 515 - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 516 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 517 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 518 - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 519 - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 520 - p_dev->resource[0]->flags |= 521 - pcmcia_io_cfg_data_width(io->flags); 522 - p_dev->resource[0]->start = io->win[0].base; 523 - p_dev->resource[0]->end = io->win[0].len; 524 - if (io->nwin > 1) { 525 - p_dev->resource[1]->flags = p_dev->resource[0]->flags; 526 - p_dev->resource[1]->start = io->win[1].base; 527 - p_dev->resource[1]->end = io->win[1].len; 528 - } 529 - /* This reserves IO space but doesn't actually enable it */ 530 - if (pcmcia_request_io(p_dev) != 0) 531 - return -ENODEV; 532 - } 533 - 534 - /* If we got this far, we're cool! */ 535 - return 0; 541 + return pcmcia_request_io(p_dev); 536 542 } 537 543 538 544 static void dio700_config(struct pcmcia_device *link) ··· 503 591 504 592 dev_dbg(&link->dev, "dio700_config\n"); 505 593 594 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO | 595 + CONF_AUTO_SET_IO; 596 + 506 597 ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, NULL); 507 598 if (ret) { 508 599 dev_warn(&link->dev, "no configuration found\n"); ··· 515 600 if (!link->irq) 516 601 goto failed; 517 602 518 - /* 519 - This actually configures the PCMCIA socket -- setting up 520 - the I/O windows and the interrupt mapping, and putting the 521 - card and host interface into "Memory and IO" mode. 522 - */ 523 - ret = pcmcia_request_configuration(link, &link->conf); 603 + ret = pcmcia_enable_device(link); 524 604 if (ret != 0) 525 605 goto failed; 526 - 527 - /* Finally, report what we've done */ 528 - dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); 529 - if (link->conf.Attributes & CONF_ENABLE_IRQ) 530 - printk(", irq %d", link->irq); 531 - if (link->resource[0]) 532 - printk(", io %pR", link->resource[0]); 533 - if (link->resource[1]) 534 - printk(" & %pR", link->resource[1]); 535 - printk("\n"); 536 606 537 607 return; 538 608 ··· 533 633 534 634 pcmcia_disable_device(link); 535 635 } /* dio700_release */ 536 - 537 - /*====================================================================== 538 - 539 - The card status event handler. Mostly, this schedules other 540 - stuff to run after an event is received. 541 - 542 - When a CARD_REMOVAL event is received, we immediately set a 543 - private flag to block future accesses to this device. All the 544 - functions that actually access the device should check this flag 545 - to make sure the card is still present. 546 - 547 - ======================================================================*/ 548 636 549 637 static int dio700_cs_suspend(struct pcmcia_device *link) 550 638 { ··· 573 685 .resume = dio700_cs_resume, 574 686 .id_table = dio700_cs_ids, 575 687 .owner = THIS_MODULE, 576 - .drv = { 577 - .name = "ni_daq_700", 578 - }, 688 + .name = "ni_daq_700", 579 689 }; 580 690 581 691 static int __init init_dio700_cs(void)
+8 -122
drivers/staging/comedi/drivers/ni_daq_dio24.c
··· 48 48 49 49 #include "8255.h" 50 50 51 - #include <pcmcia/cs.h> 52 51 #include <pcmcia/cistpl.h> 53 52 #include <pcmcia/cisreg.h> 54 53 #include <pcmcia/ds.h> ··· 186 187 return 0; 187 188 }; 188 189 189 - /* PCMCIA crap -- watch your words! */ 190 - 191 190 static void dio24_config(struct pcmcia_device *link); 192 191 static void dio24_release(struct pcmcia_device *link); 193 192 static int dio24_cs_suspend(struct pcmcia_device *p_dev); 194 193 static int dio24_cs_resume(struct pcmcia_device *p_dev); 195 194 196 - /* 197 - The attach() and detach() entry points are used to create and destroy 198 - "instances" of the driver, where each instance represents everything 199 - needed to manage one actual PCMCIA card. 200 - */ 201 - 202 195 static int dio24_cs_attach(struct pcmcia_device *); 203 196 static void dio24_cs_detach(struct pcmcia_device *); 204 - 205 - /* 206 - You'll also need to prototype all the functions that will actually 207 - be used to talk to your device. See 'memory_cs' for a good example 208 - of a fully self-sufficient driver; the other drivers rely more or 209 - less on other parts of the kernel. 210 - */ 211 197 212 198 struct local_info_t { 213 199 struct pcmcia_device *link; 214 200 int stop; 215 201 struct bus_operations *bus; 216 202 }; 217 - 218 - /*====================================================================== 219 - 220 - dio24_cs_attach() creates an "instance" of the driver, allocating 221 - local data structures for one device. The device is registered 222 - with Card Services. 223 - 224 - The dev_link structure is initialized, but we don't actually 225 - configure the card at this point -- we wait until we receive a 226 - card insertion event. 227 - 228 - ======================================================================*/ 229 203 230 204 static int dio24_cs_attach(struct pcmcia_device *link) 231 205 { ··· 215 243 local->link = link; 216 244 link->priv = local; 217 245 218 - /* 219 - General socket configuration defaults can go here. In this 220 - client, we assume very little, and rely on the CIS for almost 221 - everything. In most clients, many details (i.e., number, sizes, 222 - and attributes of IO windows) are fixed by the nature of the 223 - device, and can be hard-wired here. 224 - */ 225 - link->conf.Attributes = 0; 226 - link->conf.IntType = INT_MEMORY_AND_IO; 227 - 228 246 pcmcia_cur_dev = link; 229 247 230 248 dio24_config(link); 231 249 232 250 return 0; 233 251 } /* dio24_cs_attach */ 234 - 235 - /*====================================================================== 236 - 237 - This deletes a driver "instance". The device is de-registered 238 - with Card Services. If it has been released, all local data 239 - structures are freed. Otherwise, the structures will be freed 240 - when the device is released. 241 - 242 - ======================================================================*/ 243 252 244 253 static void dio24_cs_detach(struct pcmcia_device *link) 245 254 { ··· 237 284 238 285 } /* dio24_cs_detach */ 239 286 240 - /*====================================================================== 241 - 242 - dio24_config() is scheduled to run after a CARD_INSERTION event 243 - is received, to configure the PCMCIA socket, and to make the 244 - device available to the system. 245 - 246 - ======================================================================*/ 247 - 248 287 static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, 249 - cistpl_cftable_entry_t *cfg, 250 - cistpl_cftable_entry_t *dflt, 251 - unsigned int vcc, 252 288 void *priv_data) 253 289 { 254 - if (cfg->index == 0) 255 - return -ENODEV; 290 + if (p_dev->config_index == 0) 291 + return -EINVAL; 256 292 257 - /* Does this card need audio output? */ 258 - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { 259 - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; 260 - p_dev->conf.Status = CCSR_AUDIO_ENA; 261 - } 262 - 263 - /* Do we need to allocate an interrupt? */ 264 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 265 - 266 - /* IO window settings */ 267 - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 268 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 269 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 270 - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 271 - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 272 - p_dev->resource[0]->flags |= 273 - pcmcia_io_cfg_data_width(io->flags); 274 - p_dev->resource[0]->start = io->win[0].base; 275 - p_dev->resource[0]->end = io->win[0].len; 276 - if (io->nwin > 1) { 277 - p_dev->resource[1]->flags = p_dev->resource[0]->flags; 278 - p_dev->resource[1]->start = io->win[1].base; 279 - p_dev->resource[1]->end = io->win[1].len; 280 - } 281 - /* This reserves IO space but doesn't actually enable it */ 282 - if (pcmcia_request_io(p_dev) != 0) 283 - return -ENODEV; 284 - } 285 - 286 - /* If we got this far, we're cool! */ 287 - return 0; 293 + return pcmcia_request_io(p_dev); 288 294 } 289 295 290 296 static void dio24_config(struct pcmcia_device *link) ··· 254 342 255 343 dev_dbg(&link->dev, "dio24_config\n"); 256 344 345 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO | 346 + CONF_AUTO_SET_IO; 347 + 257 348 ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, NULL); 258 349 if (ret) { 259 350 dev_warn(&link->dev, "no configuration found\n"); ··· 266 351 if (!link->irq) 267 352 goto failed; 268 353 269 - /* 270 - This actually configures the PCMCIA socket -- setting up 271 - the I/O windows and the interrupt mapping, and putting the 272 - card and host interface into "Memory and IO" mode. 273 - */ 274 - ret = pcmcia_request_configuration(link, &link->conf); 354 + ret = pcmcia_enable_device(link); 275 355 if (ret) 276 356 goto failed; 277 - 278 - /* Finally, report what we've done */ 279 - dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); 280 - if (link->conf.Attributes & CONF_ENABLE_IRQ) 281 - printk(", irq %d", link->irq); 282 - if (link->resource[0]) 283 - printk(" & %pR", link->resource[0]); 284 - if (link->resource[1]) 285 - printk(" & %pR", link->resource[1]); 286 - printk("\n"); 287 357 288 358 return; 289 359 ··· 284 384 285 385 pcmcia_disable_device(link); 286 386 } /* dio24_release */ 287 - 288 - /*====================================================================== 289 - 290 - The card status event handler. Mostly, this schedules other 291 - stuff to run after an event is received. 292 - 293 - When a CARD_REMOVAL event is received, we immediately set a 294 - private flag to block future accesses to this device. All the 295 - functions that actually access the device should check this flag 296 - to make sure the card is still present. 297 - 298 - ======================================================================*/ 299 387 300 388 static int dio24_cs_suspend(struct pcmcia_device *link) 301 389 { ··· 323 435 .resume = dio24_cs_resume, 324 436 .id_table = dio24_cs_ids, 325 437 .owner = THIS_MODULE, 326 - .drv = { 327 - .name = "ni_daq_dio24", 328 - }, 438 + .name = "ni_daq_dio24", 329 439 }; 330 440 331 441 static int __init init_dio24_cs(void)
+8 -136
drivers/staging/comedi/drivers/ni_labpc_cs.c
··· 71 71 #include "comedi_fc.h" 72 72 #include "ni_labpc.h" 73 73 74 - #include <pcmcia/cs.h> 75 74 #include <pcmcia/cistpl.h> 76 75 #include <pcmcia/cisreg.h> 77 76 #include <pcmcia/ds.h> ··· 152 153 return labpc_common_attach(dev, iobase, irq, 0); 153 154 } 154 155 155 - /*====================================================================*/ 156 - 157 - /* 158 - The event() function is this driver's Card Services event handler. 159 - It will be called by Card Services when an appropriate card status 160 - event is received. The config() and release() entry points are 161 - used to configure or release a socket, in response to card 162 - insertion and ejection events. They are invoked from the dummy 163 - event handler. 164 - 165 - Kernel version 2.6.16 upwards uses suspend() and resume() functions 166 - instead of an event() function. 167 - */ 168 - 169 156 static void labpc_config(struct pcmcia_device *link); 170 157 static void labpc_release(struct pcmcia_device *link); 171 158 static int labpc_cs_suspend(struct pcmcia_device *p_dev); 172 159 static int labpc_cs_resume(struct pcmcia_device *p_dev); 173 160 174 - /* 175 - The attach() and detach() entry points are used to create and destroy 176 - "instances" of the driver, where each instance represents everything 177 - needed to manage one actual PCMCIA card. 178 - */ 179 - 180 161 static int labpc_cs_attach(struct pcmcia_device *); 181 162 static void labpc_cs_detach(struct pcmcia_device *); 182 - 183 - /* 184 - You'll also need to prototype all the functions that will actually 185 - be used to talk to your device. See 'memory_cs' for a good example 186 - of a fully self-sufficient driver; the other drivers rely more or 187 - less on other parts of the kernel. 188 - */ 189 163 190 164 struct local_info_t { 191 165 struct pcmcia_device *link; 192 166 int stop; 193 167 struct bus_operations *bus; 194 168 }; 195 - 196 - /*====================================================================== 197 - 198 - labpc_cs_attach() creates an "instance" of the driver, allocating 199 - local data structures for one device. The device is registered 200 - with Card Services. 201 - 202 - The dev_link structure is initialized, but we don't actually 203 - configure the card at this point -- we wait until we receive a 204 - card insertion event. 205 - 206 - ======================================================================*/ 207 169 208 170 static int labpc_cs_attach(struct pcmcia_device *link) 209 171 { ··· 179 219 local->link = link; 180 220 link->priv = local; 181 221 182 - /* 183 - General socket configuration defaults can go here. In this 184 - client, we assume very little, and rely on the CIS for almost 185 - everything. In most clients, many details (i.e., number, sizes, 186 - and attributes of IO windows) are fixed by the nature of the 187 - device, and can be hard-wired here. 188 - */ 189 - link->conf.Attributes = 0; 190 - link->conf.IntType = INT_MEMORY_AND_IO; 191 - 192 222 pcmcia_cur_dev = link; 193 223 194 224 labpc_config(link); 195 225 196 226 return 0; 197 227 } /* labpc_cs_attach */ 198 - 199 - /*====================================================================== 200 - 201 - This deletes a driver "instance". The device is de-registered 202 - with Card Services. If it has been released, all local data 203 - structures are freed. Otherwise, the structures will be freed 204 - when the device is released. 205 - 206 - ======================================================================*/ 207 228 208 229 static void labpc_cs_detach(struct pcmcia_device *link) 209 230 { ··· 204 263 205 264 } /* labpc_cs_detach */ 206 265 207 - /*====================================================================== 208 - 209 - labpc_config() is scheduled to run after a CARD_INSERTION event 210 - is received, to configure the PCMCIA socket, and to make the 211 - device available to the system. 212 - 213 - ======================================================================*/ 214 - 215 266 static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, 216 - cistpl_cftable_entry_t *cfg, 217 - cistpl_cftable_entry_t *dflt, 218 - unsigned int vcc, 219 267 void *priv_data) 220 268 { 221 - if (cfg->index == 0) 222 - return -ENODEV; 269 + if (p_dev->config_index == 0) 270 + return -EINVAL; 223 271 224 - /* Does this card need audio output? */ 225 - if (cfg->flags & CISTPL_CFTABLE_AUDIO) { 226 - p_dev->conf.Attributes |= CONF_ENABLE_SPKR; 227 - p_dev->conf.Status = CCSR_AUDIO_ENA; 228 - } 229 - 230 - /* Do we need to allocate an interrupt? */ 231 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; 232 - 233 - /* IO window settings */ 234 - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 235 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 236 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 237 - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 238 - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 239 - p_dev->resource[0]->flags |= 240 - pcmcia_io_cfg_data_width(io->flags); 241 - p_dev->resource[0]->start = io->win[0].base; 242 - p_dev->resource[0]->end = io->win[0].len; 243 - if (io->nwin > 1) { 244 - p_dev->resource[1]->flags = p_dev->resource[0]->flags; 245 - p_dev->resource[1]->start = io->win[1].base; 246 - p_dev->resource[1]->end = io->win[1].len; 247 - } 248 - /* This reserves IO space but doesn't actually enable it */ 249 - if (pcmcia_request_io(p_dev) != 0) 250 - return -ENODEV; 251 - } 252 - 253 - /* If we got this far, we're cool! */ 254 - return 0; 272 + return pcmcia_request_io(p_dev); 255 273 } 256 274 257 275 ··· 219 319 int ret; 220 320 221 321 dev_dbg(&link->dev, "labpc_config\n"); 322 + 323 + link->config_flags |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ | 324 + CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; 222 325 223 326 ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, NULL); 224 327 if (ret) { ··· 232 329 if (!link->irq) 233 330 goto failed; 234 331 235 - /* 236 - This actually configures the PCMCIA socket -- setting up 237 - the I/O windows and the interrupt mapping, and putting the 238 - card and host interface into "Memory and IO" mode. 239 - */ 240 - ret = pcmcia_request_configuration(link, &link->conf); 332 + ret = pcmcia_enable_device(link); 241 333 if (ret) 242 334 goto failed; 243 - 244 - /* Finally, report what we've done */ 245 - dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); 246 - if (link->conf.Attributes & CONF_ENABLE_IRQ) 247 - printk(", irq %d", link->irq); 248 - if (link->resource[0]) 249 - printk(" & %pR", link->resource[0]); 250 - if (link->resource[1]) 251 - printk(" & %pR", link->resource[1]); 252 - printk("\n"); 253 335 254 336 return; 255 337 ··· 249 361 250 362 pcmcia_disable_device(link); 251 363 } /* labpc_release */ 252 - 253 - /*====================================================================== 254 - 255 - The card status event handler. Mostly, this schedules other 256 - stuff to run after an event is received. 257 - 258 - When a CARD_REMOVAL event is received, we immediately set a 259 - private flag to block future accesses to this device. All the 260 - functions that actually access the device should check this flag 261 - to make sure the card is still present. 262 - 263 - ======================================================================*/ 264 364 265 365 static int labpc_cs_suspend(struct pcmcia_device *link) 266 366 { ··· 266 390 local->stop = 0; 267 391 return 0; 268 392 } /* labpc_cs_resume */ 269 - 270 - /*====================================================================*/ 271 393 272 394 static struct pcmcia_device_id labpc_cs_ids[] = { 273 395 /* N.B. These IDs should match those in labpc_cs_boards (ni_labpc.c) */ ··· 285 411 .resume = labpc_cs_resume, 286 412 .id_table = labpc_cs_ids, 287 413 .owner = THIS_MODULE, 288 - .drv = { 289 - .name = "daqcard-1200", 290 - }, 414 + .name = "daqcard-1200", 291 415 }; 292 416 293 417 static int __init init_labpc_cs(void)
+6 -17
drivers/staging/comedi/drivers/ni_mio_cs.c
··· 48 48 #include "ni_stc.h" 49 49 #include "8255.h" 50 50 51 - #include <pcmcia/cs.h> 52 51 #include <pcmcia/cistpl.h> 53 52 #include <pcmcia/ds.h> 54 53 ··· 262 263 263 264 static int cs_attach(struct pcmcia_device *link) 264 265 { 265 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 266 - link->resource[0]->end = 16; 267 - link->conf.Attributes = CONF_ENABLE_IRQ; 268 - link->conf.IntType = INT_MEMORY_AND_IO; 269 - 270 266 cur_dev = link; 271 267 272 268 mio_cs_config(link); ··· 295 301 } 296 302 297 303 298 - static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, 299 - cistpl_cftable_entry_t *cfg, 300 - cistpl_cftable_entry_t *dflt, 301 - unsigned int vcc, 302 - void *priv_data) 304 + static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) 303 305 { 304 306 int base, ret; 305 307 306 - p_dev->resource[0]->end = cfg->io.win[0].len; 307 - p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; 308 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 309 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 308 310 309 311 for (base = 0x000; base < 0x400; base += 0x20) { 310 312 p_dev->resource[0]->start = base; ··· 317 327 int ret; 318 328 319 329 DPRINTK("mio_cs_config(link=%p)\n", link); 330 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 320 331 321 332 ret = pcmcia_loop_config(link, mio_pcmcia_config_loop, NULL); 322 333 if (ret) { ··· 328 337 if (!link->irq) 329 338 dev_info(&link->dev, "no IRQ available\n"); 330 339 331 - ret = pcmcia_request_configuration(link, &link->conf); 340 + ret = pcmcia_enable_device(link); 332 341 } 333 342 334 343 static int mio_cs_attach(struct comedi_device *dev, struct comedi_devconfig *it) ··· 437 446 .resume = &mio_cs_resume, 438 447 .id_table = ni_mio_cs_ids, 439 448 .owner = THIS_MODULE, 440 - .drv = { 441 - .name = "ni_mio_cs", 442 - }, 449 + .name = "ni_mio_cs", 443 450 }; 444 451 445 452 int init_module(void)
+7 -117
drivers/staging/comedi/drivers/quatech_daqp_cs.c
··· 50 50 #include "../comedidev.h" 51 51 #include <linux/semaphore.h> 52 52 53 - #include <pcmcia/cs.h> 54 53 #include <pcmcia/cistpl.h> 55 54 #include <pcmcia/cisreg.h> 56 55 #include <pcmcia/ds.h> ··· 968 969 969 970 ======================================================================*/ 970 971 971 - /* 972 - The event() function is this driver's Card Services event handler. 973 - It will be called by Card Services when an appropriate card status 974 - event is received. The config() and release() entry points are 975 - used to configure or release a socket, in response to card 976 - insertion and ejection events. 977 - 978 - Kernel version 2.6.16 upwards uses suspend() and resume() functions 979 - instead of an event() function. 980 - */ 981 - 982 972 static void daqp_cs_config(struct pcmcia_device *link); 983 973 static void daqp_cs_release(struct pcmcia_device *link); 984 974 static int daqp_cs_suspend(struct pcmcia_device *p_dev); 985 975 static int daqp_cs_resume(struct pcmcia_device *p_dev); 986 976 987 - /* 988 - The attach() and detach() entry points are used to create and destroy 989 - "instances" of the driver, where each instance represents everything 990 - needed to manage one actual PCMCIA card. 991 - */ 992 - 993 977 static int daqp_cs_attach(struct pcmcia_device *); 994 978 static void daqp_cs_detach(struct pcmcia_device *); 995 - 996 - /*====================================================================== 997 - 998 - daqp_cs_attach() creates an "instance" of the driver, allocating 999 - local data structures for one device. The device is registered 1000 - with Card Services. 1001 - 1002 - The dev_link structure is initialized, but we don't actually 1003 - configure the card at this point -- we wait until we receive a 1004 - card insertion event. 1005 - 1006 - ======================================================================*/ 1007 979 1008 980 static int daqp_cs_attach(struct pcmcia_device *link) 1009 981 { ··· 1001 1031 local->link = link; 1002 1032 link->priv = local; 1003 1033 1004 - /* 1005 - General socket configuration defaults can go here. In this 1006 - client, we assume very little, and rely on the CIS for almost 1007 - everything. In most clients, many details (i.e., number, sizes, 1008 - and attributes of IO windows) are fixed by the nature of the 1009 - device, and can be hard-wired here. 1010 - */ 1011 - link->conf.Attributes = 0; 1012 - link->conf.IntType = INT_MEMORY_AND_IO; 1013 - 1014 1034 daqp_cs_config(link); 1015 1035 1016 1036 return 0; 1017 1037 } /* daqp_cs_attach */ 1018 - 1019 - /*====================================================================== 1020 - 1021 - This deletes a driver "instance". The device is de-registered 1022 - with Card Services. If it has been released, all local data 1023 - structures are freed. Otherwise, the structures will be freed 1024 - when the device is released. 1025 - 1026 - ======================================================================*/ 1027 1038 1028 1039 static void daqp_cs_detach(struct pcmcia_device *link) 1029 1040 { ··· 1021 1070 1022 1071 } /* daqp_cs_detach */ 1023 1072 1024 - /*====================================================================== 1025 - 1026 - daqp_cs_config() is scheduled to run after a CARD_INSERTION event 1027 - is received, to configure the PCMCIA socket, and to make the 1028 - device available to the system. 1029 - 1030 - ======================================================================*/ 1031 - 1032 - 1033 - static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, 1034 - cistpl_cftable_entry_t *cfg, 1035 - cistpl_cftable_entry_t *dflt, 1036 - unsigned int vcc, 1037 - void *priv_data) 1073 + static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) 1038 1074 { 1039 - if (cfg->index == 0) 1040 - return -ENODEV; 1075 + if (p_dev->config_index == 0) 1076 + return -EINVAL; 1041 1077 1042 - /* Do we need to allocate an interrupt? */ 1043 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 1044 - 1045 - /* IO window settings */ 1046 - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 1047 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 1048 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 1049 - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 1050 - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 1051 - p_dev->resource[0]->flags |= 1052 - pcmcia_io_cfg_data_width(io->flags); 1053 - p_dev->resource[0]->start = io->win[0].base; 1054 - p_dev->resource[0]->end = io->win[0].len; 1055 - if (io->nwin > 1) { 1056 - p_dev->resource[1]->flags = p_dev->resource[0]->flags; 1057 - p_dev->resource[1]->start = io->win[1].base; 1058 - p_dev->resource[1]->end = io->win[1].len; 1059 - } 1060 - } 1061 - 1062 - /* This reserves IO space but doesn't actually enable it */ 1063 1078 return pcmcia_request_io(p_dev); 1064 1079 } 1065 1080 ··· 1034 1117 int ret; 1035 1118 1036 1119 dev_dbg(&link->dev, "daqp_cs_config\n"); 1120 + 1121 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 1037 1122 1038 1123 ret = pcmcia_loop_config(link, daqp_pcmcia_config_loop, NULL); 1039 1124 if (ret) { ··· 1047 1128 if (ret) 1048 1129 goto failed; 1049 1130 1050 - /* 1051 - This actually configures the PCMCIA socket -- setting up 1052 - the I/O windows and the interrupt mapping, and putting the 1053 - card and host interface into "Memory and IO" mode. 1054 - */ 1055 - ret = pcmcia_request_configuration(link, &link->conf); 1131 + ret = pcmcia_enable_device(link); 1056 1132 if (ret) 1057 1133 goto failed; 1058 - 1059 - /* Finally, report what we've done */ 1060 - dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); 1061 - if (link->conf.Attributes & CONF_ENABLE_IRQ) 1062 - printk(", irq %u", link->irq); 1063 - if (link->resource[0]) 1064 - printk(" & %pR", link->resource[0]); 1065 - if (link->resource[1]) 1066 - printk(" & %pR", link->resource[1]); 1067 - printk("\n"); 1068 1134 1069 1135 return; 1070 1136 ··· 1064 1160 1065 1161 pcmcia_disable_device(link); 1066 1162 } /* daqp_cs_release */ 1067 - 1068 - /*====================================================================== 1069 - 1070 - The card status event handler. Mostly, this schedules other 1071 - stuff to run after an event is received. 1072 - 1073 - When a CARD_REMOVAL event is received, we immediately set a 1074 - private flag to block future accesses to this device. All the 1075 - functions that actually access the device should check this flag 1076 - to make sure the card is still present. 1077 - 1078 - ======================================================================*/ 1079 1163 1080 1164 static int daqp_cs_suspend(struct pcmcia_device *link) 1081 1165 { ··· 1104 1212 .resume = daqp_cs_resume, 1105 1213 .id_table = daqp_cs_id_table, 1106 1214 .owner = THIS_MODULE, 1107 - .drv = { 1108 - .name = "quatech_daqp_cs", 1109 - }, 1215 + .name = "quatech_daqp_cs", 1110 1216 }; 1111 1217 1112 1218 int __init init_module(void)
+6 -71
drivers/staging/wlags49_h2/wl_cs.c
··· 83 83 #include <linux/if_arp.h> 84 84 #include <linux/ioport.h> 85 85 86 - #include <pcmcia/cs.h> 87 86 #include <pcmcia/cistpl.h> 88 87 #include <pcmcia/cisreg.h> 89 88 #include <pcmcia/ciscode.h> ··· 146 147 147 148 link->resource[0]->end = HCF_NUM_IO_PORTS; 148 149 link->resource[0]->flags= IO_DATA_PATH_WIDTH_16; 149 - link->conf.Attributes = CONF_ENABLE_IRQ; 150 - link->conf.IntType = INT_MEMORY_AND_IO; 151 - link->conf.ConfigIndex = 5; 152 - link->conf.Present = PRESENT_OPTION; 150 + link->config_flags |= CONF_ENABLE_IRQ; 151 + link->config_index = 5; 152 + link->config_regs = PRESENT_OPTION; 153 153 154 154 link->priv = dev; 155 155 lp = wl_priv(dev); ··· 163 165 164 166 165 167 166 - /******************************************************************************* 167 - * wl_adapter_detach() 168 - ******************************************************************************* 169 - * 170 - * DESCRIPTION: 171 - * 172 - * This deletes a driver "instance". The device is de-registered with Card 173 - * Services. If it has been released, then the net device is unregistered, and 174 - * all local data structures are freed. Otherwise, the structures will be 175 - * freed when the device is released. 176 - * 177 - * PARAMETERS: 178 - * 179 - * link - pointer to the dev_link_t structure representing the device to 180 - * detach 181 - * 182 - * RETURNS: 183 - * 184 - * N/A 185 - * 186 - ******************************************************************************/ 187 168 static void wl_adapter_detach(struct pcmcia_device *link) 188 169 { 189 170 struct net_device *dev = link->priv; ··· 186 209 /*============================================================================*/ 187 210 188 211 189 - /******************************************************************************* 190 - * wl_adapter_release() 191 - ******************************************************************************* 192 - * 193 - * DESCRIPTION: 194 - * 195 - * After a card is removed, this routine will release the PCMCIA 196 - * configuration. If the device is still open, this will be postponed until it 197 - * is closed. 198 - * 199 - * PARAMETERS: 200 - * 201 - * arg - a u_long representing a pointer to a dev_link_t structure for the 202 - * device to be released. 203 - * 204 - * RETURNS: 205 - * 206 - * N/A 207 - * 208 - ******************************************************************************/ 209 212 void wl_adapter_release(struct pcmcia_device *link) 210 213 { 211 214 DBG_FUNC("wl_adapter_release"); ··· 225 268 return 0; 226 269 } /* wl_adapter_resume */ 227 270 228 - /******************************************************************************* 229 - * wl_adapter_insert() 230 - ******************************************************************************* 231 - * 232 - * DESCRIPTION: 233 - * 234 - * wl_adapter_insert() is scheduled to run after a CARD_INSERTION event is 235 - * received, to configure the PCMCIA socket, and to make the ethernet device 236 - * available to the system. 237 - * 238 - * PARAMETERS: 239 - * 240 - * link - pointer to the dev_link_t structure representing the device to 241 - * insert 242 - * 243 - * RETURNS: 244 - * 245 - * N/A 246 - * 247 - ******************************************************************************/ 248 271 void wl_adapter_insert(struct pcmcia_device *link) 249 272 { 250 273 struct net_device *dev; ··· 239 302 dev = link->priv; 240 303 241 304 /* Do we need to allocate an interrupt? */ 242 - link->conf.Attributes |= CONF_ENABLE_IRQ; 305 + link->config_flags |= CONF_ENABLE_IRQ; 243 306 link->io_lines = 6; 244 307 245 308 ret = pcmcia_request_io(link); ··· 250 313 if (ret != 0) 251 314 goto failed; 252 315 253 - ret = pcmcia_request_configuration(link, &link->conf); 316 + ret = pcmcia_enable_device(link); 254 317 if (ret != 0) 255 318 goto failed; 256 319 ··· 394 457 395 458 static struct pcmcia_driver wlags49_driver = { 396 459 .owner = THIS_MODULE, 397 - .drv = { 398 - .name = DRIVER_NAME, 399 - }, 460 + .name = DRIVER_NAME, 400 461 .probe = wl_adapter_attach, 401 462 .remove = wl_adapter_detach, 402 463 .id_table = wl_adapter_ids,
-1
drivers/staging/wlags49_h2/wl_internal.h
··· 69 69 ******************************************************************************/ 70 70 #include <linux/version.h> 71 71 #ifdef BUS_PCMCIA 72 - #include <pcmcia/cs.h> 73 72 #include <pcmcia/cistpl.h> 74 73 #include <pcmcia/cisreg.h> 75 74 #include <pcmcia/ciscode.h>
-19
drivers/staging/wlags49_h2/wl_main.c
··· 414 414 #endif /* HCF_STA */ 415 415 416 416 417 - /******************************************************************************* 418 - * wl_insert() 419 - ******************************************************************************* 420 - * 421 - * DESCRIPTION: 422 - * 423 - * wl_insert() is scheduled to run after a CARD_INSERTION event is 424 - * received, to configure the PCMCIA socket, and to make the ethernet device 425 - * available to the system. 426 - * 427 - * PARAMETERS: 428 - * 429 - * dev - a pointer to the net_device struct of the wireless device 430 - * 431 - * RETURNS: 432 - * 433 - * TRUE or FALSE 434 - * 435 - ******************************************************************************/ 436 417 int wl_insert( struct net_device *dev ) 437 418 { 438 419 int result = 0;
+13 -28
drivers/telephony/ixj_pcmcia.c
··· 8 8 #include <linux/errno.h> /* error codes */ 9 9 #include <linux/slab.h> 10 10 11 - #include <pcmcia/cs.h> 12 11 #include <pcmcia/cistpl.h> 13 12 #include <pcmcia/ds.h> 14 13 ··· 31 32 { 32 33 dev_dbg(&p_dev->dev, "ixj_attach()\n"); 33 34 /* Create new ixj device */ 34 - p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 35 - p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 36 - p_dev->conf.IntType = INT_MEMORY_AND_IO; 37 35 p_dev->priv = kzalloc(sizeof(struct ixj_info_t), GFP_KERNEL); 38 36 if (!p_dev->priv) { 39 37 return -ENOMEM; ··· 107 111 return; 108 112 } 109 113 110 - static int ixj_config_check(struct pcmcia_device *p_dev, 111 - cistpl_cftable_entry_t *cfg, 112 - cistpl_cftable_entry_t *dflt, 113 - unsigned int vcc, 114 - void *priv_data) 114 + static int ixj_config_check(struct pcmcia_device *p_dev, void *priv_data) 115 115 { 116 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 117 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 118 - p_dev->resource[0]->start = io->win[0].base; 119 - p_dev->resource[0]->end = io->win[0].len; 120 - p_dev->io_lines = 3; 121 - if (io->nwin == 2) { 122 - p_dev->resource[1]->start = io->win[1].base; 123 - p_dev->resource[1]->end = io->win[1].len; 124 - } 125 - if (!pcmcia_request_io(p_dev)) 126 - return 0; 127 - } 128 - return -ENODEV; 116 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 117 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 118 + p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; 119 + p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 120 + p_dev->io_lines = 3; 121 + 122 + return pcmcia_request_io(p_dev); 129 123 } 130 124 131 125 static int ixj_config(struct pcmcia_device * link) 132 126 { 133 127 IXJ *j; 134 128 ixj_info_t *info; 135 - cistpl_cftable_entry_t dflt = { 0 }; 136 129 137 130 info = link->priv; 138 131 dev_dbg(&link->dev, "ixj_config\n"); 139 132 140 - if (pcmcia_loop_config(link, ixj_config_check, &dflt)) 133 + link->config_flags = CONF_AUTO_SET_IO; 134 + 135 + if (pcmcia_loop_config(link, ixj_config_check, NULL)) 141 136 goto failed; 142 137 143 - if (pcmcia_request_configuration(link, &link->conf)) 138 + if (pcmcia_enable_device(link)) 144 139 goto failed; 145 140 146 141 /* ··· 165 178 166 179 static struct pcmcia_driver ixj_driver = { 167 180 .owner = THIS_MODULE, 168 - .drv = { 169 - .name = "ixj_cs", 170 - }, 181 + .name = "ixj_cs", 171 182 .probe = ixj_probe, 172 183 .remove = ixj_detach, 173 184 .id_table = ixj_ids,
+9 -57
drivers/usb/host/sl811_cs.c
··· 20 20 #include <linux/ioport.h> 21 21 #include <linux/platform_device.h> 22 22 23 - #include <pcmcia/cs.h> 24 23 #include <pcmcia/cistpl.h> 25 24 #include <pcmcia/cisreg.h> 26 25 #include <pcmcia/ds.h> ··· 131 132 platform_device_unregister(&platform_dev); 132 133 } 133 134 134 - static int sl811_cs_config_check(struct pcmcia_device *p_dev, 135 - cistpl_cftable_entry_t *cfg, 136 - cistpl_cftable_entry_t *dflt, 137 - unsigned int vcc, 138 - void *priv_data) 135 + static int sl811_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) 139 136 { 140 - if (cfg->index == 0) 141 - return -ENODEV; 137 + if (p_dev->config_index == 0) 138 + return -EINVAL; 142 139 143 - /* Use power settings for Vcc and Vpp if present */ 144 - /* Note that the CIS values need to be rescaled */ 145 - if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { 146 - if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 != vcc) 147 - return -ENODEV; 148 - } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { 149 - if (dflt->vcc.param[CISTPL_POWER_VNOM]/10000 != vcc) 150 - return -ENODEV; 151 - } 152 - 153 - if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) 154 - p_dev->conf.Vpp = 155 - cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; 156 - else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM)) 157 - p_dev->conf.Vpp = 158 - dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; 159 - 160 - /* we need an interrupt */ 161 - p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 162 - 163 - /* IO window settings */ 164 - p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 165 - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 166 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 167 - p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 168 - 169 - p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 170 - p_dev->resource[0]->start = io->win[0].base; 171 - p_dev->resource[0]->end = io->win[0].len; 172 - 173 - return pcmcia_request_io(p_dev); 174 - } 175 - pcmcia_disable_device(p_dev); 176 - return -ENODEV; 140 + return pcmcia_request_io(p_dev); 177 141 } 178 142 179 143 ··· 146 184 int ret; 147 185 148 186 dev_dbg(&link->dev, "sl811_cs_config\n"); 187 + 188 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | 189 + CONF_AUTO_CHECK_VCC | CONF_AUTO_SET_IO; 149 190 150 191 if (pcmcia_loop_config(link, sl811_cs_config_check, NULL)) 151 192 goto failed; ··· 160 195 if (!link->irq) 161 196 goto failed; 162 197 163 - ret = pcmcia_request_configuration(link, &link->conf); 198 + ret = pcmcia_enable_device(link); 164 199 if (ret) 165 200 goto failed; 166 - 167 - dev_info(&link->dev, "index 0x%02x: ", 168 - link->conf.ConfigIndex); 169 - if (link->conf.Vpp) 170 - printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); 171 - printk(", irq %d", link->irq); 172 - printk(", io %pR", link->resource[0]); 173 - printk("\n"); 174 201 175 202 if (sl811_hc_init(parent, link->resource[0]->start, link->irq) 176 203 < 0) { ··· 184 227 local->p_dev = link; 185 228 link->priv = local; 186 229 187 - link->conf.Attributes = 0; 188 - link->conf.IntType = INT_MEMORY_AND_IO; 189 - 190 230 return sl811_cs_config(link); 191 231 } 192 232 ··· 195 241 196 242 static struct pcmcia_driver sl811_cs_driver = { 197 243 .owner = THIS_MODULE, 198 - .drv = { 199 - .name = "sl811_cs", 200 - }, 244 + .name = "sl811_cs", 201 245 .probe = sl811_cs_probe, 202 246 .remove = sl811_cs_detach, 203 247 .id_table = sl811_ids,
-95
include/pcmcia/cs.h
··· 1 - /* 2 - * cs.h 3 - * 4 - * This program is free software; you can redistribute it and/or modify 5 - * it under the terms of the GNU General Public License version 2 as 6 - * published by the Free Software Foundation. 7 - * 8 - * The initial developer of the original code is David A. Hinds 9 - * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds 10 - * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 11 - * 12 - * (C) 1999 David A. Hinds 13 - */ 14 - 15 - #ifndef _LINUX_CS_H 16 - #define _LINUX_CS_H 17 - 18 - #ifdef __KERNEL__ 19 - #include <linux/interrupt.h> 20 - #endif 21 - 22 - /* ModifyConfiguration */ 23 - typedef struct modconf_t { 24 - u_int Attributes; 25 - u_int Vcc, Vpp1, Vpp2; 26 - } modconf_t; 27 - 28 - /* Attributes for ModifyConfiguration */ 29 - #define CONF_IRQ_CHANGE_VALID 0x0100 30 - #define CONF_VCC_CHANGE_VALID 0x0200 31 - #define CONF_VPP1_CHANGE_VALID 0x0400 32 - #define CONF_VPP2_CHANGE_VALID 0x0800 33 - #define CONF_IO_CHANGE_WIDTH 0x1000 34 - 35 - /* For RequestConfiguration */ 36 - typedef struct config_req_t { 37 - u_int Attributes; 38 - u_int Vpp; /* both Vpp1 and Vpp2 */ 39 - u_int IntType; 40 - u_int ConfigBase; 41 - u_char Status, Pin, Copy, ExtStatus; 42 - u_char ConfigIndex; 43 - u_int Present; 44 - } config_req_t; 45 - 46 - /* Attributes for RequestConfiguration */ 47 - #define CONF_ENABLE_IRQ 0x01 48 - #define CONF_ENABLE_DMA 0x02 49 - #define CONF_ENABLE_SPKR 0x04 50 - #define CONF_ENABLE_PULSE_IRQ 0x08 51 - #define CONF_VALID_CLIENT 0x100 52 - 53 - /* IntType field */ 54 - #define INT_MEMORY 0x01 55 - #define INT_MEMORY_AND_IO 0x02 56 - #define INT_CARDBUS 0x04 57 - #define INT_ZOOMED_VIDEO 0x08 58 - 59 - /* Configuration registers present */ 60 - #define PRESENT_OPTION 0x001 61 - #define PRESENT_STATUS 0x002 62 - #define PRESENT_PIN_REPLACE 0x004 63 - #define PRESENT_COPY 0x008 64 - #define PRESENT_EXT_STATUS 0x010 65 - #define PRESENT_IOBASE_0 0x020 66 - #define PRESENT_IOBASE_1 0x040 67 - #define PRESENT_IOBASE_2 0x080 68 - #define PRESENT_IOBASE_3 0x100 69 - #define PRESENT_IOSIZE 0x200 70 - 71 - /* For RequestWindow */ 72 - typedef struct win_req_t { 73 - u_int Attributes; 74 - u_long Base; 75 - u_int Size; 76 - u_int AccessSpeed; 77 - } win_req_t; 78 - 79 - /* Attributes for RequestWindow */ 80 - #define WIN_MEMORY_TYPE_CM 0x00 /* default */ 81 - #define WIN_MEMORY_TYPE_AM 0x20 /* MAP_ATTRIB */ 82 - #define WIN_DATA_WIDTH_8 0x00 /* default */ 83 - #define WIN_DATA_WIDTH_16 0x02 /* MAP_16BIT */ 84 - #define WIN_ENABLE 0x01 /* MAP_ACTIVE */ 85 - #define WIN_USE_WAIT 0x40 /* MAP_USE_WAIT */ 86 - 87 - #define WIN_FLAGS_MAP 0x63 /* MAP_ATTRIB | MAP_16BIT | MAP_ACTIVE | 88 - MAP_USE_WAIT */ 89 - #define WIN_FLAGS_REQ 0x1c /* mapping to socket->win[i]: 90 - 0x04 -> 0 91 - 0x08 -> 1 92 - 0x0c -> 2 93 - 0x10 -> 3 */ 94 - 95 - #endif /* _LINUX_CS_H */
+59 -26
include/pcmcia/ds.h
··· 24 24 25 25 #ifdef __KERNEL__ 26 26 #include <linux/device.h> 27 + #include <linux/interrupt.h> 27 28 #include <pcmcia/ss.h> 28 29 #include <asm/atomic.h> 30 + 29 31 30 32 /* 31 33 * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus ··· 38 36 struct config_t; 39 37 struct net_device; 40 38 41 - typedef struct resource *window_handle_t; 42 - 43 39 /* dynamic device IDs for PCMCIA device drivers. See 44 40 * Documentation/pcmcia/driver.txt for details. 45 41 */ ··· 47 47 }; 48 48 49 49 struct pcmcia_driver { 50 + const char *name; 51 + 50 52 int (*probe) (struct pcmcia_device *dev); 51 53 void (*remove) (struct pcmcia_device *dev); 52 54 ··· 92 90 93 91 struct list_head socket_device_list; 94 92 95 - /* deprecated, will be cleaned up soon */ 96 - config_req_t conf; 97 - window_handle_t win; 98 - 99 93 /* device setup */ 100 94 unsigned int irq; 101 95 struct resource *resource[PCMCIA_NUM_RESOURCES]; 96 + resource_size_t card_addr; /* for the 1st IOMEM resource */ 97 + unsigned int vpp; 102 98 103 - unsigned int io_lines; /* number of I/O lines */ 99 + unsigned int config_flags; /* CONF_ENABLE_ flags below */ 100 + unsigned int config_base; 101 + unsigned int config_index; 102 + unsigned int config_regs; /* PRESENT_ flags below */ 103 + unsigned int io_lines; /* number of I/O lines */ 104 104 105 105 /* Is the device suspended? */ 106 106 u16 suspended:1; ··· 178 174 /* loop CIS entries for valid configuration */ 179 175 int pcmcia_loop_config(struct pcmcia_device *p_dev, 180 176 int (*conf_check) (struct pcmcia_device *p_dev, 181 - cistpl_cftable_entry_t *cf, 182 - cistpl_cftable_entry_t *dflt, 183 - unsigned int vcc, 184 177 void *priv_data), 185 178 void *priv_data); 186 179 ··· 207 206 int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, 208 207 irq_handler_t handler); 209 208 210 - int pcmcia_request_configuration(struct pcmcia_device *p_dev, 211 - config_req_t *req); 209 + int pcmcia_enable_device(struct pcmcia_device *p_dev); 212 210 213 - int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, 214 - window_handle_t *wh); 215 - int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t win); 216 - int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t win, 211 + int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, 212 + unsigned int speed); 213 + int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res); 214 + int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, 217 215 unsigned int offset); 218 216 219 - int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); 217 + int pcmcia_fixup_vpp(struct pcmcia_device *p_dev, unsigned char new_vpp); 218 + int pcmcia_fixup_iowidth(struct pcmcia_device *p_dev); 219 + 220 220 void pcmcia_disable_device(struct pcmcia_device *p_dev); 221 221 222 222 /* IO ports */ ··· 226 224 #define IO_DATA_PATH_WIDTH_16 0x08 227 225 #define IO_DATA_PATH_WIDTH_AUTO 0x10 228 226 229 - /* convert flag found in cfgtable to data path width parameter */ 230 - static inline int pcmcia_io_cfg_data_width(unsigned int flags) 231 - { 232 - if (!(flags & CISTPL_IO_8BIT)) 233 - return IO_DATA_PATH_WIDTH_16; 234 - if (!(flags & CISTPL_IO_16BIT)) 235 - return IO_DATA_PATH_WIDTH_8; 236 - return IO_DATA_PATH_WIDTH_AUTO; 237 - } 227 + /* IO memory */ 228 + #define WIN_MEMORY_TYPE_CM 0x00 /* default */ 229 + #define WIN_MEMORY_TYPE_AM 0x20 /* MAP_ATTRIB */ 230 + #define WIN_DATA_WIDTH_8 0x00 /* default */ 231 + #define WIN_DATA_WIDTH_16 0x02 /* MAP_16BIT */ 232 + #define WIN_ENABLE 0x01 /* MAP_ACTIVE */ 233 + #define WIN_USE_WAIT 0x40 /* MAP_USE_WAIT */ 234 + 235 + #define WIN_FLAGS_MAP 0x63 /* MAP_ATTRIB | MAP_16BIT | MAP_ACTIVE | 236 + MAP_USE_WAIT */ 237 + #define WIN_FLAGS_REQ 0x1c /* mapping to socket->win[i]: 238 + 0x04 -> 0 239 + 0x08 -> 1 240 + 0x0c -> 2 241 + 0x10 -> 3 */ 242 + 243 + /* config_reg{ister}s present for this PCMCIA device */ 244 + #define PRESENT_OPTION 0x001 245 + #define PRESENT_STATUS 0x002 246 + #define PRESENT_PIN_REPLACE 0x004 247 + #define PRESENT_COPY 0x008 248 + #define PRESENT_EXT_STATUS 0x010 249 + #define PRESENT_IOBASE_0 0x020 250 + #define PRESENT_IOBASE_1 0x040 251 + #define PRESENT_IOBASE_2 0x080 252 + #define PRESENT_IOBASE_3 0x100 253 + #define PRESENT_IOSIZE 0x200 254 + 255 + /* flags to be passed to pcmcia_enable_device() */ 256 + #define CONF_ENABLE_IRQ 0x0001 257 + #define CONF_ENABLE_SPKR 0x0002 258 + #define CONF_ENABLE_PULSE_IRQ 0x0004 259 + #define CONF_ENABLE_ESR 0x0008 260 + 261 + /* flags used by pcmcia_loop_config() autoconfiguration */ 262 + #define CONF_AUTO_CHECK_VCC 0x0100 /* check for matching Vcc? */ 263 + #define CONF_AUTO_SET_VPP 0x0200 /* set Vpp? */ 264 + #define CONF_AUTO_AUDIO 0x0400 /* enable audio line? */ 265 + #define CONF_AUTO_SET_IO 0x0800 /* set ->resource[0,1] */ 266 + #define CONF_AUTO_SET_IOMEM 0x1000 /* set ->resource[2] */ 238 267 239 268 #endif /* __KERNEL__ */ 240 269
-1
include/pcmcia/ss.h
··· 19 19 #include <linux/sched.h> /* task_struct, completion */ 20 20 #include <linux/mutex.h> 21 21 22 - #include <pcmcia/cs.h> 23 22 #ifdef CONFIG_CARDBUS 24 23 #include <linux/pci.h> 25 24 #endif
+7 -9
sound/pcmcia/pdaudiocf/pdaudiocf.c
··· 142 142 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 143 143 link->resource[0]->end = 16; 144 144 145 - link->conf.Attributes = CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; 146 - link->conf.IntType = INT_MEMORY_AND_IO; 147 - link->conf.ConfigIndex = 1; 148 - link->conf.Present = PRESENT_OPTION; 145 + link->config_flags = CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; 146 + link->config_index = 1; 147 + link->config_regs = PRESENT_OPTION; 149 148 150 149 return pdacf_config(link); 151 150 } ··· 216 217 int ret; 217 218 218 219 snd_printdd(KERN_DEBUG "pdacf_config called\n"); 219 - link->conf.ConfigIndex = 0x5; 220 + link->config_index = 0x5; 221 + link->config_flags |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; 220 222 221 223 ret = pcmcia_request_io(link); 222 224 if (ret) ··· 227 227 if (ret) 228 228 goto failed; 229 229 230 - ret = pcmcia_request_configuration(link, &link->conf); 230 + ret = pcmcia_enable_device(link); 231 231 if (ret) 232 232 goto failed; 233 233 ··· 287 287 288 288 static struct pcmcia_driver pdacf_cs_driver = { 289 289 .owner = THIS_MODULE, 290 - .drv = { 291 - .name = "snd-pdaudiocf", 292 - }, 290 + .name = "snd-pdaudiocf", 293 291 .probe = snd_pdacf_probe, 294 292 .remove = snd_pdacf_detach, 295 293 .id_table = snd_pdacf_ids,
-1
sound/pcmcia/pdaudiocf/pdaudiocf.h
··· 24 24 #include <sound/pcm.h> 25 25 #include <asm/io.h> 26 26 #include <linux/interrupt.h> 27 - #include <pcmcia/cs.h> 28 27 #include <pcmcia/cistpl.h> 29 28 #include <pcmcia/ds.h> 30 29
+6 -9
sound/pcmcia/vx/vxpocket.c
··· 2 2 * Driver for Digigram VXpocket V2/440 soundcards 3 3 * 4 4 * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de> 5 - * 5 + 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License as published by 8 8 * the Free Software Foundation; either version 2 of the License, or ··· 162 162 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 163 163 link->resource[0]->end = 16; 164 164 165 - link->conf.Attributes = CONF_ENABLE_IRQ; 166 - link->conf.IntType = INT_MEMORY_AND_IO; 167 - link->conf.ConfigIndex = 1; 168 - link->conf.Present = PRESENT_OPTION; 165 + link->config_flags |= CONF_ENABLE_IRQ; 166 + link->config_index = 1; 167 + link->config_regs = PRESENT_OPTION; 169 168 170 169 *chip_ret = vxp; 171 170 return 0; ··· 233 234 if (ret) 234 235 goto failed; 235 236 236 - ret = pcmcia_request_configuration(link, &link->conf); 237 + ret = pcmcia_enable_device(link); 237 238 if (ret) 238 239 goto failed; 239 240 ··· 358 359 359 360 static struct pcmcia_driver vxp_cs_driver = { 360 361 .owner = THIS_MODULE, 361 - .drv = { 362 - .name = "snd-vxpocket", 363 - }, 362 + .name = "snd-vxpocket", 364 363 .probe = vxpocket_probe, 365 364 .remove = vxpocket_detach, 366 365 .id_table = vxp_ids,
-1
sound/pcmcia/vx/vxpocket.h
··· 23 23 24 24 #include <sound/vx_core.h> 25 25 26 - #include <pcmcia/cs.h> 27 26 #include <pcmcia/cistpl.h> 28 27 #include <pcmcia/ds.h> 29 28