2 * arch/arm/mach-orion5x/rd88f5182-setup.c
4 * Marvell Orion-NAS Reference Design Setup
6 * Maintainer: Ronen Shitrit <rshitrit@marvell.com>
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
12 #include <linux/gpio.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
16 #include <linux/pci.h>
17 #include <linux/irq.h>
18 #include <asm/mach-types.h>
19 #include <asm/mach/arch.h>
20 #include <asm/mach/pci.h>
21 #include <mach/orion5x.h>
24 /*****************************************************************************
26 ****************************************************************************/
32 #define RD88F5182_PCI_SLOT0_OFFS 7
33 #define RD88F5182_PCI_SLOT0_IRQ_A_PIN 7
34 #define RD88F5182_PCI_SLOT0_IRQ_B_PIN 6
36 /*****************************************************************************
38 ****************************************************************************/
40 static void __init
rd88f5182_pci_preinit(void)
45 * Configure PCI GPIO IRQ pins
47 pin
= RD88F5182_PCI_SLOT0_IRQ_A_PIN
;
48 if (gpio_request(pin
, "PCI IntA") == 0) {
49 if (gpio_direction_input(pin
) == 0) {
50 irq_set_irq_type(gpio_to_irq(pin
), IRQ_TYPE_LEVEL_LOW
);
52 printk(KERN_ERR
"rd88f5182_pci_preinit failed to "
53 "set_irq_type pin %d\n", pin
);
57 printk(KERN_ERR
"rd88f5182_pci_preinit failed to request gpio %d\n", pin
);
60 pin
= RD88F5182_PCI_SLOT0_IRQ_B_PIN
;
61 if (gpio_request(pin
, "PCI IntB") == 0) {
62 if (gpio_direction_input(pin
) == 0) {
63 irq_set_irq_type(gpio_to_irq(pin
), IRQ_TYPE_LEVEL_LOW
);
65 printk(KERN_ERR
"rd88f5182_pci_preinit failed to "
66 "set_irq_type pin %d\n", pin
);
70 printk(KERN_ERR
"rd88f5182_pci_preinit failed to gpio_request %d\n", pin
);
74 static int __init
rd88f5182_pci_map_irq(const struct pci_dev
*dev
, u8 slot
,
80 * Check for devices with hard-wired IRQs.
82 irq
= orion5x_pci_map_irq(dev
, slot
, pin
);
87 * PCI IRQs are connected via GPIOs
89 switch (slot
- RD88F5182_PCI_SLOT0_OFFS
) {
92 return gpio_to_irq(RD88F5182_PCI_SLOT0_IRQ_A_PIN
);
94 return gpio_to_irq(RD88F5182_PCI_SLOT0_IRQ_B_PIN
);
100 static struct hw_pci rd88f5182_pci __initdata
= {
102 .preinit
= rd88f5182_pci_preinit
,
103 .setup
= orion5x_pci_sys_setup
,
104 .scan
= orion5x_pci_sys_scan_bus
,
105 .map_irq
= rd88f5182_pci_map_irq
,
108 static int __init
rd88f5182_pci_init(void)
110 if (of_machine_is_compatible("marvell,rd-88f5182-nas"))
111 pci_common_init(&rd88f5182_pci
);
116 subsys_initcall(rd88f5182_pci_init
);