diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-12-09 18:12:32 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-01-07 14:12:52 -0500 |
commit | 6aa6e4981741013e4a8c7c3ee7b90c24e89fae24 (patch) | |
tree | b9b3c6f7414759681525427fc00e14d53530be7a /arch | |
parent | f14d766a1a438fdc69d04b876965d6b26b071f14 (diff) |
PCI: sh: use generic pci_swizzle_interrupt_pin()
Use the generic pci_swizzle_interrupt_pin() instead of arch-specific code.
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sh/drivers/pci/ops-cayman.c | 9 | ||||
-rw-r--r-- | arch/sh/drivers/pci/pci.c | 7 |
2 files changed, 3 insertions, 13 deletions
diff --git a/arch/sh/drivers/pci/ops-cayman.c b/arch/sh/drivers/pci/ops-cayman.c index 5ccf9ea3a9de..38ef76207af6 100644 --- a/arch/sh/drivers/pci/ops-cayman.c +++ b/arch/sh/drivers/pci/ops-cayman.c | |||
@@ -5,11 +5,6 @@ | |||
5 | #include <cpu/irq.h> | 5 | #include <cpu/irq.h> |
6 | #include "pci-sh5.h" | 6 | #include "pci-sh5.h" |
7 | 7 | ||
8 | static inline u8 bridge_swizzle(u8 pin, u8 slot) | ||
9 | { | ||
10 | return (((pin - 1) + slot) % 4) + 1; | ||
11 | } | ||
12 | |||
13 | int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin) | 8 | int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin) |
14 | { | 9 | { |
15 | int result = -1; | 10 | int result = -1; |
@@ -42,7 +37,7 @@ int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin) | |||
42 | while (dev->bus->number > 0) { | 37 | while (dev->bus->number > 0) { |
43 | 38 | ||
44 | slot = path[i].slot = PCI_SLOT(dev->devfn); | 39 | slot = path[i].slot = PCI_SLOT(dev->devfn); |
45 | pin = path[i].pin = bridge_swizzle(pin, slot); | 40 | pin = path[i].pin = pci_swizzle_interrupt_pin(dev, pin); |
46 | dev = dev->bus->self; | 41 | dev = dev->bus->self; |
47 | i++; | 42 | i++; |
48 | if (i > 3) panic("PCI path to root bus too long!\n"); | 43 | if (i > 3) panic("PCI path to root bus too long!\n"); |
@@ -56,7 +51,7 @@ int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin) | |||
56 | if ((slot < 3) || (i == 0)) { | 51 | if ((slot < 3) || (i == 0)) { |
57 | /* Bus 0 (incl. PCI-PCI bridge itself) : perform the final | 52 | /* Bus 0 (incl. PCI-PCI bridge itself) : perform the final |
58 | swizzle now. */ | 53 | swizzle now. */ |
59 | result = IRQ_INTA + bridge_swizzle(pin, slot) - 1; | 54 | result = IRQ_INTA + pci_swizzle_interrupt_pin(dev, pin) - 1; |
60 | } else { | 55 | } else { |
61 | i--; | 56 | i--; |
62 | slot = path[i].slot; | 57 | slot = path[i].slot; |
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c index d3839e609aac..aea3b6b3033a 100644 --- a/arch/sh/drivers/pci/pci.c +++ b/arch/sh/drivers/pci/pci.c | |||
@@ -21,17 +21,12 @@ | |||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <asm/io.h> | 22 | #include <asm/io.h> |
23 | 23 | ||
24 | static inline u8 bridge_swizzle(u8 pin, u8 slot) | ||
25 | { | ||
26 | return (((pin - 1) + slot) % 4) + 1; | ||
27 | } | ||
28 | |||
29 | static u8 __init simple_swizzle(struct pci_dev *dev, u8 *pinp) | 24 | static u8 __init simple_swizzle(struct pci_dev *dev, u8 *pinp) |
30 | { | 25 | { |
31 | u8 pin = *pinp; | 26 | u8 pin = *pinp; |
32 | 27 | ||
33 | while (dev->bus->parent) { | 28 | while (dev->bus->parent) { |
34 | pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); | 29 | pin = pci_swizzle_interrupt_pin(dev, pin); |
35 | /* Move up the chain of bridges. */ | 30 | /* Move up the chain of bridges. */ |
36 | dev = dev->bus->self; | 31 | dev = dev->bus->self; |
37 | } | 32 | } |