From 6ad1b614007c556129989b9f6b020d0d2e058121 Mon Sep 17 00:00:00 2001 From: Russell King Date: Mon, 16 Jan 2012 09:31:47 +0000 Subject: ARM: sa11x0: neponset: provide function to manipulate NCR_0 Rather than having direct register accesses to NCR_0 scattered amongst the code, provide a function instead. This contains the necessary race protection for this platform, ensuring that updates to this register are safe. Signed-off-by: Russell King --- drivers/pcmcia/sa1100_neponset.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/sa1100_neponset.c b/drivers/pcmcia/sa1100_neponset.c index c95639b5f2a0..4300a7fb3edb 100644 --- a/drivers/pcmcia/sa1100_neponset.c +++ b/drivers/pcmcia/sa1100_neponset.c @@ -94,12 +94,7 @@ neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_sta ret = sa1111_pcmcia_configure_socket(skt, state); if (ret == 0) { - unsigned long flags; - - local_irq_save(flags); - NCR_0 = (NCR_0 & ~ncr_mask) | ncr_set; - - local_irq_restore(flags); + neponset_ncr_frob(ncr_mask, ncr_set); sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set); } -- cgit v1.2.1 From ae99ddbc976572194e8a68cb9ca1e27805ce30c7 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 26 Jan 2012 13:25:47 +0000 Subject: ARM: sa1111: add platform enable/disable functions Add platform hooks to be called when individual sa1111 devices are enabled and disabled. This will allow us to move some platform specifics out of the individual drivers. Acked-by: Nicolas Pitre Signed-off-by: Russell King --- drivers/pcmcia/sa1111_generic.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c index 27f2fe3b7fb4..0735c3e6a8b0 100644 --- a/drivers/pcmcia/sa1111_generic.c +++ b/drivers/pcmcia/sa1111_generic.c @@ -163,12 +163,18 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops, static int pcmcia_probe(struct sa1111_dev *dev) { void __iomem *base; + int ret; + + ret = sa1111_enable_device(dev); + if (ret) + return ret; dev_set_drvdata(&dev->dev, NULL); - if (!request_mem_region(dev->res.start, 512, - SA1111_DRIVER_NAME(dev))) + if (!request_mem_region(dev->res.start, 512, SA1111_DRIVER_NAME(dev))) { + sa1111_disable_device(dev); return -EBUSY; + } base = dev->mapbase; @@ -212,6 +218,7 @@ static int __devexit pcmcia_remove(struct sa1111_dev *dev) } release_mem_region(dev->res.start, 512); + sa1111_disable_device(dev); return 0; } -- cgit v1.2.1 From d571c79e86fa7704265b9127403a78ccd3c01729 Mon Sep 17 00:00:00 2001 From: Yong Zhang Date: Sat, 22 Oct 2011 17:56:49 +0800 Subject: pcmcia: irq: Remove IRQF_DISABLED Since commit [e58aa3d2: genirq: Run irq handlers with interrupts disabled], We run all interrupt handlers with interrupts disabled and we even check and yell when an interrupt handler returns with interrupts enabled (see commit [b738a50a: genirq: Warn when handler enables interrupts]). So now this flag is a NOOP and can be removed. Signed-off-by: Yong Zhang Acked-by: Wolfram Sang Signed-off-by: Dominik Brodowski --- drivers/pcmcia/db1xxx_ss.c | 4 ++-- drivers/pcmcia/soc_common.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/db1xxx_ss.c b/drivers/pcmcia/db1xxx_ss.c index 5b7c22784aff..deb348cf573e 100644 --- a/drivers/pcmcia/db1xxx_ss.c +++ b/drivers/pcmcia/db1xxx_ss.c @@ -172,12 +172,12 @@ static int db1x_pcmcia_setup_irqs(struct db1x_pcmcia_sock *sock) if ((sock->board_type == BOARD_TYPE_DB1200) || (sock->board_type == BOARD_TYPE_DB1300)) { ret = request_irq(sock->insert_irq, db1200_pcmcia_cdirq, - IRQF_DISABLED, "pcmcia_insert", sock); + 0, "pcmcia_insert", sock); if (ret) goto out1; ret = request_irq(sock->eject_irq, db1200_pcmcia_cdirq, - IRQF_DISABLED, "pcmcia_eject", sock); + 0, "pcmcia_eject", sock); if (ret) { free_irq(sock->insert_irq, sock); goto out1; diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index a0a9c2aa8d78..0493a3146da3 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c @@ -535,7 +535,7 @@ int soc_pcmcia_request_irqs(struct soc_pcmcia_socket *skt, if (irqs[i].sock != skt->nr) continue; res = request_irq(irqs[i].irq, soc_common_pcmcia_interrupt, - IRQF_DISABLED, irqs[i].str, skt); + 0, irqs[i].str, skt); if (res) break; irq_set_irq_type(irqs[i].irq, IRQ_TYPE_NONE); -- cgit v1.2.1 From 5d95f8e2dd263f3e05ae4bf9a3309552363e13af Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sun, 27 Nov 2011 12:53:06 +0800 Subject: pcmcia: convert drivers/pcmcia/* to use module_platform_driver() This patch converts the drivers in drivers/pcmcia/* to use the module_platform_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin Acked-by: Wolfram Sang Acked-by: Olof Johansson Acked-by: Michael Hennerich Acked-by: Marc Zyngier [for the viper part] Acked-by: Manuel Lauss [for the db1xxx_ss.c part] Signed-off-by: Dominik Brodowski --- drivers/pcmcia/bfin_cf_pcmcia.c | 13 +------------ drivers/pcmcia/db1xxx_ss.c | 13 +------------ drivers/pcmcia/electra_cf.c | 12 +----------- drivers/pcmcia/m8xx_pcmcia.c | 13 +------------ drivers/pcmcia/pxa2xx_viper.c | 13 +------------ drivers/pcmcia/xxs1500_ss.c | 13 +------------ 6 files changed, 6 insertions(+), 71 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/bfin_cf_pcmcia.c b/drivers/pcmcia/bfin_cf_pcmcia.c index 49221395101e..ac1a2232eab9 100644 --- a/drivers/pcmcia/bfin_cf_pcmcia.c +++ b/drivers/pcmcia/bfin_cf_pcmcia.c @@ -310,18 +310,7 @@ static struct platform_driver bfin_cf_driver = { .remove = __devexit_p(bfin_cf_remove), }; -static int __init bfin_cf_init(void) -{ - return platform_driver_register(&bfin_cf_driver); -} - -static void __exit bfin_cf_exit(void) -{ - platform_driver_unregister(&bfin_cf_driver); -} - -module_init(bfin_cf_init); -module_exit(bfin_cf_exit); +module_platform_driver(bfin_cf_driver); MODULE_AUTHOR("Michael Hennerich "); MODULE_DESCRIPTION("BFIN CF/PCMCIA Driver"); diff --git a/drivers/pcmcia/db1xxx_ss.c b/drivers/pcmcia/db1xxx_ss.c index deb348cf573e..a484b1fb3382 100644 --- a/drivers/pcmcia/db1xxx_ss.c +++ b/drivers/pcmcia/db1xxx_ss.c @@ -580,18 +580,7 @@ static struct platform_driver db1x_pcmcia_socket_driver = { .remove = __devexit_p(db1x_pcmcia_socket_remove), }; -int __init db1x_pcmcia_socket_load(void) -{ - return platform_driver_register(&db1x_pcmcia_socket_driver); -} - -void __exit db1x_pcmcia_socket_unload(void) -{ - platform_driver_unregister(&db1x_pcmcia_socket_driver); -} - -module_init(db1x_pcmcia_socket_load); -module_exit(db1x_pcmcia_socket_unload); +module_platform_driver(db1x_pcmcia_socket_driver); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("PCMCIA Socket Services for Alchemy Db/Pb1x00 boards"); diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c index 06ad3e5e7d3d..7647d232e9e2 100644 --- a/drivers/pcmcia/electra_cf.c +++ b/drivers/pcmcia/electra_cf.c @@ -365,17 +365,7 @@ static struct platform_driver electra_cf_driver = { .remove = electra_cf_remove, }; -static int __init electra_cf_init(void) -{ - return platform_driver_register(&electra_cf_driver); -} -module_init(electra_cf_init); - -static void __exit electra_cf_exit(void) -{ - platform_driver_unregister(&electra_cf_driver); -} -module_exit(electra_cf_exit); +module_platform_driver(electra_cf_driver); MODULE_LICENSE("GPL"); MODULE_AUTHOR ("Olof Johansson "); diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index 271a590a5f3c..b120928cf3e9 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c @@ -1304,15 +1304,4 @@ static struct platform_driver m8xx_pcmcia_driver = { .remove = m8xx_remove, }; -static int __init m8xx_init(void) -{ - return platform_driver_register(&m8xx_pcmcia_driver); -} - -static void __exit m8xx_exit(void) -{ - platform_driver_unregister(&m8xx_pcmcia_driver); -} - -module_init(m8xx_init); -module_exit(m8xx_exit); +module_platform_driver(m8xx_pcmcia_driver); diff --git a/drivers/pcmcia/pxa2xx_viper.c b/drivers/pcmcia/pxa2xx_viper.c index 1064b1c2869d..44f5c7fc9b6f 100644 --- a/drivers/pcmcia/pxa2xx_viper.c +++ b/drivers/pcmcia/pxa2xx_viper.c @@ -204,18 +204,7 @@ static struct platform_driver viper_pcmcia_driver = { .id_table = viper_pcmcia_id_table, }; -static int __init viper_pcmcia_init(void) -{ - return platform_driver_register(&viper_pcmcia_driver); -} - -static void __exit viper_pcmcia_exit(void) -{ - return platform_driver_unregister(&viper_pcmcia_driver); -} - -module_init(viper_pcmcia_init); -module_exit(viper_pcmcia_exit); +module_platform_driver(viper_pcmcia_driver); MODULE_DEVICE_TABLE(platform, viper_pcmcia_id_table); MODULE_LICENSE("GPL"); diff --git a/drivers/pcmcia/xxs1500_ss.c b/drivers/pcmcia/xxs1500_ss.c index 379f4218857d..1ceff698c654 100644 --- a/drivers/pcmcia/xxs1500_ss.c +++ b/drivers/pcmcia/xxs1500_ss.c @@ -321,18 +321,7 @@ static struct platform_driver xxs1500_pcmcia_socket_driver = { .remove = __devexit_p(xxs1500_pcmcia_remove), }; -int __init xxs1500_pcmcia_socket_load(void) -{ - return platform_driver_register(&xxs1500_pcmcia_socket_driver); -} - -void __exit xxs1500_pcmcia_socket_unload(void) -{ - platform_driver_unregister(&xxs1500_pcmcia_socket_driver); -} - -module_init(xxs1500_pcmcia_socket_load); -module_exit(xxs1500_pcmcia_socket_unload); +module_platform_driver(xxs1500_pcmcia_socket_driver); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("PCMCIA Socket Services for MyCable XXS1500 systems"); -- cgit v1.2.1 From 2b2c5d8c1dff8ed42d6d841f56428c0ce2bd71b5 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 27 Dec 2011 16:17:46 +0800 Subject: pcmcia: Convert to DEFINE_PCI_DEVICE_TABLE Convert static struct pci_device_id *[] to static DEFINE_PCI_DEVICE_TABLE tables. Also convert to use PCI_DEVICE macro for better readablity. Signed-off-by: Axel Lin Signed-off-by: Dominik Brodowski --- drivers/pcmcia/bcm63xx_pcmcia.c | 2 +- drivers/pcmcia/i82092.c | 11 +++-------- drivers/pcmcia/pd6729.c | 9 ++------- drivers/pcmcia/vrc4173_cardu.c | 7 ++----- drivers/pcmcia/yenta_socket.c | 2 +- 5 files changed, 9 insertions(+), 22 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/bcm63xx_pcmcia.c b/drivers/pcmcia/bcm63xx_pcmcia.c index 693577e0fefc..c2e997a570bf 100644 --- a/drivers/pcmcia/bcm63xx_pcmcia.c +++ b/drivers/pcmcia/bcm63xx_pcmcia.c @@ -475,7 +475,7 @@ static void __devexit bcm63xx_cb_exit(struct pci_dev *dev) bcm63xx_cb_dev = NULL; } -static struct pci_device_id bcm63xx_cb_table[] = { +static DEFINE_PCI_DEVICE_TABLE(bcm63xx_cb_table) = { { .vendor = PCI_VENDOR_ID_BROADCOM, .device = BCM6348_CPU_ID, diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c index 3e447d0387b7..17035236ad2e 100644 --- a/drivers/pcmcia/i82092.c +++ b/drivers/pcmcia/i82092.c @@ -26,14 +26,9 @@ MODULE_LICENSE("GPL"); /* PCI core routines */ -static struct pci_device_id i82092aa_pci_ids[] = { - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82092AA_0, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - {} +static DEFINE_PCI_DEVICE_TABLE(i82092aa_pci_ids) = { + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82092AA_0) }, + { } }; MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids); diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 96c72e90b79c..5928247a4af0 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c @@ -763,13 +763,8 @@ static void __devexit pd6729_pci_remove(struct pci_dev *dev) kfree(socket); } -static struct pci_device_id pd6729_pci_ids[] = { - { - .vendor = PCI_VENDOR_ID_CIRRUS, - .device = PCI_DEVICE_ID_CIRRUS_6729, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, +static DEFINE_PCI_DEVICE_TABLE(pd6729_pci_ids) = { + { PCI_DEVICE(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_6729) }, { } }; MODULE_DEVICE_TABLE(pci, pd6729_pci_ids); diff --git a/drivers/pcmcia/vrc4173_cardu.c b/drivers/pcmcia/vrc4173_cardu.c index c6d36b3a6ce8..cd0a315d922b 100644 --- a/drivers/pcmcia/vrc4173_cardu.c +++ b/drivers/pcmcia/vrc4173_cardu.c @@ -563,11 +563,8 @@ static int __devinit vrc4173_cardu_setup(char *options) __setup("vrc4173_cardu=", vrc4173_cardu_setup); -static struct pci_device_id vrc4173_cardu_id_table[] __devinitdata = { - { .vendor = PCI_VENDOR_ID_NEC, - .device = PCI_DEVICE_ID_NEC_NAPCCARD, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, }, +static DEFINE_PCI_DEVICE_TABLE(vrc4173_cardu_id_table) = { + { PCI_DEVICE(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_NAPCCARD) }, {0, } }; diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 849c0c11d2af..d07f9ac8c41d 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c @@ -1352,7 +1352,7 @@ static const struct dev_pm_ops yenta_pm_ops = { .driver_data = CARDBUS_TYPE_##type, \ } -static struct pci_device_id yenta_table[] = { +static DEFINE_PCI_DEVICE_TABLE(yenta_table) = { CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1031, TI), /* -- cgit v1.2.1 From f24fa8affe020c57a25bbb73ed31a6e4eb5c00c2 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 27 Dec 2011 16:25:44 +0800 Subject: ARM: pxa: fix error handling in pxa2xx_drv_pcmcia_probe If pxa2xx_drv_pcmcia_add_one fails, it will go to err1 error path. Add a missing clk_put in the error path. Checking the ret value after the for loop is redundant, it is always false. Thus remove the redundant checking. Signed-off-by: Axel Lin Acked-by: Eric Miao Acked-by: Marek Vasut Signed-off-by: Dominik Brodowski --- drivers/pcmcia/pxa2xx_base.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index a87e2728b2c3..64d433ec4fc6 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c @@ -328,21 +328,15 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev) goto err1; } - if (ret) { - while (--i >= 0) - soc_pcmcia_remove_one(&sinfo->skt[i]); - kfree(sinfo); - clk_put(clk); - } else { - pxa2xx_configure_sockets(&dev->dev); - dev_set_drvdata(&dev->dev, sinfo); - } + pxa2xx_configure_sockets(&dev->dev); + dev_set_drvdata(&dev->dev, sinfo); return 0; err1: while (--i >= 0) soc_pcmcia_remove_one(&sinfo->skt[i]); + clk_put(clk); kfree(sinfo); err0: return ret; -- cgit v1.2.1 From 80af9e6d7ae633309cc5bca96aee6a45117e7c98 Mon Sep 17 00:00:00 2001 From: Joachim Eastwood Date: Tue, 10 Jan 2012 02:37:25 +0100 Subject: pcmcia at91_cf: fix raw gpio number usage This patches fixes two things: * Use gpio_valid function to check gpio before usage This must be done after 63b4c29678500 which uses -EINVAL for unused pin's * Use gpio_to_irq to convert gpio's to irq The driver assumed a 1:1 mapping between gpio and irq numbers. This is no longer true after d0fbda9add3281. Tested on custom RM9200 board with 8gb CF card. Signed-off-by: Joachim Eastwood Acked-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Dominik Brodowski --- drivers/pcmcia/at91_cf.c | 52 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c index 4902206f53d9..4127441015db 100644 --- a/drivers/pcmcia/at91_cf.c +++ b/drivers/pcmcia/at91_cf.c @@ -16,13 +16,13 @@ #include #include #include +#include #include #include #include #include -#include #include #include @@ -69,7 +69,7 @@ static irqreturn_t at91_cf_irq(int irq, void *_cf) { struct at91_cf_socket *cf = _cf; - if (irq == cf->board->det_pin) { + if (irq == gpio_to_irq(cf->board->det_pin)) { unsigned present = at91_cf_present(cf); /* kick pccard as needed */ @@ -95,8 +95,8 @@ static int at91_cf_get_status(struct pcmcia_socket *s, u_int *sp) /* NOTE: CF is always 3VCARD */ if (at91_cf_present(cf)) { - int rdy = cf->board->irq_pin; /* RDY/nIRQ */ - int vcc = cf->board->vcc_pin; + int rdy = gpio_is_valid(cf->board->irq_pin); /* RDY/nIRQ */ + int vcc = gpio_is_valid(cf->board->vcc_pin); *sp = SS_DETECT | SS_3VCARD; if (!rdy || gpio_get_value(rdy)) @@ -117,7 +117,7 @@ at91_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s) cf = container_of(sock, struct at91_cf_socket, socket); /* switch Vcc if needed and possible */ - if (cf->board->vcc_pin) { + if (gpio_is_valid(cf->board->vcc_pin)) { switch (s->Vcc) { case 0: gpio_set_value(cf->board->vcc_pin, 0); @@ -221,7 +221,7 @@ static int __init at91_cf_probe(struct platform_device *pdev) struct resource *io; int status; - if (!board || !board->det_pin || !board->rst_pin) + if (!board || !gpio_is_valid(board->det_pin) || !gpio_is_valid(board->rst_pin)) return -ENODEV; io = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -241,7 +241,7 @@ static int __init at91_cf_probe(struct platform_device *pdev) status = gpio_request(board->det_pin, "cf_det"); if (status < 0) goto fail0; - status = request_irq(board->det_pin, at91_cf_irq, 0, driver_name, cf); + status = request_irq(gpio_to_irq(board->det_pin), at91_cf_irq, 0, driver_name, cf); if (status < 0) goto fail00; device_init_wakeup(&pdev->dev, 1); @@ -250,7 +250,7 @@ static int __init at91_cf_probe(struct platform_device *pdev) if (status < 0) goto fail0a; - if (board->vcc_pin) { + if (gpio_is_valid(board->vcc_pin)) { status = gpio_request(board->vcc_pin, "cf_vcc"); if (status < 0) goto fail0b; @@ -262,15 +262,15 @@ static int __init at91_cf_probe(struct platform_device *pdev) * unless we report that we handle everything (sigh). * (Note: DK board doesn't wire the IRQ pin...) */ - if (board->irq_pin) { + if (gpio_is_valid(board->irq_pin)) { status = gpio_request(board->irq_pin, "cf_irq"); if (status < 0) goto fail0c; - status = request_irq(board->irq_pin, at91_cf_irq, + status = request_irq(gpio_to_irq(board->irq_pin), at91_cf_irq, IRQF_SHARED, driver_name, cf); if (status < 0) goto fail0d; - cf->socket.pci_irq = board->irq_pin; + cf->socket.pci_irq = gpio_to_irq(board->irq_pin); } else cf->socket.pci_irq = nr_irqs + 1; @@ -289,7 +289,7 @@ static int __init at91_cf_probe(struct platform_device *pdev) } pr_info("%s: irqs det #%d, io #%d\n", driver_name, - board->det_pin, board->irq_pin); + gpio_to_irq(board->det_pin), gpio_to_irq(board->irq_pin)); cf->socket.owner = THIS_MODULE; cf->socket.dev.parent = &pdev->dev; @@ -311,19 +311,19 @@ fail2: fail1: if (cf->socket.io_offset) iounmap((void __iomem *) cf->socket.io_offset); - if (board->irq_pin) { - free_irq(board->irq_pin, cf); + if (gpio_is_valid(board->irq_pin)) { + free_irq(gpio_to_irq(board->irq_pin), cf); fail0d: gpio_free(board->irq_pin); } fail0c: - if (board->vcc_pin) + if (gpio_is_valid(board->vcc_pin)) gpio_free(board->vcc_pin); fail0b: gpio_free(board->rst_pin); fail0a: device_init_wakeup(&pdev->dev, 0); - free_irq(board->det_pin, cf); + free_irq(gpio_to_irq(board->det_pin), cf); fail00: gpio_free(board->det_pin); fail0: @@ -340,15 +340,15 @@ static int __exit at91_cf_remove(struct platform_device *pdev) pcmcia_unregister_socket(&cf->socket); release_mem_region(io->start, resource_size(io)); iounmap((void __iomem *) cf->socket.io_offset); - if (board->irq_pin) { - free_irq(board->irq_pin, cf); + if (gpio_is_valid(board->irq_pin)) { + free_irq(gpio_to_irq(board->irq_pin), cf); gpio_free(board->irq_pin); } - if (board->vcc_pin) + if (gpio_is_valid(board->vcc_pin)) gpio_free(board->vcc_pin); gpio_free(board->rst_pin); device_init_wakeup(&pdev->dev, 0); - free_irq(board->det_pin, cf); + free_irq(gpio_to_irq(board->det_pin), cf); gpio_free(board->det_pin); kfree(cf); return 0; @@ -362,9 +362,9 @@ static int at91_cf_suspend(struct platform_device *pdev, pm_message_t mesg) struct at91_cf_data *board = cf->board; if (device_may_wakeup(&pdev->dev)) { - enable_irq_wake(board->det_pin); - if (board->irq_pin) - enable_irq_wake(board->irq_pin); + enable_irq_wake(gpio_to_irq(board->det_pin)); + if (gpio_is_valid(board->irq_pin)) + enable_irq_wake(gpio_to_irq(board->irq_pin)); } return 0; } @@ -375,9 +375,9 @@ static int at91_cf_resume(struct platform_device *pdev) struct at91_cf_data *board = cf->board; if (device_may_wakeup(&pdev->dev)) { - disable_irq_wake(board->det_pin); - if (board->irq_pin) - disable_irq_wake(board->irq_pin); + disable_irq_wake(gpio_to_irq(board->det_pin)); + if (gpio_is_valid(board->irq_pin)) + disable_irq_wake(gpio_to_irq(board->irq_pin)); } return 0; -- cgit v1.2.1 From ea8c00ac18198763bceb7ca53d26df4aa8d3c414 Mon Sep 17 00:00:00 2001 From: Russell King Date: Mon, 16 Jan 2012 11:32:09 +0000 Subject: ARM: sa1111: move PCMCIA interface register definitions to sa1111_generic.c Move the PCMCIA interface register definitions into the driver, rather than keeping them in a common place. Acked-by: Nicolas Pitre Signed-off-by: Russell King --- drivers/pcmcia/sa1111_generic.c | 44 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c index 0735c3e6a8b0..33568e18998b 100644 --- a/drivers/pcmcia/sa1111_generic.c +++ b/drivers/pcmcia/sa1111_generic.c @@ -22,6 +22,40 @@ #include "sa1111_generic.h" +/* + * These are offsets from the above base. + */ +#define PCCR 0x0000 +#define PCSSR 0x0004 +#define PCSR 0x0008 + +#define PCSR_S0_READY (1<<0) +#define PCSR_S1_READY (1<<1) +#define PCSR_S0_DETECT (1<<2) +#define PCSR_S1_DETECT (1<<3) +#define PCSR_S0_VS1 (1<<4) +#define PCSR_S0_VS2 (1<<5) +#define PCSR_S1_VS1 (1<<6) +#define PCSR_S1_VS2 (1<<7) +#define PCSR_S0_WP (1<<8) +#define PCSR_S1_WP (1<<9) +#define PCSR_S0_BVD1 (1<<10) +#define PCSR_S0_BVD2 (1<<11) +#define PCSR_S1_BVD1 (1<<12) +#define PCSR_S1_BVD2 (1<<13) + +#define PCCR_S0_RST (1<<0) +#define PCCR_S1_RST (1<<1) +#define PCCR_S0_FLT (1<<2) +#define PCCR_S1_FLT (1<<3) +#define PCCR_S0_PWAITEN (1<<4) +#define PCCR_S1_PWAITEN (1<<5) +#define PCCR_S0_PSE (1<<6) +#define PCCR_S1_PSE (1<<7) + +#define PCSSR_S0_SLEEP (1<<0) +#define PCSSR_S1_SLEEP (1<<1) + #define IDX_IRQ_S0_READY_NINT (0) #define IDX_IRQ_S0_CD_VALID (1) #define IDX_IRQ_S0_BVD1_STSCHG (2) @@ -49,7 +83,7 @@ static void sa1111_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) { struct sa1111_pcmcia_socket *s = to_skt(skt); - unsigned long status = sa1111_readl(s->dev->mapbase + SA1111_PCSR); + unsigned long status = sa1111_readl(s->dev->mapbase + PCSR); switch (skt->nr) { case 0: @@ -105,10 +139,10 @@ int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_s pccr_set_mask |= PCCR_S0_FLT|PCCR_S1_FLT; local_irq_save(flags); - val = sa1111_readl(s->dev->mapbase + SA1111_PCCR); + val = sa1111_readl(s->dev->mapbase + PCCR); val &= ~pccr_skt_mask; val |= pccr_set_mask & pccr_skt_mask; - sa1111_writel(val, s->dev->mapbase + SA1111_PCCR); + sa1111_writel(val, s->dev->mapbase + PCCR); local_irq_restore(flags); return 0; @@ -187,8 +221,8 @@ static int pcmcia_probe(struct sa1111_dev *dev) /* * Initialise the suspend state. */ - sa1111_writel(PCSSR_S0_SLEEP | PCSSR_S1_SLEEP, base + SA1111_PCSSR); - sa1111_writel(PCCR_S0_FLT | PCCR_S1_FLT, base + SA1111_PCCR); + sa1111_writel(PCSSR_S0_SLEEP | PCSSR_S1_SLEEP, base + PCSSR); + sa1111_writel(PCCR_S0_FLT | PCCR_S1_FLT, base + PCCR); #ifdef CONFIG_SA1100_BADGE4 pcmcia_badge4_init(&dev->dev); -- cgit v1.2.1 From 9ffc93f203c18a70623f21950f1dd473c9ec48cd Mon Sep 17 00:00:00 2001 From: David Howells Date: Wed, 28 Mar 2012 18:30:03 +0100 Subject: Remove all #inclusions of asm/system.h Remove all #inclusions of asm/system.h preparatory to splitting and killing it. Performed with the following command: perl -p -i -e 's!^#\s*include\s*.*\n!!' `grep -Irl '^#\s*include\s*' *` Signed-off-by: David Howells --- drivers/pcmcia/cs.c | 1 - drivers/pcmcia/i82092.c | 1 - drivers/pcmcia/i82365.c | 1 - drivers/pcmcia/m32r_cfc.c | 1 - drivers/pcmcia/m32r_pcc.c | 1 - drivers/pcmcia/m8xx_pcmcia.c | 1 - drivers/pcmcia/pd6729.c | 1 - drivers/pcmcia/pxa2xx_base.c | 1 - drivers/pcmcia/sa11xx_base.c | 1 - drivers/pcmcia/soc_common.c | 1 - drivers/pcmcia/socket_sysfs.c | 1 - drivers/pcmcia/tcic.c | 1 - drivers/pcmcia/xxs1500_ss.c | 1 - 13 files changed, 13 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index d9ea192c4001..673c14ea11e3 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c index 3e447d0387b7..0b66bfc0e148 100644 --- a/drivers/pcmcia/i82092.c +++ b/drivers/pcmcia/i82092.c @@ -17,7 +17,6 @@ #include -#include #include #include "i82092aa.h" diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index 72a033a2acdb..e6f3d17dd2b4 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c @@ -48,7 +48,6 @@ #include #include #include -#include #include diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c index 2adb0106a039..a26f38c6402a 100644 --- a/drivers/pcmcia/m32r_cfc.c +++ b/drivers/pcmcia/m32r_cfc.c @@ -24,7 +24,6 @@ #include #include #include -#include #include diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c index 1511ff71c87b..296514155cd5 100644 --- a/drivers/pcmcia/m32r_pcc.c +++ b/drivers/pcmcia/m32r_pcc.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index 271a590a5f3c..a317defd616d 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c @@ -52,7 +52,6 @@ #include #include -#include #include #include #include diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 96c72e90b79c..0f8b70b27762 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c @@ -19,7 +19,6 @@ #include -#include #include "pd6729.h" #include "i82365.h" diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 64d433ec4fc6..85ac0957dcd0 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c index 0c62fe31a40e..79ecc23643ec 100644 --- a/drivers/pcmcia/sa11xx_base.c +++ b/drivers/pcmcia/sa11xx_base.c @@ -41,7 +41,6 @@ #include #include -#include #include "soc_common.h" #include "sa11xx_base.h" diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index a0a9c2aa8d78..5d22c6acb8e2 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c @@ -45,7 +45,6 @@ #include #include -#include #include "soc_common.h" diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index 71aeed93037c..d6881514d38e 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index 310160bffe38..cbe15fc37411 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c @@ -47,7 +47,6 @@ #include #include -#include #include #include "tcic.h" diff --git a/drivers/pcmcia/xxs1500_ss.c b/drivers/pcmcia/xxs1500_ss.c index 379f4218857d..8f6698074f8e 100644 --- a/drivers/pcmcia/xxs1500_ss.c +++ b/drivers/pcmcia/xxs1500_ss.c @@ -21,7 +21,6 @@ #include #include -#include #include #define MEM_MAP_SIZE 0x400000 -- cgit v1.2.1