aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/indirect_pci.c
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2007-07-19 17:07:35 -0400
committerKumar Gala <galak@kernel.crashing.org>2007-07-23 23:29:09 -0400
commit2e56ff206b7c6c28b847ccdbe46ad69b3263ac32 (patch)
tree636f8d31a2b6c19fe21b12c61f47dcd96d393871 /arch/powerpc/sysdev/indirect_pci.c
parentd5269966e57484548bc5d38e117f161bf2f56ce9 (diff)
[POWERPC] Make endianess of cfg_addr for indirect pci ops runtime
Make it so we do a runtime check to know if we need to write cfg_addr as big or little endian. This is needed if we want to allow 86xx support to co-exist in the same kernel as other 6xx PPCs. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev/indirect_pci.c')
-rw-r--r--arch/powerpc/sysdev/indirect_pci.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/arch/powerpc/sysdev/indirect_pci.c b/arch/powerpc/sysdev/indirect_pci.c
index ad341f5ff94f..a8ac2dfdd3d4 100644
--- a/arch/powerpc/sysdev/indirect_pci.c
+++ b/arch/powerpc/sysdev/indirect_pci.c
@@ -20,12 +20,6 @@
20#include <asm/pci-bridge.h> 20#include <asm/pci-bridge.h>
21#include <asm/machdep.h> 21#include <asm/machdep.h>
22 22
23#ifdef CONFIG_PPC_INDIRECT_PCI_BE
24#define PCI_CFG_OUT out_be32
25#else
26#define PCI_CFG_OUT out_le32
27#endif
28
29static int 23static int
30indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset, 24indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
31 int len, u32 *val) 25 int len, u32 *val)
@@ -58,9 +52,12 @@ indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
58 else 52 else
59 reg = offset & 0xfc; 53 reg = offset & 0xfc;
60 54
61 PCI_CFG_OUT(hose->cfg_addr, 55 if (hose->indirect_type & PPC_INDIRECT_TYPE_BIG_ENDIAN)
62 (0x80000000 | (bus_no << 16) 56 out_be32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
63 | (devfn << 8) | reg | cfg_type)); 57 (devfn << 8) | reg | cfg_type));
58 else
59 out_le32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
60 (devfn << 8) | reg | cfg_type));
64 61
65 /* 62 /*
66 * Note: the caller has already checked that offset is 63 * Note: the caller has already checked that offset is
@@ -113,9 +110,12 @@ indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
113 else 110 else
114 reg = offset & 0xfc; 111 reg = offset & 0xfc;
115 112
116 PCI_CFG_OUT(hose->cfg_addr, 113 if (hose->indirect_type & PPC_INDIRECT_TYPE_BIG_ENDIAN)
117 (0x80000000 | (bus_no << 16) 114 out_be32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
118 | (devfn << 8) | reg | cfg_type)); 115 (devfn << 8) | reg | cfg_type));
116 else
117 out_le32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
118 (devfn << 8) | reg | cfg_type));
119 119
120 /* surpress setting of PCI_PRIMARY_BUS */ 120 /* surpress setting of PCI_PRIMARY_BUS */
121 if (hose->indirect_type & PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS) 121 if (hose->indirect_type & PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS)
@@ -149,7 +149,7 @@ static struct pci_ops indirect_pci_ops =
149}; 149};
150 150
151void __init 151void __init
152setup_indirect_pci(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data) 152setup_indirect_pci(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data, u32 flags)
153{ 153{
154 unsigned long base = cfg_addr & PAGE_MASK; 154 unsigned long base = cfg_addr & PAGE_MASK;
155 void __iomem *mbase; 155 void __iomem *mbase;