diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2013-02-02 17:16:57 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-06-03 02:04:35 -0400 |
commit | 86adc39ffc9360eee43ff5913468620a3fdd7289 (patch) | |
tree | 4cbfd727c8f96f5df60820473ba59a00b54e7f77 /arch/arm/mach-integrator/pci_v3.c | |
parent | f4bc4f0ab4081b5bf99c92663877a41adf8c843a (diff) |
ARM: integrator: convert PCIv3 bridge to platform device
This converts the PCIv3 driver to a platform device driver, and
registers the device only on the Integrator/AP instead of bailing
out in the initcall if the platform is not correct.
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm/mach-integrator/pci_v3.c')
-rw-r--r-- | arch/arm/mach-integrator/pci_v3.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c index b8d7033da2b5..2733c6c1f027 100644 --- a/arch/arm/mach-integrator/pci_v3.c +++ b/arch/arm/mach-integrator/pci_v3.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/io.h> | 29 | #include <linux/io.h> |
30 | #include <linux/platform_device.h> | ||
30 | 31 | ||
31 | #include <mach/hardware.h> | 32 | #include <mach/hardware.h> |
32 | #include <mach/platform.h> | 33 | #include <mach/platform.h> |
@@ -35,7 +36,6 @@ | |||
35 | #include <asm/signal.h> | 36 | #include <asm/signal.h> |
36 | #include <asm/mach/pci.h> | 37 | #include <asm/mach/pci.h> |
37 | #include <asm/irq_regs.h> | 38 | #include <asm/irq_regs.h> |
38 | #include <asm/mach-types.h> | ||
39 | 39 | ||
40 | #include <asm/hardware/pci_v3.h> | 40 | #include <asm/hardware/pci_v3.h> |
41 | 41 | ||
@@ -649,7 +649,7 @@ static void __init pci_v3_postinit(void) | |||
649 | /* | 649 | /* |
650 | * This routine handles multiple bridges. | 650 | * This routine handles multiple bridges. |
651 | */ | 651 | */ |
652 | static u8 __init integrator_swizzle(struct pci_dev *dev, u8 *pinp) | 652 | static u8 __init pci_v3_swizzle(struct pci_dev *dev, u8 *pinp) |
653 | { | 653 | { |
654 | if (*pinp == 0) | 654 | if (*pinp == 0) |
655 | *pinp = 1; | 655 | *pinp = 1; |
@@ -665,16 +665,16 @@ static int irq_tab[4] __initdata = { | |||
665 | * map the specified device/slot/pin to an IRQ. This works out such | 665 | * map the specified device/slot/pin to an IRQ. This works out such |
666 | * that slot 9 pin 1 is INT0, pin 2 is INT1, and slot 10 pin 1 is INT1. | 666 | * that slot 9 pin 1 is INT0, pin 2 is INT1, and slot 10 pin 1 is INT1. |
667 | */ | 667 | */ |
668 | static int __init integrator_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 668 | static int __init pci_v3_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
669 | { | 669 | { |
670 | int intnr = ((slot - 9) + (pin - 1)) & 3; | 670 | int intnr = ((slot - 9) + (pin - 1)) & 3; |
671 | 671 | ||
672 | return irq_tab[intnr]; | 672 | return irq_tab[intnr]; |
673 | } | 673 | } |
674 | 674 | ||
675 | static struct hw_pci integrator_pci __initdata = { | 675 | static struct hw_pci pci_v3 __initdata = { |
676 | .swizzle = integrator_swizzle, | 676 | .swizzle = pci_v3_swizzle, |
677 | .map_irq = integrator_map_irq, | 677 | .map_irq = pci_v3_map_irq, |
678 | .setup = pci_v3_setup, | 678 | .setup = pci_v3_setup, |
679 | .nr_controllers = 1, | 679 | .nr_controllers = 1, |
680 | .ops = &pci_v3_ops, | 680 | .ops = &pci_v3_ops, |
@@ -682,11 +682,21 @@ static struct hw_pci integrator_pci __initdata = { | |||
682 | .postinit = pci_v3_postinit, | 682 | .postinit = pci_v3_postinit, |
683 | }; | 683 | }; |
684 | 684 | ||
685 | static int __init integrator_pci_init(void) | 685 | static int __init pci_v3_probe(struct platform_device *pdev) |
686 | { | 686 | { |
687 | if (machine_is_integrator()) | 687 | pci_common_init(&pci_v3); |
688 | pci_common_init(&integrator_pci); | ||
689 | return 0; | 688 | return 0; |
690 | } | 689 | } |
691 | 690 | ||
692 | subsys_initcall(integrator_pci_init); | 691 | static struct platform_driver pci_v3_driver = { |
692 | .driver = { | ||
693 | .name = "pci-v3", | ||
694 | }, | ||
695 | }; | ||
696 | |||
697 | static int __init pci_v3_init(void) | ||
698 | { | ||
699 | return platform_driver_probe(&pci_v3_driver, pci_v3_probe); | ||
700 | } | ||
701 | |||
702 | subsys_initcall(pci_v3_init); | ||