diff options
author | David S. Miller <davem@davemloft.net> | 2010-04-11 17:53:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-11 17:53:53 -0400 |
commit | 871039f02f8ec4ab2e5e9010718caa8e085786f1 (patch) | |
tree | f0d2b3127fc48c862967d68c46c2d46668137515 /drivers/pcmcia/pd6729.c | |
parent | e4077e018b5ead3de9951fc01d8bf12eeeeeefed (diff) | |
parent | 4a1032faac94ebbf647460ae3e06fc21146eb280 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/stmmac/stmmac_main.c
drivers/net/wireless/wl12xx/wl1271_cmd.c
drivers/net/wireless/wl12xx/wl1271_main.c
drivers/net/wireless/wl12xx/wl1271_spi.c
net/core/ethtool.c
net/mac80211/scan.c
Diffstat (limited to 'drivers/pcmcia/pd6729.c')
-rw-r--r-- | drivers/pcmcia/pd6729.c | 81 |
1 files changed, 40 insertions, 41 deletions
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 7ba57a565cd7..b61a13663a0a 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c | |||
@@ -9,18 +9,19 @@ | |||
9 | 9 | ||
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/slab.h> | ||
12 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
13 | #include <linux/init.h> | 14 | #include <linux/init.h> |
14 | #include <linux/workqueue.h> | 15 | #include <linux/workqueue.h> |
15 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
16 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/io.h> | ||
17 | 19 | ||
18 | #include <pcmcia/cs_types.h> | 20 | #include <pcmcia/cs_types.h> |
19 | #include <pcmcia/ss.h> | 21 | #include <pcmcia/ss.h> |
20 | #include <pcmcia/cs.h> | 22 | #include <pcmcia/cs.h> |
21 | 23 | ||
22 | #include <asm/system.h> | 24 | #include <asm/system.h> |
23 | #include <asm/io.h> | ||
24 | 25 | ||
25 | #include "pd6729.h" | 26 | #include "pd6729.h" |
26 | #include "i82365.h" | 27 | #include "i82365.h" |
@@ -222,9 +223,9 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev) | |||
222 | ? SS_READY : 0; | 223 | ? SS_READY : 0; |
223 | } | 224 | } |
224 | 225 | ||
225 | if (events) { | 226 | if (events) |
226 | pcmcia_parse_events(&socket[i].socket, events); | 227 | pcmcia_parse_events(&socket[i].socket, events); |
227 | } | 228 | |
228 | active |= events; | 229 | active |= events; |
229 | } | 230 | } |
230 | 231 | ||
@@ -256,9 +257,8 @@ static int pd6729_get_status(struct pcmcia_socket *sock, u_int *value) | |||
256 | status = indirect_read(socket, I365_STATUS); | 257 | status = indirect_read(socket, I365_STATUS); |
257 | *value = 0; | 258 | *value = 0; |
258 | 259 | ||
259 | if ((status & I365_CS_DETECT) == I365_CS_DETECT) { | 260 | if ((status & I365_CS_DETECT) == I365_CS_DETECT) |
260 | *value |= SS_DETECT; | 261 | *value |= SS_DETECT; |
261 | } | ||
262 | 262 | ||
263 | /* | 263 | /* |
264 | * IO cards have a different meaning of bits 0,1 | 264 | * IO cards have a different meaning of bits 0,1 |
@@ -308,7 +308,7 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | |||
308 | socket->card_irq = state->io_irq; | 308 | socket->card_irq = state->io_irq; |
309 | 309 | ||
310 | reg = 0; | 310 | reg = 0; |
311 | /* The reset bit has "inverse" logic */ | 311 | /* The reset bit has "inverse" logic */ |
312 | if (!(state->flags & SS_RESET)) | 312 | if (!(state->flags & SS_RESET)) |
313 | reg |= I365_PC_RESET; | 313 | reg |= I365_PC_RESET; |
314 | if (state->flags & SS_IOCARD) | 314 | if (state->flags & SS_IOCARD) |
@@ -380,7 +380,7 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | |||
380 | indirect_write(socket, I365_POWER, reg); | 380 | indirect_write(socket, I365_POWER, reg); |
381 | 381 | ||
382 | if (irq_mode == 1) { | 382 | if (irq_mode == 1) { |
383 | /* all interrupts are to be done as PCI interrupts */ | 383 | /* all interrupts are to be done as PCI interrupts */ |
384 | data = PD67_EC1_INV_MGMT_IRQ | PD67_EC1_INV_CARD_IRQ; | 384 | data = PD67_EC1_INV_MGMT_IRQ | PD67_EC1_INV_CARD_IRQ; |
385 | } else | 385 | } else |
386 | data = 0; | 386 | data = 0; |
@@ -391,9 +391,9 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | |||
391 | /* Enable specific interrupt events */ | 391 | /* Enable specific interrupt events */ |
392 | 392 | ||
393 | reg = 0x00; | 393 | reg = 0x00; |
394 | if (state->csc_mask & SS_DETECT) { | 394 | if (state->csc_mask & SS_DETECT) |
395 | reg |= I365_CSC_DETECT; | 395 | reg |= I365_CSC_DETECT; |
396 | } | 396 | |
397 | if (state->flags & SS_IOCARD) { | 397 | if (state->flags & SS_IOCARD) { |
398 | if (state->csc_mask & SS_STSCHG) | 398 | if (state->csc_mask & SS_STSCHG) |
399 | reg |= I365_CSC_STSCHG; | 399 | reg |= I365_CSC_STSCHG; |
@@ -450,9 +450,12 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, | |||
450 | 450 | ||
451 | ioctl = indirect_read(socket, I365_IOCTL) & ~I365_IOCTL_MASK(map); | 451 | ioctl = indirect_read(socket, I365_IOCTL) & ~I365_IOCTL_MASK(map); |
452 | 452 | ||
453 | if (io->flags & MAP_0WS) ioctl |= I365_IOCTL_0WS(map); | 453 | if (io->flags & MAP_0WS) |
454 | if (io->flags & MAP_16BIT) ioctl |= I365_IOCTL_16BIT(map); | 454 | ioctl |= I365_IOCTL_0WS(map); |
455 | if (io->flags & MAP_AUTOSZ) ioctl |= I365_IOCTL_IOCS16(map); | 455 | if (io->flags & MAP_16BIT) |
456 | ioctl |= I365_IOCTL_16BIT(map); | ||
457 | if (io->flags & MAP_AUTOSZ) | ||
458 | ioctl |= I365_IOCTL_IOCS16(map); | ||
456 | 459 | ||
457 | indirect_write(socket, I365_IOCTL, ioctl); | 460 | indirect_write(socket, I365_IOCTL, ioctl); |
458 | 461 | ||
@@ -497,7 +500,7 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, | |||
497 | 500 | ||
498 | /* write the stop address */ | 501 | /* write the stop address */ |
499 | 502 | ||
500 | i= (mem->res->end >> 12) & 0x0fff; | 503 | i = (mem->res->end >> 12) & 0x0fff; |
501 | switch (to_cycles(mem->speed)) { | 504 | switch (to_cycles(mem->speed)) { |
502 | case 0: | 505 | case 0: |
503 | break; | 506 | break; |
@@ -563,7 +566,7 @@ static int pd6729_init(struct pcmcia_socket *sock) | |||
563 | 566 | ||
564 | /* the pccard structure and its functions */ | 567 | /* the pccard structure and its functions */ |
565 | static struct pccard_operations pd6729_operations = { | 568 | static struct pccard_operations pd6729_operations = { |
566 | .init = pd6729_init, | 569 | .init = pd6729_init, |
567 | .get_status = pd6729_get_status, | 570 | .get_status = pd6729_get_status, |
568 | .set_socket = pd6729_set_socket, | 571 | .set_socket = pd6729_set_socket, |
569 | .set_io_map = pd6729_set_io_map, | 572 | .set_io_map = pd6729_set_io_map, |
@@ -578,8 +581,13 @@ static irqreturn_t pd6729_test(int irq, void *dev) | |||
578 | 581 | ||
579 | static int pd6729_check_irq(int irq) | 582 | static int pd6729_check_irq(int irq) |
580 | { | 583 | { |
581 | if (request_irq(irq, pd6729_test, IRQF_PROBE_SHARED, "x", pd6729_test) | 584 | int ret; |
582 | != 0) return -1; | 585 | |
586 | ret = request_irq(irq, pd6729_test, IRQF_PROBE_SHARED, "x", | ||
587 | pd6729_test); | ||
588 | if (ret) | ||
589 | return -1; | ||
590 | |||
583 | free_irq(irq, pd6729_test); | 591 | free_irq(irq, pd6729_test); |
584 | return 0; | 592 | return 0; |
585 | } | 593 | } |
@@ -591,7 +599,7 @@ static u_int __devinit pd6729_isa_scan(void) | |||
591 | 599 | ||
592 | if (irq_mode == 1) { | 600 | if (irq_mode == 1) { |
593 | printk(KERN_INFO "pd6729: PCI card interrupts, " | 601 | printk(KERN_INFO "pd6729: PCI card interrupts, " |
594 | "PCI status changes\n"); | 602 | "PCI status changes\n"); |
595 | return 0; | 603 | return 0; |
596 | } | 604 | } |
597 | 605 | ||
@@ -607,9 +615,10 @@ static u_int __devinit pd6729_isa_scan(void) | |||
607 | if (mask & (1<<i)) | 615 | if (mask & (1<<i)) |
608 | printk("%s%d", ((mask & ((1<<i)-1)) ? "," : ""), i); | 616 | printk("%s%d", ((mask & ((1<<i)-1)) ? "," : ""), i); |
609 | 617 | ||
610 | if (mask == 0) printk("none!"); | 618 | if (mask == 0) |
611 | 619 | printk("none!"); | |
612 | printk(" polling status changes.\n"); | 620 | else |
621 | printk(" polling status changes.\n"); | ||
613 | 622 | ||
614 | return mask; | 623 | return mask; |
615 | } | 624 | } |
@@ -624,11 +633,16 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
624 | 633 | ||
625 | socket = kzalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS, | 634 | socket = kzalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS, |
626 | GFP_KERNEL); | 635 | GFP_KERNEL); |
627 | if (!socket) | 636 | if (!socket) { |
637 | dev_warn(&dev->dev, "failed to kzalloc socket.\n"); | ||
628 | return -ENOMEM; | 638 | return -ENOMEM; |
639 | } | ||
629 | 640 | ||
630 | if ((ret = pci_enable_device(dev))) | 641 | ret = pci_enable_device(dev); |
642 | if (ret) { | ||
643 | dev_warn(&dev->dev, "failed to enable pci_device.\n"); | ||
631 | goto err_out_free_mem; | 644 | goto err_out_free_mem; |
645 | } | ||
632 | 646 | ||
633 | if (!pci_resource_start(dev, 0)) { | 647 | if (!pci_resource_start(dev, 0)) { |
634 | dev_warn(&dev->dev, "refusing to load the driver as the " | 648 | dev_warn(&dev->dev, "refusing to load the driver as the " |
@@ -639,7 +653,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
639 | dev_info(&dev->dev, "Cirrus PD6729 PCI to PCMCIA Bridge at 0x%llx " | 653 | dev_info(&dev->dev, "Cirrus PD6729 PCI to PCMCIA Bridge at 0x%llx " |
640 | "on irq %d\n", | 654 | "on irq %d\n", |
641 | (unsigned long long)pci_resource_start(dev, 0), dev->irq); | 655 | (unsigned long long)pci_resource_start(dev, 0), dev->irq); |
642 | /* | 656 | /* |
643 | * Since we have no memory BARs some firmware may not | 657 | * Since we have no memory BARs some firmware may not |
644 | * have had PCI_COMMAND_MEMORY enabled, yet the device needs it. | 658 | * have had PCI_COMMAND_MEMORY enabled, yet the device needs it. |
645 | */ | 659 | */ |
@@ -685,8 +699,9 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
685 | pci_set_drvdata(dev, socket); | 699 | pci_set_drvdata(dev, socket); |
686 | if (irq_mode == 1) { | 700 | if (irq_mode == 1) { |
687 | /* Register the interrupt handler */ | 701 | /* Register the interrupt handler */ |
688 | if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED, | 702 | ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED, |
689 | "pd6729", socket))) { | 703 | "pd6729", socket); |
704 | if (ret) { | ||
690 | dev_err(&dev->dev, "Failed to register irq %d\n", | 705 | dev_err(&dev->dev, "Failed to register irq %d\n", |
691 | dev->irq); | 706 | dev->irq); |
692 | goto err_out_free_res; | 707 | goto err_out_free_res; |
@@ -750,18 +765,6 @@ static void __devexit pd6729_pci_remove(struct pci_dev *dev) | |||
750 | kfree(socket); | 765 | kfree(socket); |
751 | } | 766 | } |
752 | 767 | ||
753 | #ifdef CONFIG_PM | ||
754 | static int pd6729_socket_suspend(struct pci_dev *dev, pm_message_t state) | ||
755 | { | ||
756 | return pcmcia_socket_dev_suspend(&dev->dev); | ||
757 | } | ||
758 | |||
759 | static int pd6729_socket_resume(struct pci_dev *dev) | ||
760 | { | ||
761 | return pcmcia_socket_dev_resume(&dev->dev); | ||
762 | } | ||
763 | #endif | ||
764 | |||
765 | static struct pci_device_id pd6729_pci_ids[] = { | 768 | static struct pci_device_id pd6729_pci_ids[] = { |
766 | { | 769 | { |
767 | .vendor = PCI_VENDOR_ID_CIRRUS, | 770 | .vendor = PCI_VENDOR_ID_CIRRUS, |
@@ -778,10 +781,6 @@ static struct pci_driver pd6729_pci_driver = { | |||
778 | .id_table = pd6729_pci_ids, | 781 | .id_table = pd6729_pci_ids, |
779 | .probe = pd6729_pci_probe, | 782 | .probe = pd6729_pci_probe, |
780 | .remove = __devexit_p(pd6729_pci_remove), | 783 | .remove = __devexit_p(pd6729_pci_remove), |
781 | #ifdef CONFIG_PM | ||
782 | .suspend = pd6729_socket_suspend, | ||
783 | .resume = pd6729_socket_resume, | ||
784 | #endif | ||
785 | }; | 784 | }; |
786 | 785 | ||
787 | static int pd6729_module_init(void) | 786 | static int pd6729_module_init(void) |