diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2008-04-25 16:28:33 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@cam.org> | 2008-04-28 15:58:23 -0400 |
commit | 92b913b08b18faa487b0c744282fafd944446ade (patch) | |
tree | 1a20f86d3762ebafeb4aea172d35e23ef1ade34f /arch/arm/mach-orion5x | |
parent | fd153abb01c3fbcc47cd4ac3c0bc8801cfcc0009 (diff) |
[ARM] Orion: fix ->map_irq() PCIe bus number check
The current orion5x board ->map_irq() routines check whether a
given bus number lives on the PCIe controller by comparing it with
the PCIe controller's primary bus number. This doesn't work in
case there are multiple buses in the PCIe domain, i.e. if there
exists a PCIe bridge on the primary PCIe bus.
This patch adds a helper function (orion5x_pci_map_irq()) that
returns the IRQ number for the given PCI device if that device has
a hard-wired IRQ, or -1 otherwise, and makes each board's
->map_irq() function use this helper function.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'arch/arm/mach-orion5x')
-rw-r--r-- | arch/arm/mach-orion5x/common.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/db88f5281-setup.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/dns323-setup.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/kurobox_pro-setup.c | 14 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/pci.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/rd88f5182-setup.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/ts209-setup.c | 11 |
7 files changed, 54 insertions, 27 deletions
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h index f4c4c9a72a7c..14adf8d1a54a 100644 --- a/arch/arm/mach-orion5x/common.h +++ b/arch/arm/mach-orion5x/common.h | |||
@@ -33,10 +33,9 @@ struct pci_sys_data; | |||
33 | struct pci_bus; | 33 | struct pci_bus; |
34 | 34 | ||
35 | void orion5x_pcie_id(u32 *dev, u32 *rev); | 35 | void orion5x_pcie_id(u32 *dev, u32 *rev); |
36 | int orion5x_pcie_local_bus_nr(void); | ||
37 | int orion5x_pci_local_bus_nr(void); | ||
38 | int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys); | 36 | int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys); |
39 | struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys); | 37 | struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys); |
38 | int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin); | ||
40 | 39 | ||
41 | /* | 40 | /* |
42 | * Valid GPIO pins according to MPP setup, used by machine-setup. | 41 | * Valid GPIO pins according to MPP setup, used by machine-setup. |
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c index 872aed372327..83e9ad4cf190 100644 --- a/arch/arm/mach-orion5x/db88f5281-setup.c +++ b/arch/arm/mach-orion5x/db88f5281-setup.c | |||
@@ -241,14 +241,17 @@ void __init db88f5281_pci_preinit(void) | |||
241 | 241 | ||
242 | static int __init db88f5281_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 242 | static int __init db88f5281_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |
243 | { | 243 | { |
244 | int irq; | ||
245 | |||
244 | /* | 246 | /* |
245 | * PCIE IRQ is connected internally (not GPIO) | 247 | * Check for devices with hard-wired IRQs. |
246 | */ | 248 | */ |
247 | if (dev->bus->number == orion5x_pcie_local_bus_nr()) | 249 | irq = orion5x_pci_map_irq(dev, slot, pin); |
248 | return IRQ_ORION5X_PCIE0_INT; | 250 | if (irq != -1) |
251 | return irq; | ||
249 | 252 | ||
250 | /* | 253 | /* |
251 | * PCI IRQs are connected via GPIOs | 254 | * PCI IRQs are connected via GPIOs. |
252 | */ | 255 | */ |
253 | switch (slot - DB88F5281_PCI_SLOT0_OFFS) { | 256 | switch (slot - DB88F5281_PCI_SLOT0_OFFS) { |
254 | case 0: | 257 | case 0: |
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c index d67790ef236e..46181737fb75 100644 --- a/arch/arm/mach-orion5x/dns323-setup.c +++ b/arch/arm/mach-orion5x/dns323-setup.c | |||
@@ -43,11 +43,16 @@ | |||
43 | 43 | ||
44 | static int __init dns323_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 44 | static int __init dns323_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |
45 | { | 45 | { |
46 | /* PCI-E */ | 46 | int irq; |
47 | if (dev->bus->number == orion5x_pcie_local_bus_nr()) | ||
48 | return IRQ_ORION5X_PCIE0_INT; | ||
49 | 47 | ||
50 | pr_err("%s: requested mapping for unknown bus\n", __func__); | 48 | /* |
49 | * Check for devices with hard-wired IRQs. | ||
50 | */ | ||
51 | irq = orion5x_pci_map_irq(dev, slot, pin); | ||
52 | if (irq != -1) | ||
53 | return irq; | ||
54 | |||
55 | pr_err("%s: requested mapping for unknown device\n", __func__); | ||
51 | 56 | ||
52 | return -1; | 57 | return -1; |
53 | } | 58 | } |
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c index 91413455beba..36cf76388693 100644 --- a/arch/arm/mach-orion5x/kurobox_pro-setup.c +++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c | |||
@@ -120,13 +120,19 @@ static struct platform_device kurobox_pro_nor_flash = { | |||
120 | 120 | ||
121 | static int __init kurobox_pro_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 121 | static int __init kurobox_pro_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |
122 | { | 122 | { |
123 | int irq; | ||
124 | |||
125 | /* | ||
126 | * Check for devices with hard-wired IRQs. | ||
127 | */ | ||
128 | irq = orion5x_pci_map_irq(dev, slot, pin); | ||
129 | if (irq != -1) | ||
130 | return irq; | ||
131 | |||
123 | /* | 132 | /* |
124 | * PCI isn't used on the Kuro | 133 | * PCI isn't used on the Kuro |
125 | */ | 134 | */ |
126 | if (dev->bus->number == orion5x_pcie_local_bus_nr()) | 135 | printk(KERN_ERR "kurobox_pro_pci_map_irq failed, unknown bus\n"); |
127 | return IRQ_ORION5X_PCIE0_INT; | ||
128 | else | ||
129 | printk(KERN_ERR "kurobox_pro_pci_map_irq failed, unknown bus\n"); | ||
130 | 136 | ||
131 | return -1; | 137 | return -1; |
132 | } | 138 | } |
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c index fdf99fca85b3..9d5d39fa19c3 100644 --- a/arch/arm/mach-orion5x/pci.c +++ b/arch/arm/mach-orion5x/pci.c | |||
@@ -41,11 +41,6 @@ void __init orion5x_pcie_id(u32 *dev, u32 *rev) | |||
41 | *rev = orion_pcie_rev(PCIE_BASE); | 41 | *rev = orion_pcie_rev(PCIE_BASE); |
42 | } | 42 | } |
43 | 43 | ||
44 | int __init orion5x_pcie_local_bus_nr(void) | ||
45 | { | ||
46 | return orion_pcie_get_local_bus_nr(PCIE_BASE); | ||
47 | } | ||
48 | |||
49 | static int pcie_valid_config(int bus, int dev) | 44 | static int pcie_valid_config(int bus, int dev) |
50 | { | 45 | { |
51 | /* | 46 | /* |
@@ -269,7 +264,7 @@ static int __init pcie_setup(struct pci_sys_data *sys) | |||
269 | */ | 264 | */ |
270 | static DEFINE_SPINLOCK(orion5x_pci_lock); | 265 | static DEFINE_SPINLOCK(orion5x_pci_lock); |
271 | 266 | ||
272 | int orion5x_pci_local_bus_nr(void) | 267 | static int orion5x_pci_local_bus_nr(void) |
273 | { | 268 | { |
274 | u32 conf = orion5x_read(PCI_P2P_CONF); | 269 | u32 conf = orion5x_read(PCI_P2P_CONF); |
275 | return((conf & PCI_P2P_BUS_MASK) >> PCI_P2P_BUS_OFFS); | 270 | return((conf & PCI_P2P_BUS_MASK) >> PCI_P2P_BUS_OFFS); |
@@ -557,3 +552,16 @@ struct pci_bus __init *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys | |||
557 | 552 | ||
558 | return bus; | 553 | return bus; |
559 | } | 554 | } |
555 | |||
556 | int __init orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | ||
557 | { | ||
558 | int bus = dev->bus->number; | ||
559 | |||
560 | /* | ||
561 | * PCIe endpoint? | ||
562 | */ | ||
563 | if (bus < orion5x_pci_local_bus_nr()) | ||
564 | return IRQ_ORION5X_PCIE0_INT; | ||
565 | |||
566 | return -1; | ||
567 | } | ||
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c index 37e8b2dc3ed5..b4315dfd4a35 100644 --- a/arch/arm/mach-orion5x/rd88f5182-setup.c +++ b/arch/arm/mach-orion5x/rd88f5182-setup.c | |||
@@ -172,11 +172,14 @@ void __init rd88f5182_pci_preinit(void) | |||
172 | 172 | ||
173 | static int __init rd88f5182_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 173 | static int __init rd88f5182_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |
174 | { | 174 | { |
175 | int irq; | ||
176 | |||
175 | /* | 177 | /* |
176 | * PCI-E isn't used on the RD2 | 178 | * Check for devices with hard-wired IRQs. |
177 | */ | 179 | */ |
178 | if (dev->bus->number == orion5x_pcie_local_bus_nr()) | 180 | irq = orion5x_pci_map_irq(dev, slot, pin); |
179 | return IRQ_ORION5X_PCIE0_INT; | 181 | if (irq != -1) |
182 | return irq; | ||
180 | 183 | ||
181 | /* | 184 | /* |
182 | * PCI IRQs are connected via GPIOs | 185 | * PCI IRQs are connected via GPIOs |
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c index fd43863a86f6..d3a892283dd0 100644 --- a/arch/arm/mach-orion5x/ts209-setup.c +++ b/arch/arm/mach-orion5x/ts209-setup.c | |||
@@ -141,14 +141,17 @@ void __init qnap_ts209_pci_preinit(void) | |||
141 | 141 | ||
142 | static int __init qnap_ts209_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 142 | static int __init qnap_ts209_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |
143 | { | 143 | { |
144 | int irq; | ||
145 | |||
144 | /* | 146 | /* |
145 | * PCIE IRQ is connected internally (not GPIO) | 147 | * Check for devices with hard-wired IRQs. |
146 | */ | 148 | */ |
147 | if (dev->bus->number == orion5x_pcie_local_bus_nr()) | 149 | irq = orion5x_pci_map_irq(dev, slot, pin); |
148 | return IRQ_ORION5X_PCIE0_INT; | 150 | if (irq != -1) |
151 | return irq; | ||
149 | 152 | ||
150 | /* | 153 | /* |
151 | * PCI IRQs are connected via GPIOs | 154 | * PCI IRQs are connected via GPIOs. |
152 | */ | 155 | */ |
153 | switch (slot - QNAP_TS209_PCI_SLOT0_OFFS) { | 156 | switch (slot - QNAP_TS209_PCI_SLOT0_OFFS) { |
154 | case 0: | 157 | case 0: |