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 This file details changes in 2.6 which affect PCMCIA card driver authors: 2 * pcmcia_request_io changes (as of 2.6.36) 3 Instead of io_req_t, drivers are now requested to fill out 4 struct pcmcia_device *p_dev->resource[0,1] for up to two ioport
··· 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 + 27 * pcmcia_request_io changes (as of 2.6.36) 28 Instead of io_req_t, drivers are now requested to fill out 29 struct pcmcia_device *p_dev->resource[0,1] for up to two ioport
+26 -76
drivers/ata/pata_pcmcia.c
··· 34 #include <linux/ata.h> 35 #include <linux/libata.h> 36 37 - #include <pcmcia/cs.h> 38 #include <pcmcia/cistpl.h> 39 #include <pcmcia/ds.h> 40 #include <pcmcia/cisreg.h> ··· 167 }; 168 169 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) 181 { 182 - struct pcmcia_config_check *stk = priv_data; 183 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 - } 193 } 194 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 222 return -ENODEV; 223 - /* If we've got this far, we're done */ 224 - return 0; 225 } 226 - return -ENODEV; 227 } 228 229 /** ··· 201 { 202 struct ata_host *host; 203 struct ata_port *ap; 204 - struct pcmcia_config_check *stk = NULL; 205 int is_kme = 0, ret = -ENOMEM, p; 206 unsigned long io_base, ctl_base; 207 void __iomem *io_addr, *ctl_addr; ··· 208 struct ata_port_operations *ops = &pcmcia_port_ops; 209 210 /* 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; 215 216 /* See if we have a manufacturer identifier. Use it to set is_kme for 217 vendor quirks */ ··· 217 ((pdev->card_id == PRODID_KME_KXLC005_A) || 218 (pdev->card_id == PRODID_KME_KXLC005_B))); 219 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)) 231 goto failed; /* No suitable config found */ 232 } 233 io_base = pdev->resource[0]->start; 234 - ctl_base = stk->ctl_base; 235 if (!pdev->irq) 236 goto failed; 237 238 - ret = pcmcia_request_configuration(pdev, &pdev->conf); 239 if (ret) 240 goto failed; 241 ··· 284 goto failed; 285 286 pdev->priv = host; 287 - kfree(stk); 288 return 0; 289 290 failed: 291 - kfree(stk); 292 pcmcia_disable_device(pdev); 293 - out1: 294 return ret; 295 } 296 ··· 382 383 static struct pcmcia_driver pcmcia_driver = { 384 .owner = THIS_MODULE, 385 - .drv = { 386 - .name = DRV_NAME, 387 - }, 388 .id_table = pcmcia_devices, 389 .probe = pcmcia_init_one, 390 .remove = pcmcia_remove_one,
··· 34 #include <linux/ata.h> 35 #include <linux/libata.h> 36 37 #include <pcmcia/cistpl.h> 38 #include <pcmcia/ds.h> 39 #include <pcmcia/cisreg.h> ··· 168 }; 169 170 171 + static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data) 172 { 173 + int *is_kme = priv_data; 174 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; 178 } 179 + pdev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; 180 + pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 181 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) 187 return -ENODEV; 188 } 189 + 190 + return pcmcia_request_io(pdev); 191 } 192 193 /** ··· 239 { 240 struct ata_host *host; 241 struct ata_port *ap; 242 int is_kme = 0, ret = -ENOMEM, p; 243 unsigned long io_base, ctl_base; 244 void __iomem *io_addr, *ctl_addr; ··· 247 struct ata_port_operations *ops = &pcmcia_port_ops; 248 249 /* Set up attributes in order to probe card and get resources */ 250 + pdev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO | 251 + CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; 252 253 /* See if we have a manufacturer identifier. Use it to set is_kme for 254 vendor quirks */ ··· 258 ((pdev->card_id == PRODID_KME_KXLC005_A) || 259 (pdev->card_id == PRODID_KME_KXLC005_B))); 260 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)) 264 goto failed; /* No suitable config found */ 265 } 266 io_base = pdev->resource[0]->start; 267 + if (pdev->resource[1]->end) 268 + ctl_base = pdev->resource[1]->start; 269 + else 270 + ctl_base = pdev->resource[0]->start + 0x0e; 271 + 272 if (!pdev->irq) 273 goto failed; 274 275 + ret = pcmcia_enable_device(pdev); 276 if (ret) 277 goto failed; 278 ··· 329 goto failed; 330 331 pdev->priv = host; 332 return 0; 333 334 failed: 335 pcmcia_disable_device(pdev); 336 return ret; 337 } 338 ··· 430 431 static struct pcmcia_driver pcmcia_driver = { 432 .owner = THIS_MODULE, 433 + .name = DRV_NAME, 434 .id_table = pcmcia_devices, 435 .probe = pcmcia_init_one, 436 .remove = pcmcia_remove_one,
+4 -8
drivers/bluetooth/bluecard_cs.c
··· 39 #include <linux/skbuff.h> 40 #include <linux/io.h> 41 42 - #include <pcmcia/cs.h> 43 #include <pcmcia/cistpl.h> 44 #include <pcmcia/ciscode.h> 45 #include <pcmcia/ds.h> ··· 864 info->p_dev = link; 865 link->priv = info; 866 867 - link->conf.Attributes = CONF_ENABLE_IRQ; 868 - link->conf.IntType = INT_MEMORY_AND_IO; 869 870 return bluecard_config(link); 871 } ··· 884 bluecard_info_t *info = link->priv; 885 int i, n; 886 887 - link->conf.ConfigIndex = 0x20; 888 889 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 890 link->resource[0]->end = 64; ··· 904 if (i != 0) 905 goto failed; 906 907 - i = pcmcia_request_configuration(link, &link->conf); 908 if (i != 0) 909 goto failed; 910 ··· 940 941 static struct pcmcia_driver bluecard_driver = { 942 .owner = THIS_MODULE, 943 - .drv = { 944 - .name = "bluecard_cs", 945 - }, 946 .probe = bluecard_probe, 947 .remove = bluecard_detach, 948 .id_table = bluecard_ids,
··· 39 #include <linux/skbuff.h> 40 #include <linux/io.h> 41 42 #include <pcmcia/cistpl.h> 43 #include <pcmcia/ciscode.h> 44 #include <pcmcia/ds.h> ··· 865 info->p_dev = link; 866 link->priv = info; 867 868 + link->config_flags |= CONF_ENABLE_IRQ; 869 870 return bluecard_config(link); 871 } ··· 886 bluecard_info_t *info = link->priv; 887 int i, n; 888 889 + link->config_index = 0x20; 890 891 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 892 link->resource[0]->end = 64; ··· 906 if (i != 0) 907 goto failed; 908 909 + i = pcmcia_enable_device(link); 910 if (i != 0) 911 goto failed; 912 ··· 942 943 static struct pcmcia_driver bluecard_driver = { 944 .owner = THIS_MODULE, 945 + .name = "bluecard_cs", 946 .probe = bluecard_probe, 947 .remove = bluecard_detach, 948 .id_table = bluecard_ids,
+28 -36
drivers/bluetooth/bt3c_cs.c
··· 45 #include <linux/device.h> 46 #include <linux/firmware.h> 47 48 - #include <pcmcia/cs.h> 49 #include <pcmcia/cistpl.h> 50 #include <pcmcia/ciscode.h> 51 #include <pcmcia/ds.h> ··· 656 info->p_dev = link; 657 link->priv = info; 658 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; 664 665 return bt3c_config(link); 666 } ··· 671 kfree(info); 672 } 673 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) 679 { 680 - unsigned long try = (unsigned long) priv_data; 681 682 - p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 683 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; 693 } 694 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 void *priv_data) 700 { 701 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 702 int j; 703 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 - } 711 } 712 return -ENODEV; 713 } ··· 736 if (i != 0) 737 goto failed; 738 739 - i = pcmcia_request_configuration(link, &link->conf); 740 if (i != 0) 741 goto failed; 742 ··· 769 770 static struct pcmcia_driver bt3c_driver = { 771 .owner = THIS_MODULE, 772 - .drv = { 773 - .name = "bt3c_cs", 774 - }, 775 .probe = bt3c_probe, 776 .remove = bt3c_detach, 777 .id_table = bt3c_ids,
··· 45 #include <linux/device.h> 46 #include <linux/firmware.h> 47 48 #include <pcmcia/cistpl.h> 49 #include <pcmcia/ciscode.h> 50 #include <pcmcia/ds.h> ··· 657 info->p_dev = link; 658 link->priv = info; 659 660 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | 661 + CONF_AUTO_SET_IO; 662 663 return bt3c_config(link); 664 } ··· 675 kfree(info); 676 } 677 678 + static int bt3c_check_config(struct pcmcia_device *p_dev, void *priv_data) 679 { 680 + int *try = priv_data; 681 682 + if (try == 0) 683 + p_dev->io_lines = 16; 684 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 } 694 695 static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, 696 void *priv_data) 697 { 698 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 699 int j; 700 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; 713 } 714 return -ENODEV; 715 } ··· 742 if (i != 0) 743 goto failed; 744 745 + i = pcmcia_enable_device(link); 746 if (i != 0) 747 goto failed; 748 ··· 775 776 static struct pcmcia_driver bt3c_driver = { 777 .owner = THIS_MODULE, 778 + .name = "bt3c_cs", 779 .probe = bt3c_probe, 780 .remove = bt3c_detach, 781 .id_table = bt3c_ids,
+27 -35
drivers/bluetooth/btuart_cs.c
··· 41 #include <asm/system.h> 42 #include <asm/io.h> 43 44 - #include <pcmcia/cs.h> 45 #include <pcmcia/cistpl.h> 46 #include <pcmcia/ciscode.h> 47 #include <pcmcia/ds.h> ··· 585 info->p_dev = link; 586 link->priv = info; 587 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; 593 594 return btuart_config(link); 595 } ··· 600 kfree(info); 601 } 602 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) 608 { 609 int *try = priv_data; 610 611 - p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 612 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; 622 } 623 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 void *priv_data) 629 { 630 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 631 int j; 632 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 - } 640 } 641 return -ENODEV; 642 } ··· 665 if (i != 0) 666 goto failed; 667 668 - i = pcmcia_request_configuration(link, &link->conf); 669 if (i != 0) 670 goto failed; 671 ··· 697 698 static struct pcmcia_driver btuart_driver = { 699 .owner = THIS_MODULE, 700 - .drv = { 701 - .name = "btuart_cs", 702 - }, 703 .probe = btuart_probe, 704 .remove = btuart_detach, 705 .id_table = btuart_ids,
··· 41 #include <asm/system.h> 42 #include <asm/io.h> 43 44 #include <pcmcia/cistpl.h> 45 #include <pcmcia/ciscode.h> 46 #include <pcmcia/ds.h> ··· 586 info->p_dev = link; 587 link->priv = info; 588 589 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | 590 + CONF_AUTO_SET_IO; 591 592 return btuart_config(link); 593 } ··· 604 kfree(info); 605 } 606 607 + static int btuart_check_config(struct pcmcia_device *p_dev, void *priv_data) 608 { 609 int *try = priv_data; 610 611 + if (try == 0) 612 + p_dev->io_lines = 16; 613 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 } 623 624 static int btuart_check_config_notpicky(struct pcmcia_device *p_dev, 625 void *priv_data) 626 { 627 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 628 int j; 629 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; 642 } 643 return -ENODEV; 644 } ··· 671 if (i != 0) 672 goto failed; 673 674 + i = pcmcia_enable_device(link); 675 if (i != 0) 676 goto failed; 677 ··· 703 704 static struct pcmcia_driver btuart_driver = { 705 .owner = THIS_MODULE, 706 + .name = "btuart_cs", 707 .probe = btuart_probe, 708 .remove = btuart_detach, 709 .id_table = btuart_ids,
+8 -19
drivers/bluetooth/dtl1_cs.c
··· 41 #include <asm/system.h> 42 #include <asm/io.h> 43 44 - #include <pcmcia/cs.h> 45 #include <pcmcia/cistpl.h> 46 #include <pcmcia/ciscode.h> 47 #include <pcmcia/ds.h> ··· 571 info->p_dev = link; 572 link->priv = info; 573 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; 579 580 return dtl1_config(link); 581 } ··· 586 kfree(info); 587 } 588 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 { 595 - if ((cf->io.nwin != 1) || (cf->io.win[0].len <= 8)) 596 return -ENODEV; 597 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; 601 return pcmcia_request_io(p_dev); 602 } 603 ··· 611 if (i != 0) 612 goto failed; 613 614 - i = pcmcia_request_configuration(link, &link->conf); 615 if (i != 0) 616 goto failed; 617 ··· 647 648 static struct pcmcia_driver dtl1_driver = { 649 .owner = THIS_MODULE, 650 - .drv = { 651 - .name = "dtl1_cs", 652 - }, 653 .probe = dtl1_probe, 654 .remove = dtl1_detach, 655 .id_table = dtl1_ids,
··· 41 #include <asm/system.h> 42 #include <asm/io.h> 43 44 #include <pcmcia/cistpl.h> 45 #include <pcmcia/ciscode.h> 46 #include <pcmcia/ds.h> ··· 572 info->p_dev = link; 573 link->priv = info; 574 575 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 576 577 return dtl1_config(link); 578 } ··· 591 kfree(info); 592 } 593 594 + static int dtl1_confcheck(struct pcmcia_device *p_dev, void *priv_data) 595 { 596 + if ((p_dev->resource[1]->end) || (p_dev->resource[1]->end < 8)) 597 return -ENODEV; 598 599 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 600 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 601 + 602 return pcmcia_request_io(p_dev); 603 } 604 ··· 620 if (i != 0) 621 goto failed; 622 623 + i = pcmcia_enable_device(link); 624 if (i != 0) 625 goto failed; 626 ··· 656 657 static struct pcmcia_driver dtl1_driver = { 658 .owner = THIS_MODULE, 659 + .name = "dtl1_cs", 660 .probe = dtl1_probe, 661 .remove = dtl1_detach, 662 .id_table = dtl1_ids,
+5 -26
drivers/char/pcmcia/cm4000_cs.c
··· 34 #include <linux/uaccess.h> 35 #include <linux/io.h> 36 37 - #include <pcmcia/cs.h> 38 #include <pcmcia/cistpl.h> 39 #include <pcmcia/cisreg.h> 40 #include <pcmcia/ciscode.h> ··· 53 dev_dbg(reader_to_dev(rdr), "%s:" x, \ 54 __func__ , ## args); \ 55 } while (0) 56 - 57 - static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte"; 58 59 #define T_1SEC (HZ) 60 #define T_10MSEC msecs_to_jiffies(10) ··· 1739 1740 /*==== Interface to PCMCIA Layer =======================================*/ 1741 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) 1747 { 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 return pcmcia_request_io(p_dev); 1757 } 1758 ··· 1748 { 1749 struct cm4000_dev *dev; 1750 1751 /* read the config-tuples */ 1752 if (pcmcia_loop_config(link, cm4000_config_check, NULL)) 1753 goto cs_release; 1754 1755 - link->conf.IntType = 00000002; 1756 - 1757 - if (pcmcia_request_configuration(link, &link->conf)) 1758 goto cs_release; 1759 1760 dev = link->priv; ··· 1814 1815 dev->p_dev = link; 1816 link->priv = dev; 1817 - link->conf.IntType = INT_MEMORY_AND_IO; 1818 dev_table[i] = link; 1819 1820 init_waitqueue_head(&dev->devq); ··· 1875 1876 static struct pcmcia_driver cm4000_driver = { 1877 .owner = THIS_MODULE, 1878 - .drv = { 1879 - .name = "cm4000_cs", 1880 - }, 1881 .probe = cm4000_probe, 1882 .remove = cm4000_detach, 1883 .suspend = cm4000_suspend, ··· 1886 static int __init cmm_init(void) 1887 { 1888 int rc; 1889 - 1890 - printk(KERN_INFO "%s\n", version); 1891 1892 cmm_class = class_create(THIS_MODULE, "cardman_4000"); 1893 if (IS_ERR(cmm_class)) ··· 1911 1912 static void __exit cmm_exit(void) 1913 { 1914 - printk(KERN_INFO MODULE_NAME ": unloading\n"); 1915 pcmcia_unregister_driver(&cm4000_driver); 1916 unregister_chrdev(major, DEVICE_NAME); 1917 class_destroy(cmm_class);
··· 34 #include <linux/uaccess.h> 35 #include <linux/io.h> 36 37 #include <pcmcia/cistpl.h> 38 #include <pcmcia/cisreg.h> 39 #include <pcmcia/ciscode.h> ··· 54 dev_dbg(reader_to_dev(rdr), "%s:" x, \ 55 __func__ , ## args); \ 56 } while (0) 57 58 #define T_1SEC (HZ) 59 #define T_10MSEC msecs_to_jiffies(10) ··· 1742 1743 /*==== Interface to PCMCIA Layer =======================================*/ 1744 1745 + static int cm4000_config_check(struct pcmcia_device *p_dev, void *priv_data) 1746 { 1747 return pcmcia_request_io(p_dev); 1748 } 1749 ··· 1763 { 1764 struct cm4000_dev *dev; 1765 1766 + link->config_flags |= CONF_AUTO_SET_IO; 1767 + 1768 /* read the config-tuples */ 1769 if (pcmcia_loop_config(link, cm4000_config_check, NULL)) 1770 goto cs_release; 1771 1772 + if (pcmcia_enable_device(link)) 1773 goto cs_release; 1774 1775 dev = link->priv; ··· 1829 1830 dev->p_dev = link; 1831 link->priv = dev; 1832 dev_table[i] = link; 1833 1834 init_waitqueue_head(&dev->devq); ··· 1891 1892 static struct pcmcia_driver cm4000_driver = { 1893 .owner = THIS_MODULE, 1894 + .name = "cm4000_cs", 1895 .probe = cm4000_probe, 1896 .remove = cm4000_detach, 1897 .suspend = cm4000_suspend, ··· 1904 static int __init cmm_init(void) 1905 { 1906 int rc; 1907 1908 cmm_class = class_create(THIS_MODULE, "cardman_4000"); 1909 if (IS_ERR(cmm_class)) ··· 1931 1932 static void __exit cmm_exit(void) 1933 { 1934 pcmcia_unregister_driver(&cm4000_driver); 1935 unregister_chrdev(major, DEVICE_NAME); 1936 class_destroy(cmm_class);
+7 -33
drivers/char/pcmcia/cm4040_cs.c
··· 29 #include <asm/uaccess.h> 30 #include <asm/io.h> 31 32 - #include <pcmcia/cs.h> 33 #include <pcmcia/cistpl.h> 34 #include <pcmcia/cisreg.h> 35 #include <pcmcia/ciscode.h> ··· 47 dev_dbg(reader_to_dev(rdr), "%s:" x, \ 48 __func__ , ## args); \ 49 } while (0) 50 - 51 - static char *version = 52 - "OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte"; 53 54 #define CCID_DRIVER_BULK_DEFAULT_TIMEOUT (150*HZ) 55 #define CCID_DRIVER_ASYNC_POWERUP_TIMEOUT (35*HZ) ··· 512 return; 513 } 514 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) 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; 535 } 536 537 ··· 523 struct reader_dev *dev; 524 int fail_rc; 525 526 if (pcmcia_loop_config(link, cm4040_config_check, NULL)) 527 goto cs_release; 528 529 - link->conf.IntType = 00000002; 530 - 531 - fail_rc = pcmcia_request_configuration(link, &link->conf); 532 if (fail_rc != 0) { 533 dev_printk(KERN_INFO, &link->dev, 534 - "pcmcia_request_configuration failed 0x%x\n", 535 fail_rc); 536 goto cs_release; 537 } ··· 578 link->priv = dev; 579 dev->p_dev = link; 580 581 - link->conf.IntType = INT_MEMORY_AND_IO; 582 dev_table[i] = link; 583 584 init_waitqueue_head(&dev->devq); ··· 640 641 static struct pcmcia_driver reader_driver = { 642 .owner = THIS_MODULE, 643 - .drv = { 644 - .name = "cm4040_cs", 645 - }, 646 .probe = reader_probe, 647 .remove = reader_detach, 648 .id_table = cm4040_ids, ··· 650 { 651 int rc; 652 653 - printk(KERN_INFO "%s\n", version); 654 cmx_class = class_create(THIS_MODULE, "cardman_4040"); 655 if (IS_ERR(cmx_class)) 656 return PTR_ERR(cmx_class); ··· 674 675 static void __exit cm4040_exit(void) 676 { 677 - printk(KERN_INFO MODULE_NAME ": unloading\n"); 678 pcmcia_unregister_driver(&reader_driver); 679 unregister_chrdev(major, DEVICE_NAME); 680 class_destroy(cmx_class);
··· 29 #include <asm/uaccess.h> 30 #include <asm/io.h> 31 32 #include <pcmcia/cistpl.h> 33 #include <pcmcia/cisreg.h> 34 #include <pcmcia/ciscode.h> ··· 48 dev_dbg(reader_to_dev(rdr), "%s:" x, \ 49 __func__ , ## args); \ 50 } while (0) 51 52 #define CCID_DRIVER_BULK_DEFAULT_TIMEOUT (150*HZ) 53 #define CCID_DRIVER_ASYNC_POWERUP_TIMEOUT (35*HZ) ··· 516 return; 517 } 518 519 + static int cm4040_config_check(struct pcmcia_device *p_dev, void *priv_data) 520 { 521 + return pcmcia_request_io(p_dev); 522 } 523 524 ··· 544 struct reader_dev *dev; 545 int fail_rc; 546 547 + link->config_flags |= CONF_AUTO_SET_IO; 548 + 549 if (pcmcia_loop_config(link, cm4040_config_check, NULL)) 550 goto cs_release; 551 552 + fail_rc = pcmcia_enable_device(link); 553 if (fail_rc != 0) { 554 dev_printk(KERN_INFO, &link->dev, 555 + "pcmcia_enable_device failed 0x%x\n", 556 fail_rc); 557 goto cs_release; 558 } ··· 599 link->priv = dev; 600 dev->p_dev = link; 601 602 dev_table[i] = link; 603 604 init_waitqueue_head(&dev->devq); ··· 662 663 static struct pcmcia_driver reader_driver = { 664 .owner = THIS_MODULE, 665 + .name = "cm4040_cs", 666 .probe = reader_probe, 667 .remove = reader_detach, 668 .id_table = cm4040_ids, ··· 674 { 675 int rc; 676 677 cmx_class = class_create(THIS_MODULE, "cardman_4040"); 678 if (IS_ERR(cmx_class)) 679 return PTR_ERR(cmx_class); ··· 699 700 static void __exit cm4040_exit(void) 701 { 702 pcmcia_unregister_driver(&reader_driver); 703 unregister_chrdev(major, DEVICE_NAME); 704 class_destroy(cmx_class);
+41 -76
drivers/char/pcmcia/ipwireless/main.c
··· 32 #include <pcmcia/device_id.h> 33 #include <pcmcia/ss.h> 34 #include <pcmcia/ds.h> 35 - #include <pcmcia/cs.h> 36 37 static struct pcmcia_device_id ipw_ids[] = { 38 PCMCIA_DEVICE_MANF_CARD(0x02f2, 0x0100), ··· 75 schedule_work(&ipw->work_reboot); 76 } 77 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) 83 { 84 struct ipw_dev *ipw = priv_data; 85 struct resource *io_resource; 86 int ret; 87 88 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 92 /* 0x40 causes it to generate level mode interrupts. */ 93 /* 0x04 enables IREQ pin. */ 94 - p_dev->conf.ConfigIndex = cfg->index | 0x44; 95 p_dev->io_lines = 16; 96 ret = pcmcia_request_io(p_dev); 97 if (ret) ··· 96 resource_size(p_dev->resource[0]), 97 IPWIRELESS_PCCARD_NAME); 98 99 - if (cfg->mem.nwin == 0) 100 - return 0; 101 - 102 - ipw->request_common_memory.Attributes = 103 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 110 - ret = pcmcia_request_window(p_dev, &ipw->request_common_memory, 111 - &ipw->handle_common_memory); 112 - 113 if (ret != 0) 114 goto exit1; 115 116 - ret = pcmcia_map_mem_page(p_dev, ipw->handle_common_memory, 117 - cfg->mem.win[0].card_addr); 118 - 119 if (ret != 0) 120 goto exit2; 121 122 - ipw->is_v2_card = cfg->mem.win[0].len == 0x100; 123 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, 128 IPWIRELESS_PCCARD_NAME); 129 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 - 139 if (ret != 0) 140 goto exit2; 141 142 - ret = pcmcia_map_mem_page(p_dev, ipw->handle_attr_memory, 0); 143 if (ret != 0) 144 goto exit3; 145 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); 150 151 return 0; 152 153 exit3: 154 exit2: 155 if (ipw->common_memory) { 156 - release_mem_region(ipw->request_common_memory.Base, 157 - ipw->request_common_memory.Size); 158 iounmap(ipw->common_memory); 159 } 160 exit1: ··· 153 int ret = 0; 154 155 ipw->is_v2_card = 0; 156 157 ret = pcmcia_loop_config(link, ipwireless_probe, ipw); 158 if (ret != 0) 159 return ret; 160 - 161 - link->conf.Attributes = CONF_ENABLE_IRQ; 162 - link->conf.IntType = INT_MEMORY_AND_IO; 163 164 INIT_WORK(&ipw->work_reboot, signalled_reboot_work); 165 ··· 178 (unsigned int) link->irq); 179 if (ipw->attr_memory && ipw->common_memory) 180 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); 188 189 ipw->network = ipwireless_network_create(ipw->hardware); 190 if (!ipw->network) ··· 196 * Do the RequestConfiguration last, because it enables interrupts. 197 * Then we don't get any interrupts before we're ready for them. 198 */ 199 - ret = pcmcia_request_configuration(link, &link->conf); 200 - 201 if (ret != 0) 202 goto exit; 203 204 return 0; 205 206 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 if (ipw->common_memory) { 214 - release_mem_region(ipw->request_common_memory.Base, 215 - ipw->request_common_memory.Size); 216 iounmap(ipw->common_memory); 217 } 218 pcmcia_disable_device(link); 219 return -1; ··· 220 static void release_ipwireless(struct ipw_dev *ipw) 221 { 222 if (ipw->common_memory) { 223 - release_mem_region(ipw->request_common_memory.Base, 224 - ipw->request_common_memory.Size); 225 iounmap(ipw->common_memory); 226 } 227 if (ipw->attr_memory) { 228 - release_mem_region(ipw->request_attr_memory.Base, 229 - ipw->request_attr_memory.Size); 230 iounmap(ipw->attr_memory); 231 } 232 pcmcia_disable_device(ipw->link); ··· 295 .owner = THIS_MODULE, 296 .probe = ipwireless_attach, 297 .remove = ipwireless_detach, 298 - .drv = { .name = IPWIRELESS_PCCARD_NAME }, 299 .id_table = ipw_ids 300 }; 301 ··· 306 static int __init init_ipwireless(void) 307 { 308 int ret; 309 - 310 - printk(KERN_INFO IPWIRELESS_PCCARD_NAME " " 311 - IPWIRELESS_PCMCIA_VERSION " by " IPWIRELESS_PCMCIA_AUTHOR "\n"); 312 313 ret = ipwireless_tty_init(); 314 if (ret != 0) ··· 323 */ 324 static void __exit exit_ipwireless(void) 325 { 326 - printk(KERN_INFO IPWIRELESS_PCCARD_NAME " " 327 - IPWIRELESS_PCMCIA_VERSION " removed\n"); 328 - 329 pcmcia_unregister_driver(&me); 330 ipwireless_tty_release(); 331 }
··· 32 #include <pcmcia/device_id.h> 33 #include <pcmcia/ss.h> 34 #include <pcmcia/ds.h> 35 36 static struct pcmcia_device_id ipw_ids[] = { 37 PCMCIA_DEVICE_MANF_CARD(0x02f2, 0x0100), ··· 76 schedule_work(&ipw->work_reboot); 77 } 78 79 + static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) 80 { 81 struct ipw_dev *ipw = priv_data; 82 struct resource *io_resource; 83 int ret; 84 85 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 86 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 87 88 /* 0x40 causes it to generate level mode interrupts. */ 89 /* 0x04 enables IREQ pin. */ 90 + p_dev->config_index |= 0x44; 91 p_dev->io_lines = 16; 92 ret = pcmcia_request_io(p_dev); 93 if (ret) ··· 102 resource_size(p_dev->resource[0]), 103 IPWIRELESS_PCCARD_NAME); 104 105 + p_dev->resource[2]->flags |= 106 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; 107 108 + ret = pcmcia_request_window(p_dev, p_dev->resource[2], 0); 109 if (ret != 0) 110 goto exit1; 111 112 + ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], p_dev->card_addr); 113 if (ret != 0) 114 goto exit2; 115 116 + ipw->is_v2_card = resource_size(p_dev->resource[2]) == 0x100; 117 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]), 122 IPWIRELESS_PCCARD_NAME); 123 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); 128 if (ret != 0) 129 goto exit2; 130 131 + ret = pcmcia_map_mem_page(p_dev, p_dev->resource[3], 0); 132 if (ret != 0) 133 goto exit3; 134 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); 140 141 return 0; 142 143 exit3: 144 exit2: 145 if (ipw->common_memory) { 146 + release_mem_region(p_dev->resource[2]->start, 147 + resource_size(p_dev->resource[2])); 148 iounmap(ipw->common_memory); 149 } 150 exit1: ··· 175 int ret = 0; 176 177 ipw->is_v2_card = 0; 178 + link->config_flags |= CONF_AUTO_SET_IO | CONF_AUTO_SET_IOMEM | 179 + CONF_ENABLE_IRQ; 180 181 ret = pcmcia_loop_config(link, ipwireless_probe, ipw); 182 if (ret != 0) 183 return ret; 184 185 INIT_WORK(&ipw->work_reboot, signalled_reboot_work); 186 ··· 201 (unsigned int) link->irq); 202 if (ipw->attr_memory && ipw->common_memory) 203 printk(KERN_INFO IPWIRELESS_PCCARD_NAME 204 + ": attr memory %pR, common memory %pR\n", 205 + link->resource[3], 206 + link->resource[2]); 207 208 ipw->network = ipwireless_network_create(ipw->hardware); 209 if (!ipw->network) ··· 223 * Do the RequestConfiguration last, because it enables interrupts. 224 * Then we don't get any interrupts before we're ready for them. 225 */ 226 + ret = pcmcia_enable_device(link); 227 if (ret != 0) 228 goto exit; 229 230 return 0; 231 232 exit: 233 if (ipw->common_memory) { 234 + release_mem_region(link->resource[2]->start, 235 + resource_size(link->resource[2])); 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); 242 } 243 pcmcia_disable_device(link); 244 return -1; ··· 249 static void release_ipwireless(struct ipw_dev *ipw) 250 { 251 if (ipw->common_memory) { 252 + release_mem_region(ipw->link->resource[2]->start, 253 + resource_size(ipw->link->resource[2])); 254 iounmap(ipw->common_memory); 255 } 256 if (ipw->attr_memory) { 257 + release_mem_region(ipw->link->resource[3]->start, 258 + resource_size(ipw->link->resource[3])); 259 iounmap(ipw->attr_memory); 260 } 261 pcmcia_disable_device(ipw->link); ··· 324 .owner = THIS_MODULE, 325 .probe = ipwireless_attach, 326 .remove = ipwireless_detach, 327 + .name = IPWIRELESS_PCCARD_NAME, 328 .id_table = ipw_ids 329 }; 330 ··· 335 static int __init init_ipwireless(void) 336 { 337 int ret; 338 339 ret = ipwireless_tty_init(); 340 if (ret != 0) ··· 355 */ 356 static void __exit exit_ipwireless(void) 357 { 358 pcmcia_unregister_driver(&me); 359 ipwireless_tty_release(); 360 }
-5
drivers/char/pcmcia/ipwireless/main.h
··· 21 #include <linux/sched.h> 22 #include <linux/types.h> 23 24 - #include <pcmcia/cs.h> 25 #include <pcmcia/cistpl.h> 26 #include <pcmcia/ds.h> 27 ··· 44 struct pcmcia_device *link; 45 int is_v2_card; 46 47 - window_handle_t handle_attr_memory; 48 void __iomem *attr_memory; 49 - win_req_t request_attr_memory; 50 51 - window_handle_t handle_common_memory; 52 void __iomem *common_memory; 53 - win_req_t request_common_memory; 54 55 /* Reference to attribute memory, containing CIS data */ 56 void *attribute_memory;
··· 21 #include <linux/sched.h> 22 #include <linux/types.h> 23 24 #include <pcmcia/cistpl.h> 25 #include <pcmcia/ds.h> 26 ··· 45 struct pcmcia_device *link; 46 int is_v2_card; 47 48 void __iomem *attr_memory; 49 50 void __iomem *common_memory; 51 52 /* Reference to attribute memory, containing CIS data */ 53 void *attribute_memory;
-1
drivers/char/pcmcia/ipwireless/tty.h
··· 21 #include <linux/types.h> 22 #include <linux/sched.h> 23 24 - #include <pcmcia/cs.h> 25 #include <pcmcia/cistpl.h> 26 #include <pcmcia/ds.h> 27
··· 21 #include <linux/types.h> 22 #include <linux/sched.h> 23 24 #include <pcmcia/cistpl.h> 25 #include <pcmcia/ds.h> 26
+27 -125
drivers/ide/ide-cs.c
··· 43 #include <asm/io.h> 44 #include <asm/system.h> 45 46 - #include <pcmcia/cs.h> 47 #include <pcmcia/cistpl.h> 48 #include <pcmcia/ds.h> 49 #include <pcmcia/cisreg.h> ··· 71 72 static void ide_detach(struct pcmcia_device *p_dev); 73 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 static int ide_probe(struct pcmcia_device *link) 86 { 87 ide_info_t *info; ··· 85 info->p_dev = link; 86 link->priv = info; 87 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; 92 93 return ide_config(link); 94 } /* 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 static void ide_detach(struct pcmcia_device *link) 106 { ··· 164 return NULL; 165 } 166 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) 186 { 187 - struct pcmcia_config_check *stk = priv_data; 188 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 - } 198 } 199 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 229 return -ENODEV; 230 - /* If we've got this far, we're done */ 231 - return 0; 232 } 233 - return -ENODEV; 234 } 235 236 static int ide_config(struct pcmcia_device *link) 237 { 238 ide_info_t *info = link->priv; 239 - struct pcmcia_config_check *stk = NULL; 240 int ret = 0, is_kme = 0; 241 unsigned long io_base, ctl_base; 242 struct ide_host *host; ··· 199 ((link->card_id == PRODID_KME_KXLC005_A) || 200 (link->card_id == PRODID_KME_KXLC005_B))); 201 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)) 211 goto failed; /* No suitable config found */ 212 } 213 io_base = link->resource[0]->start; 214 - ctl_base = stk->ctl_base; 215 216 if (!link->irq) 217 goto failed; 218 - ret = pcmcia_request_configuration(link, &link->conf); 219 if (ret) 220 goto failed; 221 ··· 238 info->host = host; 239 dev_info(&link->dev, "ide-cs: hd%c: Vpp = %d.%d\n", 240 'a' + host->ports[0]->index * 2, 241 - link->conf.Vpp / 10, link->conf.Vpp % 10); 242 243 - kfree(stk); 244 return 0; 245 246 - err_mem: 247 - printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n"); 248 - goto failed; 249 - 250 failed: 251 - kfree(stk); 252 ide_release(link); 253 return -ENODEV; 254 } /* 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 264 static void ide_release(struct pcmcia_device *link) 265 { ··· 271 pcmcia_disable_device(link); 272 } /* ide_release */ 273 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 284 static struct pcmcia_device_id ide_ids[] = { 285 PCMCIA_DEVICE_FUNC_ID(4), ··· 344 345 static struct pcmcia_driver ide_cs_driver = { 346 .owner = THIS_MODULE, 347 - .drv = { 348 - .name = "ide-cs", 349 - }, 350 .probe = ide_probe, 351 .remove = ide_detach, 352 .id_table = ide_ids,
··· 43 #include <asm/io.h> 44 #include <asm/system.h> 45 46 #include <pcmcia/cistpl.h> 47 #include <pcmcia/ds.h> 48 #include <pcmcia/cisreg.h> ··· 72 73 static void ide_detach(struct pcmcia_device *p_dev); 74 75 static int ide_probe(struct pcmcia_device *link) 76 { 77 ide_info_t *info; ··· 97 info->p_dev = link; 98 link->priv = info; 99 100 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO | 101 + CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; 102 103 return ide_config(link); 104 } /* ide_attach */ 105 106 static void ide_detach(struct pcmcia_device *link) 107 { ··· 187 return NULL; 188 } 189 190 + static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data) 191 { 192 + int *is_kme = priv_data; 193 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; 197 } 198 + pdev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; 199 + pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 200 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) 206 return -ENODEV; 207 } 208 + 209 + return pcmcia_request_io(pdev); 210 } 211 212 static int ide_config(struct pcmcia_device *link) 213 { 214 ide_info_t *info = link->priv; 215 int ret = 0, is_kme = 0; 216 unsigned long io_base, ctl_base; 217 struct ide_host *host; ··· 270 ((link->card_id == PRODID_KME_KXLC005_A) || 271 (link->card_id == PRODID_KME_KXLC005_B))); 272 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)) 276 goto failed; /* No suitable config found */ 277 } 278 io_base = link->resource[0]->start; 279 + if (link->resource[1]->end) 280 + ctl_base = link->resource[1]->start; 281 + else 282 + ctl_base = link->resource[0]->start + 0x0e; 283 284 if (!link->irq) 285 goto failed; 286 + 287 + ret = pcmcia_enable_device(link); 288 if (ret) 289 goto failed; 290 ··· 311 info->host = host; 312 dev_info(&link->dev, "ide-cs: hd%c: Vpp = %d.%d\n", 313 'a' + host->ports[0]->index * 2, 314 + link->vpp / 10, link->vpp % 10); 315 316 return 0; 317 318 failed: 319 ide_release(link); 320 return -ENODEV; 321 } /* ide_config */ 322 323 static void ide_release(struct pcmcia_device *link) 324 { ··· 358 pcmcia_disable_device(link); 359 } /* ide_release */ 360 361 362 static struct pcmcia_device_id ide_ids[] = { 363 PCMCIA_DEVICE_FUNC_ID(4), ··· 440 441 static struct pcmcia_driver ide_cs_driver = { 442 .owner = THIS_MODULE, 443 + .name = "ide-cs", 444 .probe = ide_probe, 445 .remove = ide_detach, 446 .id_table = ide_ids,
+9 -74
drivers/isdn/hardware/avm/avm_cs.c
··· 20 #include <asm/io.h> 21 #include <asm/system.h> 22 23 - #include <pcmcia/cs.h> 24 #include <pcmcia/cistpl.h> 25 #include <pcmcia/ciscode.h> 26 #include <pcmcia/ds.h> ··· 38 39 /*====================================================================*/ 40 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 static int avmcs_config(struct pcmcia_device *link); 51 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 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 73 static int avmcs_probe(struct pcmcia_device *p_dev) 74 { 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 /* 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; 85 86 return avmcs_config(p_dev); 87 } /* avmcs_attach */ 88 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 98 static void avmcs_detach(struct pcmcia_device *link) 99 { 100 avmcs_release(link); 101 } /* avmcs_detach */ 102 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) 116 { 117 - if (cf->io.nwin <= 0) 118 - return -ENODEV; 119 120 - p_dev->resource[0]->start = cf->io.win[0].base; 121 - p_dev->resource[0]->end = cf->io.win[0].len; 122 return pcmcia_request_io(p_dev); 123 } 124 ··· 94 /* 95 * configure the PCMCIA socket 96 */ 97 - i = pcmcia_request_configuration(link, &link->conf); 98 if (i != 0) { 99 pcmcia_disable_device(link); 100 break; ··· 141 142 } /* avmcs_config */ 143 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 152 static void avmcs_release(struct pcmcia_device *link) 153 { ··· 159 160 static struct pcmcia_driver avmcs_driver = { 161 .owner = THIS_MODULE, 162 - .drv = { 163 - .name = "avm_cs", 164 - }, 165 .probe = avmcs_probe, 166 .remove = avmcs_detach, 167 .id_table = avmcs_ids,
··· 20 #include <asm/io.h> 21 #include <asm/system.h> 22 23 #include <pcmcia/cistpl.h> 24 #include <pcmcia/ciscode.h> 25 #include <pcmcia/ds.h> ··· 39 40 /*====================================================================*/ 41 42 static int avmcs_config(struct pcmcia_device *link); 43 static void avmcs_release(struct pcmcia_device *link); 44 static void avmcs_detach(struct pcmcia_device *p_dev); 45 46 static int avmcs_probe(struct pcmcia_device *p_dev) 47 { 48 /* General socket configuration */ 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; 52 53 return avmcs_config(p_dev); 54 } /* avmcs_attach */ 55 56 57 static void avmcs_detach(struct pcmcia_device *link) 58 { 59 avmcs_release(link); 60 } /* avmcs_detach */ 61 62 + static int avmcs_configcheck(struct pcmcia_device *p_dev, void *priv_data) 63 { 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; 67 68 return pcmcia_request_io(p_dev); 69 } 70 ··· 150 /* 151 * configure the PCMCIA socket 152 */ 153 + i = pcmcia_enable_device(link); 154 if (i != 0) { 155 pcmcia_disable_device(link); 156 break; ··· 197 198 } /* avmcs_config */ 199 200 201 static void avmcs_release(struct pcmcia_device *link) 202 { ··· 222 223 static struct pcmcia_driver avmcs_driver = { 224 .owner = THIS_MODULE, 225 + .name = "avm_cs", 226 .probe = avmcs_probe, 227 .remove = avmcs_detach, 228 .id_table = avmcs_ids,
+11 -86
drivers/isdn/hisax/avma1_cs.c
··· 20 #include <asm/io.h> 21 #include <asm/system.h> 22 23 - #include <pcmcia/cs.h> 24 #include <pcmcia/cistpl.h> 25 #include <pcmcia/ds.h> 26 #include "hisax_cfg.h" ··· 39 40 /*====================================================================*/ 41 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 static int avma1cs_config(struct pcmcia_device *link) __devinit ; 52 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 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 75 static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) 76 { 77 dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); 78 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 /* 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; 90 91 return avma1cs_config(p_dev); 92 } /* 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 103 static void __devexit avma1cs_detach(struct pcmcia_device *link) 104 { ··· 62 kfree(link->priv); 63 } /* avma1cs_detach */ 64 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) 78 { 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; 84 p_dev->io_lines = 5; 85 return pcmcia_request_io(p_dev); 86 } 87 ··· 102 /* 103 * configure the PCMCIA socket 104 */ 105 - i = pcmcia_request_configuration(link, &link->conf); 106 if (i != 0) { 107 pcmcia_disable_device(link); 108 break; ··· 115 avma1cs_release(link); 116 return -ENODEV; 117 } 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 122 icard.para[0] = link->irq; 123 icard.para[1] = link->resource[0]->start; ··· 134 return 0; 135 } /* avma1cs_config */ 136 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 static void avma1cs_release(struct pcmcia_device *link) 146 { 147 unsigned long minor = (unsigned long) link->priv; ··· 146 pcmcia_disable_device(link); 147 } /* avma1cs_release */ 148 149 - 150 static struct pcmcia_device_id avma1cs_ids[] = { 151 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb), 152 PCMCIA_DEVICE_PROD_ID12("ISDN", "CARD", 0x8d9761c8, 0x01c5aa7b), ··· 155 156 static struct pcmcia_driver avma1cs_driver = { 157 .owner = THIS_MODULE, 158 - .drv = { 159 - .name = "avma1_cs", 160 - }, 161 .probe = avma1cs_probe, 162 .remove = __devexit_p(avma1cs_detach), 163 .id_table = avma1cs_ids, 164 }; 165 166 - /*====================================================================*/ 167 - 168 static int __init init_avma1_cs(void) 169 { 170 - return(pcmcia_register_driver(&avma1cs_driver)); 171 } 172 173 static void __exit exit_avma1_cs(void)
··· 20 #include <asm/io.h> 21 #include <asm/system.h> 22 23 #include <pcmcia/cistpl.h> 24 #include <pcmcia/ds.h> 25 #include "hisax_cfg.h" ··· 40 41 /*====================================================================*/ 42 43 static int avma1cs_config(struct pcmcia_device *link) __devinit ; 44 static void avma1cs_release(struct pcmcia_device *link); 45 static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit ; 46 47 static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) 48 { 49 dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); 50 51 /* General socket configuration */ 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; 55 56 return avma1cs_config(p_dev); 57 } /* avma1cs_attach */ 58 59 static void __devexit avma1cs_detach(struct pcmcia_device *link) 60 { ··· 108 kfree(link->priv); 109 } /* avma1cs_detach */ 110 111 + static int avma1cs_configcheck(struct pcmcia_device *p_dev, void *priv_data) 112 { 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; 116 p_dev->io_lines = 5; 117 + 118 return pcmcia_request_io(p_dev); 119 } 120 ··· 161 /* 162 * configure the PCMCIA socket 163 */ 164 + i = pcmcia_enable_device(link); 165 if (i != 0) { 166 pcmcia_disable_device(link); 167 break; ··· 174 avma1cs_release(link); 175 return -ENODEV; 176 } 177 178 icard.para[0] = link->irq; 179 icard.para[1] = link->resource[0]->start; ··· 196 return 0; 197 } /* avma1cs_config */ 198 199 static void avma1cs_release(struct pcmcia_device *link) 200 { 201 unsigned long minor = (unsigned long) link->priv; ··· 216 pcmcia_disable_device(link); 217 } /* avma1cs_release */ 218 219 static struct pcmcia_device_id avma1cs_ids[] = { 220 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb), 221 PCMCIA_DEVICE_PROD_ID12("ISDN", "CARD", 0x8d9761c8, 0x01c5aa7b), ··· 226 227 static struct pcmcia_driver avma1cs_driver = { 228 .owner = THIS_MODULE, 229 + .name = "avma1_cs", 230 .probe = avma1cs_probe, 231 .remove = __devexit_p(avma1cs_detach), 232 .id_table = avma1cs_ids, 233 }; 234 235 static int __init init_avma1_cs(void) 236 { 237 + return pcmcia_register_driver(&avma1cs_driver); 238 } 239 240 static void __exit exit_avma1_cs(void)
+9 -91
drivers/isdn/hisax/elsa_cs.c
··· 46 #include <asm/io.h> 47 #include <asm/system.h> 48 49 - #include <pcmcia/cs.h> 50 #include <pcmcia/cistpl.h> 51 #include <pcmcia/cisreg.h> 52 #include <pcmcia/ds.h> ··· 63 static int protocol = 2; /* EURO-ISDN Default */ 64 module_param(protocol, int, 0); 65 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 static int elsa_cs_config(struct pcmcia_device *link) __devinit ; 78 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 static void elsa_cs_detach(struct pcmcia_device *p_dev) __devexit; 87 88 typedef struct local_info_t { ··· 72 int busy; 73 int cardnr; 74 } 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 88 static int __devinit elsa_cs_probe(struct pcmcia_device *link) 89 { ··· 88 89 local->cardnr = -1; 90 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 return elsa_cs_config(link); 105 } /* 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 116 static void __devexit elsa_cs_detach(struct pcmcia_device *link) 117 { ··· 103 kfree(info); 104 } /* elsa_cs_detach */ 105 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) 119 { 120 int j; 121 122 p_dev->io_lines = 3; 123 124 - if ((cf->io.nwin > 0) && cf->io.win[0].base) { 125 printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); 126 - p_dev->resource[0]->start = cf->io.win[0].base; 127 if (!pcmcia_request_io(p_dev)) 128 return 0; 129 } else { ··· 136 dev_dbg(&link->dev, "elsa_config(0x%p)\n", link); 137 dev = link->priv; 138 139 i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL); 140 if (i != 0) 141 goto failed; ··· 145 if (!link->irq) 146 goto failed; 147 148 - i = pcmcia_request_configuration(link, &link->conf); 149 if (i != 0) 150 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 163 icard.para[0] = link->irq; 164 icard.para[1] = link->resource[0]->start; ··· 167 elsa_cs_release(link); 168 return -ENODEV; 169 } /* 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 179 static void elsa_cs_release(struct pcmcia_device *link) 180 { ··· 211 212 static struct pcmcia_driver elsa_cs_driver = { 213 .owner = THIS_MODULE, 214 - .drv = { 215 - .name = "elsa_cs", 216 - }, 217 .probe = elsa_cs_probe, 218 .remove = __devexit_p(elsa_cs_detach), 219 .id_table = elsa_ids,
··· 46 #include <asm/io.h> 47 #include <asm/system.h> 48 49 #include <pcmcia/cistpl.h> 50 #include <pcmcia/cisreg.h> 51 #include <pcmcia/ds.h> ··· 64 static int protocol = 2; /* EURO-ISDN Default */ 65 module_param(protocol, int, 0); 66 67 static int elsa_cs_config(struct pcmcia_device *link) __devinit ; 68 static void elsa_cs_release(struct pcmcia_device *link); 69 static void elsa_cs_detach(struct pcmcia_device *p_dev) __devexit; 70 71 typedef struct local_info_t { ··· 91 int busy; 92 int cardnr; 93 } local_info_t; 94 95 static int __devinit elsa_cs_probe(struct pcmcia_device *link) 96 { ··· 119 120 local->cardnr = -1; 121 122 return elsa_cs_config(link); 123 } /* elsa_cs_attach */ 124 125 static void __devexit elsa_cs_detach(struct pcmcia_device *link) 126 { ··· 156 kfree(info); 157 } /* elsa_cs_detach */ 158 159 + static int elsa_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data) 160 { 161 int j; 162 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; 167 168 + if ((p_dev->resource[0]->end) && p_dev->resource[0]->start) { 169 printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); 170 if (!pcmcia_request_io(p_dev)) 171 return 0; 172 } else { ··· 199 dev_dbg(&link->dev, "elsa_config(0x%p)\n", link); 200 dev = link->priv; 201 202 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 203 + 204 i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL); 205 if (i != 0) 206 goto failed; ··· 206 if (!link->irq) 207 goto failed; 208 209 + i = pcmcia_enable_device(link); 210 if (i != 0) 211 goto failed; 212 213 icard.para[0] = link->irq; 214 icard.para[1] = link->resource[0]->start; ··· 239 elsa_cs_release(link); 240 return -ENODEV; 241 } /* elsa_cs_config */ 242 243 static void elsa_cs_release(struct pcmcia_device *link) 244 { ··· 291 292 static struct pcmcia_driver elsa_cs_driver = { 293 .owner = THIS_MODULE, 294 + .name = "elsa_cs", 295 .probe = elsa_cs_probe, 296 .remove = __devexit_p(elsa_cs_detach), 297 .id_table = elsa_ids,
+9 -157
drivers/isdn/hisax/sedlbauer_cs.c
··· 46 #include <asm/io.h> 47 #include <asm/system.h> 48 49 - #include <pcmcia/cs.h> 50 #include <pcmcia/cistpl.h> 51 #include <pcmcia/cisreg.h> 52 #include <pcmcia/ds.h> ··· 63 static int protocol = 2; /* EURO-ISDN Default */ 64 module_param(protocol, int, 0); 65 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 static int sedlbauer_config(struct pcmcia_device *link) __devinit ; 78 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 86 static void sedlbauer_detach(struct pcmcia_device *p_dev) __devexit; 87 ··· 73 int stop; 74 int cardnr; 75 } 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 89 static int __devinit sedlbauer_probe(struct pcmcia_device *link) 90 { ··· 88 local->p_dev = link; 89 link->priv = local; 90 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 return sedlbauer_config(link); 109 } /* 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 120 static void __devexit sedlbauer_detach(struct pcmcia_device *link) 121 { ··· 102 kfree(link->priv); 103 } /* sedlbauer_detach */ 104 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) 117 { 118 - if (cfg->index == 0) 119 - return -ENODEV; 120 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; 165 } 166 - 167 - 168 169 static int __devinit sedlbauer_config(struct pcmcia_device *link) 170 { ··· 118 119 dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); 120 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. 125 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 ret = pcmcia_loop_config(link, sedlbauer_config_check, NULL); 134 if (ret) 135 goto failed; 136 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); 143 if (ret) 144 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 159 icard.para[0] = link->irq; 160 icard.para[1] = link->resource[0]->start; ··· 151 return -ENODEV; 152 153 } /* 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 163 static void sedlbauer_release(struct pcmcia_device *link) 164 { ··· 200 201 static struct pcmcia_driver sedlbauer_driver = { 202 .owner = THIS_MODULE, 203 - .drv = { 204 - .name = "sedlbauer_cs", 205 - }, 206 .probe = sedlbauer_probe, 207 .remove = __devexit_p(sedlbauer_detach), 208 .id_table = sedlbauer_ids,
··· 46 #include <asm/io.h> 47 #include <asm/system.h> 48 49 #include <pcmcia/cistpl.h> 50 #include <pcmcia/cisreg.h> 51 #include <pcmcia/ds.h> ··· 64 static int protocol = 2; /* EURO-ISDN Default */ 65 module_param(protocol, int, 0); 66 67 static int sedlbauer_config(struct pcmcia_device *link) __devinit ; 68 static void sedlbauer_release(struct pcmcia_device *link); 69 70 static void sedlbauer_detach(struct pcmcia_device *p_dev) __devexit; 71 ··· 91 int stop; 92 int cardnr; 93 } local_info_t; 94 95 static int __devinit sedlbauer_probe(struct pcmcia_device *link) 96 { ··· 118 local->p_dev = link; 119 link->priv = local; 120 121 return sedlbauer_config(link); 122 } /* sedlbauer_attach */ 123 124 static void __devexit sedlbauer_detach(struct pcmcia_device *link) 125 { ··· 158 kfree(link->priv); 159 } /* sedlbauer_detach */ 160 161 + static int sedlbauer_config_check(struct pcmcia_device *p_dev, void *priv_data) 162 { 163 + if (p_dev->config_index == 0) 164 + return -EINVAL; 165 166 + p_dev->io_lines = 3; 167 + return pcmcia_request_io(p_dev); 168 } 169 170 static int __devinit sedlbauer_config(struct pcmcia_device *link) 171 { ··· 229 230 dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); 231 232 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_CHECK_VCC | 233 + CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; 234 235 ret = pcmcia_loop_config(link, sedlbauer_config_check, NULL); 236 if (ret) 237 goto failed; 238 239 + ret = pcmcia_enable_device(link); 240 if (ret) 241 goto failed; 242 243 icard.para[0] = link->irq; 244 icard.para[1] = link->resource[0]->start; ··· 289 return -ENODEV; 290 291 } /* sedlbauer_config */ 292 293 static void sedlbauer_release(struct pcmcia_device *link) 294 { ··· 346 347 static struct pcmcia_driver sedlbauer_driver = { 348 .owner = THIS_MODULE, 349 + .name = "sedlbauer_cs", 350 .probe = sedlbauer_probe, 351 .remove = __devexit_p(sedlbauer_detach), 352 .id_table = sedlbauer_ids,
+8 -90
drivers/isdn/hisax/teles_cs.c
··· 27 #include <asm/io.h> 28 #include <asm/system.h> 29 30 - #include <pcmcia/cs.h> 31 #include <pcmcia/cistpl.h> 32 #include <pcmcia/cisreg.h> 33 #include <pcmcia/ds.h> ··· 44 static int protocol = 2; /* EURO-ISDN Default */ 45 module_param(protocol, int, 0); 46 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 static int teles_cs_config(struct pcmcia_device *link) __devinit ; 59 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 static void teles_detach(struct pcmcia_device *p_dev) __devexit ; 68 69 typedef struct local_info_t { ··· 53 int busy; 54 int cardnr; 55 } 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 69 static int __devinit teles_probe(struct pcmcia_device *link) 70 { ··· 68 local->p_dev = link; 69 link->priv = local; 70 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; 83 84 return teles_cs_config(link); 85 } /* 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 96 static void __devexit teles_detach(struct pcmcia_device *link) 97 { ··· 85 kfree(info); 86 } /* teles_detach */ 87 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) 101 { 102 int j; 103 104 p_dev->io_lines = 5; 105 106 - if ((cf->io.nwin > 0) && cf->io.win[0].base) { 107 printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); 108 - p_dev->resource[0]->start = cf->io.win[0].base; 109 if (!pcmcia_request_io(p_dev)) 110 return 0; 111 } else { ··· 125 if (!link->irq) 126 goto cs_failed; 127 128 - i = pcmcia_request_configuration(link, &link->conf); 129 if (i != 0) 130 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 143 icard.para[0] = link->irq; 144 icard.para[1] = link->resource[0]->start; ··· 149 teles_cs_release(link); 150 return -ENODEV; 151 } /* 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 161 static void teles_cs_release(struct pcmcia_device *link) 162 { ··· 193 194 static struct pcmcia_driver teles_cs_driver = { 195 .owner = THIS_MODULE, 196 - .drv = { 197 - .name = "teles_cs", 198 - }, 199 .probe = teles_probe, 200 .remove = __devexit_p(teles_detach), 201 .id_table = teles_ids,
··· 27 #include <asm/io.h> 28 #include <asm/system.h> 29 30 #include <pcmcia/cistpl.h> 31 #include <pcmcia/cisreg.h> 32 #include <pcmcia/ds.h> ··· 45 static int protocol = 2; /* EURO-ISDN Default */ 46 module_param(protocol, int, 0); 47 48 static int teles_cs_config(struct pcmcia_device *link) __devinit ; 49 static void teles_cs_release(struct pcmcia_device *link); 50 static void teles_detach(struct pcmcia_device *p_dev) __devexit ; 51 52 typedef struct local_info_t { ··· 72 int busy; 73 int cardnr; 74 } local_info_t; 75 76 static int __devinit teles_probe(struct pcmcia_device *link) 77 { ··· 99 local->p_dev = link; 100 link->priv = local; 101 102 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 103 104 return teles_cs_config(link); 105 } /* teles_attach */ 106 107 static void __devexit teles_detach(struct pcmcia_device *link) 108 { ··· 136 kfree(info); 137 } /* teles_detach */ 138 139 + static int teles_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data) 140 { 141 int j; 142 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; 147 148 + if ((p_dev->resource[0]->end) && p_dev->resource[0]->start) { 149 printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); 150 if (!pcmcia_request_io(p_dev)) 151 return 0; 152 } else { ··· 186 if (!link->irq) 187 goto cs_failed; 188 189 + i = pcmcia_enable_device(link); 190 if (i != 0) 191 goto cs_failed; 192 193 icard.para[0] = link->irq; 194 icard.para[1] = link->resource[0]->start; ··· 221 teles_cs_release(link); 222 return -ENODEV; 223 } /* teles_cs_config */ 224 225 static void teles_cs_release(struct pcmcia_device *link) 226 { ··· 273 274 static struct pcmcia_driver teles_cs_driver = { 275 .owner = THIS_MODULE, 276 + .name = "teles_cs", 277 .probe = teles_probe, 278 .remove = __devexit_p(teles_detach), 279 .id_table = teles_ids,
+1 -4
drivers/mmc/host/sdricoh_cs.c
··· 30 #include <linux/ioport.h> 31 #include <linux/scatterlist.h> 32 33 - #include <pcmcia/cs.h> 34 #include <pcmcia/cistpl.h> 35 #include <pcmcia/ds.h> 36 #include <linux/io.h> ··· 535 #endif 536 537 static struct pcmcia_driver sdricoh_driver = { 538 - .drv = { 539 - .name = DRIVER_NAME, 540 - }, 541 .probe = sdricoh_pcmcia_probe, 542 .remove = sdricoh_pcmcia_detach, 543 .id_table = pcmcia_ids,
··· 30 #include <linux/ioport.h> 31 #include <linux/scatterlist.h> 32 33 #include <pcmcia/cistpl.h> 34 #include <pcmcia/ds.h> 35 #include <linux/io.h> ··· 536 #endif 537 538 static struct pcmcia_driver sdricoh_driver = { 539 + .name = DRIVER_NAME, 540 .probe = sdricoh_pcmcia_probe, 541 .remove = sdricoh_pcmcia_detach, 542 .id_table = pcmcia_ids,
+35 -67
drivers/mtd/maps/pcmciamtd.c
··· 16 #include <asm/io.h> 17 #include <asm/system.h> 18 19 - #include <pcmcia/cs.h> 20 #include <pcmcia/cistpl.h> 21 #include <pcmcia/ds.h> 22 ··· 100 static caddr_t remap_window(struct map_info *map, unsigned long to) 101 { 102 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; 103 - window_handle_t win = (window_handle_t)map->map_priv_2; 104 unsigned int offset; 105 int ret; 106 ··· 315 { 316 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; 317 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 325 DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); 326 - ret = pcmcia_modify_configuration(link, &mod); 327 } 328 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 335 static void pcmciamtd_release(struct pcmcia_device *link) 336 { ··· 327 328 DEBUG(3, "link = 0x%p", link); 329 330 - if (link->win) { 331 if(dev->win_base) { 332 iounmap(dev->win_base); 333 dev->win_base = NULL; ··· 470 } 471 472 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 static int pcmciamtd_config(struct pcmcia_device *link) 479 { 480 struct pcmciamtd_dev *dev = link->priv; 481 struct mtd_info *mtd = NULL; 482 - win_req_t req; 483 int ret; 484 - int i; 485 static char *probes[] = { "jedec_probe", "cfi_probe" }; 486 int new_name = 0; 487 ··· 502 * smaller windows until we succeed 503 */ 504 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; 511 dev->win_size = 0; 512 513 do { 514 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); 518 DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); 519 if(ret) { 520 - req.Size >>= 1; 521 } else { 522 - DEBUG(2, "Got window of size %dKiB", req.Size >> 10); 523 - dev->win_size = req.Size; 524 break; 525 } 526 - } while(req.Size >= 0x1000); 527 528 DEBUG(2, "dev->win_size = %d", dev->win_size); 529 ··· 541 DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); 542 543 /* 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); 546 if(!dev->win_base) { 547 - dev_err(&dev->p_dev->dev, "ioremap(%lu, %u) failed\n", 548 - req.Base, req.Size); 549 pcmciamtd_release(link); 550 return -ENODEV; 551 } 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); 554 555 dev->offset = 0; 556 dev->pcmcia_map.map_priv_1 = (unsigned long)dev; 557 - dev->pcmcia_map.map_priv_2 = (unsigned long)link->win; 558 559 dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp; 560 - link->conf.Attributes = 0; 561 if(setvpp == 2) { 562 - link->conf.Vpp = dev->vpp; 563 } else { 564 - link->conf.Vpp = 0; 565 } 566 567 - link->conf.IntType = INT_MEMORY; 568 - link->conf.ConfigIndex = 0; 569 DEBUG(2, "Setting Configuration"); 570 - ret = pcmcia_request_configuration(link, &link->conf); 571 if (ret != 0) { 572 if (dev->win_base) { 573 iounmap(dev->win_base); ··· 666 } 667 668 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 static void pcmciamtd_detach(struct pcmcia_device *link) 676 { 677 struct pcmciamtd_dev *dev = link->priv; ··· 683 } 684 685 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 static int pcmciamtd_probe(struct pcmcia_device *link) 692 { 693 struct pcmciamtd_dev *dev; ··· 694 695 dev->p_dev = link; 696 link->priv = dev; 697 - 698 - link->conf.Attributes = 0; 699 - link->conf.IntType = INT_MEMORY; 700 701 return pcmciamtd_config(link); 702 } ··· 729 MODULE_DEVICE_TABLE(pcmcia, pcmciamtd_ids); 730 731 static struct pcmcia_driver pcmciamtd_driver = { 732 - .drv = { 733 - .name = "pcmciamtd" 734 - }, 735 .probe = pcmciamtd_probe, 736 .remove = pcmciamtd_detach, 737 .owner = THIS_MODULE, ··· 741 742 static int __init init_pcmciamtd(void) 743 { 744 - info(DRIVER_DESC); 745 - 746 if(bankwidth && bankwidth != 1 && bankwidth != 2) { 747 info("bad bankwidth (%d), using default", bankwidth); 748 bankwidth = 2;
··· 16 #include <asm/io.h> 17 #include <asm/system.h> 18 19 #include <pcmcia/cistpl.h> 20 #include <pcmcia/ds.h> 21 ··· 101 static caddr_t remap_window(struct map_info *map, unsigned long to) 102 { 103 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; 104 + struct resource *win = (struct resource *) map->map_priv_2; 105 unsigned int offset; 106 int ret; 107 ··· 316 { 317 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; 318 struct pcmcia_device *link = dev->p_dev; 319 320 DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); 321 + pcmcia_fixup_vpp(link, on ? dev->vpp : 0); 322 } 323 324 325 static void pcmciamtd_release(struct pcmcia_device *link) 326 { ··· 339 340 DEBUG(3, "link = 0x%p", link); 341 342 + if (link->resource[2]->end) { 343 if(dev->win_base) { 344 iounmap(dev->win_base); 345 dev->win_base = NULL; ··· 482 } 483 484 485 static int pcmciamtd_config(struct pcmcia_device *link) 486 { 487 struct pcmciamtd_dev *dev = link->priv; 488 struct mtd_info *mtd = NULL; 489 int ret; 490 + int i, j = 0; 491 static char *probes[] = { "jedec_probe", "cfi_probe" }; 492 int new_name = 0; 493 ··· 520 * smaller windows until we succeed 521 */ 522 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; 529 dev->win_size = 0; 530 531 do { 532 int ret; 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); 537 DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); 538 if(ret) { 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; 544 } else { 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]); 548 break; 549 } 550 + } while (link->resource[2]->end >= 0x1000); 551 552 DEBUG(2, "dev->win_size = %d", dev->win_size); 553 ··· 553 DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); 554 555 /* Get write protect status */ 556 + dev->win_base = ioremap(link->resource[2]->start, 557 + resource_size(link->resource[2])); 558 if(!dev->win_base) { 559 + dev_err(&dev->p_dev->dev, "ioremap(%pR) failed\n", 560 + link->resource[2]); 561 pcmciamtd_release(link); 562 return -ENODEV; 563 } 564 + DEBUG(1, "mapped window dev = %p @ %pR, base = %p", 565 + dev, link->resource[2], dev->win_base); 566 567 dev->offset = 0; 568 dev->pcmcia_map.map_priv_1 = (unsigned long)dev; 569 + dev->pcmcia_map.map_priv_2 = (unsigned long)link->resource[2]; 570 571 dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp; 572 if(setvpp == 2) { 573 + link->vpp = dev->vpp; 574 } else { 575 + link->vpp = 0; 576 } 577 578 + link->config_index = 0; 579 DEBUG(2, "Setting Configuration"); 580 + ret = pcmcia_enable_device(link); 581 if (ret != 0) { 582 if (dev->win_base) { 583 iounmap(dev->win_base); ··· 680 } 681 682 683 static void pcmciamtd_detach(struct pcmcia_device *link) 684 { 685 struct pcmciamtd_dev *dev = link->priv; ··· 703 } 704 705 706 static int pcmciamtd_probe(struct pcmcia_device *link) 707 { 708 struct pcmciamtd_dev *dev; ··· 719 720 dev->p_dev = link; 721 link->priv = dev; 722 723 return pcmciamtd_config(link); 724 } ··· 757 MODULE_DEVICE_TABLE(pcmcia, pcmciamtd_ids); 758 759 static struct pcmcia_driver pcmciamtd_driver = { 760 + .name = "pcmciamtd", 761 .probe = pcmciamtd_probe, 762 .remove = pcmciamtd_detach, 763 .owner = THIS_MODULE, ··· 771 772 static int __init init_pcmciamtd(void) 773 { 774 if(bankwidth && bankwidth != 1 && bankwidth != 2) { 775 info("bad bankwidth (%d), using default", bankwidth); 776 bankwidth = 2;
+5 -30
drivers/net/pcmcia/3c574_cs.c
··· 87 #include <linux/bitops.h> 88 #include <linux/mii.h> 89 90 - #include <pcmcia/cs.h> 91 #include <pcmcia/cistpl.h> 92 #include <pcmcia/cisreg.h> 93 #include <pcmcia/ciscode.h> ··· 279 spin_lock_init(&lp->window_lock); 280 link->resource[0]->end = 32; 281 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; 285 286 dev->netdev_ops = &el3_netdev_ops; 287 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 288 dev->watchdog_timeo = TX_TIMEOUT; 289 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 - */ 301 302 static void tc574_detach(struct pcmcia_device *link) 303 { ··· 301 302 free_netdev(dev); 303 } /* 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 311 static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; 312 ··· 335 if (ret) 336 goto failed; 337 338 - ret = pcmcia_request_configuration(link, &link->conf); 339 if (ret) 340 goto failed; 341 ··· 447 return -ENODEV; 448 449 } /* 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 457 static void tc574_release(struct pcmcia_device *link) 458 { ··· 1175 1176 static struct pcmcia_driver tc574_driver = { 1177 .owner = THIS_MODULE, 1178 - .drv = { 1179 - .name = "3c574_cs", 1180 - }, 1181 .probe = tc574_probe, 1182 .remove = tc574_detach, 1183 .id_table = tc574_ids,
··· 87 #include <linux/bitops.h> 88 #include <linux/mii.h> 89 90 #include <pcmcia/cistpl.h> 91 #include <pcmcia/cisreg.h> 92 #include <pcmcia/ciscode.h> ··· 280 spin_lock_init(&lp->window_lock); 281 link->resource[0]->end = 32; 282 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 283 + link->config_flags |= CONF_ENABLE_IRQ; 284 + link->config_index = 1; 285 286 dev->netdev_ops = &el3_netdev_ops; 287 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 288 dev->watchdog_timeo = TX_TIMEOUT; 289 290 return tc574_config(link); 291 + } 292 293 static void tc574_detach(struct pcmcia_device *link) 294 { ··· 312 313 free_netdev(dev); 314 } /* tc574_detach */ 315 316 static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; 317 ··· 352 if (ret) 353 goto failed; 354 355 + ret = pcmcia_enable_device(link); 356 if (ret) 357 goto failed; 358 ··· 464 return -ENODEV; 465 466 } /* tc574_config */ 467 468 static void tc574_release(struct pcmcia_device *link) 469 { ··· 1198 1199 static struct pcmcia_driver tc574_driver = { 1200 .owner = THIS_MODULE, 1201 + .name = "3c574_cs", 1202 .probe = tc574_probe, 1203 .remove = tc574_detach, 1204 .id_table = tc574_ids,
+5 -42
drivers/net/pcmcia/3c589_cs.c
··· 41 #include <linux/bitops.h> 42 #include <linux/jiffies.h> 43 44 - #include <pcmcia/cs.h> 45 #include <pcmcia/cistpl.h> 46 #include <pcmcia/cisreg.h> 47 #include <pcmcia/ciscode.h> ··· 175 176 static void tc589_detach(struct pcmcia_device *p_dev); 177 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 static const struct net_device_ops el3_netdev_ops = { 187 .ndo_open = el3_open, 188 .ndo_stop = el3_close, ··· 207 link->resource[0]->end = 16; 208 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 209 210 - link->conf.Attributes = CONF_ENABLE_IRQ; 211 - link->conf.IntType = INT_MEMORY_AND_IO; 212 - link->conf.ConfigIndex = 1; 213 214 dev->netdev_ops = &el3_netdev_ops; 215 dev->watchdog_timeo = TX_TIMEOUT; ··· 216 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 217 218 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 230 static void tc589_detach(struct pcmcia_device *link) 231 { ··· 230 231 free_netdev(dev); 232 } /* 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 242 static int tc589_config(struct pcmcia_device *link) 243 { ··· 267 if (ret) 268 goto failed; 269 270 - ret = pcmcia_request_configuration(link, &link->conf); 271 if (ret) 272 goto failed; 273 ··· 324 tc589_release(link); 325 return -ENODEV; 326 } /* 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 336 static void tc589_release(struct pcmcia_device *link) 337 { ··· 920 921 static struct pcmcia_driver tc589_driver = { 922 .owner = THIS_MODULE, 923 - .drv = { 924 - .name = "3c589_cs", 925 - }, 926 .probe = tc589_probe, 927 .remove = tc589_detach, 928 .id_table = tc589_ids,
··· 41 #include <linux/bitops.h> 42 #include <linux/jiffies.h> 43 44 #include <pcmcia/cistpl.h> 45 #include <pcmcia/cisreg.h> 46 #include <pcmcia/ciscode.h> ··· 176 177 static void tc589_detach(struct pcmcia_device *p_dev); 178 179 static const struct net_device_ops el3_netdev_ops = { 180 .ndo_open = el3_open, 181 .ndo_stop = el3_close, ··· 216 link->resource[0]->end = 16; 217 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 218 219 + link->config_flags |= CONF_ENABLE_IRQ; 220 + link->config_index = 1; 221 222 dev->netdev_ops = &el3_netdev_ops; 223 dev->watchdog_timeo = TX_TIMEOUT; ··· 226 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 227 228 return tc589_config(link); 229 + } 230 231 static void tc589_detach(struct pcmcia_device *link) 232 { ··· 249 250 free_netdev(dev); 251 } /* tc589_detach */ 252 253 static int tc589_config(struct pcmcia_device *link) 254 { ··· 294 if (ret) 295 goto failed; 296 297 + ret = pcmcia_enable_device(link); 298 if (ret) 299 goto failed; 300 ··· 351 tc589_release(link); 352 return -ENODEV; 353 } /* tc589_config */ 354 355 static void tc589_release(struct pcmcia_device *link) 356 { ··· 955 956 static struct pcmcia_driver tc589_driver = { 957 .owner = THIS_MODULE, 958 + .name = "3c589_cs", 959 .probe = tc589_probe, 960 .remove = tc589_detach, 961 .id_table = tc589_ids,
+15 -72
drivers/net/pcmcia/axnet_cs.c
··· 39 #include <linux/mii.h> 40 #include "../8390.h" 41 42 - #include <pcmcia/cs.h> 43 #include <pcmcia/cistpl.h> 44 #include <pcmcia/ciscode.h> 45 #include <pcmcia/ds.h> ··· 139 .ndo_validate_addr = eth_validate_addr, 140 }; 141 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 static int axnet_probe(struct pcmcia_device *link) 151 { 152 axnet_dev_t *info; ··· 157 info = PRIV(dev); 158 info->p_dev = link; 159 link->priv = dev; 160 - link->conf.Attributes = CONF_ENABLE_IRQ; 161 - link->conf.IntType = INT_MEMORY_AND_IO; 162 163 dev->netdev_ops = &axnet_netdev_ops; 164 ··· 166 167 return axnet_config(link); 168 } /* 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 static void axnet_detach(struct pcmcia_device *link) 180 { ··· 212 }; 213 214 /* Not much of a test, but the alternatives are messy */ 215 - if (link->conf.ConfigBase != 0x03c0) 216 return 0; 217 218 axnet_reset_8390(dev); ··· 228 } 229 return 1; 230 } /* 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 240 static int try_io_port(struct pcmcia_device *link) 241 { ··· 259 } 260 } 261 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) 267 { 268 - int i; 269 - cistpl_io_t *io = &cfg->io; 270 271 - if (cfg->index == 0 || cfg->io.nwin == 0) 272 return -ENODEV; 273 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; 291 } 292 293 static int axnet_config(struct pcmcia_device *link) ··· 280 dev_dbg(&link->dev, "axnet_config(0x%p)\n", link); 281 282 /* don't trust the CIS on this; Linksys got it wrong */ 283 - link->conf.Present = 0x63; 284 ret = pcmcia_loop_config(link, axnet_configcheck, NULL); 285 if (ret != 0) 286 goto failed; 287 288 if (!link->irq) 289 goto failed; 290 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); 297 if (ret) 298 goto failed; 299 ··· 366 axnet_release(link); 367 return -ENODEV; 368 } /* 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 378 static void axnet_release(struct pcmcia_device *link) 379 { ··· 728 729 static struct pcmcia_driver axnet_cs_driver = { 730 .owner = THIS_MODULE, 731 - .drv = { 732 - .name = "axnet_cs", 733 - }, 734 .probe = axnet_probe, 735 .remove = axnet_detach, 736 .id_table = axnet_ids,
··· 39 #include <linux/mii.h> 40 #include "../8390.h" 41 42 #include <pcmcia/cistpl.h> 43 #include <pcmcia/ciscode.h> 44 #include <pcmcia/ds.h> ··· 140 .ndo_validate_addr = eth_validate_addr, 141 }; 142 143 static int axnet_probe(struct pcmcia_device *link) 144 { 145 axnet_dev_t *info; ··· 166 info = PRIV(dev); 167 info->p_dev = link; 168 link->priv = dev; 169 + link->config_flags |= CONF_ENABLE_IRQ; 170 171 dev->netdev_ops = &axnet_netdev_ops; 172 ··· 176 177 return axnet_config(link); 178 } /* axnet_attach */ 179 180 static void axnet_detach(struct pcmcia_device *link) 181 { ··· 231 }; 232 233 /* Not much of a test, but the alternatives are messy */ 234 + if (link->config_base != 0x03c0) 235 return 0; 236 237 axnet_reset_8390(dev); ··· 247 } 248 return 1; 249 } /* get_prom */ 250 251 static int try_io_port(struct pcmcia_device *link) 252 { ··· 286 } 287 } 288 289 + static int axnet_configcheck(struct pcmcia_device *p_dev, void *priv_data) 290 { 291 + if (p_dev->config_index == 0) 292 + return -EINVAL; 293 294 + p_dev->config_index = 0x05; 295 + if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32) 296 return -ENODEV; 297 298 + return try_io_port(p_dev); 299 } 300 301 static int axnet_config(struct pcmcia_device *link) ··· 326 dev_dbg(&link->dev, "axnet_config(0x%p)\n", link); 327 328 /* don't trust the CIS on this; Linksys got it wrong */ 329 + link->config_regs = 0x63; 330 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 331 ret = pcmcia_loop_config(link, axnet_configcheck, NULL); 332 if (ret != 0) 333 goto failed; 334 335 if (!link->irq) 336 goto failed; 337 + 338 + if (resource_size(link->resource[1]) == 8) 339 + link->config_flags |= CONF_ENABLE_SPKR; 340 341 + ret = pcmcia_enable_device(link); 342 if (ret) 343 goto failed; 344 ··· 413 axnet_release(link); 414 return -ENODEV; 415 } /* axnet_config */ 416 417 static void axnet_release(struct pcmcia_device *link) 418 { ··· 783 784 static struct pcmcia_driver axnet_cs_driver = { 785 .owner = THIS_MODULE, 786 + .name = "axnet_cs", 787 .probe = axnet_probe, 788 .remove = axnet_detach, 789 .id_table = axnet_ids,
+3 -40
drivers/net/pcmcia/com20020_cs.c
··· 43 #include <linux/arcdevice.h> 44 #include <linux/com20020.h> 45 46 - #include <pcmcia/cs.h> 47 #include <pcmcia/cistpl.h> 48 #include <pcmcia/ds.h> 49 ··· 122 struct net_device *dev; 123 } com20020_dev_t; 124 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 static int com20020_probe(struct pcmcia_device *p_dev) 134 { 135 com20020_dev_t *info; ··· 151 152 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 153 p_dev->resource[0]->end = 16; 154 - p_dev->conf.Attributes = CONF_ENABLE_IRQ; 155 - p_dev->conf.IntType = INT_MEMORY_AND_IO; 156 157 info->dev = dev; 158 p_dev->priv = info; ··· 163 fail_alloc_info: 164 return -ENOMEM; 165 } /* 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 static void com20020_detach(struct pcmcia_device *link) 177 { ··· 201 } 202 203 } /* 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 213 static int com20020_config(struct pcmcia_device *link) 214 { ··· 255 256 dev->irq = link->irq; 257 258 - ret = pcmcia_request_configuration(link, &link->conf); 259 if (ret) 260 goto failed; 261 ··· 288 com20020_release(link); 289 return -ENODEV; 290 } /* 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 300 static void com20020_release(struct pcmcia_device *link) 301 { ··· 331 332 static struct pcmcia_driver com20020_cs_driver = { 333 .owner = THIS_MODULE, 334 - .drv = { 335 - .name = "com20020_cs", 336 - }, 337 .probe = com20020_probe, 338 .remove = com20020_detach, 339 .id_table = com20020_ids,
··· 43 #include <linux/arcdevice.h> 44 #include <linux/com20020.h> 45 46 #include <pcmcia/cistpl.h> 47 #include <pcmcia/ds.h> 48 ··· 123 struct net_device *dev; 124 } com20020_dev_t; 125 126 static int com20020_probe(struct pcmcia_device *p_dev) 127 { 128 com20020_dev_t *info; ··· 160 161 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 162 p_dev->resource[0]->end = 16; 163 + p_dev->config_flags |= CONF_ENABLE_IRQ; 164 165 info->dev = dev; 166 p_dev->priv = info; ··· 173 fail_alloc_info: 174 return -ENOMEM; 175 } /* com20020_attach */ 176 177 static void com20020_detach(struct pcmcia_device *link) 178 { ··· 220 } 221 222 } /* com20020_detach */ 223 224 static int com20020_config(struct pcmcia_device *link) 225 { ··· 282 283 dev->irq = link->irq; 284 285 + ret = pcmcia_enable_device(link); 286 if (ret) 287 goto failed; 288 ··· 315 com20020_release(link); 316 return -ENODEV; 317 } /* com20020_config */ 318 319 static void com20020_release(struct pcmcia_device *link) 320 { ··· 366 367 static struct pcmcia_driver com20020_cs_driver = { 368 .owner = THIS_MODULE, 369 + .name = "com20020_cs", 370 .probe = com20020_probe, 371 .remove = com20020_detach, 372 .id_table = com20020_ids,
+27 -40
drivers/net/pcmcia/fmvj18x_cs.c
··· 49 #include <linux/ioport.h> 50 #include <linux/crc32.h> 51 52 - #include <pcmcia/cs.h> 53 #include <pcmcia/cistpl.h> 54 #include <pcmcia/ciscode.h> 55 #include <pcmcia/ds.h> ··· 251 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 252 253 /* General socket configuration */ 254 - link->conf.Attributes = CONF_ENABLE_IRQ; 255 - link->conf.IntType = INT_MEMORY_AND_IO; 256 257 dev->netdev_ops = &fjn_netdev_ops; 258 dev->watchdog_timeo = TX_TIMEOUT; ··· 311 ret = pcmcia_request_io(link); 312 if (ret == 0) { 313 /* calculate ConfigIndex value */ 314 - link->conf.ConfigIndex = 315 ((link->resource[0]->start & 0x0f0) >> 3) | 0x22; 316 return ret; 317 } ··· 319 return ret; /* RequestIO failed */ 320 } 321 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) 327 { 328 return 0; /* strange, but that's what the code did already before... */ 329 } ··· 356 link->card_id == PRODID_TDK_NP9610 || 357 link->card_id == PRODID_TDK_MN3200) { 358 /* MultiFunction Card */ 359 - link->conf.ConfigBase = 0x800; 360 - link->conf.ConfigIndex = 0x47; 361 link->resource[1]->end = 8; 362 } 363 break; 364 case MANFID_NEC: 365 cardtype = NEC; /* MultiFunction Card */ 366 - link->conf.ConfigBase = 0x800; 367 - link->conf.ConfigIndex = 0x47; 368 link->resource[1]->end = 8; 369 break; 370 case MANFID_KME: 371 cardtype = KME; /* MultiFunction Card */ 372 - link->conf.ConfigBase = 0x800; 373 - link->conf.ConfigIndex = 0x47; 374 link->resource[1]->end = 8; 375 break; 376 case MANFID_CONTEC: 377 cardtype = CONTEC; 378 break; 379 case MANFID_FUJITSU: 380 - if (link->conf.ConfigBase == 0x0fe0) 381 cardtype = MBH10302; 382 else if (link->card_id == PRODID_FUJITSU_MBH10302) 383 /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), ··· 397 case MANFID_FUJITSU: 398 if (link->card_id == PRODID_FUJITSU_MBH10304) { 399 cardtype = XXX10304; /* MBH10304 with buggy CIS */ 400 - link->conf.ConfigIndex = 0x20; 401 } else { 402 cardtype = MBH10302; /* NextCom NC5310, etc. */ 403 - link->conf.ConfigIndex = 1; 404 } 405 break; 406 case MANFID_UNGERMANN: ··· 408 break; 409 default: 410 cardtype = MBH10302; 411 - link->conf.ConfigIndex = 1; 412 } 413 } 414 ··· 426 ret = pcmcia_request_irq(link, fjn_interrupt); 427 if (ret) 428 goto failed; 429 - ret = pcmcia_request_configuration(link, &link->conf); 430 if (ret) 431 goto failed; 432 ··· 538 539 static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) 540 { 541 - win_req_t req; 542 u_char __iomem *base; 543 int i, j; 544 545 /* 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); 550 if (i != 0) 551 return -1; 552 553 - base = ioremap(req.Base, req.Size); 554 - pcmcia_map_mem_page(link, link->win, 0); 555 556 /* 557 * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format ··· 574 } 575 576 iounmap(base); 577 - j = pcmcia_release_window(link, link->win); 578 return (i != 0x200) ? 0 : -1; 579 580 } /* fmvj18x_get_hwinfo */ ··· 582 583 static int fmvj18x_setup_mfc(struct pcmcia_device *link) 584 { 585 - win_req_t req; 586 int i; 587 struct net_device *dev = link->priv; 588 unsigned int ioaddr; 589 local_info_t *lp = netdev_priv(dev); 590 591 /* 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); 596 if (i != 0) 597 return -1; 598 599 - lp->base = ioremap(req.Base, req.Size); 600 if (lp->base == NULL) { 601 printk(KERN_NOTICE "fmvj18x_cs: ioremap failed\n"); 602 return -1; 603 } 604 605 - i = pcmcia_map_mem_page(link, link->win, 0); 606 if (i != 0) { 607 iounmap(lp->base); 608 lp->base = NULL; ··· 629 struct net_device *dev = link->priv; 630 local_info_t *lp = netdev_priv(dev); 631 u_char __iomem *tmp; 632 - int j; 633 634 dev_dbg(&link->dev, "fmvj18x_release\n"); 635 ··· 636 tmp = lp->base; 637 lp->base = NULL; /* set NULL before iounmap */ 638 iounmap(tmp); 639 - j = pcmcia_release_window(link, link->win); 640 } 641 642 pcmcia_disable_device(link); ··· 697 698 static struct pcmcia_driver fmvj18x_cs_driver = { 699 .owner = THIS_MODULE, 700 - .drv = { 701 - .name = "fmvj18x_cs", 702 - }, 703 .probe = fmvj18x_probe, 704 .remove = fmvj18x_detach, 705 .id_table = fmvj18x_ids,
··· 49 #include <linux/ioport.h> 50 #include <linux/crc32.h> 51 52 #include <pcmcia/cistpl.h> 53 #include <pcmcia/ciscode.h> 54 #include <pcmcia/ds.h> ··· 252 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 253 254 /* General socket configuration */ 255 + link->config_flags |= CONF_ENABLE_IRQ; 256 257 dev->netdev_ops = &fjn_netdev_ops; 258 dev->watchdog_timeo = TX_TIMEOUT; ··· 313 ret = pcmcia_request_io(link); 314 if (ret == 0) { 315 /* calculate ConfigIndex value */ 316 + link->config_index = 317 ((link->resource[0]->start & 0x0f0) >> 3) | 0x22; 318 return ret; 319 } ··· 321 return ret; /* RequestIO failed */ 322 } 323 324 + static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, void *priv_data) 325 { 326 return 0; /* strange, but that's what the code did already before... */ 327 } ··· 362 link->card_id == PRODID_TDK_NP9610 || 363 link->card_id == PRODID_TDK_MN3200) { 364 /* MultiFunction Card */ 365 + link->config_base = 0x800; 366 + link->config_index = 0x47; 367 link->resource[1]->end = 8; 368 } 369 break; 370 case MANFID_NEC: 371 cardtype = NEC; /* MultiFunction Card */ 372 + link->config_base = 0x800; 373 + link->config_index = 0x47; 374 link->resource[1]->end = 8; 375 break; 376 case MANFID_KME: 377 cardtype = KME; /* MultiFunction Card */ 378 + link->config_base = 0x800; 379 + link->config_index = 0x47; 380 link->resource[1]->end = 8; 381 break; 382 case MANFID_CONTEC: 383 cardtype = CONTEC; 384 break; 385 case MANFID_FUJITSU: 386 + if (link->config_base == 0x0fe0) 387 cardtype = MBH10302; 388 else if (link->card_id == PRODID_FUJITSU_MBH10302) 389 /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), ··· 403 case MANFID_FUJITSU: 404 if (link->card_id == PRODID_FUJITSU_MBH10304) { 405 cardtype = XXX10304; /* MBH10304 with buggy CIS */ 406 + link->config_index = 0x20; 407 } else { 408 cardtype = MBH10302; /* NextCom NC5310, etc. */ 409 + link->config_index = 1; 410 } 411 break; 412 case MANFID_UNGERMANN: ··· 414 break; 415 default: 416 cardtype = MBH10302; 417 + link->config_index = 1; 418 } 419 } 420 ··· 432 ret = pcmcia_request_irq(link, fjn_interrupt); 433 if (ret) 434 goto failed; 435 + ret = pcmcia_enable_device(link); 436 if (ret) 437 goto failed; 438 ··· 544 545 static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) 546 { 547 u_char __iomem *base; 548 int i, j; 549 550 /* Allocate a small memory window */ 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); 554 if (i != 0) 555 return -1; 556 557 + base = ioremap(link->resource[2]->start, resource_size(link->resource[2])); 558 + pcmcia_map_mem_page(link, link->resource[2], 0); 559 560 /* 561 * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format ··· 582 } 583 584 iounmap(base); 585 + j = pcmcia_release_window(link, link->resource[2]); 586 return (i != 0x200) ? 0 : -1; 587 588 } /* fmvj18x_get_hwinfo */ ··· 590 591 static int fmvj18x_setup_mfc(struct pcmcia_device *link) 592 { 593 int i; 594 struct net_device *dev = link->priv; 595 unsigned int ioaddr; 596 local_info_t *lp = netdev_priv(dev); 597 598 /* Allocate a small memory window */ 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); 602 if (i != 0) 603 return -1; 604 605 + lp->base = ioremap(link->resource[3]->start, 606 + resource_size(link->resource[3])); 607 if (lp->base == NULL) { 608 printk(KERN_NOTICE "fmvj18x_cs: ioremap failed\n"); 609 return -1; 610 } 611 612 + i = pcmcia_map_mem_page(link, link->resource[3], 0); 613 if (i != 0) { 614 iounmap(lp->base); 615 lp->base = NULL; ··· 638 struct net_device *dev = link->priv; 639 local_info_t *lp = netdev_priv(dev); 640 u_char __iomem *tmp; 641 642 dev_dbg(&link->dev, "fmvj18x_release\n"); 643 ··· 646 tmp = lp->base; 647 lp->base = NULL; /* set NULL before iounmap */ 648 iounmap(tmp); 649 } 650 651 pcmcia_disable_device(link); ··· 708 709 static struct pcmcia_driver fmvj18x_cs_driver = { 710 .owner = THIS_MODULE, 711 + .name = "fmvj18x_cs", 712 .probe = fmvj18x_probe, 713 .remove = fmvj18x_detach, 714 .id_table = fmvj18x_ids,
+25 -64
drivers/net/pcmcia/ibmtr_cs.c
··· 57 #include <linux/trdevice.h> 58 #include <linux/ibmtr.h> 59 60 - #include <pcmcia/cs.h> 61 #include <pcmcia/cistpl.h> 62 #include <pcmcia/ds.h> 63 ··· 101 102 typedef struct ibmtr_dev_t { 103 struct pcmcia_device *p_dev; 104 - struct net_device *dev; 105 - window_handle_t sram_win_handle; 106 - struct tok_info *ti; 107 } ibmtr_dev_t; 108 109 static void netdev_get_drvinfo(struct net_device *dev, ··· 120 struct net_device *dev = info->dev; 121 return tok_interrupt(irq, dev); 122 }; 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 132 static int __devinit ibmtr_attach(struct pcmcia_device *link) 133 { ··· 143 144 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 145 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; 149 150 info->dev = dev; 151 ··· 152 153 return ibmtr_config(link); 154 } /* 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 165 static void ibmtr_detach(struct pcmcia_device *link) 166 { ··· 177 kfree(info); 178 } /* ibmtr_detach */ 179 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 static int __devinit ibmtr_config(struct pcmcia_device *link) 189 { 190 ibmtr_dev_t *info = link->priv; 191 struct net_device *dev = info->dev; 192 struct tok_info *ti = netdev_priv(dev); 193 - win_req_t req; 194 int i, ret; 195 196 dev_dbg(&link->dev, "ibmtr_config\n"); 197 198 - link->conf.ConfigIndex = 0x61; 199 link->io_lines = 16; 200 201 /* Determine if this is PRIMARY or ALTERNATE. */ 202 ··· 211 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); 212 213 /* 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); 220 if (ret) 221 goto failed; 222 223 - ret = pcmcia_map_mem_page(link, link->win, mmiobase); 224 if (ret) 225 goto failed; 226 - ti->mmio = ioremap(req.Base, req.Size); 227 228 /* 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); 235 if (ret) 236 goto failed; 237 238 - ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase); 239 if (ret) 240 goto failed; 241 242 ti->sram_base = srambase >> 12; 243 - ti->sram_virt = ioremap(req.Base, req.Size); 244 - ti->sram_phys = req.Base; 245 246 - ret = pcmcia_request_configuration(link, &link->conf); 247 if (ret) 248 goto failed; 249 ··· 272 return -ENODEV; 273 } /* ibmtr_config */ 274 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 static void ibmtr_release(struct pcmcia_device *link) 284 { 285 ibmtr_dev_t *info = link->priv; ··· 279 280 dev_dbg(&link->dev, "ibmtr_release\n"); 281 282 - if (link->win) { 283 struct tok_info *ti = netdev_priv(dev); 284 iounmap(ti->mmio); 285 } ··· 361 362 static struct pcmcia_driver ibmtr_cs_driver = { 363 .owner = THIS_MODULE, 364 - .drv = { 365 - .name = "ibmtr_cs", 366 - }, 367 .probe = ibmtr_attach, 368 .remove = ibmtr_detach, 369 .id_table = ibmtr_ids,
··· 57 #include <linux/trdevice.h> 58 #include <linux/ibmtr.h> 59 60 #include <pcmcia/cistpl.h> 61 #include <pcmcia/ds.h> 62 ··· 102 103 typedef struct ibmtr_dev_t { 104 struct pcmcia_device *p_dev; 105 + struct net_device *dev; 106 + struct tok_info *ti; 107 } ibmtr_dev_t; 108 109 static void netdev_get_drvinfo(struct net_device *dev, ··· 122 struct net_device *dev = info->dev; 123 return tok_interrupt(irq, dev); 124 }; 125 126 static int __devinit ibmtr_attach(struct pcmcia_device *link) 127 { ··· 153 154 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 155 link->resource[0]->end = 4; 156 + link->config_flags |= CONF_ENABLE_IRQ; 157 + link->config_regs = PRESENT_OPTION; 158 159 info->dev = dev; 160 ··· 163 164 return ibmtr_config(link); 165 } /* ibmtr_attach */ 166 167 static void ibmtr_detach(struct pcmcia_device *link) 168 { ··· 197 kfree(info); 198 } /* ibmtr_detach */ 199 200 static int __devinit ibmtr_config(struct pcmcia_device *link) 201 { 202 ibmtr_dev_t *info = link->priv; 203 struct net_device *dev = info->dev; 204 struct tok_info *ti = netdev_priv(dev); 205 int i, ret; 206 207 dev_dbg(&link->dev, "ibmtr_config\n"); 208 209 link->io_lines = 16; 210 + link->config_index = 0x61; 211 212 /* Determine if this is PRIMARY or ALTERNATE. */ 213 ··· 240 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); 241 242 /* Allocate the MMIO memory window */ 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); 248 if (ret) 249 goto failed; 250 251 + ret = pcmcia_map_mem_page(link, link->resource[2], mmiobase); 252 if (ret) 253 goto failed; 254 + ti->mmio = ioremap(link->resource[2]->start, 255 + resource_size(link->resource[2])); 256 257 /* Allocate the SRAM memory window */ 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); 263 if (ret) 264 goto failed; 265 266 + ret = pcmcia_map_mem_page(link, link->resource[3], srambase); 267 if (ret) 268 goto failed; 269 270 ti->sram_base = srambase >> 12; 271 + ti->sram_virt = ioremap(link->resource[3]->start, 272 + resource_size(link->resource[3])); 273 + ti->sram_phys = link->resource[3]->start; 274 275 + ret = pcmcia_enable_device(link); 276 if (ret) 277 goto failed; 278 ··· 301 return -ENODEV; 302 } /* ibmtr_config */ 303 304 static void ibmtr_release(struct pcmcia_device *link) 305 { 306 ibmtr_dev_t *info = link->priv; ··· 316 317 dev_dbg(&link->dev, "ibmtr_release\n"); 318 319 + if (link->resource[2]->end) { 320 struct tok_info *ti = netdev_priv(dev); 321 iounmap(ti->mmio); 322 } ··· 398 399 static struct pcmcia_driver ibmtr_cs_driver = { 400 .owner = THIS_MODULE, 401 + .name = "ibmtr_cs", 402 .probe = ibmtr_attach, 403 .remove = ibmtr_detach, 404 .id_table = ibmtr_ids,
+5 -37
drivers/net/pcmcia/nmclan_cs.c
··· 146 #include <linux/ioport.h> 147 #include <linux/bitops.h> 148 149 - #include <pcmcia/cs.h> 150 #include <pcmcia/cisreg.h> 151 #include <pcmcia/cistpl.h> 152 #include <pcmcia/ds.h> ··· 434 .ndo_validate_addr = eth_validate_addr, 435 }; 436 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 static int nmclan_probe(struct pcmcia_device *link) 445 { 446 mace_private *lp; ··· 452 spin_lock_init(&lp->bank_lock); 453 link->resource[0]->end = 32; 454 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; 459 460 lp->tx_free_frames=AM2150_MAX_TX_FRAMES; 461 ··· 464 465 return nmclan_config(link); 466 } /* 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 static void nmclan_detach(struct pcmcia_device *link) 477 { ··· 608 return 0; 609 } /* mace_init */ 610 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 static int nmclan_config(struct pcmcia_device *link) 619 { 620 struct net_device *dev = link->priv; ··· 626 ret = pcmcia_request_exclusive_irq(link, mace_interrupt); 627 if (ret) 628 goto failed; 629 - ret = pcmcia_request_configuration(link, &link->conf); 630 if (ret) 631 goto failed; 632 ··· 688 return -ENODEV; 689 } /* nmclan_config */ 690 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 static void nmclan_release(struct pcmcia_device *link) 698 { 699 dev_dbg(&link->dev, "nmclan_release\n"); ··· 1505 1506 static struct pcmcia_driver nmclan_cs_driver = { 1507 .owner = THIS_MODULE, 1508 - .drv = { 1509 - .name = "nmclan_cs", 1510 - }, 1511 .probe = nmclan_probe, 1512 .remove = nmclan_detach, 1513 .id_table = nmclan_ids,
··· 146 #include <linux/ioport.h> 147 #include <linux/bitops.h> 148 149 #include <pcmcia/cisreg.h> 150 #include <pcmcia/cistpl.h> 151 #include <pcmcia/ds.h> ··· 435 .ndo_validate_addr = eth_validate_addr, 436 }; 437 438 static int nmclan_probe(struct pcmcia_device *link) 439 { 440 mace_private *lp; ··· 460 spin_lock_init(&lp->bank_lock); 461 link->resource[0]->end = 32; 462 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 463 + link->config_flags |= CONF_ENABLE_IRQ; 464 + link->config_index = 1; 465 + link->config_regs = PRESENT_OPTION; 466 467 lp->tx_free_frames=AM2150_MAX_TX_FRAMES; 468 ··· 473 474 return nmclan_config(link); 475 } /* nmclan_attach */ 476 477 static void nmclan_detach(struct pcmcia_device *link) 478 { ··· 625 return 0; 626 } /* mace_init */ 627 628 static int nmclan_config(struct pcmcia_device *link) 629 { 630 struct net_device *dev = link->priv; ··· 650 ret = pcmcia_request_exclusive_irq(link, mace_interrupt); 651 if (ret) 652 goto failed; 653 + ret = pcmcia_enable_device(link); 654 if (ret) 655 goto failed; 656 ··· 712 return -ENODEV; 713 } /* nmclan_config */ 714 715 static void nmclan_release(struct pcmcia_device *link) 716 { 717 dev_dbg(&link->dev, "nmclan_release\n"); ··· 1535 1536 static struct pcmcia_driver nmclan_cs_driver = { 1537 .owner = THIS_MODULE, 1538 + .name = "nmclan_cs", 1539 .probe = nmclan_probe, 1540 .remove = nmclan_detach, 1541 .id_table = nmclan_ids,
+39 -107
drivers/net/pcmcia/pcnet_cs.c
··· 42 #include <linux/mii.h> 43 #include "../8390.h" 44 45 - #include <pcmcia/cs.h> 46 #include <pcmcia/cistpl.h> 47 #include <pcmcia/ciscode.h> 48 #include <pcmcia/ds.h> ··· 237 #endif 238 }; 239 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 static int pcnet_probe(struct pcmcia_device *link) 249 { 250 pcnet_dev_t *info; ··· 251 info->p_dev = link; 252 link->priv = dev; 253 254 - link->conf.Attributes = CONF_ENABLE_IRQ; 255 - link->conf.IntType = INT_MEMORY_AND_IO; 256 257 dev->netdev_ops = &pcnet_netdev_ops; 258 259 return pcnet_config(link); 260 } /* 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 271 static void pcnet_detach(struct pcmcia_device *link) 272 { ··· 281 static hw_info_t *get_hwinfo(struct pcmcia_device *link) 282 { 283 struct net_device *dev = link->priv; 284 - win_req_t req; 285 u_char __iomem *base, *virt; 286 int i, j; 287 288 /* 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); 293 if (i != 0) 294 return NULL; 295 296 - virt = ioremap(req.Base, req.Size); 297 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)]; 300 if ((readb(base+0) == hw_info[i].a0) && 301 (readb(base+2) == hw_info[i].a1) && 302 (readb(base+4) == hw_info[i].a2)) { ··· 307 } 308 309 iounmap(virt); 310 - j = pcmcia_release_window(link, link->win); 311 return (i < NR_INFO) ? hw_info+i : NULL; 312 } /* get_hwinfo */ 313 ··· 402 int i, j; 403 404 /* Not much of a test, but the alternatives are messy */ 405 - if (link->conf.ConfigBase != 0x03c0) 406 return NULL; 407 408 outb_p(0x01, ioaddr + EN0_DCFG); /* Set word-wide access. */ ··· 444 return &default_info; 445 } /* get_hwired */ 446 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 static int try_io_port(struct pcmcia_device *link) 456 { 457 int j, ret; ··· 475 } 476 } 477 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) 483 { 484 int *priv = priv_data; 485 int try = (*priv & 0x1); 486 - int i; 487 - cistpl_io_t *io = &cfg->io; 488 489 - if (cfg->index == 0 || cfg->io.nwin == 0) 490 return -EINVAL; 491 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 - } 501 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 510 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; 515 } 516 517 static hw_info_t *pcnet_try_config(struct pcmcia_device *link, ··· 512 if (!link->irq) 513 return NULL; 514 515 - if (resource_size(link->resource[1]) == 8) { 516 - link->conf.Attributes |= CONF_ENABLE_SPKR; 517 - link->conf.Status = CCSR_AUDIO_ENA; 518 - } 519 if ((link->manf_id == MANFID_IBM) && 520 (link->card_id == PRODID_IBM_HOME_AND_AWAY)) 521 - link->conf.ConfigIndex |= 0x10; 522 523 - ret = pcmcia_request_configuration(link, &link->conf); 524 if (ret) 525 return NULL; 526 ··· 534 } else 535 dev->if_port = 0; 536 537 - if ((link->conf.ConfigBase == 0x03c0) && 538 (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) { 539 dev_info(&link->dev, 540 "this is an AX88190 card - use axnet_cs instead.\n"); ··· 640 return -ENODEV; 641 } /* pcnet_config */ 642 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 static void pcnet_release(struct pcmcia_device *link) 652 { 653 pcnet_dev_t *info = PRIV(link->priv); ··· 651 652 pcmcia_disable_device(link); 653 } 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 664 static int pcnet_suspend(struct pcmcia_device *link) 665 { ··· 1420 { 1421 struct net_device *dev = link->priv; 1422 pcnet_dev_t *info = PRIV(dev); 1423 - win_req_t req; 1424 int i, window_size, offset, ret; 1425 1426 window_size = (stop_pg - start_pg) << 8; ··· 1430 window_size = roundup_pow_of_two(window_size); 1431 1432 /* 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); 1438 if (ret) 1439 goto failed; 1440 1441 offset = (start_pg << 8) + cm_offset; 1442 offset -= offset % window_size; 1443 - ret = pcmcia_map_mem_page(link, link->win, offset); 1444 if (ret) 1445 goto failed; 1446 1447 /* Try scribbling on the buffer */ 1448 - info->base = ioremap(req.Base, window_size); 1449 for (i = 0; i < (TX_PAGES<<8); i += 2) 1450 __raw_writew((i>>1), info->base+offset+i); 1451 udelay(100); ··· 1454 pcnet_reset_8390(dev); 1455 if (i != (TX_PAGES<<8)) { 1456 iounmap(info->base); 1457 - pcmcia_release_window(link, link->win); 1458 - info->base = NULL; link->win = 0; 1459 goto failed; 1460 } 1461 1462 ei_status.mem = info->base + offset; 1463 - ei_status.priv = req.Size; 1464 dev->mem_start = (u_long)ei_status.mem; 1465 - dev->mem_end = dev->mem_start + req.Size; 1466 1467 ei_status.tx_start_page = start_pg; 1468 ei_status.rx_start_page = start_pg + TX_PAGES; 1469 - ei_status.stop_page = start_pg + ((req.Size - offset) >> 8); 1470 1471 /* set up block i/o functions */ 1472 ei_status.get_8390_hdr = &shmem_get_8390_hdr; ··· 1706 MODULE_FIRMWARE("cis/tamarack.cis"); 1707 1708 static struct pcmcia_driver pcnet_driver = { 1709 - .drv = { 1710 - .name = "pcnet_cs", 1711 - }, 1712 .probe = pcnet_probe, 1713 .remove = pcnet_detach, 1714 .owner = THIS_MODULE,
··· 42 #include <linux/mii.h> 43 #include "../8390.h" 44 45 #include <pcmcia/cistpl.h> 46 #include <pcmcia/ciscode.h> 47 #include <pcmcia/ds.h> ··· 238 #endif 239 }; 240 241 static int pcnet_probe(struct pcmcia_device *link) 242 { 243 pcnet_dev_t *info; ··· 260 info->p_dev = link; 261 link->priv = dev; 262 263 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 264 265 dev->netdev_ops = &pcnet_netdev_ops; 266 267 return pcnet_config(link); 268 } /* pcnet_attach */ 269 270 static void pcnet_detach(struct pcmcia_device *link) 271 { ··· 300 static hw_info_t *get_hwinfo(struct pcmcia_device *link) 301 { 302 struct net_device *dev = link->priv; 303 u_char __iomem *base, *virt; 304 int i, j; 305 306 /* Allocate a small memory window */ 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); 310 if (i != 0) 311 return NULL; 312 313 + virt = ioremap(link->resource[2]->start, 314 + resource_size(link->resource[2])); 315 for (i = 0; i < NR_INFO; i++) { 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)]; 319 if ((readb(base+0) == hw_info[i].a0) && 320 (readb(base+2) == hw_info[i].a1) && 321 (readb(base+4) == hw_info[i].a2)) { ··· 326 } 327 328 iounmap(virt); 329 + j = pcmcia_release_window(link, link->resource[2]); 330 return (i < NR_INFO) ? hw_info+i : NULL; 331 } /* get_hwinfo */ 332 ··· 421 int i, j; 422 423 /* Not much of a test, but the alternatives are messy */ 424 + if (link->config_base != 0x03c0) 425 return NULL; 426 427 outb_p(0x01, ioaddr + EN0_DCFG); /* Set word-wide access. */ ··· 463 return &default_info; 464 } /* get_hwired */ 465 466 static int try_io_port(struct pcmcia_device *link) 467 { 468 int j, ret; ··· 502 } 503 } 504 505 + static int pcnet_confcheck(struct pcmcia_device *p_dev, void *priv_data) 506 { 507 int *priv = priv_data; 508 int try = (*priv & 0x1); 509 510 + *priv &= (p_dev->resource[2]->end >= 0x4000) ? 0x10 : ~0x10; 511 + 512 + if (p_dev->config_index == 0) 513 return -EINVAL; 514 515 + if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32) 516 + return -EINVAL; 517 518 + if (try) 519 p_dev->io_lines = 16; 520 + return try_io_port(p_dev); 521 } 522 523 static hw_info_t *pcnet_try_config(struct pcmcia_device *link, ··· 560 if (!link->irq) 561 return NULL; 562 563 + if (resource_size(link->resource[1]) == 8) 564 + link->config_flags |= CONF_ENABLE_SPKR; 565 + 566 if ((link->manf_id == MANFID_IBM) && 567 (link->card_id == PRODID_IBM_HOME_AND_AWAY)) 568 + link->config_index |= 0x10; 569 570 + ret = pcmcia_enable_device(link); 571 if (ret) 572 return NULL; 573 ··· 583 } else 584 dev->if_port = 0; 585 586 + if ((link->config_base == 0x03c0) && 587 (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) { 588 dev_info(&link->dev, 589 "this is an AX88190 card - use axnet_cs instead.\n"); ··· 689 return -ENODEV; 690 } /* pcnet_config */ 691 692 static void pcnet_release(struct pcmcia_device *link) 693 { 694 pcnet_dev_t *info = PRIV(link->priv); ··· 708 709 pcmcia_disable_device(link); 710 } 711 712 static int pcnet_suspend(struct pcmcia_device *link) 713 { ··· 1486 { 1487 struct net_device *dev = link->priv; 1488 pcnet_dev_t *info = PRIV(dev); 1489 int i, window_size, offset, ret; 1490 1491 window_size = (stop_pg - start_pg) << 8; ··· 1497 window_size = roundup_pow_of_two(window_size); 1498 1499 /* Allocate a memory window */ 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); 1504 if (ret) 1505 goto failed; 1506 1507 offset = (start_pg << 8) + cm_offset; 1508 offset -= offset % window_size; 1509 + ret = pcmcia_map_mem_page(link, link->resource[3], offset); 1510 if (ret) 1511 goto failed; 1512 1513 /* Try scribbling on the buffer */ 1514 + info->base = ioremap(link->resource[3]->start, 1515 + resource_size(link->resource[3])); 1516 for (i = 0; i < (TX_PAGES<<8); i += 2) 1517 __raw_writew((i>>1), info->base+offset+i); 1518 udelay(100); ··· 1521 pcnet_reset_8390(dev); 1522 if (i != (TX_PAGES<<8)) { 1523 iounmap(info->base); 1524 + pcmcia_release_window(link, link->resource[3]); 1525 + info->base = NULL; 1526 goto failed; 1527 } 1528 1529 ei_status.mem = info->base + offset; 1530 + ei_status.priv = resource_size(link->resource[3]); 1531 dev->mem_start = (u_long)ei_status.mem; 1532 + dev->mem_end = dev->mem_start + resource_size(link->resource[3]); 1533 1534 ei_status.tx_start_page = start_pg; 1535 ei_status.rx_start_page = start_pg + TX_PAGES; 1536 + ei_status.stop_page = start_pg + ( 1537 + (resource_size(link->resource[3]) - offset) >> 8); 1538 1539 /* set up block i/o functions */ 1540 ei_status.get_8390_hdr = &shmem_get_8390_hdr; ··· 1772 MODULE_FIRMWARE("cis/tamarack.cis"); 1773 1774 static struct pcmcia_driver pcnet_driver = { 1775 + .name = "pcnet_cs", 1776 .probe = pcnet_probe, 1777 .remove = pcnet_detach, 1778 .owner = THIS_MODULE,
+34 -80
drivers/net/pcmcia/smc91c92_cs.c
··· 44 #include <linux/jiffies.h> 45 #include <linux/firmware.h> 46 47 - #include <pcmcia/cs.h> 48 #include <pcmcia/cistpl.h> 49 #include <pcmcia/cisreg.h> 50 #include <pcmcia/ciscode.h> ··· 299 .ndo_validate_addr = eth_validate_addr, 300 }; 301 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 static int smc91c92_probe(struct pcmcia_device *link) 311 { 312 struct smc_private *smc; ··· 315 link->priv = dev; 316 317 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 323 /* The SMC91c92-specific entries in the device structure. */ 324 dev->netdev_ops = &smc_netdev_ops; ··· 329 330 return smc91c92_config(link); 331 } /* 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 342 static void smc91c92_detach(struct pcmcia_device *link) 343 { ··· 390 mdelay(200); 391 392 /* Now read and write the COR... */ 393 - tmp = readb(smc->base + link->conf.ConfigBase + CISREG_COR); 394 udelay(5); 395 - writeb(tmp, smc->base + link->conf.ConfigBase + CISREG_COR); 396 397 return 0; 398 } 399 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) 405 { 406 int k; 407 - p_dev->resource[1]->start = cf->io.win[0].base; 408 for (k = 0; k < 0x400; k += 0x10) { 409 if (k & 0x80) 410 continue; 411 p_dev->resource[0]->start = k ^ 0x300; 412 - p_dev->io_lines = 16; 413 if (!pcmcia_request_io(p_dev)) 414 return 0; 415 } ··· 422 { 423 struct net_device *dev = link->priv; 424 struct smc_private *smc = netdev_priv(dev); 425 - win_req_t req; 426 unsigned int offset; 427 int i; 428 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; 433 434 /* The Megahertz combo cards have modem-like CIS entries, so 435 we have to explicitly try a bunch of port combinations. */ ··· 436 dev->base_addr = link->resource[0]->start; 437 438 /* 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); 443 if (i != 0) 444 return -ENODEV; 445 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); 449 if ((i == 0) && 450 (smc->manfid == MANFID_MEGAHERTZ) && 451 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) ··· 568 569 /*====================================================================*/ 570 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) 576 { 577 - p_dev->resource[0]->start = cf->io.win[0].base; 578 - p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; 579 return pcmcia_request_io(p_dev); 580 } 581 ··· 582 struct net_device *dev = link->priv; 583 int i; 584 585 - link->resource[0]->end = 16; 586 i = pcmcia_loop_config(link, smc_configcheck, NULL); 587 if (!i) 588 dev->base_addr = link->resource[0]->start; ··· 616 static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; 617 int i, j; 618 619 - link->conf.Attributes |= CONF_ENABLE_SPKR; 620 - link->conf.Status = CCSR_AUDIO_ENA; 621 link->resource[0]->end = 64; 622 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 623 link->resource[1]->end = 8; 624 625 /* Enable Hard Decode, LAN, Modem */ 626 - link->conf.ConfigIndex = 0x23; 627 link->io_lines = 16; 628 629 for (i = j = 0; j < 4; j++) { 630 link->resource[1]->start = com[j]; ··· 633 } 634 if (i != 0) { 635 /* Fallback: turn off hard decode */ 636 - link->conf.ConfigIndex = 0x03; 637 link->resource[1]->end = 0; 638 i = pcmcia_request_io(link); 639 } ··· 792 } 793 794 if (width) { 795 - modconf_t mod = { 796 - .Attributes = CONF_IO_CHANGE_WIDTH, 797 - }; 798 printk(KERN_INFO "smc91c92_cs: using 8-bit IO window.\n"); 799 800 smc91c92_suspend(link); 801 - pcmcia_modify_configuration(link, &mod); 802 smc91c92_resume(link); 803 return check_sig(link); 804 } 805 return -ENODEV; 806 } 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 816 static int smc91c92_config(struct pcmcia_device *link) 817 { ··· 833 i = pcmcia_request_irq(link, smc_interrupt); 834 if (i) 835 goto config_failed; 836 - i = pcmcia_request_configuration(link, &link->conf); 837 if (i) 838 goto config_failed; 839 ··· 952 return -ENODEV; 953 } /* smc91c92_config */ 954 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 static void smc91c92_release(struct pcmcia_device *link) 964 { 965 dev_dbg(&link->dev, "smc91c92_release\n"); 966 - if (link->win) { 967 struct net_device *dev = link->priv; 968 struct smc_private *smc = netdev_priv(dev); 969 iounmap(smc->base); ··· 2057 2058 static struct pcmcia_driver smc91c92_cs_driver = { 2059 .owner = THIS_MODULE, 2060 - .drv = { 2061 - .name = "smc91c92_cs", 2062 - }, 2063 .probe = smc91c92_probe, 2064 .remove = smc91c92_detach, 2065 .id_table = smc91c92_ids,
··· 44 #include <linux/jiffies.h> 45 #include <linux/firmware.h> 46 47 #include <pcmcia/cistpl.h> 48 #include <pcmcia/cisreg.h> 49 #include <pcmcia/ciscode.h> ··· 300 .ndo_validate_addr = eth_validate_addr, 301 }; 302 303 static int smc91c92_probe(struct pcmcia_device *link) 304 { 305 struct smc_private *smc; ··· 324 link->priv = dev; 325 326 spin_lock_init(&smc->lock); 327 328 /* The SMC91c92-specific entries in the device structure. */ 329 dev->netdev_ops = &smc_netdev_ops; ··· 342 343 return smc91c92_config(link); 344 } /* smc91c92_attach */ 345 346 static void smc91c92_detach(struct pcmcia_device *link) 347 { ··· 412 mdelay(200); 413 414 /* Now read and write the COR... */ 415 + tmp = readb(smc->base + link->config_base + CISREG_COR); 416 udelay(5); 417 + writeb(tmp, smc->base + link->config_base + CISREG_COR); 418 419 return 0; 420 } 421 422 + static int mhz_mfc_config_check(struct pcmcia_device *p_dev, void *priv_data) 423 { 424 int k; 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; 433 for (k = 0; k < 0x400; k += 0x10) { 434 if (k & 0x80) 435 continue; 436 p_dev->resource[0]->start = k ^ 0x300; 437 if (!pcmcia_request_io(p_dev)) 438 return 0; 439 } ··· 442 { 443 struct net_device *dev = link->priv; 444 struct smc_private *smc = netdev_priv(dev); 445 unsigned int offset; 446 int i; 447 448 + link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ | 449 + CONF_AUTO_SET_IO; 450 451 /* The Megahertz combo cards have modem-like CIS entries, so 452 we have to explicitly try a bunch of port combinations. */ ··· 459 dev->base_addr = link->resource[0]->start; 460 461 /* Allocate a memory window, for accessing the ISR */ 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); 465 if (i != 0) 466 return -ENODEV; 467 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); 472 if ((i == 0) && 473 (smc->manfid == MANFID_MEGAHERTZ) && 474 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) ··· 591 592 /*====================================================================*/ 593 594 + static int smc_configcheck(struct pcmcia_device *p_dev, void *priv_data) 595 { 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 + 600 return pcmcia_request_io(p_dev); 601 } 602 ··· 607 struct net_device *dev = link->priv; 608 int i; 609 610 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 611 + 612 i = pcmcia_loop_config(link, smc_configcheck, NULL); 613 if (!i) 614 dev->base_addr = link->resource[0]->start; ··· 640 static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; 641 int i, j; 642 643 + link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ; 644 link->resource[0]->end = 64; 645 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 646 link->resource[1]->end = 8; 647 648 /* Enable Hard Decode, LAN, Modem */ 649 link->io_lines = 16; 650 + link->config_index = 0x23; 651 652 for (i = j = 0; j < 4; j++) { 653 link->resource[1]->start = com[j]; ··· 658 } 659 if (i != 0) { 660 /* Fallback: turn off hard decode */ 661 + link->config_index = 0x03; 662 link->resource[1]->end = 0; 663 i = pcmcia_request_io(link); 664 } ··· 817 } 818 819 if (width) { 820 printk(KERN_INFO "smc91c92_cs: using 8-bit IO window.\n"); 821 822 smc91c92_suspend(link); 823 + pcmcia_fixup_iowidth(link); 824 smc91c92_resume(link); 825 return check_sig(link); 826 } 827 return -ENODEV; 828 } 829 830 static int smc91c92_config(struct pcmcia_device *link) 831 { ··· 869 i = pcmcia_request_irq(link, smc_interrupt); 870 if (i) 871 goto config_failed; 872 + i = pcmcia_enable_device(link); 873 if (i) 874 goto config_failed; 875 ··· 988 return -ENODEV; 989 } /* smc91c92_config */ 990 991 static void smc91c92_release(struct pcmcia_device *link) 992 { 993 dev_dbg(&link->dev, "smc91c92_release\n"); 994 + if (link->resource[2]->end) { 995 struct net_device *dev = link->priv; 996 struct smc_private *smc = netdev_priv(dev); 997 iounmap(smc->base); ··· 2101 2102 static struct pcmcia_driver smc91c92_cs_driver = { 2103 .owner = THIS_MODULE, 2104 + .name = "smc91c92_cs", 2105 .probe = smc91c92_probe, 2106 .remove = smc91c92_detach, 2107 .id_table = smc91c92_ids,
+54 -107
drivers/net/pcmcia/xirc2ps_cs.c
··· 82 #include <linux/bitops.h> 83 #include <linux/mii.h> 84 85 - #include <pcmcia/cs.h> 86 #include <pcmcia/cistpl.h> 87 #include <pcmcia/cisreg.h> 88 #include <pcmcia/ciscode.h> ··· 266 static void mii_wr(unsigned int ioaddr, u_char phyaddr, u_char phyreg, 267 unsigned data, int len); 268 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 static int has_ce2_string(struct pcmcia_device * link); 278 static int xirc2ps_config(struct pcmcia_device * link); 279 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 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 296 static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id); 297 ··· 478 .ndo_validate_addr = eth_validate_addr, 479 }; 480 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 static int 492 xirc2ps_probe(struct pcmcia_device *link) 493 { ··· 496 link->priv = dev; 497 498 /* General socket configuration */ 499 - link->conf.Attributes = CONF_ENABLE_IRQ; 500 - link->conf.IntType = INT_MEMORY_AND_IO; 501 - link->conf.ConfigIndex = 1; 502 503 /* Fill in card specific entries */ 504 dev->netdev_ops = &netdev_ops; ··· 506 507 return xirc2ps_config(link); 508 } /* 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 517 static void 518 xirc2ps_detach(struct pcmcia_device *link) ··· 625 } 626 627 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) 633 { 634 unsigned int ioaddr; 635 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 - } 643 } 644 return -ENODEV; 645 } 646 647 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) 653 { 654 int *pass = priv_data; 655 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; 665 666 } 667 668 ··· 694 }; 695 696 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 static int 703 xirc2ps_config(struct pcmcia_device * link) 704 { ··· 769 goto failure; 770 } 771 772 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 773 - link->io_lines = 10; 774 if (local->modem) { 775 int pass; 776 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 if (local->dingo) { 784 /* Take the Modem IO port from the CIS and scan for a free 785 * Ethernet port */ 786 - link->resource[0]->end = 16; /* no Mako stuff anymore */ 787 if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) 788 goto port_found; 789 } else { 790 - link->resource[0]->end = 18; 791 /* We do 2 passes here: The first one uses the regular mapping and 792 * the second tries again, thereby considering that the 32 ports are 793 * mirrored every 32 bytes. Actually we use a mirrored port for 794 * the Mako if (on the first pass) the COR bit 5 is set. 795 */ 796 for (pass=0; pass < 2; pass++) 797 - if (!pcmcia_loop_config(link, xirc2ps_config_check, &pass)) 798 goto port_found; 799 /* if special option: 800 * try to configure as Ethernet only. ··· 794 } 795 printk(KNOT_XIRC "no ports available\n"); 796 } else { 797 link->resource[0]->end = 16; 798 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 799 link->resource[0]->start = ioaddr; 800 if (!(err = pcmcia_request_io(link))) ··· 817 if ((err=pcmcia_request_irq(link, xirc2ps_interrupt))) 818 goto config_error; 819 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))) 825 goto config_error; 826 827 if (local->dingo) { 828 - win_req_t req; 829 - 830 /* Reset the modem's BAR to the correct value 831 * This is necessary because in the RequestConfiguration call, 832 * the base address of the ethernet port (BasePort1) is written ··· 844 * is at 0x0800. So we allocate a window into the attribute 845 * memory and write direct to the CIS registers 846 */ 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))) 851 goto config_error; 852 853 - local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; 854 - if ((err = pcmcia_map_mem_page(link, link->win, 0))) 855 goto config_error; 856 857 /* Setup the CCRs; there are no infos in the CIS about the Ethernet ··· 932 return -ENODEV; 933 } /* xirc2ps_config */ 934 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 static void 941 xirc2ps_release(struct pcmcia_device *link) 942 { 943 dev_dbg(&link->dev, "release\n"); 944 945 - if (link->win) { 946 struct net_device *dev = link->priv; 947 local_info_t *local = netdev_priv(dev); 948 if (local->dingo) ··· 1779 1780 static struct pcmcia_driver xirc2ps_cs_driver = { 1781 .owner = THIS_MODULE, 1782 - .drv = { 1783 - .name = "xirc2ps_cs", 1784 - }, 1785 .probe = xirc2ps_probe, 1786 .remove = xirc2ps_detach, 1787 .id_table = xirc2ps_ids,
··· 82 #include <linux/bitops.h> 83 #include <linux/mii.h> 84 85 #include <pcmcia/cistpl.h> 86 #include <pcmcia/cisreg.h> 87 #include <pcmcia/ciscode.h> ··· 267 static void mii_wr(unsigned int ioaddr, u_char phyaddr, u_char phyreg, 268 unsigned data, int len); 269 270 static int has_ce2_string(struct pcmcia_device * link); 271 static int xirc2ps_config(struct pcmcia_device * link); 272 static void xirc2ps_release(struct pcmcia_device * link); 273 static void xirc2ps_detach(struct pcmcia_device *p_dev); 274 275 static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id); 276 ··· 501 .ndo_validate_addr = eth_validate_addr, 502 }; 503 504 static int 505 xirc2ps_probe(struct pcmcia_device *link) 506 { ··· 529 link->priv = dev; 530 531 /* General socket configuration */ 532 + link->config_index = 1; 533 534 /* Fill in card specific entries */ 535 dev->netdev_ops = &netdev_ops; ··· 541 542 return xirc2ps_config(link); 543 } /* xirc2ps_attach */ 544 545 static void 546 xirc2ps_detach(struct pcmcia_device *link) ··· 667 } 668 669 static int 670 + xirc2ps_config_modem(struct pcmcia_device *p_dev, void *priv_data) 671 { 672 unsigned int ioaddr; 673 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; 690 } 691 return -ENODEV; 692 } 693 694 static int 695 + xirc2ps_config_check(struct pcmcia_device *p_dev, void *priv_data) 696 { 697 int *pass = priv_data; 698 + resource_size_t tmp = p_dev->resource[1]->start; 699 700 + tmp += (*pass ? (p_dev->config_index & 0x20 ? -24 : 8) 701 + : (p_dev->config_index & 0x20 ? 8 : -24)); 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); 717 } 718 719 ··· 727 }; 728 729 730 static int 731 xirc2ps_config(struct pcmcia_device * link) 732 { ··· 807 goto failure; 808 } 809 810 if (local->modem) { 811 int pass; 812 + link->config_flags |= CONF_AUTO_SET_IO; 813 814 if (local->dingo) { 815 /* Take the Modem IO port from the CIS and scan for a free 816 * Ethernet port */ 817 if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) 818 goto port_found; 819 } else { 820 /* We do 2 passes here: The first one uses the regular mapping and 821 * the second tries again, thereby considering that the 32 ports are 822 * mirrored every 32 bytes. Actually we use a mirrored port for 823 * the Mako if (on the first pass) the COR bit 5 is set. 824 */ 825 for (pass=0; pass < 2; pass++) 826 + if (!pcmcia_loop_config(link, xirc2ps_config_check, 827 + &pass)) 828 goto port_found; 829 /* if special option: 830 * try to configure as Ethernet only. ··· 840 } 841 printk(KNOT_XIRC "no ports available\n"); 842 } else { 843 + link->io_lines = 10; 844 link->resource[0]->end = 16; 845 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 846 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 847 link->resource[0]->start = ioaddr; 848 if (!(err = pcmcia_request_io(link))) ··· 861 if ((err=pcmcia_request_irq(link, xirc2ps_interrupt))) 862 goto config_error; 863 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))) 869 goto config_error; 870 871 if (local->dingo) { 872 /* Reset the modem's BAR to the correct value 873 * This is necessary because in the RequestConfiguration call, 874 * the base address of the ethernet port (BasePort1) is written ··· 890 * is at 0x0800. So we allocate a window into the attribute 891 * memory and write direct to the CIS registers 892 */ 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))) 897 goto config_error; 898 899 + local->dingo_ccr = ioremap(link->resource[2]->start, 0x1000) + 0x0800; 900 + if ((err = pcmcia_map_mem_page(link, link->resource[2], 0))) 901 goto config_error; 902 903 /* Setup the CCRs; there are no infos in the CIS about the Ethernet ··· 978 return -ENODEV; 979 } /* xirc2ps_config */ 980 981 static void 982 xirc2ps_release(struct pcmcia_device *link) 983 { 984 dev_dbg(&link->dev, "release\n"); 985 986 + if (link->resource[2]->end) { 987 struct net_device *dev = link->priv; 988 local_info_t *local = netdev_priv(dev); 989 if (local->dingo) ··· 1830 1831 static struct pcmcia_driver xirc2ps_cs_driver = { 1832 .owner = THIS_MODULE, 1833 + .name = "xirc2ps_cs", 1834 .probe = xirc2ps_probe, 1835 .remove = xirc2ps_detach, 1836 .id_table = xirc2ps_ids,
+11 -143
drivers/net/wireless/airo_cs.c
··· 32 #include <linux/timer.h> 33 #include <linux/netdevice.h> 34 35 - #include <pcmcia/cs.h> 36 #include <pcmcia/cistpl.h> 37 #include <pcmcia/cisreg.h> 38 #include <pcmcia/ds.h> ··· 53 54 /*====================================================================*/ 55 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 static int airo_config(struct pcmcia_device *link); 66 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 74 static void airo_detach(struct pcmcia_device *p_dev); 75 ··· 62 struct net_device *eth_dev; 63 } local_info_t; 64 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 static int airo_probe(struct pcmcia_device *p_dev) 78 { 79 local_info_t *local; 80 81 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 93 /* Allocate space for private device-specific data */ 94 local = kzalloc(sizeof(local_info_t), GFP_KERNEL); ··· 78 79 return airo_config(p_dev); 80 } /* 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 91 static void airo_detach(struct pcmcia_device *link) 92 { ··· 93 kfree(link->priv); 94 } /* airo_detach */ 95 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) 109 { 110 - if (cfg->index == 0) 111 - return -ENODEV; 112 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; 150 } 151 152 ··· 111 112 dev_dbg(&link->dev, "airo_config\n"); 113 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 - */ 128 ret = pcmcia_loop_config(link, airo_cs_config_check, NULL); 129 if (ret) 130 goto failed; ··· 121 if (!link->irq) 122 goto failed; 123 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); 130 if (ret) 131 goto failed; 132 ((local_info_t *)link->priv)->eth_dev = ··· 130 if (!((local_info_t *)link->priv)->eth_dev) 131 goto failed; 132 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 return 0; 145 146 failed: 147 airo_release(link); 148 return -ENODEV; 149 } /* 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 159 static void airo_release(struct pcmcia_device *link) 160 { ··· 175 176 static struct pcmcia_driver airo_driver = { 177 .owner = THIS_MODULE, 178 - .drv = { 179 - .name = "airo_cs", 180 - }, 181 .probe = airo_probe, 182 .remove = airo_detach, 183 .id_table = airo_ids, ··· 183 .resume = airo_resume, 184 }; 185 186 - static int airo_cs_init(void) 187 { 188 return pcmcia_register_driver(&airo_driver); 189 } 190 191 - static void airo_cs_cleanup(void) 192 { 193 pcmcia_unregister_driver(&airo_driver); 194 }
··· 32 #include <linux/timer.h> 33 #include <linux/netdevice.h> 34 35 #include <pcmcia/cistpl.h> 36 #include <pcmcia/cisreg.h> 37 #include <pcmcia/ds.h> ··· 54 55 /*====================================================================*/ 56 57 static int airo_config(struct pcmcia_device *link); 58 static void airo_release(struct pcmcia_device *link); 59 60 static void airo_detach(struct pcmcia_device *p_dev); 61 ··· 78 struct net_device *eth_dev; 79 } local_info_t; 80 81 static int airo_probe(struct pcmcia_device *p_dev) 82 { 83 local_info_t *local; 84 85 dev_dbg(&p_dev->dev, "airo_attach()\n"); 86 87 /* Allocate space for private device-specific data */ 88 local = kzalloc(sizeof(local_info_t), GFP_KERNEL); ··· 116 117 return airo_config(p_dev); 118 } /* airo_attach */ 119 120 static void airo_detach(struct pcmcia_device *link) 121 { ··· 140 kfree(link->priv); 141 } /* airo_detach */ 142 143 + static int airo_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) 144 { 145 + if (p_dev->config_index == 0) 146 + return -EINVAL; 147 148 + return pcmcia_request_io(p_dev); 149 } 150 151 ··· 206 207 dev_dbg(&link->dev, "airo_config\n"); 208 209 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | 210 + CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; 211 + 212 ret = pcmcia_loop_config(link, airo_cs_config_check, NULL); 213 if (ret) 214 goto failed; ··· 227 if (!link->irq) 228 goto failed; 229 230 + ret = pcmcia_enable_device(link); 231 if (ret) 232 goto failed; 233 ((local_info_t *)link->priv)->eth_dev = ··· 241 if (!((local_info_t *)link->priv)->eth_dev) 242 goto failed; 243 244 return 0; 245 246 failed: 247 airo_release(link); 248 return -ENODEV; 249 } /* airo_config */ 250 251 static void airo_release(struct pcmcia_device *link) 252 { ··· 305 306 static struct pcmcia_driver airo_driver = { 307 .owner = THIS_MODULE, 308 + .name = "airo_cs", 309 .probe = airo_probe, 310 .remove = airo_detach, 311 .id_table = airo_ids, ··· 315 .resume = airo_resume, 316 }; 317 318 + static int __init airo_cs_init(void) 319 { 320 return pcmcia_register_driver(&airo_driver); 321 } 322 323 + static void __exit airo_cs_cleanup(void) 324 { 325 pcmcia_unregister_driver(&airo_driver); 326 }
+9 -124
drivers/net/wireless/atmel_cs.c
··· 42 #include <linux/moduleparam.h> 43 #include <linux/device.h> 44 45 - #include <pcmcia/cs.h> 46 #include <pcmcia/cistpl.h> 47 #include <pcmcia/cisreg.h> 48 #include <pcmcia/ds.h> ··· 63 64 /*====================================================================*/ 65 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 static int atmel_config(struct pcmcia_device *link); 76 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 84 static void atmel_detach(struct pcmcia_device *p_dev); 85 ··· 72 struct net_device *eth_dev; 73 } local_info_t; 74 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 static int atmel_probe(struct pcmcia_device *p_dev) 88 { 89 local_info_t *local; 90 91 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 103 /* Allocate space for private device-specific data */ 104 local = kzalloc(sizeof(local_info_t), GFP_KERNEL); ··· 89 return atmel_config(p_dev); 90 } /* atmel_attach */ 91 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 static void atmel_detach(struct pcmcia_device *link) 102 { 103 dev_dbg(&link->dev, "atmel_detach\n"); ··· 97 98 kfree(link->priv); 99 } 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 109 /* Call-back function to interrogate PCMCIA-specific information 110 about the current existance of the card */ ··· 110 return 0; 111 } 112 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) 118 { 119 - if (cfg->index == 0) 120 - return -ENODEV; 121 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 return pcmcia_request_io(p_dev); 155 } 156 ··· 129 130 dev_dbg(&link->dev, "atmel_config\n"); 131 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. 136 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 if (pcmcia_loop_config(link, atmel_config_check, NULL)) 145 goto failed; 146 ··· 140 goto failed; 141 } 142 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); 149 if (ret) 150 goto failed; 151 ··· 161 atmel_release(link); 162 return -ENODEV; 163 } 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 173 static void atmel_release(struct pcmcia_device *link) 174 { ··· 240 241 static struct pcmcia_driver atmel_driver = { 242 .owner = THIS_MODULE, 243 - .drv = { 244 - .name = "atmel_cs", 245 - }, 246 .probe = atmel_probe, 247 .remove = atmel_detach, 248 .id_table = atmel_ids, ··· 248 .resume = atmel_resume, 249 }; 250 251 - static int atmel_cs_init(void) 252 { 253 return pcmcia_register_driver(&atmel_driver); 254 } 255 256 - static void atmel_cs_cleanup(void) 257 { 258 pcmcia_unregister_driver(&atmel_driver); 259 }
··· 42 #include <linux/moduleparam.h> 43 #include <linux/device.h> 44 45 #include <pcmcia/cistpl.h> 46 #include <pcmcia/cisreg.h> 47 #include <pcmcia/ds.h> ··· 64 65 /*====================================================================*/ 66 67 static int atmel_config(struct pcmcia_device *link); 68 static void atmel_release(struct pcmcia_device *link); 69 70 static void atmel_detach(struct pcmcia_device *p_dev); 71 ··· 88 struct net_device *eth_dev; 89 } local_info_t; 90 91 static int atmel_probe(struct pcmcia_device *p_dev) 92 { 93 local_info_t *local; 94 95 dev_dbg(&p_dev->dev, "atmel_attach()\n"); 96 97 /* Allocate space for private device-specific data */ 98 local = kzalloc(sizeof(local_info_t), GFP_KERNEL); ··· 127 return atmel_config(p_dev); 128 } /* atmel_attach */ 129 130 static void atmel_detach(struct pcmcia_device *link) 131 { 132 dev_dbg(&link->dev, "atmel_detach\n"); ··· 144 145 kfree(link->priv); 146 } 147 148 /* Call-back function to interrogate PCMCIA-specific information 149 about the current existance of the card */ ··· 165 return 0; 166 } 167 168 + static int atmel_config_check(struct pcmcia_device *p_dev, void *priv_data) 169 { 170 + if (p_dev->config_index == 0) 171 + return -EINVAL; 172 173 return pcmcia_request_io(p_dev); 174 } 175 ··· 220 221 dev_dbg(&link->dev, "atmel_config\n"); 222 223 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | 224 + CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; 225 226 if (pcmcia_loop_config(link, atmel_config_check, NULL)) 227 goto failed; 228 ··· 240 goto failed; 241 } 242 243 + ret = pcmcia_enable_device(link); 244 if (ret) 245 goto failed; 246 ··· 266 atmel_release(link); 267 return -ENODEV; 268 } 269 270 static void atmel_release(struct pcmcia_device *link) 271 { ··· 353 354 static struct pcmcia_driver atmel_driver = { 355 .owner = THIS_MODULE, 356 + .name = "atmel_cs", 357 .probe = atmel_probe, 358 .remove = atmel_detach, 359 .id_table = atmel_ids, ··· 363 .resume = atmel_resume, 364 }; 365 366 + static int __init atmel_cs_init(void) 367 { 368 return pcmcia_register_driver(&atmel_driver); 369 } 370 371 + static void __exit atmel_cs_cleanup(void) 372 { 373 pcmcia_unregister_driver(&atmel_driver); 374 }
+9 -15
drivers/net/wireless/b43/pcmcia.c
··· 26 #include <linux/ssb/ssb.h> 27 #include <linux/slab.h> 28 29 - #include <pcmcia/cs.h> 30 #include <pcmcia/cistpl.h> 31 #include <pcmcia/ciscode.h> 32 #include <pcmcia/ds.h> ··· 62 static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) 63 { 64 struct ssb_bus *ssb; 65 - win_req_t win; 66 int err = -ENOMEM; 67 int res = 0; 68 ··· 71 72 err = -ENODEV; 73 74 - dev->conf.Attributes = CONF_ENABLE_IRQ; 75 - dev->conf.IntType = INT_MEMORY_AND_IO; 76 77 - win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 | 78 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); 83 if (res != 0) 84 goto err_kfree_ssb; 85 86 - res = pcmcia_map_mem_page(dev, dev->win, 0); 87 if (res != 0) 88 goto err_disable; 89 90 if (!dev->irq) 91 goto err_disable; 92 93 - res = pcmcia_request_configuration(dev, &dev->conf); 94 if (res != 0) 95 goto err_disable; 96 97 - err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); 98 if (err) 99 goto err_disable; 100 dev->priv = ssb; ··· 121 122 static struct pcmcia_driver b43_pcmcia_driver = { 123 .owner = THIS_MODULE, 124 - .drv = { 125 - .name = "b43-pcmcia", 126 - }, 127 .id_table = b43_pcmcia_tbl, 128 .probe = b43_pcmcia_probe, 129 .remove = __devexit_p(b43_pcmcia_remove),
··· 26 #include <linux/ssb/ssb.h> 27 #include <linux/slab.h> 28 29 #include <pcmcia/cistpl.h> 30 #include <pcmcia/ciscode.h> 31 #include <pcmcia/ds.h> ··· 63 static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) 64 { 65 struct ssb_bus *ssb; 66 int err = -ENOMEM; 67 int res = 0; 68 ··· 73 74 err = -ENODEV; 75 76 + dev->config_flags |= CONF_ENABLE_IRQ; 77 78 + dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 | 79 WIN_USE_WAIT; 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 if (res != 0) 84 goto err_kfree_ssb; 85 86 + res = pcmcia_map_mem_page(dev, dev->resource[2], 0); 87 if (res != 0) 88 goto err_disable; 89 90 if (!dev->irq) 91 goto err_disable; 92 93 + res = pcmcia_enable_device(dev); 94 if (res != 0) 95 goto err_disable; 96 97 + err = ssb_bus_pcmciabus_register(ssb, dev, dev->resource[2]->start); 98 if (err) 99 goto err_disable; 100 dev->priv = ssb; ··· 125 126 static struct pcmcia_driver b43_pcmcia_driver = { 127 .owner = THIS_MODULE, 128 + .name = "b43-pcmcia", 129 .id_table = b43_pcmcia_tbl, 130 .probe = b43_pcmcia_probe, 131 .remove = __devexit_p(b43_pcmcia_remove),
+10 -92
drivers/net/wireless/hostap/hostap_cs.c
··· 12 #include <linux/wireless.h> 13 #include <net/iw_handler.h> 14 15 - #include <pcmcia/cs.h> 16 #include <pcmcia/cistpl.h> 17 #include <pcmcia/cisreg.h> 18 #include <pcmcia/ds.h> ··· 436 int ret; 437 438 PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); 439 - p_dev->conf.IntType = INT_MEMORY_AND_IO; 440 441 ret = prism2_config(p_dev); 442 if (ret) { ··· 466 } 467 468 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) 477 { 478 - if (cfg->index == 0) 479 - return -ENODEV; 480 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 return pcmcia_request_io(p_dev); 538 } 539 ··· 492 } 493 494 /* Look for an appropriate configuration table entry in the CIS */ 495 ret = pcmcia_loop_config(link, prism2_config_check, NULL); 496 if (ret) { 497 if (!ignore_cis_vcc) ··· 527 if (ret) 528 goto failed_unlock; 529 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); 536 if (ret) 537 goto failed_unlock; 538 ··· 535 dev->base_addr = link->resource[0]->start; 536 537 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 553 local->shutdown = 0; 554 ··· 547 return ret; 548 549 failed_unlock: 550 - spin_unlock_irqrestore(&local->irq_init_lock, flags); 551 failed: 552 kfree(hw_priv); 553 prism2_release((u_long)link); ··· 699 700 701 static struct pcmcia_driver hostap_driver = { 702 - .drv = { 703 - .name = "hostap_cs", 704 - }, 705 .probe = hostap_cs_probe, 706 .remove = prism2_detach, 707 .owner = THIS_MODULE,
··· 12 #include <linux/wireless.h> 13 #include <net/iw_handler.h> 14 15 #include <pcmcia/cistpl.h> 16 #include <pcmcia/cisreg.h> 17 #include <pcmcia/ds.h> ··· 437 int ret; 438 439 PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); 440 441 ret = prism2_config(p_dev); 442 if (ret) { ··· 468 } 469 470 471 + static int prism2_config_check(struct pcmcia_device *p_dev, void *priv_data) 472 { 473 + if (p_dev->config_index == 0) 474 + return -EINVAL; 475 476 return pcmcia_request_io(p_dev); 477 } 478 ··· 557 } 558 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; 564 ret = pcmcia_loop_config(link, prism2_config_check, NULL); 565 if (ret) { 566 if (!ignore_cis_vcc) ··· 588 if (ret) 589 goto failed_unlock; 590 591 + ret = pcmcia_enable_device(link); 592 if (ret) 593 goto failed_unlock; 594 ··· 601 dev->base_addr = link->resource[0]->start; 602 603 spin_unlock_irqrestore(&local->irq_init_lock, flags); 604 605 local->shutdown = 0; 606 ··· 627 return ret; 628 629 failed_unlock: 630 + spin_unlock_irqrestore(&local->irq_init_lock, flags); 631 failed: 632 kfree(hw_priv); 633 prism2_release((u_long)link); ··· 779 780 781 static struct pcmcia_driver hostap_driver = { 782 + .name = "hostap_cs", 783 .probe = hostap_cs_probe, 784 .remove = prism2_detach, 785 .owner = THIS_MODULE,
+7 -51
drivers/net/wireless/libertas/if_cs.c
··· 28 #include <linux/firmware.h> 29 #include <linux/netdevice.h> 30 31 - #include <pcmcia/cs.h> 32 #include <pcmcia/cistpl.h> 33 #include <pcmcia/ds.h> 34 ··· 760 } 761 762 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 static void if_cs_release(struct pcmcia_device *p_dev) 773 { 774 struct if_cs_card *card = p_dev->priv; ··· 775 } 776 777 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) 793 { 794 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 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) { 803 lbs_pr_err("wrong CIS (check number of IO windows)\n"); 804 return -ENODEV; 805 } ··· 806 card->p_dev = p_dev; 807 p_dev->priv = card; 808 809 - p_dev->conf.Attributes = 0; 810 - p_dev->conf.IntType = INT_MEMORY_AND_IO; 811 812 if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { 813 lbs_pr_err("error in pcmcia_loop_config\n"); 814 goto out1; 815 } 816 - 817 818 /* 819 * Allocate an interrupt line. Note that this does not assign ··· 830 goto out1; 831 } 832 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); 839 if (ret) { 840 - lbs_pr_err("error in pcmcia_request_configuration\n"); 841 goto out2; 842 } 843 ··· 926 } 927 928 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 static void if_cs_detach(struct pcmcia_device *p_dev) 936 { 937 struct if_cs_card *card = p_dev->priv; ··· 958 959 static struct pcmcia_driver lbs_driver = { 960 .owner = THIS_MODULE, 961 - .drv = { 962 - .name = DRV_NAME, 963 - }, 964 .probe = if_cs_probe, 965 .remove = if_cs_detach, 966 .id_table = if_cs_ids,
··· 28 #include <linux/firmware.h> 29 #include <linux/netdevice.h> 30 31 #include <pcmcia/cistpl.h> 32 #include <pcmcia/ds.h> 33 ··· 761 } 762 763 764 static void if_cs_release(struct pcmcia_device *p_dev) 765 { 766 struct if_cs_card *card = p_dev->priv; ··· 785 } 786 787 788 + static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data) 789 { 790 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 791 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 792 793 + if (p_dev->resource[1]->end) { 794 lbs_pr_err("wrong CIS (check number of IO windows)\n"); 795 return -ENODEV; 796 } ··· 835 card->p_dev = p_dev; 836 p_dev->priv = card; 837 838 + p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 839 840 if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { 841 lbs_pr_err("error in pcmcia_loop_config\n"); 842 goto out1; 843 } 844 845 /* 846 * Allocate an interrupt line. Note that this does not assign ··· 861 goto out1; 862 } 863 864 + ret = pcmcia_enable_device(p_dev); 865 if (ret) { 866 + lbs_pr_err("error in pcmcia_enable_device\n"); 867 goto out2; 868 } 869 ··· 962 } 963 964 965 static void if_cs_detach(struct pcmcia_device *p_dev) 966 { 967 struct if_cs_card *card = p_dev->priv; ··· 1000 1001 static struct pcmcia_driver lbs_driver = { 1002 .owner = THIS_MODULE, 1003 + .name = DRV_NAME, 1004 .probe = if_cs_probe, 1005 .remove = if_cs_detach, 1006 .id_table = if_cs_ids,
+10 -127
drivers/net/wireless/orinoco/orinoco_cs.c
··· 17 #include <linux/kernel.h> 18 #include <linux/init.h> 19 #include <linux/delay.h> 20 - #include <pcmcia/cs.h> 21 #include <pcmcia/cistpl.h> 22 #include <pcmcia/cisreg.h> 23 #include <pcmcia/ds.h> ··· 92 /* PCMCIA stuff */ 93 /********************************************************************/ 94 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 static int 104 orinoco_cs_probe(struct pcmcia_device *link) 105 { ··· 108 card->p_dev = link; 109 link->priv = priv; 110 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 return orinoco_cs_config(link); 120 } /* orinoco_cs_attach */ 121 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 static void orinoco_cs_detach(struct pcmcia_device *link) 129 { 130 struct orinoco_private *priv = link->priv; ··· 122 free_orinocodev(priv); 123 } /* orinoco_cs_detach */ 124 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) 136 { 137 - if (cfg->index == 0) 138 - goto next_entry; 139 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; 195 }; 196 197 static int ··· 138 int ret; 139 void __iomem *mem; 140 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 - */ 155 ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); 156 if (ret) { 157 if (!ignore_cis_vcc) ··· 165 166 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 167 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); 174 if (ret) 175 goto failed; 176 ··· 189 return -ENODEV; 190 } /* orinoco_cs_config */ 191 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 static void 198 orinoco_cs_release(struct pcmcia_device *link) 199 { ··· 236 /********************************************************************/ 237 /* Module initialization */ 238 /********************************************************************/ 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 246 static struct pcmcia_device_id orinoco_cs_ids[] = { 247 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), /* 3Com AirConnect PCI 777A */ ··· 328 329 static struct pcmcia_driver orinoco_driver = { 330 .owner = THIS_MODULE, 331 - .drv = { 332 - .name = DRIVER_NAME, 333 - }, 334 .probe = orinoco_cs_probe, 335 .remove = orinoco_cs_detach, 336 .id_table = orinoco_cs_ids, ··· 339 static int __init 340 init_orinoco_cs(void) 341 { 342 - printk(KERN_DEBUG "%s\n", version); 343 - 344 return pcmcia_register_driver(&orinoco_driver); 345 } 346
··· 17 #include <linux/kernel.h> 18 #include <linux/init.h> 19 #include <linux/delay.h> 20 #include <pcmcia/cistpl.h> 21 #include <pcmcia/cisreg.h> 22 #include <pcmcia/ds.h> ··· 93 /* PCMCIA stuff */ 94 /********************************************************************/ 95 96 static int 97 orinoco_cs_probe(struct pcmcia_device *link) 98 { ··· 117 card->p_dev = link; 118 link->priv = priv; 119 120 return orinoco_cs_config(link); 121 } /* orinoco_cs_attach */ 122 123 static void orinoco_cs_detach(struct pcmcia_device *link) 124 { 125 struct orinoco_private *priv = link->priv; ··· 145 free_orinocodev(priv); 146 } /* orinoco_cs_detach */ 147 148 + static int orinoco_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) 149 { 150 + if (p_dev->config_index == 0) 151 + return -EINVAL; 152 153 + return pcmcia_request_io(p_dev); 154 }; 155 156 static int ··· 225 int ret; 226 void __iomem *mem; 227 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; 232 ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); 233 if (ret) { 234 if (!ignore_cis_vcc) ··· 262 263 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 264 265 + ret = pcmcia_enable_device(link); 266 if (ret) 267 goto failed; 268 ··· 291 return -ENODEV; 292 } /* orinoco_cs_config */ 293 294 static void 295 orinoco_cs_release(struct pcmcia_device *link) 296 { ··· 343 /********************************************************************/ 344 /* Module initialization */ 345 /********************************************************************/ 346 347 static struct pcmcia_device_id orinoco_cs_ids[] = { 348 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), /* 3Com AirConnect PCI 777A */ ··· 441 442 static struct pcmcia_driver orinoco_driver = { 443 .owner = THIS_MODULE, 444 + .name = DRIVER_NAME, 445 .probe = orinoco_cs_probe, 446 .remove = orinoco_cs_detach, 447 .id_table = orinoco_cs_ids, ··· 454 static int __init 455 init_orinoco_cs(void) 456 { 457 return pcmcia_register_driver(&orinoco_driver); 458 } 459
+9 -125
drivers/net/wireless/orinoco/spectrum_cs.c
··· 25 #include <linux/kernel.h> 26 #include <linux/init.h> 27 #include <linux/delay.h> 28 - #include <pcmcia/cs.h> 29 #include <pcmcia/cistpl.h> 30 #include <pcmcia/cisreg.h> 31 #include <pcmcia/ds.h> ··· 153 /* PCMCIA stuff */ 154 /********************************************************************/ 155 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 static int 165 spectrum_cs_probe(struct pcmcia_device *link) 166 { ··· 170 card->p_dev = link; 171 link->priv = priv; 172 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 return spectrum_cs_config(link); 182 } /* spectrum_cs_attach */ 183 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 static void spectrum_cs_detach(struct pcmcia_device *link) 191 { 192 struct orinoco_private *priv = link->priv; ··· 184 free_orinocodev(priv); 185 } /* spectrum_cs_detach */ 186 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 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 void *priv_data) 198 { 199 - if (cfg->index == 0) 200 - goto next_entry; 201 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; 257 }; 258 259 static int ··· 201 int ret; 202 void __iomem *mem; 203 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 - */ 218 ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); 219 if (ret) { 220 if (!ignore_cis_vcc) ··· 229 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 230 hw->eeprom_pda = true; 231 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); 238 if (ret) 239 goto failed; 240 ··· 257 return -ENODEV; 258 } /* spectrum_cs_config */ 259 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 static void 266 spectrum_cs_release(struct pcmcia_device *link) 267 { ··· 301 /* Module initialization */ 302 /********************************************************************/ 303 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 static struct pcmcia_device_id spectrum_cs_ids[] = { 311 PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4137 */ 312 PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ ··· 311 312 static struct pcmcia_driver orinoco_driver = { 313 .owner = THIS_MODULE, 314 - .drv = { 315 - .name = DRIVER_NAME, 316 - }, 317 .probe = spectrum_cs_probe, 318 .remove = spectrum_cs_detach, 319 .suspend = spectrum_cs_suspend, ··· 322 static int __init 323 init_spectrum_cs(void) 324 { 325 - printk(KERN_DEBUG "%s\n", version); 326 - 327 return pcmcia_register_driver(&orinoco_driver); 328 } 329
··· 25 #include <linux/kernel.h> 26 #include <linux/init.h> 27 #include <linux/delay.h> 28 #include <pcmcia/cistpl.h> 29 #include <pcmcia/cisreg.h> 30 #include <pcmcia/ds.h> ··· 154 /* PCMCIA stuff */ 155 /********************************************************************/ 156 157 static int 158 spectrum_cs_probe(struct pcmcia_device *link) 159 { ··· 179 card->p_dev = link; 180 link->priv = priv; 181 182 return spectrum_cs_config(link); 183 } /* spectrum_cs_attach */ 184 185 static void spectrum_cs_detach(struct pcmcia_device *link) 186 { 187 struct orinoco_private *priv = link->priv; ··· 207 free_orinocodev(priv); 208 } /* spectrum_cs_detach */ 209 210 static int spectrum_cs_config_check(struct pcmcia_device *p_dev, 211 void *priv_data) 212 { 213 + if (p_dev->config_index == 0) 214 + return -EINVAL; 215 216 + return pcmcia_request_io(p_dev); 217 }; 218 219 static int ··· 287 int ret; 288 void __iomem *mem; 289 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; 294 ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); 295 if (ret) { 296 if (!ignore_cis_vcc) ··· 325 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 326 hw->eeprom_pda = true; 327 328 + ret = pcmcia_enable_device(link); 329 if (ret) 330 goto failed; 331 ··· 358 return -ENODEV; 359 } /* spectrum_cs_config */ 360 361 static void 362 spectrum_cs_release(struct pcmcia_device *link) 363 { ··· 407 /* Module initialization */ 408 /********************************************************************/ 409 410 static struct pcmcia_device_id spectrum_cs_ids[] = { 411 PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4137 */ 412 PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ ··· 423 424 static struct pcmcia_driver orinoco_driver = { 425 .owner = THIS_MODULE, 426 + .name = DRIVER_NAME, 427 .probe = spectrum_cs_probe, 428 .remove = spectrum_cs_detach, 429 .suspend = spectrum_cs_suspend, ··· 436 static int __init 437 init_spectrum_cs(void) 438 { 439 return pcmcia_register_driver(&orinoco_driver); 440 } 441
+26 -65
drivers/net/wireless/ray_cs.c
··· 46 #include <linux/ethtool.h> 47 #include <linux/ieee80211.h> 48 49 - #include <pcmcia/cs.h> 50 #include <pcmcia/cistpl.h> 51 #include <pcmcia/cisreg.h> 52 #include <pcmcia/ds.h> ··· 168 */ 169 static char *phy_addr = NULL; 170 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 static unsigned int ray_mem_speed = 500; 179 180 /* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */ ··· 282 .ndo_validate_addr = eth_validate_addr, 283 }; 284 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 static int ray_probe(struct pcmcia_device *p_dev) 294 { 295 ray_dev_t *local; ··· 302 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 303 304 /* 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; 308 309 p_dev->priv = dev; 310 ··· 336 return -ENOMEM; 337 } /* ray_attach */ 338 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 static void ray_detach(struct pcmcia_device *link) 346 { 347 struct net_device *dev; ··· 358 dev_dbg(&link->dev, "ray_cs ray_detach ending\n"); 359 } /* ray_detach */ 360 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 #define MAX_TUPLE_SIZE 128 367 static int ray_config(struct pcmcia_device *link) 368 { 369 int ret = 0; 370 int i; 371 - win_req_t req; 372 struct net_device *dev = (struct net_device *)link->priv; 373 ray_dev_t *local = netdev_priv(dev); 374 ··· 383 goto failed; 384 dev->irq = link->irq; 385 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); 390 if (ret) 391 goto failed; 392 393 /*** 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); 400 if (ret) 401 goto failed; 402 - ret = pcmcia_map_mem_page(link, link->win, 0); 403 if (ret) 404 goto failed; 405 - local->sram = ioremap(req.Base, req.Size); 406 407 /*** Set up 16k window for shared memory (receive buffer) ***************/ 408 - req.Attributes = 409 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); 414 if (ret) 415 goto failed; 416 - ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000); 417 if (ret) 418 goto failed; 419 - local->rmem = ioremap(req.Base, req.Size); 420 421 /*** Set up window for attribute memory ***********************************/ 422 - req.Attributes = 423 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); 428 if (ret) 429 goto failed; 430 - ret = pcmcia_map_mem_page(link, local->amem_handle, 0); 431 if (ret) 432 goto failed; 433 - local->amem = ioremap(req.Base, req.Size); 434 435 dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); 436 dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); ··· 742 local->card_status = CARD_DOING_ACQ; 743 } 744 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 - =============================================================================*/ 750 static void ray_release(struct pcmcia_device *link) 751 { 752 struct net_device *dev = link->priv; ··· 2810 2811 static struct pcmcia_driver ray_driver = { 2812 .owner = THIS_MODULE, 2813 - .drv = { 2814 - .name = "ray_cs", 2815 - }, 2816 .probe = ray_probe, 2817 .remove = ray_detach, 2818 .id_table = ray_ids,
··· 46 #include <linux/ethtool.h> 47 #include <linux/ieee80211.h> 48 49 #include <pcmcia/cistpl.h> 50 #include <pcmcia/cisreg.h> 51 #include <pcmcia/ds.h> ··· 169 */ 170 static char *phy_addr = NULL; 171 172 static unsigned int ray_mem_speed = 500; 173 174 /* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */ ··· 290 .ndo_validate_addr = eth_validate_addr, 291 }; 292 293 static int ray_probe(struct pcmcia_device *p_dev) 294 { 295 ray_dev_t *local; ··· 318 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 319 320 /* General socket configuration */ 321 + p_dev->config_flags |= CONF_ENABLE_IRQ; 322 + p_dev->config_index = 1; 323 324 p_dev->priv = dev; 325 ··· 353 return -ENOMEM; 354 } /* ray_attach */ 355 356 static void ray_detach(struct pcmcia_device *link) 357 { 358 struct net_device *dev; ··· 381 dev_dbg(&link->dev, "ray_cs ray_detach ending\n"); 382 } /* ray_detach */ 383 384 #define MAX_TUPLE_SIZE 128 385 static int ray_config(struct pcmcia_device *link) 386 { 387 int ret = 0; 388 int i; 389 struct net_device *dev = (struct net_device *)link->priv; 390 ray_dev_t *local = netdev_priv(dev); 391 ··· 412 goto failed; 413 dev->irq = link->irq; 414 415 + ret = pcmcia_enable_device(link); 416 if (ret) 417 goto failed; 418 419 /*** Set up 32k window for shared memory (transmit and control) ************/ 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); 424 if (ret) 425 goto failed; 426 + ret = pcmcia_map_mem_page(link, link->resource[2], 0); 427 if (ret) 428 goto failed; 429 + local->sram = ioremap(link->resource[2]->start, 430 + resource_size(link->resource[2])); 431 432 /*** Set up 16k window for shared memory (receive buffer) ***************/ 433 + link->resource[3]->flags |= 434 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; 435 + link->resource[3]->start = 0; 436 + link->resource[3]->end = 0x4000; 437 + ret = pcmcia_request_window(link, link->resource[3], ray_mem_speed); 438 if (ret) 439 goto failed; 440 + ret = pcmcia_map_mem_page(link, link->resource[3], 0x8000); 441 if (ret) 442 goto failed; 443 + local->rmem = ioremap(link->resource[3]->start, 444 + resource_size(link->resource[3])); 445 446 /*** Set up window for attribute memory ***********************************/ 447 + link->resource[4]->flags |= 448 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT; 449 + link->resource[4]->start = 0; 450 + link->resource[4]->end = 0x1000; 451 + ret = pcmcia_request_window(link, link->resource[4], ray_mem_speed); 452 if (ret) 453 goto failed; 454 + ret = pcmcia_map_mem_page(link, link->resource[4], 0); 455 if (ret) 456 goto failed; 457 + local->amem = ioremap(link->resource[4]->start, 458 + resource_size(link->resource[4])); 459 460 dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); 461 dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); ··· 775 local->card_status = CARD_DOING_ACQ; 776 } 777 778 + 779 static void ray_release(struct pcmcia_device *link) 780 { 781 struct net_device *dev = link->priv; ··· 2847 2848 static struct pcmcia_driver ray_driver = { 2849 .owner = THIS_MODULE, 2850 + .name = "ray_cs", 2851 .probe = ray_probe, 2852 .remove = ray_detach, 2853 .id_table = ray_ids,
-2
drivers/net/wireless/ray_cs.h
··· 25 typedef struct ray_dev_t { 26 int card_status; 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 void __iomem *sram; /* pointer to beginning of shared RAM */ 31 void __iomem *amem; /* pointer to attribute mem window */ 32 void __iomem *rmem; /* pointer to receive buffer window */
··· 25 typedef struct ray_dev_t { 26 int card_status; 27 int authentication_state; 28 void __iomem *sram; /* pointer to beginning of shared RAM */ 29 void __iomem *amem; /* pointer to attribute mem window */ 30 void __iomem *rmem; /* pointer to receive buffer window */
+4 -43
drivers/net/wireless/wl3501_cs.c
··· 48 49 #include <net/iw_handler.h> 50 51 - #include <pcmcia/cs.h> 52 #include <pcmcia/cistpl.h> 53 #include <pcmcia/cisreg.h> 54 #include <pcmcia/ds.h> ··· 77 #define WL3501_RESUME 0 78 #define WL3501_SUSPEND 1 79 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 static int wl3501_config(struct pcmcia_device *link); 88 static void wl3501_release(struct pcmcia_device *link); 89 ··· 1861 .ndo_validate_addr = eth_validate_addr, 1862 }; 1863 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 static int wl3501_probe(struct pcmcia_device *p_dev) 1874 { 1875 struct net_device *dev; ··· 1871 p_dev->resource[0]->flags = IO_DATA_PATH_WIDTH_8; 1872 1873 /* 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; 1877 1878 dev = alloc_etherdev(sizeof(struct wl3501_card)); 1879 if (!dev) ··· 1896 return -ENOMEM; 1897 } 1898 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 static int wl3501_config(struct pcmcia_device *link) 1908 { 1909 struct net_device *dev = link->priv; ··· 1926 if (ret) 1927 goto failed; 1928 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); 1933 if (ret) 1934 goto failed; 1935 ··· 1981 return -ENODEV; 1982 } 1983 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 static void wl3501_release(struct pcmcia_device *link) 1993 { 1994 pcmcia_disable_device(link); ··· 2019 2020 static struct pcmcia_driver wl3501_driver = { 2021 .owner = THIS_MODULE, 2022 - .drv = { 2023 - .name = "wl3501_cs", 2024 - }, 2025 .probe = wl3501_probe, 2026 .remove = wl3501_detach, 2027 .id_table = wl3501_ids,
··· 48 49 #include <net/iw_handler.h> 50 51 #include <pcmcia/cistpl.h> 52 #include <pcmcia/cisreg.h> 53 #include <pcmcia/ds.h> ··· 78 #define WL3501_RESUME 0 79 #define WL3501_SUSPEND 1 80 81 static int wl3501_config(struct pcmcia_device *link); 82 static void wl3501_release(struct pcmcia_device *link); 83 ··· 1869 .ndo_validate_addr = eth_validate_addr, 1870 }; 1871 1872 static int wl3501_probe(struct pcmcia_device *p_dev) 1873 { 1874 struct net_device *dev; ··· 1888 p_dev->resource[0]->flags = IO_DATA_PATH_WIDTH_8; 1889 1890 /* General socket configuration */ 1891 + p_dev->config_flags = CONF_ENABLE_IRQ; 1892 + p_dev->config_index = 1; 1893 1894 dev = alloc_etherdev(sizeof(struct wl3501_card)); 1895 if (!dev) ··· 1914 return -ENOMEM; 1915 } 1916 1917 static int wl3501_config(struct pcmcia_device *link) 1918 { 1919 struct net_device *dev = link->priv; ··· 1952 if (ret) 1953 goto failed; 1954 1955 + ret = pcmcia_enable_device(link); 1956 if (ret) 1957 goto failed; 1958 ··· 2010 return -ENODEV; 2011 } 2012 2013 static void wl3501_release(struct pcmcia_device *link) 2014 { 2015 pcmcia_disable_device(link); ··· 2056 2057 static struct pcmcia_driver wl3501_driver = { 2058 .owner = THIS_MODULE, 2059 + .name = "wl3501_cs", 2060 .probe = wl3501_probe, 2061 .remove = wl3501_detach, 2062 .id_table = wl3501_ids,
+13 -63
drivers/parport/parport_cs.c
··· 48 #include <linux/parport.h> 49 #include <linux/parport_pc.h> 50 51 - #include <pcmcia/cs.h> 52 #include <pcmcia/cistpl.h> 53 #include <pcmcia/ds.h> 54 #include <pcmcia/cisreg.h> ··· 80 static int parport_config(struct pcmcia_device *link); 81 static void parport_cs_release(struct pcmcia_device *); 82 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 static int parport_probe(struct pcmcia_device *link) 92 { 93 parport_info_t *info; ··· 92 link->priv = info; 93 info->p_dev = link; 94 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; 99 100 return parport_config(link); 101 } /* 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 112 static void parport_detach(struct pcmcia_device *link) 113 { ··· 106 kfree(link->priv); 107 } /* parport_detach */ 108 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) 122 { 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; 139 } 140 141 static int parport_config(struct pcmcia_device *link) ··· 124 125 dev_dbg(&link->dev, "parport_config\n"); 126 127 ret = pcmcia_loop_config(link, parport_config_check, NULL); 128 if (ret) 129 goto failed; 130 131 if (!link->irq) 132 goto failed; 133 - ret = pcmcia_request_configuration(link, &link->conf); 134 if (ret) 135 goto failed; 136 ··· 162 return -ENODEV; 163 } /* parport_config */ 164 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 static void parport_cs_release(struct pcmcia_device *link) 174 { 175 parport_info_t *info = link->priv; ··· 188 189 static struct pcmcia_driver parport_cs_driver = { 190 .owner = THIS_MODULE, 191 - .drv = { 192 - .name = "parport_cs", 193 - }, 194 .probe = parport_probe, 195 .remove = parport_detach, 196 .id_table = parport_ids,
··· 48 #include <linux/parport.h> 49 #include <linux/parport_pc.h> 50 51 #include <pcmcia/cistpl.h> 52 #include <pcmcia/ds.h> 53 #include <pcmcia/cisreg.h> ··· 81 static int parport_config(struct pcmcia_device *link); 82 static void parport_cs_release(struct pcmcia_device *); 83 84 static int parport_probe(struct pcmcia_device *link) 85 { 86 parport_info_t *info; ··· 101 link->priv = info; 102 info->p_dev = link; 103 104 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 105 106 return parport_config(link); 107 } /* parport_attach */ 108 109 static void parport_detach(struct pcmcia_device *link) 110 { ··· 127 kfree(link->priv); 128 } /* parport_detach */ 129 130 + static int parport_config_check(struct pcmcia_device *p_dev, void *priv_data) 131 { 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); 138 } 139 140 static int parport_config(struct pcmcia_device *link) ··· 167 168 dev_dbg(&link->dev, "parport_config\n"); 169 170 + if (epp_mode) 171 + link->config_index |= FORCE_EPP_MODE; 172 + 173 ret = pcmcia_loop_config(link, parport_config_check, NULL); 174 if (ret) 175 goto failed; 176 177 if (!link->irq) 178 goto failed; 179 + ret = pcmcia_enable_device(link); 180 if (ret) 181 goto failed; 182 ··· 202 return -ENODEV; 203 } /* parport_config */ 204 205 static void parport_cs_release(struct pcmcia_device *link) 206 { 207 parport_info_t *info = link->priv; ··· 236 237 static struct pcmcia_driver parport_cs_driver = { 238 .owner = THIS_MODULE, 239 + .name = "parport_cs", 240 .probe = parport_probe, 241 .remove = parport_detach, 242 .id_table = parport_ids,
-3
drivers/pcmcia/au1000_generic.c
··· 441 442 443 out_err: 444 - flush_scheduled_work(); 445 ops->hw_shutdown(skt); 446 while (i-- > 0) { 447 skt = PCMCIA_SOCKET(i); 448 449 del_timer_sync(&skt->poll_timer); 450 pcmcia_unregister_socket(&skt->socket); 451 - flush_scheduled_work(); 452 if (i == 0) { 453 iounmap(skt->virt_io + (u32)mips_io_port_base); 454 skt->virt_io = NULL; ··· 478 479 del_timer_sync(&skt->poll_timer); 480 pcmcia_unregister_socket(&skt->socket); 481 - flush_scheduled_work(); 482 skt->ops->hw_shutdown(skt); 483 au1x00_pcmcia_config_skt(skt, &dead_socket); 484 iounmap(skt->virt_io + (u32)mips_io_port_base);
··· 441 442 443 out_err: 444 ops->hw_shutdown(skt); 445 while (i-- > 0) { 446 skt = PCMCIA_SOCKET(i); 447 448 del_timer_sync(&skt->poll_timer); 449 pcmcia_unregister_socket(&skt->socket); 450 if (i == 0) { 451 iounmap(skt->virt_io + (u32)mips_io_port_base); 452 skt->virt_io = NULL; ··· 480 481 del_timer_sync(&skt->poll_timer); 482 pcmcia_unregister_socket(&skt->socket); 483 skt->ops->hw_shutdown(skt); 484 au1x00_pcmcia_config_skt(skt, &dead_socket); 485 iounmap(skt->virt_io + (u32)mips_io_port_base);
-1
drivers/pcmcia/au1000_generic.h
··· 23 24 /* include the world */ 25 26 - #include <pcmcia/cs.h> 27 #include <pcmcia/ss.h> 28 #include <pcmcia/cistpl.h> 29 #include "cs_internal.h"
··· 23 24 /* include the world */ 25 26 #include <pcmcia/ss.h> 27 #include <pcmcia/cistpl.h> 28 #include "cs_internal.h"
-1
drivers/pcmcia/au1000_pb1x00.c
··· 31 #include <linux/proc_fs.h> 32 #include <linux/types.h> 33 34 - #include <pcmcia/cs.h> 35 #include <pcmcia/ss.h> 36 #include <pcmcia/cistpl.h> 37
··· 31 #include <linux/proc_fs.h> 32 #include <linux/types.h> 33 34 #include <pcmcia/ss.h> 35 #include <pcmcia/cistpl.h> 36
-1
drivers/pcmcia/cistpl.c
··· 28 #include <asm/unaligned.h> 29 30 #include <pcmcia/ss.h> 31 - #include <pcmcia/cs.h> 32 #include <pcmcia/cisreg.h> 33 #include <pcmcia/cistpl.h> 34 #include "cs_internal.h"
··· 28 #include <asm/unaligned.h> 29 30 #include <pcmcia/ss.h> 31 #include <pcmcia/cisreg.h> 32 #include <pcmcia/cistpl.h> 33 #include "cs_internal.h"
+1 -2
drivers/pcmcia/cs.c
··· 33 #include <asm/irq.h> 34 35 #include <pcmcia/ss.h> 36 - #include <pcmcia/cs.h> 37 #include <pcmcia/cistpl.h> 38 #include <pcmcia/cisreg.h> 39 #include <pcmcia/ds.h> ··· 844 return __pcmcia_pm_op(dev, socket_early_resume); 845 } 846 847 - static int pcmcia_socket_dev_resume(struct device *dev) 848 { 849 return __pcmcia_pm_op(dev, socket_late_resume); 850 }
··· 33 #include <asm/irq.h> 34 35 #include <pcmcia/ss.h> 36 #include <pcmcia/cistpl.h> 37 #include <pcmcia/cisreg.h> 38 #include <pcmcia/ds.h> ··· 845 return __pcmcia_pm_op(dev, socket_early_resume); 846 } 847 848 + static int __used pcmcia_socket_dev_resume(struct device *dev) 849 { 850 return __pcmcia_pm_op(dev, socket_late_resume); 851 }
-9
drivers/pcmcia/cs_internal.h
··· 33 typedef struct config_t { 34 struct kref ref; 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 42 struct resource io[MAX_IO_WIN]; /* io ports */ 43 struct resource mem[MAX_WIN]; /* mem areas */ 44 - 45 - struct { 46 - u_int Attributes; 47 - } irq; 48 } config_t; 49 50
··· 33 typedef struct config_t { 34 struct kref ref; 35 unsigned int state; 36 37 struct resource io[MAX_IO_WIN]; /* io ports */ 38 struct resource mem[MAX_WIN]; /* mem areas */ 39 } config_t; 40 41
+22 -15
drivers/pcmcia/ds.c
··· 26 #include <linux/dma-mapping.h> 27 #include <linux/slab.h> 28 29 - #include <pcmcia/cs.h> 30 #include <pcmcia/cistpl.h> 31 #include <pcmcia/ds.h> 32 #include <pcmcia/ss.h> ··· 51 52 if (!p_drv->probe || !p_drv->remove) 53 printk(KERN_DEBUG "pcmcia: %s lacks a requisite callback " 54 - "function\n", p_drv->drv.name); 55 56 while (did && did->match_flags) { 57 for (i = 0; i < 4; i++) { ··· 64 65 printk(KERN_DEBUG "pcmcia: %s: invalid hash for " 66 "product string \"%s\": is 0x%x, should " 67 - "be 0x%x\n", p_drv->drv.name, did->prod_id[i], 68 did->prod_id_hash[i], hash); 69 printk(KERN_DEBUG "pcmcia: see " 70 "Documentation/pcmcia/devicetable.txt for " ··· 179 /* initialize common fields */ 180 driver->drv.bus = &pcmcia_bus_type; 181 driver->drv.owner = driver->owner; 182 mutex_init(&driver->dynids.lock); 183 INIT_LIST_HEAD(&driver->dynids.list); 184 185 - pr_debug("registering driver %s\n", driver->drv.name); 186 187 error = driver_register(&driver->drv); 188 if (error < 0) ··· 203 */ 204 void pcmcia_unregister_driver(struct pcmcia_driver *driver) 205 { 206 - pr_debug("unregistering driver %s\n", driver->drv.name); 207 driver_unregister(&driver->drv); 208 pcmcia_free_dynids(driver); 209 } ··· 264 p_drv = to_pcmcia_drv(dev->driver); 265 s = p_dev->socket; 266 267 - dev_dbg(dev, "trying to bind to %s\n", p_drv->drv.name); 268 269 if ((!p_drv->probe) || (!p_dev->function_config) || 270 (!try_module_get(p_drv->owner))) { ··· 276 ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG, 277 &cis_config); 278 if (!ret) { 279 - p_dev->conf.ConfigBase = cis_config.base; 280 - p_dev->conf.Present = cis_config.rmask[0]; 281 } else { 282 dev_printk(KERN_INFO, dev, 283 "pcmcia: could not parse base and rmask0 of CIS\n"); 284 - p_dev->conf.ConfigBase = 0; 285 - p_dev->conf.Present = 0; 286 } 287 288 ret = p_drv->probe(p_dev); 289 if (ret) { 290 dev_dbg(dev, "binding to %s failed with %d\n", 291 - p_drv->drv.name, ret); 292 goto put_module; 293 } 294 295 mutex_lock(&s->ops_mutex); 296 if ((s->pcmcia_pfc) && ··· 381 if (p_dev->_irq || p_dev->_io || p_dev->_locked) 382 dev_printk(KERN_INFO, dev, 383 "pcmcia: driver %s did not release config properly\n", 384 - p_drv->drv.name); 385 386 for (i = 0; i < MAX_WIN; i++) 387 if (p_dev->_win & CLIENT_WIN_REQ(i)) 388 dev_printk(KERN_INFO, dev, 389 "pcmcia: driver %s did not release window properly\n", 390 - p_drv->drv.name); 391 392 /* references from pcmcia_probe_device */ 393 pcmcia_put_dev(p_dev); ··· 1143 dev_printk(KERN_ERR, dev, 1144 "pcmcia: device %s (driver %s) did " 1145 "not want to go to sleep (%d)\n", 1146 - p_dev->devname, p_drv->drv.name, ret); 1147 mutex_lock(&p_dev->socket->ops_mutex); 1148 p_dev->suspended = 0; 1149 mutex_unlock(&p_dev->socket->ops_mutex); ··· 1185 1186 if (p_dev->device_no == p_dev->func) { 1187 dev_dbg(dev, "requesting configuration\n"); 1188 - ret = pcmcia_request_configuration(p_dev, &p_dev->conf); 1189 if (ret) 1190 goto out; 1191 }
··· 26 #include <linux/dma-mapping.h> 27 #include <linux/slab.h> 28 29 #include <pcmcia/cistpl.h> 30 #include <pcmcia/ds.h> 31 #include <pcmcia/ss.h> ··· 52 53 if (!p_drv->probe || !p_drv->remove) 54 printk(KERN_DEBUG "pcmcia: %s lacks a requisite callback " 55 + "function\n", p_drv->name); 56 57 while (did && did->match_flags) { 58 for (i = 0; i < 4; i++) { ··· 65 66 printk(KERN_DEBUG "pcmcia: %s: invalid hash for " 67 "product string \"%s\": is 0x%x, should " 68 + "be 0x%x\n", p_drv->name, did->prod_id[i], 69 did->prod_id_hash[i], hash); 70 printk(KERN_DEBUG "pcmcia: see " 71 "Documentation/pcmcia/devicetable.txt for " ··· 180 /* initialize common fields */ 181 driver->drv.bus = &pcmcia_bus_type; 182 driver->drv.owner = driver->owner; 183 + driver->drv.name = driver->name; 184 mutex_init(&driver->dynids.lock); 185 INIT_LIST_HEAD(&driver->dynids.list); 186 187 + pr_debug("registering driver %s\n", driver->name); 188 189 error = driver_register(&driver->drv); 190 if (error < 0) ··· 203 */ 204 void pcmcia_unregister_driver(struct pcmcia_driver *driver) 205 { 206 + pr_debug("unregistering driver %s\n", driver->name); 207 driver_unregister(&driver->drv); 208 pcmcia_free_dynids(driver); 209 } ··· 264 p_drv = to_pcmcia_drv(dev->driver); 265 s = p_dev->socket; 266 267 + dev_dbg(dev, "trying to bind to %s\n", p_drv->name); 268 269 if ((!p_drv->probe) || (!p_dev->function_config) || 270 (!try_module_get(p_drv->owner))) { ··· 276 ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG, 277 &cis_config); 278 if (!ret) { 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); 283 } else { 284 dev_printk(KERN_INFO, dev, 285 "pcmcia: could not parse base and rmask0 of CIS\n"); 286 + p_dev->config_base = 0; 287 + p_dev->config_regs = 0; 288 } 289 290 ret = p_drv->probe(p_dev); 291 if (ret) { 292 dev_dbg(dev, "binding to %s failed with %d\n", 293 + p_drv->name, ret); 294 goto put_module; 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]); 301 302 mutex_lock(&s->ops_mutex); 303 if ((s->pcmcia_pfc) && ··· 374 if (p_dev->_irq || p_dev->_io || p_dev->_locked) 375 dev_printk(KERN_INFO, dev, 376 "pcmcia: driver %s did not release config properly\n", 377 + p_drv->name); 378 379 for (i = 0; i < MAX_WIN; i++) 380 if (p_dev->_win & CLIENT_WIN_REQ(i)) 381 dev_printk(KERN_INFO, dev, 382 "pcmcia: driver %s did not release window properly\n", 383 + p_drv->name); 384 385 /* references from pcmcia_probe_device */ 386 pcmcia_put_dev(p_dev); ··· 1136 dev_printk(KERN_ERR, dev, 1137 "pcmcia: device %s (driver %s) did " 1138 "not want to go to sleep (%d)\n", 1139 + p_dev->devname, p_drv->name, ret); 1140 mutex_lock(&p_dev->socket->ops_mutex); 1141 p_dev->suspended = 0; 1142 mutex_unlock(&p_dev->socket->ops_mutex); ··· 1178 1179 if (p_dev->device_no == p_dev->func) { 1180 dev_dbg(dev, "requesting configuration\n"); 1181 + ret = pcmcia_enable_device(p_dev); 1182 if (ret) 1183 goto out; 1184 }
-1
drivers/pcmcia/i82092.c
··· 16 #include <linux/device.h> 17 18 #include <pcmcia/ss.h> 19 - #include <pcmcia/cs.h> 20 21 #include <asm/system.h> 22 #include <asm/io.h>
··· 16 #include <linux/device.h> 17 18 #include <pcmcia/ss.h> 19 20 #include <asm/system.h> 21 #include <asm/io.h>
-1
drivers/pcmcia/i82365.c
··· 51 #include <asm/system.h> 52 53 #include <pcmcia/ss.h> 54 - #include <pcmcia/cs.h> 55 56 #include <linux/isapnp.h> 57
··· 51 #include <asm/system.h> 52 53 #include <pcmcia/ss.h> 54 55 #include <linux/isapnp.h> 56
-1
drivers/pcmcia/m32r_cfc.c
··· 27 #include <asm/system.h> 28 29 #include <pcmcia/ss.h> 30 - #include <pcmcia/cs.h> 31 32 #undef MAX_IO_WIN /* FIXME */ 33 #define MAX_IO_WIN 1
··· 27 #include <asm/system.h> 28 29 #include <pcmcia/ss.h> 30 31 #undef MAX_IO_WIN /* FIXME */ 32 #define MAX_IO_WIN 1
-1
drivers/pcmcia/m32r_pcc.c
··· 28 #include <asm/addrspace.h> 29 30 #include <pcmcia/ss.h> 31 - #include <pcmcia/cs.h> 32 33 /* XXX: should be moved into asm/irq.h */ 34 #define PCC0_IRQ 24
··· 28 #include <asm/addrspace.h> 29 30 #include <pcmcia/ss.h> 31 32 /* XXX: should be moved into asm/irq.h */ 33 #define PCC0_IRQ 24
-1
drivers/pcmcia/m8xx_pcmcia.c
··· 59 #include <asm/irq.h> 60 #include <asm/fs_pd.h> 61 62 - #include <pcmcia/cs.h> 63 #include <pcmcia/ss.h> 64 65 #define pcmcia_info(args...) printk(KERN_INFO "m8xx_pcmcia: "args)
··· 59 #include <asm/irq.h> 60 #include <asm/fs_pd.h> 61 62 #include <pcmcia/ss.h> 63 64 #define pcmcia_info(args...) printk(KERN_INFO "m8xx_pcmcia: "args)
+2 -2
drivers/pcmcia/o2micro.h
··· 153 154 if (use_speedup) { 155 dev_info(&socket->dev->dev, 156 - "O2: enabling read prefetch/write burst\n"); 157 config_writeb(socket, O2_RESERVED1, 158 a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST); 159 config_writeb(socket, O2_RESERVED2, 160 b | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST); 161 } else { 162 dev_info(&socket->dev->dev, 163 - "O2: disabling read prefetch/write burst\n"); 164 config_writeb(socket, O2_RESERVED1, 165 a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST)); 166 config_writeb(socket, O2_RESERVED2,
··· 153 154 if (use_speedup) { 155 dev_info(&socket->dev->dev, 156 + "O2: enabling read prefetch/write burst. If you experience problems or performance issues, use the yenta_socket parameter 'o2_speedup=off'\n"); 157 config_writeb(socket, O2_RESERVED1, 158 a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST); 159 config_writeb(socket, O2_RESERVED2, 160 b | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST); 161 } else { 162 dev_info(&socket->dev->dev, 163 + "O2: disabling read prefetch/write burst. If you experience problems or performance issues, use the yenta_socket parameter 'o2_speedup=on'\n"); 164 config_writeb(socket, O2_RESERVED1, 165 a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST)); 166 config_writeb(socket, O2_RESERVED2,
+100 -17
drivers/pcmcia/pcmcia_cis.c
··· 6 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 7 * 8 * Copyright (C) 1999 David A. Hinds 9 - * Copyright (C) 2004-2009 Dominik Brodowski 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License version 2 as ··· 22 #include <pcmcia/cisreg.h> 23 #include <pcmcia/cistpl.h> 24 #include <pcmcia/ss.h> 25 - #include <pcmcia/cs.h> 26 #include <pcmcia/ds.h> 27 #include "cs_internal.h" 28 ··· 125 return ret; 126 } 127 128 struct pcmcia_cfg_mem { 129 struct pcmcia_device *p_dev; 130 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 cisparse_t parse; 137 cistpl_cftable_entry_t dflt; 138 }; ··· 156 */ 157 static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv) 158 { 159 - cistpl_cftable_entry_t *cfg = &parse->cftable_entry; 160 struct pcmcia_cfg_mem *cfg_mem = priv; 161 162 /* default values */ 163 - cfg_mem->p_dev->conf.ConfigIndex = cfg->index; 164 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) 165 cfg_mem->dflt = *cfg; 166 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); 170 } 171 172 /** 173 * pcmcia_loop_config() - loop over configuration options 174 * @p_dev: the struct pcmcia_device which we need to loop for. 175 * @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 178 * being passed to pcmcia_loop_config() 179 * @priv_data: private data to be passed to the conf_check function. 180 * ··· 261 */ 262 int pcmcia_loop_config(struct pcmcia_device *p_dev, 263 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 void *priv_data), 268 void *priv_data) 269 {
··· 6 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 7 * 8 * Copyright (C) 1999 David A. Hinds 9 + * Copyright (C) 2004-2010 Dominik Brodowski 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License version 2 as ··· 22 #include <pcmcia/cisreg.h> 23 #include <pcmcia/cistpl.h> 24 #include <pcmcia/ss.h> 25 #include <pcmcia/ds.h> 26 #include "cs_internal.h" 27 ··· 126 return ret; 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 + 143 struct pcmcia_cfg_mem { 144 struct pcmcia_device *p_dev; 145 + int (*conf_check) (struct pcmcia_device *p_dev, void *priv_data); 146 void *priv_data; 147 cisparse_t parse; 148 cistpl_cftable_entry_t dflt; 149 }; ··· 147 */ 148 static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv) 149 { 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); 159 160 /* default values */ 161 + cfg_mem->p_dev->config_index = cfg->index; 162 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) 163 cfg_mem->dflt = *cfg; 164 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); 239 } 240 241 /** 242 * pcmcia_loop_config() - loop over configuration options 243 * @p_dev: the struct pcmcia_device which we need to loop for. 244 * @conf_check: function to call for each configuration option. 245 + * It gets passed the struct pcmcia_device and private data 246 * being passed to pcmcia_loop_config() 247 * @priv_data: private data to be passed to the conf_check function. 248 * ··· 175 */ 176 int pcmcia_loop_config(struct pcmcia_device *p_dev, 177 int (*conf_check) (struct pcmcia_device *p_dev, 178 void *priv_data), 179 void *priv_data) 180 {
+252 -167
drivers/pcmcia/pcmcia_resource.c
··· 6 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 7 * 8 * Copyright (C) 1999 David A. Hinds 9 - * Copyright (C) 2004-2005 Dominik Brodowski 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License version 2 as ··· 26 #include <asm/irq.h> 27 28 #include <pcmcia/ss.h> 29 - #include <pcmcia/cs.h> 30 #include <pcmcia/cistpl.h> 31 #include <pcmcia/cisreg.h> 32 #include <pcmcia/ds.h> ··· 55 } 56 57 58 static void release_io_space(struct pcmcia_socket *s, struct resource *res) 59 { 60 resource_size_t num = resource_size(res); ··· 86 } 87 } 88 } 89 - } /* release_io_space */ 90 91 - /** alloc_io_space 92 * 93 * Special stuff for managing IO windows, because they are scarce 94 */ ··· 145 } 146 dev_dbg(&s->dev, "alloc_io_space request result %d: %pR\n", ret, res); 147 return ret; 148 - } /* alloc_io_space */ 149 150 151 /** ··· 178 return -EACCES; 179 } 180 181 - addr = (c->ConfigBase + where) >> 1; 182 183 ret = accessf(s, 1, addr, 1, val); 184 185 mutex_unlock(&s->ops_mutex); 186 187 return ret; 188 - } /* pcmcia_access_config */ 189 190 191 /** ··· 214 EXPORT_SYMBOL(pcmcia_write_config_byte); 215 216 217 - int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, 218 unsigned int offset) 219 { 220 struct pcmcia_socket *s = p_dev->socket; 221 - struct resource *res = wh; 222 unsigned int w; 223 int ret; 224 ··· 242 dev_warn(&p_dev->dev, "failed to set_mem_map\n"); 243 mutex_unlock(&s->ops_mutex); 244 return ret; 245 - } /* pcmcia_map_mem_page */ 246 EXPORT_SYMBOL(pcmcia_map_mem_page); 247 248 249 - /** pcmcia_modify_configuration 250 * 251 - * Modify a locked socket configuration 252 */ 253 - int pcmcia_modify_configuration(struct pcmcia_device *p_dev, 254 - modconf_t *mod) 255 { 256 - struct pcmcia_socket *s; 257 - config_t *c; 258 - int ret; 259 - 260 - s = p_dev->socket; 261 262 mutex_lock(&s->ops_mutex); 263 - c = p_dev->function_config; 264 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"); 272 ret = -EACCES; 273 goto unlock; 274 } 275 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; 281 } 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 unlock: 330 mutex_unlock(&s->ops_mutex); 331 332 return ret; 333 - } /* modify_configuration */ 334 - EXPORT_SYMBOL(pcmcia_modify_configuration); 335 336 337 int pcmcia_release_configuration(struct pcmcia_device *p_dev) 338 { 339 pccard_io_map io = { 0, 0, 0, 0, 1 }; ··· 359 if (p_dev->_locked) { 360 p_dev->_locked = 0; 361 if (--(s->lock_count) == 0) { 362 - s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ 363 s->socket.Vpp = 0; 364 s->socket.io_irq = 0; 365 s->ops->set_socket(s, &s->socket); ··· 381 mutex_unlock(&s->ops_mutex); 382 383 return 0; 384 - } /* pcmcia_release_configuration */ 385 386 387 - /** pcmcia_release_io 388 * 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. 394 */ 395 static int pcmcia_release_io(struct pcmcia_device *p_dev) 396 { ··· 421 } /* pcmcia_release_io */ 422 423 424 int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) 425 { 426 struct pcmcia_socket *s = p_dev->socket; ··· 462 kfree(win->res); 463 win->res = NULL; 464 } 465 p_dev->_win &= ~CLIENT_WIN_REQ(w); 466 mutex_unlock(&s->ops_mutex); 467 ··· 472 EXPORT_SYMBOL(pcmcia_release_window); 473 474 475 - int pcmcia_request_configuration(struct pcmcia_device *p_dev, 476 - config_req_t *req) 477 { 478 int i; 479 - u_int base; 480 struct pcmcia_socket *s = p_dev->socket; 481 config_t *c; 482 pccard_io_map iomap; 483 484 if (!(s->state & SOCKET_PRESENT)) 485 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 492 mutex_lock(&s->ops_mutex); 493 c = p_dev->function_config; ··· 505 } 506 507 /* Do power control. We don't allow changes in Vcc. */ 508 - s->socket.Vpp = req->Vpp; 509 if (s->ops->set_socket(s, &s->socket)) { 510 mutex_unlock(&s->ops_mutex); 511 dev_printk(KERN_WARNING, &p_dev->dev, ··· 514 } 515 516 /* 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) 520 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) 526 s->socket.flags |= SS_SPKR_ENA; 527 - if (req->Attributes & CONF_ENABLE_IRQ) 528 s->socket.io_irq = s->pcmcia_irq; 529 else 530 s->socket.io_irq = 0; 531 s->ops->set_socket(s, &s->socket); 532 s->lock_count++; 533 534 /* 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); 540 } 541 - if (req->Present & PRESENT_OPTION) { 542 if (s->functions == 1) { 543 - c->Option = req->ConfigIndex & COR_CONFIG_MASK; 544 } 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; 549 } 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); 554 mdelay(40); 555 } 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) { 569 u8 b = c->io[0].start & 0xff; 570 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); 571 b = (c->io[0].start >> 8) & 0xff; 572 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b); 573 } 574 - if (req->Present & PRESENT_IOSIZE) { 575 u8 b = resource_size(&c->io[0]) + resource_size(&c->io[1]) - 1; 576 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b); 577 } ··· 610 p_dev->_locked = 1; 611 mutex_unlock(&s->ops_mutex); 612 return 0; 613 - } /* pcmcia_request_configuration */ 614 - EXPORT_SYMBOL(pcmcia_request_configuration); 615 616 617 /** 618 * pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices 619 * 620 - * pcmcia_request_io() attepts to reserve the IO port ranges specified in 621 * &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The 622 * "start" value is the requested start of the IO port resource; "end" 623 * reflects the number of ports requested. The number of IO lines requested ··· 682 683 /** 684 * pcmcia_request_irq() - attempt to request a IRQ for a PCMCIA device 685 * 686 - * pcmcia_request_irq() is a wrapper around request_irq which will allow 687 * the PCMCIA core to clean up the registration in pcmcia_disable_device(). 688 * 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 690 * handlers are allowed. 691 */ 692 int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, ··· 711 712 /** 713 * pcmcia_request_exclusive_irq() - attempt to request an exclusive IRQ first 714 * 715 - * pcmcia_request_exclusive_irq() is a wrapper around request_irq which 716 * attempts first to request an exclusive IRQ. If it fails, it also accepts 717 * a shared IRQ, but prints out a warning. PCMCIA drivers should allow for 718 * IRQ sharing and either use request_irq directly (then they need to call 719 - * free_irq themselves, too), or the pcmcia_request_irq() function. 720 */ 721 int __must_check 722 __pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev, ··· 859 } 860 861 862 - /** pcmcia_request_window 863 * 864 - * Request_window() establishes a mapping between card memory space 865 - * and system memory space. 866 */ 867 - int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_handle_t *wh) 868 { 869 struct pcmcia_socket *s = p_dev->socket; 870 pccard_mem_map *win; 871 u_long align; 872 - struct resource *res; 873 int w; 874 875 if (!(s->state & SOCKET_PRESENT)) { 876 dev_dbg(&p_dev->dev, "No card present\n"); ··· 887 } 888 889 /* 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)) { 894 dev_dbg(&p_dev->dev, "invalid map size\n"); 895 return -EINVAL; 896 } 897 - if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || 898 - (req->Base & (align-1))) { 899 dev_dbg(&p_dev->dev, "invalid base address\n"); 900 return -EINVAL; 901 } 902 - if (req->Base) 903 align = 0; 904 905 /* Allocate system memory window */ ··· 916 win = &s->win[w]; 917 918 if (!(s->features & SS_CAP_STATIC_MAP)) { 919 - win->res = pcmcia_find_mem_region(req->Base, req->Size, align, 920 0, s); 921 if (!win->res) { 922 dev_dbg(&p_dev->dev, "allocating mem region failed\n"); ··· 928 929 /* Configure the socket controller */ 930 win->map = w+1; 931 - win->flags = req->Attributes; 932 - win->speed = req->AccessSpeed; 933 win->card_start = 0; 934 935 if (s->ops->set_mem_map(s, win) != 0) { ··· 941 942 /* Return window handle */ 943 if (s->features & SS_CAP_STATIC_MAP) 944 - req->Base = win->static_start; 945 else 946 - req->Base = win->res->start; 947 948 /* 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; 955 res->parent = win->res; 956 if (win->res) 957 request_resource(&iomem_resource, res); ··· 956 dev_dbg(&p_dev->dev, "request_window results in %pR\n", res); 957 958 mutex_unlock(&s->ops_mutex); 959 - *wh = res; 960 961 return 0; 962 } /* pcmcia_request_window */ 963 EXPORT_SYMBOL(pcmcia_request_window); 964 965 void pcmcia_disable_device(struct pcmcia_device *p_dev) 966 { 967 int i; 968 for (i = 0; i < MAX_WIN; i++) { 969 struct resource *res = p_dev->resource[MAX_IO_WIN + i]; 970 if (res->flags & WIN_FLAGS_REQ)
··· 6 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 7 * 8 * Copyright (C) 1999 David A. Hinds 9 + * Copyright (C) 2004-2010 Dominik Brodowski 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License version 2 as ··· 26 #include <asm/irq.h> 27 28 #include <pcmcia/ss.h> 29 #include <pcmcia/cistpl.h> 30 #include <pcmcia/cisreg.h> 31 #include <pcmcia/ds.h> ··· 56 } 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 + */ 65 static void release_io_space(struct pcmcia_socket *s, struct resource *res) 66 { 67 resource_size_t num = resource_size(res); ··· 81 } 82 } 83 } 84 + } 85 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 * 93 * Special stuff for managing IO windows, because they are scarce 94 */ ··· 135 } 136 dev_dbg(&s->dev, "alloc_io_space request result %d: %pR\n", ret, res); 137 return ret; 138 + } 139 140 141 /** ··· 168 return -EACCES; 169 } 170 171 + addr = (p_dev->config_base + where) >> 1; 172 173 ret = accessf(s, 1, addr, 1, val); 174 175 mutex_unlock(&s->ops_mutex); 176 177 return ret; 178 + } 179 180 181 /** ··· 204 EXPORT_SYMBOL(pcmcia_write_config_byte); 205 206 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 unsigned int offset) 219 { 220 struct pcmcia_socket *s = p_dev->socket; 221 unsigned int w; 222 int ret; 223 ··· 223 dev_warn(&p_dev->dev, "failed to set_mem_map\n"); 224 mutex_unlock(&s->ops_mutex); 225 return ret; 226 + } 227 EXPORT_SYMBOL(pcmcia_map_mem_page); 228 229 230 + /** 231 + * pcmcia_fixup_iowidth() - reduce io width to 8bit 232 + * @p_dev: pcmcia device 233 * 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. 237 */ 238 + int pcmcia_fixup_iowidth(struct pcmcia_device *p_dev) 239 { 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; 244 245 mutex_lock(&s->ops_mutex); 246 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"); 252 ret = -EACCES; 253 goto unlock; 254 } 255 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); 270 } 271 unlock: 272 mutex_unlock(&s->ops_mutex); 273 274 return ret; 275 + } 276 + EXPORT_SYMBOL(pcmcia_fixup_iowidth); 277 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 + */ 331 int pcmcia_release_configuration(struct pcmcia_device *p_dev) 332 { 333 pccard_io_map io = { 0, 0, 0, 0, 1 }; ··· 327 if (p_dev->_locked) { 328 p_dev->_locked = 0; 329 if (--(s->lock_count) == 0) { 330 + s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ 331 s->socket.Vpp = 0; 332 s->socket.io_irq = 0; 333 s->ops->set_socket(s, &s->socket); ··· 349 mutex_unlock(&s->ops_mutex); 350 351 return 0; 352 + } 353 354 355 + /** 356 + * pcmcia_release_io() - release I/O allocated by a PCMCIA device 357 + * @p_dev: pcmcia device 358 * 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. 364 */ 365 static int pcmcia_release_io(struct pcmcia_device *p_dev) 366 { ··· 387 } /* pcmcia_release_io */ 388 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 + */ 398 int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) 399 { 400 struct pcmcia_socket *s = p_dev->socket; ··· 420 kfree(win->res); 421 win->res = NULL; 422 } 423 + res->start = res->end = 0; 424 + res->flags = IORESOURCE_MEM; 425 p_dev->_win &= ~CLIENT_WIN_REQ(w); 426 mutex_unlock(&s->ops_mutex); 427 ··· 428 EXPORT_SYMBOL(pcmcia_release_window); 429 430 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) 441 { 442 int i; 443 + unsigned int base; 444 struct pcmcia_socket *s = p_dev->socket; 445 config_t *c; 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; 451 452 if (!(s->state & SOCKET_PRESENT)) 453 return -ENODEV; 454 455 mutex_lock(&s->ops_mutex); 456 c = p_dev->function_config; ··· 454 } 455 456 /* Do power control. We don't allow changes in Vcc. */ 457 + s->socket.Vpp = p_dev->vpp; 458 if (s->ops->set_socket(s, &s->socket)) { 459 mutex_unlock(&s->ops_mutex); 460 dev_printk(KERN_WARNING, &p_dev->dev, ··· 463 } 464 465 /* Pick memory or I/O card, DMA mode, interrupt */ 466 + if (p_dev->_io) 467 s->socket.flags |= SS_IOCARD; 468 + if (flags & CONF_ENABLE_SPKR) { 469 s->socket.flags |= SS_SPKR_ENA; 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) 476 s->socket.io_irq = s->pcmcia_irq; 477 else 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 + } 483 s->ops->set_socket(s, &s->socket); 484 s->lock_count++; 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 + 491 /* Set up CIS configuration registers */ 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); 497 } 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) { 504 if (s->functions == 1) { 505 + option = p_dev->config_index & COR_CONFIG_MASK; 506 } else { 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; 511 } 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); 516 mdelay(40); 517 } 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) { 526 u8 b = c->io[0].start & 0xff; 527 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); 528 b = (c->io[0].start >> 8) & 0xff; 529 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b); 530 } 531 + if (p_dev->config_regs & PRESENT_IOSIZE) { 532 u8 b = resource_size(&c->io[0]) + resource_size(&c->io[1]) - 1; 533 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b); 534 } ··· 551 p_dev->_locked = 1; 552 mutex_unlock(&s->ops_mutex); 553 return 0; 554 + } /* pcmcia_enable_device */ 555 + EXPORT_SYMBOL(pcmcia_enable_device); 556 557 558 /** 559 * pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices 560 + * @p_dev: the associated PCMCIA device 561 * 562 + * pcmcia_request_io() attempts to reserve the IO port ranges specified in 563 * &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The 564 * "start" value is the requested start of the IO port resource; "end" 565 * reflects the number of ports requested. The number of IO lines requested ··· 622 623 /** 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 627 * 628 + * pcmcia_request_irq() is a wrapper around request_irq() which allows 629 * the PCMCIA core to clean up the registration in pcmcia_disable_device(). 630 * Drivers are free to use request_irq() directly, but then they need to 631 + * call free_irq() themselfves, too. Also, only %IRQF_SHARED capable IRQ 632 * handlers are allowed. 633 */ 634 int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, ··· 649 650 /** 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 654 * 655 + * pcmcia_request_exclusive_irq() is a wrapper around request_irq() which 656 * attempts first to request an exclusive IRQ. If it fails, it also accepts 657 * a shared IRQ, but prints out a warning. PCMCIA drivers should allow for 658 * IRQ sharing and either use request_irq directly (then they need to call 659 + * free_irq() themselves, too), or the pcmcia_request_irq() function. 660 */ 661 int __must_check 662 __pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev, ··· 795 } 796 797 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 803 * 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. 809 */ 810 + int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, 811 + unsigned int speed) 812 { 813 struct pcmcia_socket *s = p_dev->socket; 814 pccard_mem_map *win; 815 u_long align; 816 int w; 817 + 818 + dev_dbg(&p_dev->dev, "request_window %pR %d\n", res, speed); 819 820 if (!(s->state & SOCKET_PRESENT)) { 821 dev_dbg(&p_dev->dev, "No card present\n"); ··· 814 } 815 816 /* Window size defaults to smallest available */ 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)) { 821 dev_dbg(&p_dev->dev, "invalid map size\n"); 822 return -EINVAL; 823 } 824 + if ((res->start && (s->features & SS_CAP_STATIC_MAP)) || 825 + (res->start & (align-1))) { 826 dev_dbg(&p_dev->dev, "invalid base address\n"); 827 return -EINVAL; 828 } 829 + if (res->start) 830 align = 0; 831 832 /* Allocate system memory window */ ··· 843 win = &s->win[w]; 844 845 if (!(s->features & SS_CAP_STATIC_MAP)) { 846 + win->res = pcmcia_find_mem_region(res->start, res->end, align, 847 0, s); 848 if (!win->res) { 849 dev_dbg(&p_dev->dev, "allocating mem region failed\n"); ··· 855 856 /* Configure the socket controller */ 857 win->map = w+1; 858 + win->flags = res->flags & WIN_FLAGS_MAP; 859 + win->speed = speed; 860 win->card_start = 0; 861 862 if (s->ops->set_mem_map(s, win) != 0) { ··· 868 869 /* Return window handle */ 870 if (s->features & SS_CAP_STATIC_MAP) 871 + res->start = win->static_start; 872 else 873 + res->start = win->res->start; 874 875 /* convert to new-style resources */ 876 + res->end += res->start - 1; 877 + res->flags &= ~WIN_FLAGS_REQ; 878 + res->flags |= (win->map << 2) | IORESOURCE_MEM; 879 res->parent = win->res; 880 if (win->res) 881 request_resource(&iomem_resource, res); ··· 886 dev_dbg(&p_dev->dev, "request_window results in %pR\n", res); 887 888 mutex_unlock(&s->ops_mutex); 889 890 return 0; 891 } /* pcmcia_request_window */ 892 EXPORT_SYMBOL(pcmcia_request_window); 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 + */ 907 void pcmcia_disable_device(struct pcmcia_device *p_dev) 908 { 909 int i; 910 + 911 + dev_dbg(&p_dev->dev, "disabling device\n"); 912 + 913 for (i = 0; i < MAX_WIN; i++) { 914 struct resource *res = p_dev->resource[MAX_IO_WIN + i]; 915 if (res->flags & WIN_FLAGS_REQ)
-1
drivers/pcmcia/pd6729.c
··· 18 #include <linux/io.h> 19 20 #include <pcmcia/ss.h> 21 - #include <pcmcia/cs.h> 22 23 #include <asm/system.h> 24
··· 18 #include <linux/io.h> 19 20 #include <pcmcia/ss.h> 21 22 #include <asm/system.h> 23
-1
drivers/pcmcia/rsrc_iodyn.c
··· 17 #include <linux/kernel.h> 18 19 #include <pcmcia/ss.h> 20 - #include <pcmcia/cs.h> 21 #include <pcmcia/cistpl.h> 22 #include "cs_internal.h" 23
··· 17 #include <linux/kernel.h> 18 19 #include <pcmcia/ss.h> 20 #include <pcmcia/cistpl.h> 21 #include "cs_internal.h" 22
-1
drivers/pcmcia/rsrc_mgr.c
··· 17 #include <linux/kernel.h> 18 19 #include <pcmcia/ss.h> 20 - #include <pcmcia/cs.h> 21 #include <pcmcia/cistpl.h> 22 #include "cs_internal.h" 23
··· 17 #include <linux/kernel.h> 18 19 #include <pcmcia/ss.h> 20 #include <pcmcia/cistpl.h> 21 #include "cs_internal.h" 22
-1
drivers/pcmcia/rsrc_nonstatic.c
··· 29 #include <asm/irq.h> 30 31 #include <pcmcia/ss.h> 32 - #include <pcmcia/cs.h> 33 #include <pcmcia/cistpl.h> 34 #include "cs_internal.h" 35
··· 29 #include <asm/irq.h> 30 31 #include <pcmcia/ss.h> 32 #include <pcmcia/cistpl.h> 33 #include "cs_internal.h" 34
-1
drivers/pcmcia/sa1100_generic.c
··· 35 #include <linux/slab.h> 36 #include <linux/platform_device.h> 37 38 - #include <pcmcia/cs.h> 39 #include <pcmcia/ss.h> 40 41 #include <asm/hardware/scoop.h>
··· 35 #include <linux/slab.h> 36 #include <linux/platform_device.h> 37 38 #include <pcmcia/ss.h> 39 40 #include <asm/hardware/scoop.h>
-4
drivers/pcmcia/soc_common.c
··· 627 628 pcmcia_unregister_socket(&skt->socket); 629 630 - flush_scheduled_work(); 631 - 632 skt->ops->hw_shutdown(skt); 633 634 soc_common_pcmcia_config_skt(skt, &dead_socket); ··· 718 pcmcia_unregister_socket(&skt->socket); 719 720 out_err_7: 721 - flush_scheduled_work(); 722 - 723 skt->ops->hw_shutdown(skt); 724 out_err_6: 725 list_del(&skt->node);
··· 627 628 pcmcia_unregister_socket(&skt->socket); 629 630 skt->ops->hw_shutdown(skt); 631 632 soc_common_pcmcia_config_skt(skt, &dead_socket); ··· 720 pcmcia_unregister_socket(&skt->socket); 721 722 out_err_7: 723 skt->ops->hw_shutdown(skt); 724 out_err_6: 725 list_del(&skt->node);
-1
drivers/pcmcia/soc_common.h
··· 11 12 /* include the world */ 13 #include <linux/cpufreq.h> 14 - #include <pcmcia/cs.h> 15 #include <pcmcia/ss.h> 16 #include <pcmcia/cistpl.h> 17
··· 11 12 /* include the world */ 13 #include <linux/cpufreq.h> 14 #include <pcmcia/ss.h> 15 #include <pcmcia/cistpl.h> 16
-1
drivers/pcmcia/socket_sysfs.c
··· 27 #include <asm/irq.h> 28 29 #include <pcmcia/ss.h> 30 - #include <pcmcia/cs.h> 31 #include <pcmcia/cistpl.h> 32 #include <pcmcia/cisreg.h> 33 #include <pcmcia/ds.h>
··· 27 #include <asm/irq.h> 28 29 #include <pcmcia/ss.h> 30 #include <pcmcia/cistpl.h> 31 #include <pcmcia/cisreg.h> 32 #include <pcmcia/ds.h>
-1
drivers/pcmcia/tcic.c
··· 49 #include <asm/io.h> 50 #include <asm/system.h> 51 52 - #include <pcmcia/cs.h> 53 #include <pcmcia/ss.h> 54 #include "tcic.h" 55
··· 49 #include <asm/io.h> 50 #include <asm/system.h> 51 52 #include <pcmcia/ss.h> 53 #include "tcic.h" 54
+39 -19
drivers/pcmcia/vrc4173_cardu.c
··· 461 { 462 vrc4173_socket_t *socket; 463 unsigned long start, len, flags; 464 - int slot, err; 465 466 slot = vrc4173_cardu_slots++; 467 socket = &cardu_sockets[slot]; ··· 474 return err; 475 476 start = pci_resource_start(dev, 0); 477 - if (start == 0) 478 - return -ENODEV; 479 480 len = pci_resource_len(dev, 0); 481 - if (len == 0) 482 - return -ENODEV; 483 484 - if (((flags = pci_resource_flags(dev, 0)) & IORESOURCE_MEM) == 0) 485 - return -EBUSY; 486 487 - if ((err = pci_request_regions(dev, socket->name)) < 0) 488 - return err; 489 490 socket->base = ioremap(start, len); 491 - if (socket->base == NULL) 492 - return -ENODEV; 493 494 socket->dev = dev; 495 496 socket->pcmcia_socket = pcmcia_register_socket(slot, &cardu_operations, 1); 497 if (socket->pcmcia_socket == NULL) { 498 - iounmap(socket->base); 499 - socket->base = NULL; 500 - return -ENOMEM; 501 } 502 503 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; 509 } 510 511 printk(KERN_INFO "%s at %#08lx, IRQ %d\n", socket->name, start, dev->irq); 512 513 return 0; 514 } 515 516 static int __devinit vrc4173_cardu_setup(char *options)
··· 461 { 462 vrc4173_socket_t *socket; 463 unsigned long start, len, flags; 464 + int slot, err, ret; 465 466 slot = vrc4173_cardu_slots++; 467 socket = &cardu_sockets[slot]; ··· 474 return err; 475 476 start = pci_resource_start(dev, 0); 477 + if (start == 0) { 478 + ret = -ENODEV; 479 + goto disable; 480 + } 481 482 len = pci_resource_len(dev, 0); 483 + if (len == 0) { 484 + ret = -ENODEV; 485 + goto disable; 486 + } 487 488 + flags = pci_resource_flags(dev, 0); 489 + if ((flags & IORESOURCE_MEM) == 0) { 490 + ret = -EBUSY; 491 + goto disable; 492 + } 493 494 + err = pci_request_regions(dev, socket->name); 495 + if (err < 0) { 496 + ret = err; 497 + goto disable; 498 + } 499 500 socket->base = ioremap(start, len); 501 + if (socket->base == NULL) { 502 + ret = -ENODEV; 503 + goto release; 504 + } 505 506 socket->dev = dev; 507 508 socket->pcmcia_socket = pcmcia_register_socket(slot, &cardu_operations, 1); 509 if (socket->pcmcia_socket == NULL) { 510 + ret = -ENOMEM; 511 + goto unmap; 512 } 513 514 if (request_irq(dev->irq, cardu_interrupt, IRQF_SHARED, socket->name, socket) < 0) { 515 + ret = -EBUSY; 516 + goto unregister; 517 } 518 519 printk(KERN_INFO "%s at %#08lx, IRQ %d\n", socket->name, start, dev->irq); 520 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; 534 } 535 536 static int __devinit vrc4173_cardu_setup(char *options)
-1
drivers/pcmcia/xxs1500_ss.c
··· 17 #include <linux/slab.h> 18 #include <linux/spinlock.h> 19 20 - #include <pcmcia/cs.h> 21 #include <pcmcia/ss.h> 22 #include <pcmcia/cistpl.h> 23
··· 17 #include <linux/slab.h> 18 #include <linux/spinlock.h> 19 20 #include <pcmcia/ss.h> 21 #include <pcmcia/cistpl.h> 22
-1
drivers/pcmcia/yenta_socket.c
··· 20 #include <linux/slab.h> 21 22 #include <pcmcia/ss.h> 23 - #include <pcmcia/cs.h> 24 25 #include "yenta_socket.h" 26 #include "i82365.h"
··· 20 #include <linux/slab.h> 21 22 #include <pcmcia/ss.h> 23 24 #include "yenta_socket.h" 25 #include "i82365.h"
+19 -29
drivers/scsi/pcmcia/aha152x_stub.c
··· 49 #include <scsi/scsi_host.h> 50 #include "aha152x.h" 51 52 - #include <pcmcia/cs.h> 53 #include <pcmcia/cistpl.h> 54 #include <pcmcia/ds.h> 55 ··· 85 static void aha152x_detach(struct pcmcia_device *p_dev); 86 static int aha152x_config_cs(struct pcmcia_device *link); 87 88 - static struct pcmcia_device *dev_list; 89 - 90 static int aha152x_probe(struct pcmcia_device *link) 91 { 92 scsi_info_t *info; ··· 97 info->p_dev = link; 98 link->priv = info; 99 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; 105 106 return aha152x_config_cs(link); 107 } /* aha152x_attach */ ··· 117 118 /*====================================================================*/ 119 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) 125 { 126 p_dev->io_lines = 10; 127 /* 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; 139 } 140 141 static int aha152x_config_cs(struct pcmcia_device *link) ··· 153 if (!link->irq) 154 goto failed; 155 156 - ret = pcmcia_request_configuration(link, &link->conf); 157 if (ret) 158 goto failed; 159 ··· 214 215 static struct pcmcia_driver aha152x_cs_driver = { 216 .owner = THIS_MODULE, 217 - .drv = { 218 - .name = "aha152x_cs", 219 - }, 220 .probe = aha152x_probe, 221 .remove = aha152x_detach, 222 .id_table = aha152x_ids, ··· 229 static void __exit exit_aha152x_cs(void) 230 { 231 pcmcia_unregister_driver(&aha152x_cs_driver); 232 - BUG_ON(dev_list != NULL); 233 } 234 235 module_init(init_aha152x_cs);
··· 49 #include <scsi/scsi_host.h> 50 #include "aha152x.h" 51 52 #include <pcmcia/cistpl.h> 53 #include <pcmcia/ds.h> 54 ··· 86 static void aha152x_detach(struct pcmcia_device *p_dev); 87 static int aha152x_config_cs(struct pcmcia_device *link); 88 89 static int aha152x_probe(struct pcmcia_device *link) 90 { 91 scsi_info_t *info; ··· 100 info->p_dev = link; 101 link->priv = info; 102 103 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 104 + link->config_regs = PRESENT_OPTION; 105 106 return aha152x_config_cs(link); 107 } /* aha152x_attach */ ··· 123 124 /*====================================================================*/ 125 126 + static int aha152x_config_check(struct pcmcia_device *p_dev, void *priv_data) 127 { 128 p_dev->io_lines = 10; 129 + 130 /* For New Media T&J, look for a SCSI window */ 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); 144 } 145 146 static int aha152x_config_cs(struct pcmcia_device *link) ··· 160 if (!link->irq) 161 goto failed; 162 163 + ret = pcmcia_enable_device(link); 164 if (ret) 165 goto failed; 166 ··· 221 222 static struct pcmcia_driver aha152x_cs_driver = { 223 .owner = THIS_MODULE, 224 + .name = "aha152x_cs", 225 .probe = aha152x_probe, 226 .remove = aha152x_detach, 227 .id_table = aha152x_ids, ··· 238 static void __exit exit_aha152x_cs(void) 239 { 240 pcmcia_unregister_driver(&aha152x_cs_driver); 241 } 242 243 module_init(init_aha152x_cs);
+8 -16
drivers/scsi/pcmcia/fdomain_stub.c
··· 46 #include <scsi/scsi_host.h> 47 #include "fdomain.h" 48 49 - #include <pcmcia/cs.h> 50 #include <pcmcia/cistpl.h> 51 #include <pcmcia/ds.h> 52 ··· 82 83 info->p_dev = link; 84 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; 90 91 return fdomain_config(link); 92 } /* fdomain_attach */ ··· 101 102 /*====================================================================*/ 103 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) 109 { 110 p_dev->io_lines = 10; 111 - p_dev->resource[0]->start = cfg->io.win[0].base; 112 return pcmcia_request_io(p_dev); 113 } 114 ··· 126 127 if (!link->irq) 128 goto failed; 129 - ret = pcmcia_request_configuration(link, &link->conf); 130 if (ret) 131 goto failed; 132 ··· 188 189 static struct pcmcia_driver fdomain_cs_driver = { 190 .owner = THIS_MODULE, 191 - .drv = { 192 - .name = "fdomain_cs", 193 - }, 194 .probe = fdomain_probe, 195 .remove = fdomain_detach, 196 .id_table = fdomain_ids,
··· 46 #include <scsi/scsi_host.h> 47 #include "fdomain.h" 48 49 #include <pcmcia/cistpl.h> 50 #include <pcmcia/ds.h> 51 ··· 83 84 info->p_dev = link; 85 link->priv = info; 86 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 87 + link->config_regs = PRESENT_OPTION; 88 89 return fdomain_config(link); 90 } /* fdomain_attach */ ··· 105 106 /*====================================================================*/ 107 108 + static int fdomain_config_check(struct pcmcia_device *p_dev, void *priv_data) 109 { 110 p_dev->io_lines = 10; 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; 114 return pcmcia_request_io(p_dev); 115 } 116 ··· 132 133 if (!link->irq) 134 goto failed; 135 + ret = pcmcia_enable_device(link); 136 if (ret) 137 goto failed; 138 ··· 194 195 static struct pcmcia_driver fdomain_cs_driver = { 196 .owner = THIS_MODULE, 197 + .name = "fdomain_cs", 198 .probe = fdomain_probe, 199 .remove = fdomain_detach, 200 .id_table = fdomain_ids,
+32 -150
drivers/scsi/pcmcia/nsp_cs.c
··· 47 #include <scsi/scsi.h> 48 #include <scsi/scsi_ioctl.h> 49 50 - #include <pcmcia/cs.h> 51 #include <pcmcia/cistpl.h> 52 #include <pcmcia/cisreg.h> 53 #include <pcmcia/ds.h> ··· 1530 PCMCIA functions 1531 **********************************************************************/ 1532 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 static int nsp_cs_probe(struct pcmcia_device *link) 1543 { 1544 scsi_info_t *info; ··· 1547 1548 nsp_dbg(NSP_DEBUG_INIT, "info=0x%p", info); 1549 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 ret = nsp_cs_config(link); 1559 1560 nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link); ··· 1554 } /* nsp_cs_attach */ 1555 1556 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 static void nsp_cs_detach(struct pcmcia_device *link) 1564 { 1565 nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link); ··· 1566 } /* nsp_cs_detach */ 1567 1568 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) 1585 { 1586 - struct nsp_cs_configdata *cfg_mem = priv_data; 1587 1588 - if (cfg->index == 0) 1589 return -ENODEV; 1590 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; 1595 } 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 - } 1661 1662 next_entry: 1663 nsp_dbg(NSP_DEBUG_INIT, "next"); ··· 1607 { 1608 int ret; 1609 scsi_info_t *info = link->priv; 1610 - struct nsp_cs_configdata *cfg_mem; 1611 struct Scsi_Host *host; 1612 nsp_hw_data *data = &nsp_data_base; 1613 1614 nsp_dbg(NSP_DEBUG_INIT, "in"); 1615 1616 - cfg_mem = kzalloc(sizeof(*cfg_mem), GFP_KERNEL); 1617 - if (!cfg_mem) 1618 - return -ENOMEM; 1619 - cfg_mem->data = data; 1620 1621 - ret = pcmcia_loop_config(link, nsp_cs_config_check, cfg_mem); 1622 if (ret) 1623 goto cs_failed; 1624 1625 if (pcmcia_request_irq(link, nspintr)) 1626 goto cs_failed; 1627 1628 - ret = pcmcia_request_configuration(link, &link->conf); 1629 if (ret) 1630 goto cs_failed; 1631 ··· 1666 1667 info->host = host; 1668 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 return 0; 1689 1690 cs_failed: 1691 nsp_dbg(NSP_DEBUG_INIT, "config fail"); 1692 nsp_cs_release(link); 1693 - kfree(cfg_mem); 1694 1695 return -ENODEV; 1696 } /* nsp_cs_config */ 1697 1698 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 static void nsp_cs_release(struct pcmcia_device *link) 1705 { 1706 scsi_info_t *info = link->priv; ··· 1694 scsi_remove_host(info->host); 1695 } 1696 1697 - if (link->win) { 1698 if (data != NULL) { 1699 iounmap((void *)(data->MmioAddress)); 1700 } ··· 1764 1765 static struct pcmcia_driver nsp_driver = { 1766 .owner = THIS_MODULE, 1767 - .drv = { 1768 - .name = "nsp_cs", 1769 - }, 1770 .probe = nsp_cs_probe, 1771 .remove = nsp_cs_detach, 1772 .id_table = nsp_cs_ids, ··· 1774 1775 static int __init nsp_cs_init(void) 1776 { 1777 - nsp_msg(KERN_INFO, "loading..."); 1778 - 1779 return pcmcia_register_driver(&nsp_driver); 1780 } 1781 1782 static void __exit nsp_cs_exit(void) 1783 { 1784 - nsp_msg(KERN_INFO, "unloading..."); 1785 pcmcia_unregister_driver(&nsp_driver); 1786 } 1787
··· 47 #include <scsi/scsi.h> 48 #include <scsi/scsi_ioctl.h> 49 50 #include <pcmcia/cistpl.h> 51 #include <pcmcia/cisreg.h> 52 #include <pcmcia/ds.h> ··· 1531 PCMCIA functions 1532 **********************************************************************/ 1533 1534 static int nsp_cs_probe(struct pcmcia_device *link) 1535 { 1536 scsi_info_t *info; ··· 1557 1558 nsp_dbg(NSP_DEBUG_INIT, "info=0x%p", info); 1559 1560 ret = nsp_cs_config(link); 1561 1562 nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link); ··· 1572 } /* nsp_cs_attach */ 1573 1574 1575 static void nsp_cs_detach(struct pcmcia_device *link) 1576 { 1577 nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link); ··· 1590 } /* nsp_cs_detach */ 1591 1592 1593 + static int nsp_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) 1594 { 1595 + nsp_hw_data *data = priv_data; 1596 1597 + if (p_dev->config_index == 0) 1598 return -ENODEV; 1599 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]); 1620 } 1621 + /* If we got this far, we're cool! */ 1622 + return 0; 1623 1624 next_entry: 1625 nsp_dbg(NSP_DEBUG_INIT, "next"); ··· 1693 { 1694 int ret; 1695 scsi_info_t *info = link->priv; 1696 struct Scsi_Host *host; 1697 nsp_hw_data *data = &nsp_data_base; 1698 1699 nsp_dbg(NSP_DEBUG_INIT, "in"); 1700 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; 1704 1705 + ret = pcmcia_loop_config(link, nsp_cs_config_check, data); 1706 if (ret) 1707 goto cs_failed; 1708 1709 if (pcmcia_request_irq(link, nspintr)) 1710 goto cs_failed; 1711 1712 + ret = pcmcia_enable_device(link); 1713 if (ret) 1714 goto cs_failed; 1715 ··· 1754 1755 info->host = host; 1756 1757 return 0; 1758 1759 cs_failed: 1760 nsp_dbg(NSP_DEBUG_INIT, "config fail"); 1761 nsp_cs_release(link); 1762 1763 return -ENODEV; 1764 } /* nsp_cs_config */ 1765 1766 1767 static void nsp_cs_release(struct pcmcia_device *link) 1768 { 1769 scsi_info_t *info = link->priv; ··· 1807 scsi_remove_host(info->host); 1808 } 1809 1810 + if (resource_size(link->resource[2])) { 1811 if (data != NULL) { 1812 iounmap((void *)(data->MmioAddress)); 1813 } ··· 1877 1878 static struct pcmcia_driver nsp_driver = { 1879 .owner = THIS_MODULE, 1880 + .name = "nsp_cs", 1881 .probe = nsp_cs_probe, 1882 .remove = nsp_cs_detach, 1883 .id_table = nsp_cs_ids, ··· 1889 1890 static int __init nsp_cs_init(void) 1891 { 1892 return pcmcia_register_driver(&nsp_driver); 1893 } 1894 1895 static void __exit nsp_cs_exit(void) 1896 { 1897 pcmcia_unregister_driver(&nsp_driver); 1898 } 1899
+7 -17
drivers/scsi/pcmcia/qlogic_stub.c
··· 48 #include <scsi/scsi_host.h> 49 #include "../qlogicfas408.h" 50 51 - #include <pcmcia/cs.h> 52 #include <pcmcia/cistpl.h> 53 #include <pcmcia/ds.h> 54 #include <pcmcia/ciscode.h> ··· 155 return -ENOMEM; 156 info->p_dev = link; 157 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; 163 164 return qlogic_config(link); 165 } /* qlogic_attach */ ··· 174 175 /*====================================================================*/ 176 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) 182 { 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; 186 187 if (p_dev->resource[0]->start == 0) 188 return -ENODEV; ··· 201 if (!link->irq) 202 goto failed; 203 204 - ret = pcmcia_request_configuration(link, &link->conf); 205 if (ret) 206 goto failed; 207 ··· 256 { 257 scsi_info_t *info = link->priv; 258 259 - pcmcia_request_configuration(link, &link->conf); 260 if ((info->manf_id == MANFID_MACNICA) || 261 (info->manf_id == MANFID_PIONEER) || 262 (info->manf_id == 0x0098)) { ··· 294 295 static struct pcmcia_driver qlogic_cs_driver = { 296 .owner = THIS_MODULE, 297 - .drv = { 298 .name = "qlogic_cs", 299 - }, 300 .probe = qlogic_probe, 301 .remove = qlogic_detach, 302 .id_table = qlogic_ids,
··· 48 #include <scsi/scsi_host.h> 49 #include "../qlogicfas408.h" 50 51 #include <pcmcia/cistpl.h> 52 #include <pcmcia/ds.h> 53 #include <pcmcia/ciscode.h> ··· 156 return -ENOMEM; 157 info->p_dev = link; 158 link->priv = info; 159 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 160 + link->config_regs = PRESENT_OPTION; 161 162 return qlogic_config(link); 163 } /* qlogic_attach */ ··· 178 179 /*====================================================================*/ 180 181 + static int qlogic_config_check(struct pcmcia_device *p_dev, void *priv_data) 182 { 183 p_dev->io_lines = 10; 184 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 185 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 186 187 if (p_dev->resource[0]->start == 0) 188 return -ENODEV; ··· 209 if (!link->irq) 210 goto failed; 211 212 + ret = pcmcia_enable_device(link); 213 if (ret) 214 goto failed; 215 ··· 264 { 265 scsi_info_t *info = link->priv; 266 267 + pcmcia_enable_device(link); 268 if ((info->manf_id == MANFID_MACNICA) || 269 (info->manf_id == MANFID_PIONEER) || 270 (info->manf_id == 0x0098)) { ··· 302 303 static struct pcmcia_driver qlogic_cs_driver = { 304 .owner = THIS_MODULE, 305 .name = "qlogic_cs", 306 .probe = qlogic_probe, 307 .remove = qlogic_detach, 308 .id_table = qlogic_ids,
+6 -16
drivers/scsi/pcmcia/sym53c500_cs.c
··· 71 #include <scsi/scsi.h> 72 #include <scsi/scsi_host.h> 73 74 - #include <pcmcia/cs.h> 75 #include <pcmcia/cistpl.h> 76 #include <pcmcia/ds.h> 77 #include <pcmcia/ciscode.h> ··· 683 .shost_attrs = SYM53C500_shost_attrs 684 }; 685 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) 691 { 692 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; 695 696 if (p_dev->resource[0]->start == 0) 697 return -ENODEV; ··· 716 if (!link->irq) 717 goto failed; 718 719 - ret = pcmcia_request_configuration(link, &link->conf); 720 if (ret) 721 goto failed; 722 ··· 854 return -ENOMEM; 855 info->p_dev = link; 856 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; 861 862 return SYM53C500_config(link); 863 } /* SYM53C500_attach */ ··· 873 874 static struct pcmcia_driver sym53c500_cs_driver = { 875 .owner = THIS_MODULE, 876 - .drv = { 877 - .name = "sym53c500_cs", 878 - }, 879 .probe = SYM53C500_probe, 880 .remove = SYM53C500_detach, 881 .id_table = sym53c500_ids,
··· 71 #include <scsi/scsi.h> 72 #include <scsi/scsi_host.h> 73 74 #include <pcmcia/cistpl.h> 75 #include <pcmcia/ds.h> 76 #include <pcmcia/ciscode.h> ··· 684 .shost_attrs = SYM53C500_shost_attrs 685 }; 686 687 + static int SYM53C500_config_check(struct pcmcia_device *p_dev, void *priv_data) 688 { 689 p_dev->io_lines = 10; 690 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 691 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 692 693 if (p_dev->resource[0]->start == 0) 694 return -ENODEV; ··· 721 if (!link->irq) 722 goto failed; 723 724 + ret = pcmcia_enable_device(link); 725 if (ret) 726 goto failed; 727 ··· 859 return -ENOMEM; 860 info->p_dev = link; 861 link->priv = info; 862 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 863 864 return SYM53C500_config(link); 865 } /* SYM53C500_attach */ ··· 881 882 static struct pcmcia_driver sym53c500_cs_driver = { 883 .owner = THIS_MODULE, 884 + .name = "sym53c500_cs", 885 .probe = SYM53C500_probe, 886 .remove = SYM53C500_detach, 887 .id_table = sym53c500_ids,
+77 -128
drivers/serial/serial_cs.c
··· 45 #include <asm/io.h> 46 #include <asm/system.h> 47 48 - #include <pcmcia/cs.h> 49 #include <pcmcia/cistpl.h> 50 #include <pcmcia/ciscode.h> 51 #include <pcmcia/ds.h> ··· 182 { 183 struct serial_info *info = link->priv; 184 185 - if (info->multi) { 186 - link->conf.Present |= PRESENT_EXT_STATUS; 187 - link->conf.ExtStatus = ESR_REQ_ATTN_ENA; 188 - } 189 } 190 191 static const struct serial_quirk quirks[] = { ··· 262 static int serial_config(struct pcmcia_device * link); 263 264 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 static void serial_remove(struct pcmcia_device *link) 273 { 274 struct serial_info *info = link->priv; ··· 304 return 0; 305 } 306 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 static int serial_probe(struct pcmcia_device *link) 316 { 317 struct serial_info *info; ··· 317 info->p_dev = link; 318 link->priv = info; 319 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; 326 327 return serial_config(link); 328 } 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 339 static void serial_detach(struct pcmcia_device *link) 340 { 341 struct serial_info *info = link->priv; 342 343 dev_dbg(&link->dev, "serial_detach\n"); 344 - 345 - /* 346 - * Ensure any outstanding scheduled tasks are completed. 347 - */ 348 - flush_scheduled_work(); 349 350 /* 351 * Ensure that the ports have been released. ··· 395 return -ENODEV; 396 } 397 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) 403 { 404 static const int size_table[2] = { 8, 16 }; 405 int *try = priv_data; 406 407 - if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) 408 - p_dev->conf.Vpp = 409 - cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; 410 411 - p_dev->io_lines = ((*try & 0x1) == 0) ? 412 - 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 413 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; 421 } 422 423 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 void *priv_data) 428 { 429 static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 430 int j; 431 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 - } 439 } 440 return -ENODEV; 441 } ··· 443 struct serial_info *info = link->priv; 444 int i = -ENODEV, try; 445 446 - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 447 - link->resource[0]->end = 8; 448 - 449 /* First pass: look for a config entry that looks normal. 450 * Two tries: without IO aliases, then with aliases */ 451 for (try = 0; try < 4; try++) 452 if (!pcmcia_loop_config(link, simple_config_check, &try)) 453 goto found_port; ··· 461 462 found_port: 463 if (info->multi && (info->manfid == MANFID_3COM)) 464 - link->conf.ConfigIndex &= ~(0x08); 465 466 /* 467 * Apply any configuration quirks. ··· 469 if (info->quirk && info->quirk->config) 470 info->quirk->config(link); 471 472 - i = pcmcia_request_configuration(link, &link->conf); 473 if (i != 0) 474 return -1; 475 return setup_serial(link, info, link->resource[0]->start, link->irq); 476 } 477 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) 483 { 484 - int *base2 = priv_data; 485 486 /* The quad port cards have bad CIS's, so just look for a 487 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; 497 } 498 499 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 void *priv_data) 504 { 505 int *base2 = priv_data; 506 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; 517 } 518 519 static int multi_config(struct pcmcia_device *link) ··· 520 struct serial_info *info = link->priv; 521 int i, base2 = 0; 522 523 /* 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)) { 527 /* If that didn't work, look for two windows */ 528 - link->resource[0]->end = link->resource[1]->end = 8; 529 info->multi = 2; 530 if (pcmcia_loop_config(link, multi_config_check_notpicky, 531 &base2)) { ··· 544 if (info->quirk && info->quirk->config) 545 info->quirk->config(link); 546 547 - i = pcmcia_request_configuration(link, &link->conf); 548 if (i != 0) 549 return -ENODEV; 550 ··· 556 info->prodid == PRODID_POSSIO_GCC)) { 557 int err; 558 559 - if (link->conf.ConfigIndex == 1 || 560 - link->conf.ConfigIndex == 3) { 561 err = setup_serial(link, info, base2, 562 link->irq); 563 - base2 = link->resource[0]->start;; 564 } else { 565 err = setup_serial(link, info, link->resource[0]->start, 566 link->irq); ··· 584 return 0; 585 } 586 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) 592 { 593 struct serial_info *info = p_dev->priv; 594 595 - if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) 596 - info->multi = cf->io.win[0].len >> 3; 597 598 - if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) && 599 - (cf->io.win[1].len == 8)) 600 info->multi = 2; 601 602 return 0; /* break */ 603 } 604 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 614 static int serial_config(struct pcmcia_device * link) 615 { ··· 845 846 static struct pcmcia_driver serial_cs_driver = { 847 .owner = THIS_MODULE, 848 - .drv = { 849 - .name = "serial_cs", 850 - }, 851 .probe = serial_probe, 852 .remove = serial_detach, 853 .id_table = serial_ids,
··· 45 #include <asm/io.h> 46 #include <asm/system.h> 47 48 #include <pcmcia/cistpl.h> 49 #include <pcmcia/ciscode.h> 50 #include <pcmcia/ds.h> ··· 183 { 184 struct serial_info *info = link->priv; 185 186 + if (info->multi) 187 + link->config_flags |= CONF_ENABLE_ESR; 188 } 189 190 static const struct serial_quirk quirks[] = { ··· 265 static int serial_config(struct pcmcia_device * link); 266 267 268 static void serial_remove(struct pcmcia_device *link) 269 { 270 struct serial_info *info = link->priv; ··· 314 return 0; 315 } 316 317 static int serial_probe(struct pcmcia_device *link) 318 { 319 struct serial_info *info; ··· 335 info->p_dev = link; 336 link->priv = info; 337 338 + link->config_flags |= CONF_ENABLE_IRQ; 339 + if (do_sound) 340 + link->config_flags |= CONF_ENABLE_SPKR; 341 342 return serial_config(link); 343 } 344 345 static void serial_detach(struct pcmcia_device *link) 346 { 347 struct serial_info *info = link->priv; 348 349 dev_dbg(&link->dev, "serial_detach\n"); 350 351 /* 352 * Ensure that the ports have been released. ··· 430 return -ENODEV; 431 } 432 433 + static int simple_config_check(struct pcmcia_device *p_dev, void *priv_data) 434 { 435 static const int size_table[2] = { 8, 16 }; 436 int *try = priv_data; 437 438 + if (p_dev->resource[0]->start == 0) 439 + return -ENODEV; 440 441 + if ((*try & 0x1) == 0) 442 + p_dev->io_lines = 16; 443 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); 452 } 453 454 static int simple_config_check_notpicky(struct pcmcia_device *p_dev, 455 void *priv_data) 456 { 457 static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 458 int j; 459 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; 472 } 473 return -ENODEV; 474 } ··· 480 struct serial_info *info = link->priv; 481 int i = -ENODEV, try; 482 483 /* First pass: look for a config entry that looks normal. 484 * Two tries: without IO aliases, then with aliases */ 485 + link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_SET_IO; 486 for (try = 0; try < 4; try++) 487 if (!pcmcia_loop_config(link, simple_config_check, &try)) 488 goto found_port; ··· 500 501 found_port: 502 if (info->multi && (info->manfid == MANFID_3COM)) 503 + link->config_index &= ~(0x08); 504 505 /* 506 * Apply any configuration quirks. ··· 508 if (info->quirk && info->quirk->config) 509 info->quirk->config(link); 510 511 + i = pcmcia_enable_device(link); 512 if (i != 0) 513 return -1; 514 return setup_serial(link, info, link->resource[0]->start, link->irq); 515 } 516 517 + static int multi_config_check(struct pcmcia_device *p_dev, void *priv_data) 518 { 519 + int *multi = priv_data; 520 + 521 + if (p_dev->resource[1]->end) 522 + return -EINVAL; 523 524 /* The quad port cards have bad CIS's, so just look for a 525 window larger than 8 ports and assume it will be right */ 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; 536 } 537 538 static int multi_config_check_notpicky(struct pcmcia_device *p_dev, 539 void *priv_data) 540 { 541 int *base2 = priv_data; 542 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; 555 } 556 557 static int multi_config(struct pcmcia_device *link) ··· 560 struct serial_info *info = link->priv; 561 int i, base2 = 0; 562 563 + link->config_flags |= CONF_AUTO_SET_IO; 564 /* First, look for a generic full-sized window */ 565 + if (!pcmcia_loop_config(link, multi_config_check, &info->multi)) 566 + base2 = link->resource[0]->start + 8; 567 + else { 568 /* If that didn't work, look for two windows */ 569 info->multi = 2; 570 if (pcmcia_loop_config(link, multi_config_check_notpicky, 571 &base2)) { ··· 584 if (info->quirk && info->quirk->config) 585 info->quirk->config(link); 586 587 + i = pcmcia_enable_device(link); 588 if (i != 0) 589 return -ENODEV; 590 ··· 596 info->prodid == PRODID_POSSIO_GCC)) { 597 int err; 598 599 + if (link->config_index == 1 || 600 + link->config_index == 3) { 601 err = setup_serial(link, info, base2, 602 link->irq); 603 + base2 = link->resource[0]->start; 604 } else { 605 err = setup_serial(link, info, link->resource[0]->start, 606 link->irq); ··· 624 return 0; 625 } 626 627 + static int serial_check_for_multi(struct pcmcia_device *p_dev, void *priv_data) 628 { 629 struct serial_info *info = p_dev->priv; 630 631 + if (!p_dev->resource[0]->end) 632 + return -EINVAL; 633 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)) 639 info->multi = 2; 640 641 return 0; /* break */ 642 } 643 644 645 static int serial_config(struct pcmcia_device * link) 646 { ··· 894 895 static struct pcmcia_driver serial_cs_driver = { 896 .owner = THIS_MODULE, 897 + .name = "serial_cs", 898 .probe = serial_probe, 899 .remove = serial_detach, 900 .id_table = serial_ids,
-1
drivers/ssb/main.c
··· 20 #include <linux/mmc/sdio_func.h> 21 #include <linux/slab.h> 22 23 - #include <pcmcia/cs.h> 24 #include <pcmcia/cistpl.h> 25 #include <pcmcia/ds.h> 26
··· 20 #include <linux/mmc/sdio_func.h> 21 #include <linux/slab.h> 22 23 #include <pcmcia/cistpl.h> 24 #include <pcmcia/ds.h> 25
-1
drivers/ssb/pcmcia.c
··· 13 #include <linux/io.h> 14 #include <linux/etherdevice.h> 15 16 - #include <pcmcia/cs.h> 17 #include <pcmcia/cistpl.h> 18 #include <pcmcia/ciscode.h> 19 #include <pcmcia/ds.h>
··· 13 #include <linux/io.h> 14 #include <linux/etherdevice.h> 15 16 #include <pcmcia/cistpl.h> 17 #include <pcmcia/ciscode.h> 18 #include <pcmcia/ds.h>
-1
drivers/ssb/scan.c
··· 17 #include <linux/pci.h> 18 #include <linux/io.h> 19 20 - #include <pcmcia/cs.h> 21 #include <pcmcia/cistpl.h> 22 #include <pcmcia/ds.h> 23
··· 17 #include <linux/pci.h> 18 #include <linux/io.h> 19 20 #include <pcmcia/cistpl.h> 21 #include <pcmcia/ds.h> 22
+7 -51
drivers/staging/comedi/drivers/cb_das16_cs.c
··· 37 #include <linux/delay.h> 38 #include <linux/pci.h> 39 40 - #include <pcmcia/cs.h> 41 #include <pcmcia/cistpl.h> 42 #include <pcmcia/ds.h> 43 ··· 691 local->link = link; 692 link->priv = local; 693 694 - /* Initialize the pcmcia_device structure */ 695 - link->conf.Attributes = 0; 696 - link->conf.IntType = INT_MEMORY_AND_IO; 697 - 698 cur_dev = link; 699 700 das16cs_pcmcia_config(link); ··· 710 711 712 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 void *priv_data) 717 { 718 - if (cfg->index == 0) 719 return -EINVAL; 720 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; 744 } 745 746 static void das16cs_pcmcia_config(struct pcmcia_device *link) ··· 723 int ret; 724 725 dev_dbg(&link->dev, "das16cs_pcmcia_config\n"); 726 727 ret = pcmcia_loop_config(link, das16cs_pcmcia_config_loop, NULL); 728 if (ret) { ··· 736 if (!link->irq) 737 goto failed; 738 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); 745 if (ret) 746 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 758 return; 759 ··· 790 .resume = das16cs_pcmcia_resume, 791 .id_table = das16cs_id_table, 792 .owner = THIS_MODULE, 793 - .drv = { 794 - .name = "cb_das16_cs", 795 - }, 796 }; 797 798 static int __init init_das16cs_pcmcia_cs(void)
··· 37 #include <linux/delay.h> 38 #include <linux/pci.h> 39 40 #include <pcmcia/cistpl.h> 41 #include <pcmcia/ds.h> 42 ··· 692 local->link = link; 693 link->priv = local; 694 695 cur_dev = link; 696 697 das16cs_pcmcia_config(link); ··· 715 716 717 static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, 718 void *priv_data) 719 { 720 + if (p_dev->config_index == 0) 721 return -EINVAL; 722 723 + return pcmcia_request_io(p_dev); 724 } 725 726 static void das16cs_pcmcia_config(struct pcmcia_device *link) ··· 753 int ret; 754 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; 759 760 ret = pcmcia_loop_config(link, das16cs_pcmcia_config_loop, NULL); 761 if (ret) { ··· 763 if (!link->irq) 764 goto failed; 765 766 + ret = pcmcia_enable_device(link); 767 if (ret) 768 goto failed; 769 770 return; 771 ··· 832 .resume = das16cs_pcmcia_resume, 833 .id_table = das16cs_id_table, 834 .owner = THIS_MODULE, 835 + .name = "cb_das16_cs", 836 }; 837 838 static int __init init_das16cs_pcmcia_cs(void)
+7 -120
drivers/staging/comedi/drivers/das08_cs.c
··· 48 #include "das08.h" 49 50 /* pcmcia includes */ 51 - #include <pcmcia/cs.h> 52 #include <pcmcia/cistpl.h> 53 #include <pcmcia/ds.h> 54 ··· 114 static int das08_pcmcia_suspend(struct pcmcia_device *p_dev); 115 static int das08_pcmcia_resume(struct pcmcia_device *p_dev); 116 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 static int das08_pcmcia_attach(struct pcmcia_device *); 124 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 133 struct local_info_t { 134 struct pcmcia_device *link; 135 int stop; 136 struct bus_operations *bus; 137 }; 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 151 static int das08_pcmcia_attach(struct pcmcia_device *link) 152 { ··· 136 local->link = link; 137 link->priv = local; 138 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 cur_dev = link; 150 151 das08_pcmcia_config(link); 152 153 return 0; 154 } /* 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 165 static void das08_pcmcia_detach(struct pcmcia_device *link) 166 { ··· 158 159 160 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 void *priv_data) 165 { 166 - if (cfg->index == 0) 167 - return -ENODEV; 168 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; 191 } 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 202 static void das08_pcmcia_config(struct pcmcia_device *link) 203 { 204 int ret; 205 206 dev_dbg(&link->dev, "das08_pcmcia_config\n"); 207 208 ret = pcmcia_loop_config(link, das08_pcmcia_config_loop, NULL); 209 if (ret) { ··· 183 if (!link->irq) 184 goto failed; 185 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); 192 if (ret) 193 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 205 return; 206 ··· 194 195 } /* das08_pcmcia_config */ 196 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 static void das08_pcmcia_release(struct pcmcia_device *link) 206 { 207 dev_dbg(&link->dev, "das08_pcmcia_release\n"); 208 pcmcia_disable_device(link); 209 } /* 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 223 static int das08_pcmcia_suspend(struct pcmcia_device *link) 224 { ··· 237 .resume = das08_pcmcia_resume, 238 .id_table = das08_cs_id_table, 239 .owner = THIS_MODULE, 240 - .drv = { 241 - .name = "pcm-das08", 242 - }, 243 }; 244 245 static int __init init_das08_pcmcia_cs(void)
··· 48 #include "das08.h" 49 50 /* pcmcia includes */ 51 #include <pcmcia/cistpl.h> 52 #include <pcmcia/ds.h> 53 ··· 115 static int das08_pcmcia_suspend(struct pcmcia_device *p_dev); 116 static int das08_pcmcia_resume(struct pcmcia_device *p_dev); 117 118 static int das08_pcmcia_attach(struct pcmcia_device *); 119 static void das08_pcmcia_detach(struct pcmcia_device *); 120 121 struct local_info_t { 122 struct pcmcia_device *link; 123 int stop; 124 struct bus_operations *bus; 125 }; 126 127 static int das08_pcmcia_attach(struct pcmcia_device *link) 128 { ··· 162 local->link = link; 163 link->priv = local; 164 165 cur_dev = link; 166 167 das08_pcmcia_config(link); 168 169 return 0; 170 } /* das08_pcmcia_attach */ 171 172 static void das08_pcmcia_detach(struct pcmcia_device *link) 173 { ··· 203 204 205 static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, 206 void *priv_data) 207 { 208 + if (p_dev->config_index == 0) 209 + return -EINVAL; 210 211 + return pcmcia_request_io(p_dev); 212 } 213 214 static void das08_pcmcia_config(struct pcmcia_device *link) 215 { 216 int ret; 217 218 dev_dbg(&link->dev, "das08_pcmcia_config\n"); 219 + 220 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 221 222 ret = pcmcia_loop_config(link, das08_pcmcia_config_loop, NULL); 223 if (ret) { ··· 259 if (!link->irq) 260 goto failed; 261 262 + ret = pcmcia_enable_device(link); 263 if (ret) 264 goto failed; 265 266 return; 267 ··· 285 286 } /* das08_pcmcia_config */ 287 288 static void das08_pcmcia_release(struct pcmcia_device *link) 289 { 290 dev_dbg(&link->dev, "das08_pcmcia_release\n"); 291 pcmcia_disable_device(link); 292 } /* das08_pcmcia_release */ 293 294 static int das08_pcmcia_suspend(struct pcmcia_device *link) 295 { ··· 348 .resume = das08_pcmcia_resume, 349 .id_table = das08_cs_id_table, 350 .owner = THIS_MODULE, 351 + .name = "pcm-das08", 352 }; 353 354 static int __init init_das08_pcmcia_cs(void)
+8 -122
drivers/staging/comedi/drivers/ni_daq_700.c
··· 47 48 #include <linux/ioport.h> 49 50 - #include <pcmcia/cs.h> 51 #include <pcmcia/cistpl.h> 52 #include <pcmcia/cisreg.h> 53 #include <pcmcia/ds.h> ··· 434 return 0; 435 }; 436 437 - /* PCMCIA crap -- watch your words, please! */ 438 - 439 static void dio700_config(struct pcmcia_device *link); 440 static void dio700_release(struct pcmcia_device *link); 441 static int dio700_cs_suspend(struct pcmcia_device *p_dev); 442 static int dio700_cs_resume(struct pcmcia_device *p_dev); 443 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 static int dio700_cs_attach(struct pcmcia_device *); 451 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 460 struct local_info_t { 461 struct pcmcia_device *link; 462 int stop; 463 struct bus_operations *bus; 464 }; 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 478 static int dio700_cs_attach(struct pcmcia_device *link) 479 { ··· 463 local->link = link; 464 link->priv = local; 465 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 pcmcia_cur_dev = link; 477 478 dio700_config(link); 479 480 return 0; 481 } /* 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 492 static void dio700_cs_detach(struct pcmcia_device *link) 493 { ··· 485 486 } /* dio700_cs_detach */ 487 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 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 void *priv_data) 501 { 502 - if (cfg->index == 0) 503 - return -ENODEV; 504 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; 536 } 537 538 static void dio700_config(struct pcmcia_device *link) ··· 503 504 dev_dbg(&link->dev, "dio700_config\n"); 505 506 ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, NULL); 507 if (ret) { 508 dev_warn(&link->dev, "no configuration found\n"); ··· 515 if (!link->irq) 516 goto failed; 517 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); 524 if (ret != 0) 525 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 537 return; 538 ··· 533 534 pcmcia_disable_device(link); 535 } /* 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 549 static int dio700_cs_suspend(struct pcmcia_device *link) 550 { ··· 573 .resume = dio700_cs_resume, 574 .id_table = dio700_cs_ids, 575 .owner = THIS_MODULE, 576 - .drv = { 577 - .name = "ni_daq_700", 578 - }, 579 }; 580 581 static int __init init_dio700_cs(void)
··· 47 48 #include <linux/ioport.h> 49 50 #include <pcmcia/cistpl.h> 51 #include <pcmcia/cisreg.h> 52 #include <pcmcia/ds.h> ··· 435 return 0; 436 }; 437 438 static void dio700_config(struct pcmcia_device *link); 439 static void dio700_release(struct pcmcia_device *link); 440 static int dio700_cs_suspend(struct pcmcia_device *p_dev); 441 static int dio700_cs_resume(struct pcmcia_device *p_dev); 442 443 static int dio700_cs_attach(struct pcmcia_device *); 444 static void dio700_cs_detach(struct pcmcia_device *); 445 446 struct local_info_t { 447 struct pcmcia_device *link; 448 int stop; 449 struct bus_operations *bus; 450 }; 451 452 static int dio700_cs_attach(struct pcmcia_device *link) 453 { ··· 491 local->link = link; 492 link->priv = local; 493 494 pcmcia_cur_dev = link; 495 496 dio700_config(link); 497 498 return 0; 499 } /* dio700_cs_attach */ 500 501 static void dio700_cs_detach(struct pcmcia_device *link) 502 { ··· 532 533 } /* dio700_cs_detach */ 534 535 static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, 536 void *priv_data) 537 { 538 + if (p_dev->config_index == 0) 539 + return -EINVAL; 540 541 + return pcmcia_request_io(p_dev); 542 } 543 544 static void dio700_config(struct pcmcia_device *link) ··· 591 592 dev_dbg(&link->dev, "dio700_config\n"); 593 594 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO | 595 + CONF_AUTO_SET_IO; 596 + 597 ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, NULL); 598 if (ret) { 599 dev_warn(&link->dev, "no configuration found\n"); ··· 600 if (!link->irq) 601 goto failed; 602 603 + ret = pcmcia_enable_device(link); 604 if (ret != 0) 605 goto failed; 606 607 return; 608 ··· 633 634 pcmcia_disable_device(link); 635 } /* dio700_release */ 636 637 static int dio700_cs_suspend(struct pcmcia_device *link) 638 { ··· 685 .resume = dio700_cs_resume, 686 .id_table = dio700_cs_ids, 687 .owner = THIS_MODULE, 688 + .name = "ni_daq_700", 689 }; 690 691 static int __init init_dio700_cs(void)
+8 -122
drivers/staging/comedi/drivers/ni_daq_dio24.c
··· 48 49 #include "8255.h" 50 51 - #include <pcmcia/cs.h> 52 #include <pcmcia/cistpl.h> 53 #include <pcmcia/cisreg.h> 54 #include <pcmcia/ds.h> ··· 186 return 0; 187 }; 188 189 - /* PCMCIA crap -- watch your words! */ 190 - 191 static void dio24_config(struct pcmcia_device *link); 192 static void dio24_release(struct pcmcia_device *link); 193 static int dio24_cs_suspend(struct pcmcia_device *p_dev); 194 static int dio24_cs_resume(struct pcmcia_device *p_dev); 195 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 static int dio24_cs_attach(struct pcmcia_device *); 203 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 212 struct local_info_t { 213 struct pcmcia_device *link; 214 int stop; 215 struct bus_operations *bus; 216 }; 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 230 static int dio24_cs_attach(struct pcmcia_device *link) 231 { ··· 215 local->link = link; 216 link->priv = local; 217 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 pcmcia_cur_dev = link; 229 230 dio24_config(link); 231 232 return 0; 233 } /* 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 244 static void dio24_cs_detach(struct pcmcia_device *link) 245 { ··· 237 238 } /* dio24_cs_detach */ 239 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 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 void *priv_data) 253 { 254 - if (cfg->index == 0) 255 - return -ENODEV; 256 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; 288 } 289 290 static void dio24_config(struct pcmcia_device *link) ··· 254 255 dev_dbg(&link->dev, "dio24_config\n"); 256 257 ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, NULL); 258 if (ret) { 259 dev_warn(&link->dev, "no configuration found\n"); ··· 266 if (!link->irq) 267 goto failed; 268 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); 275 if (ret) 276 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 288 return; 289 ··· 284 285 pcmcia_disable_device(link); 286 } /* 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 300 static int dio24_cs_suspend(struct pcmcia_device *link) 301 { ··· 323 .resume = dio24_cs_resume, 324 .id_table = dio24_cs_ids, 325 .owner = THIS_MODULE, 326 - .drv = { 327 - .name = "ni_daq_dio24", 328 - }, 329 }; 330 331 static int __init init_dio24_cs(void)
··· 48 49 #include "8255.h" 50 51 #include <pcmcia/cistpl.h> 52 #include <pcmcia/cisreg.h> 53 #include <pcmcia/ds.h> ··· 187 return 0; 188 }; 189 190 static void dio24_config(struct pcmcia_device *link); 191 static void dio24_release(struct pcmcia_device *link); 192 static int dio24_cs_suspend(struct pcmcia_device *p_dev); 193 static int dio24_cs_resume(struct pcmcia_device *p_dev); 194 195 static int dio24_cs_attach(struct pcmcia_device *); 196 static void dio24_cs_detach(struct pcmcia_device *); 197 198 struct local_info_t { 199 struct pcmcia_device *link; 200 int stop; 201 struct bus_operations *bus; 202 }; 203 204 static int dio24_cs_attach(struct pcmcia_device *link) 205 { ··· 243 local->link = link; 244 link->priv = local; 245 246 pcmcia_cur_dev = link; 247 248 dio24_config(link); 249 250 return 0; 251 } /* dio24_cs_attach */ 252 253 static void dio24_cs_detach(struct pcmcia_device *link) 254 { ··· 284 285 } /* dio24_cs_detach */ 286 287 static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, 288 void *priv_data) 289 { 290 + if (p_dev->config_index == 0) 291 + return -EINVAL; 292 293 + return pcmcia_request_io(p_dev); 294 } 295 296 static void dio24_config(struct pcmcia_device *link) ··· 342 343 dev_dbg(&link->dev, "dio24_config\n"); 344 345 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO | 346 + CONF_AUTO_SET_IO; 347 + 348 ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, NULL); 349 if (ret) { 350 dev_warn(&link->dev, "no configuration found\n"); ··· 351 if (!link->irq) 352 goto failed; 353 354 + ret = pcmcia_enable_device(link); 355 if (ret) 356 goto failed; 357 358 return; 359 ··· 384 385 pcmcia_disable_device(link); 386 } /* dio24_release */ 387 388 static int dio24_cs_suspend(struct pcmcia_device *link) 389 { ··· 435 .resume = dio24_cs_resume, 436 .id_table = dio24_cs_ids, 437 .owner = THIS_MODULE, 438 + .name = "ni_daq_dio24", 439 }; 440 441 static int __init init_dio24_cs(void)
+8 -136
drivers/staging/comedi/drivers/ni_labpc_cs.c
··· 71 #include "comedi_fc.h" 72 #include "ni_labpc.h" 73 74 - #include <pcmcia/cs.h> 75 #include <pcmcia/cistpl.h> 76 #include <pcmcia/cisreg.h> 77 #include <pcmcia/ds.h> ··· 152 return labpc_common_attach(dev, iobase, irq, 0); 153 } 154 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 static void labpc_config(struct pcmcia_device *link); 170 static void labpc_release(struct pcmcia_device *link); 171 static int labpc_cs_suspend(struct pcmcia_device *p_dev); 172 static int labpc_cs_resume(struct pcmcia_device *p_dev); 173 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 static int labpc_cs_attach(struct pcmcia_device *); 181 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 190 struct local_info_t { 191 struct pcmcia_device *link; 192 int stop; 193 struct bus_operations *bus; 194 }; 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 208 static int labpc_cs_attach(struct pcmcia_device *link) 209 { ··· 179 local->link = link; 180 link->priv = local; 181 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 pcmcia_cur_dev = link; 193 194 labpc_config(link); 195 196 return 0; 197 } /* 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 208 static void labpc_cs_detach(struct pcmcia_device *link) 209 { ··· 204 205 } /* labpc_cs_detach */ 206 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 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 void *priv_data) 220 { 221 - if (cfg->index == 0) 222 - return -ENODEV; 223 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; 255 } 256 257 ··· 219 int ret; 220 221 dev_dbg(&link->dev, "labpc_config\n"); 222 223 ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, NULL); 224 if (ret) { ··· 232 if (!link->irq) 233 goto failed; 234 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); 241 if (ret) 242 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 254 return; 255 ··· 249 250 pcmcia_disable_device(link); 251 } /* 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 265 static int labpc_cs_suspend(struct pcmcia_device *link) 266 { ··· 266 local->stop = 0; 267 return 0; 268 } /* labpc_cs_resume */ 269 - 270 - /*====================================================================*/ 271 272 static struct pcmcia_device_id labpc_cs_ids[] = { 273 /* N.B. These IDs should match those in labpc_cs_boards (ni_labpc.c) */ ··· 285 .resume = labpc_cs_resume, 286 .id_table = labpc_cs_ids, 287 .owner = THIS_MODULE, 288 - .drv = { 289 - .name = "daqcard-1200", 290 - }, 291 }; 292 293 static int __init init_labpc_cs(void)
··· 71 #include "comedi_fc.h" 72 #include "ni_labpc.h" 73 74 #include <pcmcia/cistpl.h> 75 #include <pcmcia/cisreg.h> 76 #include <pcmcia/ds.h> ··· 153 return labpc_common_attach(dev, iobase, irq, 0); 154 } 155 156 static void labpc_config(struct pcmcia_device *link); 157 static void labpc_release(struct pcmcia_device *link); 158 static int labpc_cs_suspend(struct pcmcia_device *p_dev); 159 static int labpc_cs_resume(struct pcmcia_device *p_dev); 160 161 static int labpc_cs_attach(struct pcmcia_device *); 162 static void labpc_cs_detach(struct pcmcia_device *); 163 164 struct local_info_t { 165 struct pcmcia_device *link; 166 int stop; 167 struct bus_operations *bus; 168 }; 169 170 static int labpc_cs_attach(struct pcmcia_device *link) 171 { ··· 219 local->link = link; 220 link->priv = local; 221 222 pcmcia_cur_dev = link; 223 224 labpc_config(link); 225 226 return 0; 227 } /* labpc_cs_attach */ 228 229 static void labpc_cs_detach(struct pcmcia_device *link) 230 { ··· 263 264 } /* labpc_cs_detach */ 265 266 static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, 267 void *priv_data) 268 { 269 + if (p_dev->config_index == 0) 270 + return -EINVAL; 271 272 + return pcmcia_request_io(p_dev); 273 } 274 275 ··· 319 int ret; 320 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; 325 326 ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, NULL); 327 if (ret) { ··· 329 if (!link->irq) 330 goto failed; 331 332 + ret = pcmcia_enable_device(link); 333 if (ret) 334 goto failed; 335 336 return; 337 ··· 361 362 pcmcia_disable_device(link); 363 } /* labpc_release */ 364 365 static int labpc_cs_suspend(struct pcmcia_device *link) 366 { ··· 390 local->stop = 0; 391 return 0; 392 } /* labpc_cs_resume */ 393 394 static struct pcmcia_device_id labpc_cs_ids[] = { 395 /* N.B. These IDs should match those in labpc_cs_boards (ni_labpc.c) */ ··· 411 .resume = labpc_cs_resume, 412 .id_table = labpc_cs_ids, 413 .owner = THIS_MODULE, 414 + .name = "daqcard-1200", 415 }; 416 417 static int __init init_labpc_cs(void)
+6 -17
drivers/staging/comedi/drivers/ni_mio_cs.c
··· 48 #include "ni_stc.h" 49 #include "8255.h" 50 51 - #include <pcmcia/cs.h> 52 #include <pcmcia/cistpl.h> 53 #include <pcmcia/ds.h> 54 ··· 262 263 static int cs_attach(struct pcmcia_device *link) 264 { 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 cur_dev = link; 271 272 mio_cs_config(link); ··· 295 } 296 297 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) 303 { 304 int base, ret; 305 306 - p_dev->resource[0]->end = cfg->io.win[0].len; 307 - p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; 308 309 for (base = 0x000; base < 0x400; base += 0x20) { 310 p_dev->resource[0]->start = base; ··· 317 int ret; 318 319 DPRINTK("mio_cs_config(link=%p)\n", link); 320 321 ret = pcmcia_loop_config(link, mio_pcmcia_config_loop, NULL); 322 if (ret) { ··· 328 if (!link->irq) 329 dev_info(&link->dev, "no IRQ available\n"); 330 331 - ret = pcmcia_request_configuration(link, &link->conf); 332 } 333 334 static int mio_cs_attach(struct comedi_device *dev, struct comedi_devconfig *it) ··· 437 .resume = &mio_cs_resume, 438 .id_table = ni_mio_cs_ids, 439 .owner = THIS_MODULE, 440 - .drv = { 441 - .name = "ni_mio_cs", 442 - }, 443 }; 444 445 int init_module(void)
··· 48 #include "ni_stc.h" 49 #include "8255.h" 50 51 #include <pcmcia/cistpl.h> 52 #include <pcmcia/ds.h> 53 ··· 263 264 static int cs_attach(struct pcmcia_device *link) 265 { 266 cur_dev = link; 267 268 mio_cs_config(link); ··· 301 } 302 303 304 + static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) 305 { 306 int base, ret; 307 308 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 309 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 310 311 for (base = 0x000; base < 0x400; base += 0x20) { 312 p_dev->resource[0]->start = base; ··· 327 int ret; 328 329 DPRINTK("mio_cs_config(link=%p)\n", link); 330 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 331 332 ret = pcmcia_loop_config(link, mio_pcmcia_config_loop, NULL); 333 if (ret) { ··· 337 if (!link->irq) 338 dev_info(&link->dev, "no IRQ available\n"); 339 340 + ret = pcmcia_enable_device(link); 341 } 342 343 static int mio_cs_attach(struct comedi_device *dev, struct comedi_devconfig *it) ··· 446 .resume = &mio_cs_resume, 447 .id_table = ni_mio_cs_ids, 448 .owner = THIS_MODULE, 449 + .name = "ni_mio_cs", 450 }; 451 452 int init_module(void)
+7 -117
drivers/staging/comedi/drivers/quatech_daqp_cs.c
··· 50 #include "../comedidev.h" 51 #include <linux/semaphore.h> 52 53 - #include <pcmcia/cs.h> 54 #include <pcmcia/cistpl.h> 55 #include <pcmcia/cisreg.h> 56 #include <pcmcia/ds.h> ··· 968 969 ======================================================================*/ 970 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 static void daqp_cs_config(struct pcmcia_device *link); 983 static void daqp_cs_release(struct pcmcia_device *link); 984 static int daqp_cs_suspend(struct pcmcia_device *p_dev); 985 static int daqp_cs_resume(struct pcmcia_device *p_dev); 986 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 static int daqp_cs_attach(struct pcmcia_device *); 994 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 1008 static int daqp_cs_attach(struct pcmcia_device *link) 1009 { ··· 1001 local->link = link; 1002 link->priv = local; 1003 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 daqp_cs_config(link); 1015 1016 return 0; 1017 } /* 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 1028 static void daqp_cs_detach(struct pcmcia_device *link) 1029 { ··· 1021 1022 } /* daqp_cs_detach */ 1023 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) 1038 { 1039 - if (cfg->index == 0) 1040 - return -ENODEV; 1041 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 return pcmcia_request_io(p_dev); 1064 } 1065 ··· 1034 int ret; 1035 1036 dev_dbg(&link->dev, "daqp_cs_config\n"); 1037 1038 ret = pcmcia_loop_config(link, daqp_pcmcia_config_loop, NULL); 1039 if (ret) { ··· 1047 if (ret) 1048 goto failed; 1049 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); 1056 if (ret) 1057 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 1069 return; 1070 ··· 1064 1065 pcmcia_disable_device(link); 1066 } /* 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 1080 static int daqp_cs_suspend(struct pcmcia_device *link) 1081 { ··· 1104 .resume = daqp_cs_resume, 1105 .id_table = daqp_cs_id_table, 1106 .owner = THIS_MODULE, 1107 - .drv = { 1108 - .name = "quatech_daqp_cs", 1109 - }, 1110 }; 1111 1112 int __init init_module(void)
··· 50 #include "../comedidev.h" 51 #include <linux/semaphore.h> 52 53 #include <pcmcia/cistpl.h> 54 #include <pcmcia/cisreg.h> 55 #include <pcmcia/ds.h> ··· 969 970 ======================================================================*/ 971 972 static void daqp_cs_config(struct pcmcia_device *link); 973 static void daqp_cs_release(struct pcmcia_device *link); 974 static int daqp_cs_suspend(struct pcmcia_device *p_dev); 975 static int daqp_cs_resume(struct pcmcia_device *p_dev); 976 977 static int daqp_cs_attach(struct pcmcia_device *); 978 static void daqp_cs_detach(struct pcmcia_device *); 979 980 static int daqp_cs_attach(struct pcmcia_device *link) 981 { ··· 1031 local->link = link; 1032 link->priv = local; 1033 1034 daqp_cs_config(link); 1035 1036 return 0; 1037 } /* daqp_cs_attach */ 1038 1039 static void daqp_cs_detach(struct pcmcia_device *link) 1040 { ··· 1070 1071 } /* daqp_cs_detach */ 1072 1073 + static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) 1074 { 1075 + if (p_dev->config_index == 0) 1076 + return -EINVAL; 1077 1078 return pcmcia_request_io(p_dev); 1079 } 1080 ··· 1117 int ret; 1118 1119 dev_dbg(&link->dev, "daqp_cs_config\n"); 1120 + 1121 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 1122 1123 ret = pcmcia_loop_config(link, daqp_pcmcia_config_loop, NULL); 1124 if (ret) { ··· 1128 if (ret) 1129 goto failed; 1130 1131 + ret = pcmcia_enable_device(link); 1132 if (ret) 1133 goto failed; 1134 1135 return; 1136 ··· 1160 1161 pcmcia_disable_device(link); 1162 } /* daqp_cs_release */ 1163 1164 static int daqp_cs_suspend(struct pcmcia_device *link) 1165 { ··· 1212 .resume = daqp_cs_resume, 1213 .id_table = daqp_cs_id_table, 1214 .owner = THIS_MODULE, 1215 + .name = "quatech_daqp_cs", 1216 }; 1217 1218 int __init init_module(void)
+6 -71
drivers/staging/wlags49_h2/wl_cs.c
··· 83 #include <linux/if_arp.h> 84 #include <linux/ioport.h> 85 86 - #include <pcmcia/cs.h> 87 #include <pcmcia/cistpl.h> 88 #include <pcmcia/cisreg.h> 89 #include <pcmcia/ciscode.h> ··· 146 147 link->resource[0]->end = HCF_NUM_IO_PORTS; 148 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; 153 154 link->priv = dev; 155 lp = wl_priv(dev); ··· 163 164 165 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 static void wl_adapter_detach(struct pcmcia_device *link) 188 { 189 struct net_device *dev = link->priv; ··· 186 /*============================================================================*/ 187 188 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 void wl_adapter_release(struct pcmcia_device *link) 210 { 211 DBG_FUNC("wl_adapter_release"); ··· 225 return 0; 226 } /* wl_adapter_resume */ 227 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 void wl_adapter_insert(struct pcmcia_device *link) 249 { 250 struct net_device *dev; ··· 239 dev = link->priv; 240 241 /* Do we need to allocate an interrupt? */ 242 - link->conf.Attributes |= CONF_ENABLE_IRQ; 243 link->io_lines = 6; 244 245 ret = pcmcia_request_io(link); ··· 250 if (ret != 0) 251 goto failed; 252 253 - ret = pcmcia_request_configuration(link, &link->conf); 254 if (ret != 0) 255 goto failed; 256 ··· 394 395 static struct pcmcia_driver wlags49_driver = { 396 .owner = THIS_MODULE, 397 - .drv = { 398 - .name = DRIVER_NAME, 399 - }, 400 .probe = wl_adapter_attach, 401 .remove = wl_adapter_detach, 402 .id_table = wl_adapter_ids,
··· 83 #include <linux/if_arp.h> 84 #include <linux/ioport.h> 85 86 #include <pcmcia/cistpl.h> 87 #include <pcmcia/cisreg.h> 88 #include <pcmcia/ciscode.h> ··· 147 148 link->resource[0]->end = HCF_NUM_IO_PORTS; 149 link->resource[0]->flags= IO_DATA_PATH_WIDTH_16; 150 + link->config_flags |= CONF_ENABLE_IRQ; 151 + link->config_index = 5; 152 + link->config_regs = PRESENT_OPTION; 153 154 link->priv = dev; 155 lp = wl_priv(dev); ··· 165 166 167 168 static void wl_adapter_detach(struct pcmcia_device *link) 169 { 170 struct net_device *dev = link->priv; ··· 209 /*============================================================================*/ 210 211 212 void wl_adapter_release(struct pcmcia_device *link) 213 { 214 DBG_FUNC("wl_adapter_release"); ··· 268 return 0; 269 } /* wl_adapter_resume */ 270 271 void wl_adapter_insert(struct pcmcia_device *link) 272 { 273 struct net_device *dev; ··· 302 dev = link->priv; 303 304 /* Do we need to allocate an interrupt? */ 305 + link->config_flags |= CONF_ENABLE_IRQ; 306 link->io_lines = 6; 307 308 ret = pcmcia_request_io(link); ··· 313 if (ret != 0) 314 goto failed; 315 316 + ret = pcmcia_enable_device(link); 317 if (ret != 0) 318 goto failed; 319 ··· 457 458 static struct pcmcia_driver wlags49_driver = { 459 .owner = THIS_MODULE, 460 + .name = DRIVER_NAME, 461 .probe = wl_adapter_attach, 462 .remove = wl_adapter_detach, 463 .id_table = wl_adapter_ids,
-1
drivers/staging/wlags49_h2/wl_internal.h
··· 69 ******************************************************************************/ 70 #include <linux/version.h> 71 #ifdef BUS_PCMCIA 72 - #include <pcmcia/cs.h> 73 #include <pcmcia/cistpl.h> 74 #include <pcmcia/cisreg.h> 75 #include <pcmcia/ciscode.h>
··· 69 ******************************************************************************/ 70 #include <linux/version.h> 71 #ifdef BUS_PCMCIA 72 #include <pcmcia/cistpl.h> 73 #include <pcmcia/cisreg.h> 74 #include <pcmcia/ciscode.h>
-19
drivers/staging/wlags49_h2/wl_main.c
··· 414 #endif /* HCF_STA */ 415 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 int wl_insert( struct net_device *dev ) 437 { 438 int result = 0;
··· 414 #endif /* HCF_STA */ 415 416 417 int wl_insert( struct net_device *dev ) 418 { 419 int result = 0;
+13 -28
drivers/telephony/ixj_pcmcia.c
··· 8 #include <linux/errno.h> /* error codes */ 9 #include <linux/slab.h> 10 11 - #include <pcmcia/cs.h> 12 #include <pcmcia/cistpl.h> 13 #include <pcmcia/ds.h> 14 ··· 31 { 32 dev_dbg(&p_dev->dev, "ixj_attach()\n"); 33 /* 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 p_dev->priv = kzalloc(sizeof(struct ixj_info_t), GFP_KERNEL); 38 if (!p_dev->priv) { 39 return -ENOMEM; ··· 107 return; 108 } 109 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) 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; 129 } 130 131 static int ixj_config(struct pcmcia_device * link) 132 { 133 IXJ *j; 134 ixj_info_t *info; 135 - cistpl_cftable_entry_t dflt = { 0 }; 136 137 info = link->priv; 138 dev_dbg(&link->dev, "ixj_config\n"); 139 140 - if (pcmcia_loop_config(link, ixj_config_check, &dflt)) 141 goto failed; 142 143 - if (pcmcia_request_configuration(link, &link->conf)) 144 goto failed; 145 146 /* ··· 165 166 static struct pcmcia_driver ixj_driver = { 167 .owner = THIS_MODULE, 168 - .drv = { 169 - .name = "ixj_cs", 170 - }, 171 .probe = ixj_probe, 172 .remove = ixj_detach, 173 .id_table = ixj_ids,
··· 8 #include <linux/errno.h> /* error codes */ 9 #include <linux/slab.h> 10 11 #include <pcmcia/cistpl.h> 12 #include <pcmcia/ds.h> 13 ··· 32 { 33 dev_dbg(&p_dev->dev, "ixj_attach()\n"); 34 /* Create new ixj device */ 35 p_dev->priv = kzalloc(sizeof(struct ixj_info_t), GFP_KERNEL); 36 if (!p_dev->priv) { 37 return -ENOMEM; ··· 111 return; 112 } 113 114 + static int ixj_config_check(struct pcmcia_device *p_dev, void *priv_data) 115 { 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); 123 } 124 125 static int ixj_config(struct pcmcia_device * link) 126 { 127 IXJ *j; 128 ixj_info_t *info; 129 130 info = link->priv; 131 dev_dbg(&link->dev, "ixj_config\n"); 132 133 + link->config_flags = CONF_AUTO_SET_IO; 134 + 135 + if (pcmcia_loop_config(link, ixj_config_check, NULL)) 136 goto failed; 137 138 + if (pcmcia_enable_device(link)) 139 goto failed; 140 141 /* ··· 178 179 static struct pcmcia_driver ixj_driver = { 180 .owner = THIS_MODULE, 181 + .name = "ixj_cs", 182 .probe = ixj_probe, 183 .remove = ixj_detach, 184 .id_table = ixj_ids,
+9 -57
drivers/usb/host/sl811_cs.c
··· 20 #include <linux/ioport.h> 21 #include <linux/platform_device.h> 22 23 - #include <pcmcia/cs.h> 24 #include <pcmcia/cistpl.h> 25 #include <pcmcia/cisreg.h> 26 #include <pcmcia/ds.h> ··· 131 platform_device_unregister(&platform_dev); 132 } 133 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) 139 { 140 - if (cfg->index == 0) 141 - return -ENODEV; 142 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; 177 } 178 179 ··· 146 int ret; 147 148 dev_dbg(&link->dev, "sl811_cs_config\n"); 149 150 if (pcmcia_loop_config(link, sl811_cs_config_check, NULL)) 151 goto failed; ··· 160 if (!link->irq) 161 goto failed; 162 163 - ret = pcmcia_request_configuration(link, &link->conf); 164 if (ret) 165 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 175 if (sl811_hc_init(parent, link->resource[0]->start, link->irq) 176 < 0) { ··· 184 local->p_dev = link; 185 link->priv = local; 186 187 - link->conf.Attributes = 0; 188 - link->conf.IntType = INT_MEMORY_AND_IO; 189 - 190 return sl811_cs_config(link); 191 } 192 ··· 195 196 static struct pcmcia_driver sl811_cs_driver = { 197 .owner = THIS_MODULE, 198 - .drv = { 199 - .name = "sl811_cs", 200 - }, 201 .probe = sl811_cs_probe, 202 .remove = sl811_cs_detach, 203 .id_table = sl811_ids,
··· 20 #include <linux/ioport.h> 21 #include <linux/platform_device.h> 22 23 #include <pcmcia/cistpl.h> 24 #include <pcmcia/cisreg.h> 25 #include <pcmcia/ds.h> ··· 132 platform_device_unregister(&platform_dev); 133 } 134 135 + static int sl811_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) 136 { 137 + if (p_dev->config_index == 0) 138 + return -EINVAL; 139 140 + return pcmcia_request_io(p_dev); 141 } 142 143 ··· 184 int ret; 185 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; 190 191 if (pcmcia_loop_config(link, sl811_cs_config_check, NULL)) 192 goto failed; ··· 195 if (!link->irq) 196 goto failed; 197 198 + ret = pcmcia_enable_device(link); 199 if (ret) 200 goto failed; 201 202 if (sl811_hc_init(parent, link->resource[0]->start, link->irq) 203 < 0) { ··· 227 local->p_dev = link; 228 link->priv = local; 229 230 return sl811_cs_config(link); 231 } 232 ··· 241 242 static struct pcmcia_driver sl811_cs_driver = { 243 .owner = THIS_MODULE, 244 + .name = "sl811_cs", 245 .probe = sl811_cs_probe, 246 .remove = sl811_cs_detach, 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 25 #ifdef __KERNEL__ 26 #include <linux/device.h> 27 #include <pcmcia/ss.h> 28 #include <asm/atomic.h> 29 30 /* 31 * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus ··· 38 struct config_t; 39 struct net_device; 40 41 - typedef struct resource *window_handle_t; 42 - 43 /* dynamic device IDs for PCMCIA device drivers. See 44 * Documentation/pcmcia/driver.txt for details. 45 */ ··· 47 }; 48 49 struct pcmcia_driver { 50 int (*probe) (struct pcmcia_device *dev); 51 void (*remove) (struct pcmcia_device *dev); 52 ··· 92 93 struct list_head socket_device_list; 94 95 - /* deprecated, will be cleaned up soon */ 96 - config_req_t conf; 97 - window_handle_t win; 98 - 99 /* device setup */ 100 unsigned int irq; 101 struct resource *resource[PCMCIA_NUM_RESOURCES]; 102 103 - unsigned int io_lines; /* number of I/O lines */ 104 105 /* Is the device suspended? */ 106 u16 suspended:1; ··· 178 /* loop CIS entries for valid configuration */ 179 int pcmcia_loop_config(struct pcmcia_device *p_dev, 180 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 void *priv_data), 185 void *priv_data); 186 ··· 207 int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, 208 irq_handler_t handler); 209 210 - int pcmcia_request_configuration(struct pcmcia_device *p_dev, 211 - config_req_t *req); 212 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, 217 unsigned int offset); 218 219 - int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); 220 void pcmcia_disable_device(struct pcmcia_device *p_dev); 221 222 /* IO ports */ ··· 226 #define IO_DATA_PATH_WIDTH_16 0x08 227 #define IO_DATA_PATH_WIDTH_AUTO 0x10 228 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 - } 238 239 #endif /* __KERNEL__ */ 240
··· 24 25 #ifdef __KERNEL__ 26 #include <linux/device.h> 27 + #include <linux/interrupt.h> 28 #include <pcmcia/ss.h> 29 #include <asm/atomic.h> 30 + 31 32 /* 33 * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus ··· 36 struct config_t; 37 struct net_device; 38 39 /* dynamic device IDs for PCMCIA device drivers. See 40 * Documentation/pcmcia/driver.txt for details. 41 */ ··· 47 }; 48 49 struct pcmcia_driver { 50 + const char *name; 51 + 52 int (*probe) (struct pcmcia_device *dev); 53 void (*remove) (struct pcmcia_device *dev); 54 ··· 90 91 struct list_head socket_device_list; 92 93 /* device setup */ 94 unsigned int irq; 95 struct resource *resource[PCMCIA_NUM_RESOURCES]; 96 + resource_size_t card_addr; /* for the 1st IOMEM resource */ 97 + unsigned int vpp; 98 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 105 /* Is the device suspended? */ 106 u16 suspended:1; ··· 174 /* loop CIS entries for valid configuration */ 175 int pcmcia_loop_config(struct pcmcia_device *p_dev, 176 int (*conf_check) (struct pcmcia_device *p_dev, 177 void *priv_data), 178 void *priv_data); 179 ··· 206 int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, 207 irq_handler_t handler); 208 209 + int pcmcia_enable_device(struct pcmcia_device *p_dev); 210 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, 215 unsigned int offset); 216 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 void pcmcia_disable_device(struct pcmcia_device *p_dev); 221 222 /* IO ports */ ··· 224 #define IO_DATA_PATH_WIDTH_16 0x08 225 #define IO_DATA_PATH_WIDTH_AUTO 0x10 226 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] */ 267 268 #endif /* __KERNEL__ */ 269
-1
include/pcmcia/ss.h
··· 19 #include <linux/sched.h> /* task_struct, completion */ 20 #include <linux/mutex.h> 21 22 - #include <pcmcia/cs.h> 23 #ifdef CONFIG_CARDBUS 24 #include <linux/pci.h> 25 #endif
··· 19 #include <linux/sched.h> /* task_struct, completion */ 20 #include <linux/mutex.h> 21 22 #ifdef CONFIG_CARDBUS 23 #include <linux/pci.h> 24 #endif
+7 -9
sound/pcmcia/pdaudiocf/pdaudiocf.c
··· 142 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 143 link->resource[0]->end = 16; 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; 149 150 return pdacf_config(link); 151 } ··· 216 int ret; 217 218 snd_printdd(KERN_DEBUG "pdacf_config called\n"); 219 - link->conf.ConfigIndex = 0x5; 220 221 ret = pcmcia_request_io(link); 222 if (ret) ··· 227 if (ret) 228 goto failed; 229 230 - ret = pcmcia_request_configuration(link, &link->conf); 231 if (ret) 232 goto failed; 233 ··· 287 288 static struct pcmcia_driver pdacf_cs_driver = { 289 .owner = THIS_MODULE, 290 - .drv = { 291 - .name = "snd-pdaudiocf", 292 - }, 293 .probe = snd_pdacf_probe, 294 .remove = snd_pdacf_detach, 295 .id_table = snd_pdacf_ids,
··· 142 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 143 link->resource[0]->end = 16; 144 145 + link->config_flags = CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; 146 + link->config_index = 1; 147 + link->config_regs = PRESENT_OPTION; 148 149 return pdacf_config(link); 150 } ··· 217 int ret; 218 219 snd_printdd(KERN_DEBUG "pdacf_config called\n"); 220 + link->config_index = 0x5; 221 + link->config_flags |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; 222 223 ret = pcmcia_request_io(link); 224 if (ret) ··· 227 if (ret) 228 goto failed; 229 230 + ret = pcmcia_enable_device(link); 231 if (ret) 232 goto failed; 233 ··· 287 288 static struct pcmcia_driver pdacf_cs_driver = { 289 .owner = THIS_MODULE, 290 + .name = "snd-pdaudiocf", 291 .probe = snd_pdacf_probe, 292 .remove = snd_pdacf_detach, 293 .id_table = snd_pdacf_ids,
-1
sound/pcmcia/pdaudiocf/pdaudiocf.h
··· 24 #include <sound/pcm.h> 25 #include <asm/io.h> 26 #include <linux/interrupt.h> 27 - #include <pcmcia/cs.h> 28 #include <pcmcia/cistpl.h> 29 #include <pcmcia/ds.h> 30
··· 24 #include <sound/pcm.h> 25 #include <asm/io.h> 26 #include <linux/interrupt.h> 27 #include <pcmcia/cistpl.h> 28 #include <pcmcia/ds.h> 29
+6 -9
sound/pcmcia/vx/vxpocket.c
··· 2 * Driver for Digigram VXpocket V2/440 soundcards 3 * 4 * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de> 5 - * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or ··· 162 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 163 link->resource[0]->end = 16; 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; 169 170 *chip_ret = vxp; 171 return 0; ··· 233 if (ret) 234 goto failed; 235 236 - ret = pcmcia_request_configuration(link, &link->conf); 237 if (ret) 238 goto failed; 239 ··· 358 359 static struct pcmcia_driver vxp_cs_driver = { 360 .owner = THIS_MODULE, 361 - .drv = { 362 - .name = "snd-vxpocket", 363 - }, 364 .probe = vxpocket_probe, 365 .remove = vxpocket_detach, 366 .id_table = vxp_ids,
··· 2 * Driver for Digigram VXpocket V2/440 soundcards 3 * 4 * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de> 5 + 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or ··· 162 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 163 link->resource[0]->end = 16; 164 165 + link->config_flags |= CONF_ENABLE_IRQ; 166 + link->config_index = 1; 167 + link->config_regs = PRESENT_OPTION; 168 169 *chip_ret = vxp; 170 return 0; ··· 234 if (ret) 235 goto failed; 236 237 + ret = pcmcia_enable_device(link); 238 if (ret) 239 goto failed; 240 ··· 359 360 static struct pcmcia_driver vxp_cs_driver = { 361 .owner = THIS_MODULE, 362 + .name = "snd-vxpocket", 363 .probe = vxpocket_probe, 364 .remove = vxpocket_detach, 365 .id_table = vxp_ids,
-1
sound/pcmcia/vx/vxpocket.h
··· 23 24 #include <sound/vx_core.h> 25 26 - #include <pcmcia/cs.h> 27 #include <pcmcia/cistpl.h> 28 #include <pcmcia/ds.h> 29
··· 23 24 #include <sound/vx_core.h> 25 26 #include <pcmcia/cistpl.h> 27 #include <pcmcia/ds.h> 28