aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ixp4xx/nslu2-pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-ixp4xx/nslu2-pci.c')
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-pci.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/arch/arm/mach-ixp4xx/nslu2-pci.c b/arch/arm/mach-ixp4xx/nslu2-pci.c
index 4429b8448b61..1eb5a90470bc 100644
--- a/arch/arm/mach-ixp4xx/nslu2-pci.c
+++ b/arch/arm/mach-ixp4xx/nslu2-pci.c
@@ -18,35 +18,38 @@
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21
22#include <asm/mach/pci.h> 21#include <asm/mach/pci.h>
23#include <asm/mach-types.h> 22#include <asm/mach-types.h>
24 23
24#define MAX_DEV 3
25#define IRQ_LINES 3
26
27/* PCI controller GPIO to IRQ pin mappings */
28#define INTA 11
29#define INTB 10
30#define INTC 9
31#define INTD 8
32
25void __init nslu2_pci_preinit(void) 33void __init nslu2_pci_preinit(void)
26{ 34{
27 set_irq_type(IRQ_NSLU2_PCI_INTA, IRQ_TYPE_LEVEL_LOW); 35 set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
28 set_irq_type(IRQ_NSLU2_PCI_INTB, IRQ_TYPE_LEVEL_LOW); 36 set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
29 set_irq_type(IRQ_NSLU2_PCI_INTC, IRQ_TYPE_LEVEL_LOW); 37 set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW);
30
31 ixp4xx_pci_preinit(); 38 ixp4xx_pci_preinit();
32} 39}
33 40
34static int __init nslu2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 41static int __init nslu2_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
35{ 42{
36 static int pci_irq_table[NSLU2_PCI_IRQ_LINES] = { 43 static int pci_irq_table[IRQ_LINES] = {
37 IRQ_NSLU2_PCI_INTA, 44 IXP4XX_GPIO_IRQ(INTA),
38 IRQ_NSLU2_PCI_INTB, 45 IXP4XX_GPIO_IRQ(INTB),
39 IRQ_NSLU2_PCI_INTC, 46 IXP4XX_GPIO_IRQ(INTC),
40 }; 47 };
41 48
42 int irq = -1; 49 if (slot >= 1 && slot <= MAX_DEV && pin >= 1 && pin <= IRQ_LINES)
43 50 return pci_irq_table[(slot + pin - 2) % IRQ_LINES];
44 if (slot >= 1 && slot <= NSLU2_PCI_MAX_DEV &&
45 pin >= 1 && pin <= NSLU2_PCI_IRQ_LINES) {
46 irq = pci_irq_table[(slot + pin - 2) % NSLU2_PCI_IRQ_LINES];
47 }
48 51
49 return irq; 52 return -1;
50} 53}
51 54
52struct hw_pci __initdata nslu2_pci = { 55struct hw_pci __initdata nslu2_pci = {