aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ixp4xx/gtwx5715-pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-ixp4xx/gtwx5715-pci.c')
-rw-r--r--arch/arm/mach-ixp4xx/gtwx5715-pci.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-pci.c b/arch/arm/mach-ixp4xx/gtwx5715-pci.c
index 7b8a2c323840..25d2c333c204 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-pci.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-pci.c
@@ -26,14 +26,16 @@
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/irq.h> 28#include <linux/irq.h>
29
30#include <asm/mach-types.h> 29#include <asm/mach-types.h>
31#include <mach/hardware.h> 30#include <mach/hardware.h>
32#include <mach/gtwx5715.h>
33#include <asm/mach/pci.h> 31#include <asm/mach/pci.h>
34 32
33#define SLOT0_DEVID 0
34#define SLOT1_DEVID 1
35#define INTA 10 /* slot 1 has INTA and INTB crossed */
36#define INTB 11
37
35/* 38/*
36 * The exact GPIO pins and IRQs are defined in arch-ixp4xx/gtwx5715.h
37 * Slot 0 isn't actually populated with a card connector but 39 * Slot 0 isn't actually populated with a card connector but
38 * we initialize it anyway in case a future version has the 40 * we initialize it anyway in case a future version has the
39 * slot populated or someone with good soldering skills has 41 * slot populated or someone with good soldering skills has
@@ -41,32 +43,26 @@
41 */ 43 */
42void __init gtwx5715_pci_preinit(void) 44void __init gtwx5715_pci_preinit(void)
43{ 45{
44 set_irq_type(GTWX5715_PCI_SLOT0_INTA_IRQ, IRQ_TYPE_LEVEL_LOW); 46 set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
45 set_irq_type(GTWX5715_PCI_SLOT0_INTB_IRQ, IRQ_TYPE_LEVEL_LOW); 47 set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
46 set_irq_type(GTWX5715_PCI_SLOT1_INTA_IRQ, IRQ_TYPE_LEVEL_LOW);
47 set_irq_type(GTWX5715_PCI_SLOT1_INTB_IRQ, IRQ_TYPE_LEVEL_LOW);
48
49 ixp4xx_pci_preinit(); 48 ixp4xx_pci_preinit();
50} 49}
51 50
52 51
53static int __init gtwx5715_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 52static int __init gtwx5715_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
54{ 53{
55 int rc; 54 int rc = -1;
56 static int gtwx5715_irqmap
57 [GTWX5715_PCI_SLOT_COUNT]
58 [GTWX5715_PCI_INT_PIN_COUNT] = {
59 {GTWX5715_PCI_SLOT0_INTA_IRQ, GTWX5715_PCI_SLOT0_INTB_IRQ},
60 {GTWX5715_PCI_SLOT1_INTA_IRQ, GTWX5715_PCI_SLOT1_INTB_IRQ},
61};
62 55
63 if (slot >= GTWX5715_PCI_SLOT_COUNT || 56 if ((slot == SLOT0_DEVID && pin == 1) ||
64 pin >= GTWX5715_PCI_INT_PIN_COUNT) rc = -1; 57 (slot == SLOT1_DEVID && pin == 2))
65 else 58 rc = IXP4XX_GPIO_IRQ(INTA);
66 rc = gtwx5715_irqmap[slot][pin-1]; 59 else if ((slot == SLOT0_DEVID && pin == 2) ||
60 (slot == SLOT1_DEVID && pin == 1))
61 rc = IXP4XX_GPIO_IRQ(INTB);
67 62
68 printk("%s: Mapped slot %d pin %d to IRQ %d\n", __func__, slot, pin, rc); 63 printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n",
69 return(rc); 64 __func__, slot, pin, rc);
65 return rc;
70} 66}
71 67
72struct hw_pci gtwx5715_pci __initdata = { 68struct hw_pci gtwx5715_pci __initdata = {
@@ -81,9 +77,7 @@ struct hw_pci gtwx5715_pci __initdata = {
81int __init gtwx5715_pci_init(void) 77int __init gtwx5715_pci_init(void)
82{ 78{
83 if (machine_is_gtwx5715()) 79 if (machine_is_gtwx5715())
84 {
85 pci_common_init(&gtwx5715_pci); 80 pci_common_init(&gtwx5715_pci);
86 }
87 81
88 return 0; 82 return 0;
89} 83}