diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2007-07-19 17:07:35 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2007-07-23 23:29:09 -0400 |
commit | 2e56ff206b7c6c28b847ccdbe46ad69b3263ac32 (patch) | |
tree | 636f8d31a2b6c19fe21b12c61f47dcd96d393871 | |
parent | d5269966e57484548bc5d38e117f161bf2f56ce9 (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>
-rw-r--r-- | arch/powerpc/Kconfig | 5 | ||||
-rw-r--r-- | arch/powerpc/platforms/82xx/mpc82xx_ads.c | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/83xx/pci.c | 4 | ||||
-rw-r--r-- | arch/powerpc/platforms/85xx/Kconfig | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/86xx/Kconfig | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/chrp/pci.c | 7 | ||||
-rw-r--r-- | arch/powerpc/platforms/embedded6xx/linkstation.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_pci.c | 3 | ||||
-rw-r--r-- | arch/powerpc/sysdev/grackle.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/indirect_pci.c | 26 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mv64x60_pci.c | 2 | ||||
-rw-r--r-- | include/asm-powerpc/pci-bridge.h | 4 |
12 files changed, 29 insertions, 31 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 3ff90f096bff..00099efe0e9f 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -411,11 +411,6 @@ config PPC_INDIRECT_PCI | |||
411 | default y if 40x || 44x | 411 | default y if 40x || 44x |
412 | default n | 412 | default n |
413 | 413 | ||
414 | config PPC_INDIRECT_PCI_BE | ||
415 | bool | ||
416 | depends PPC_INDIRECT_PCI | ||
417 | default n | ||
418 | |||
419 | config EISA | 414 | config EISA |
420 | bool | 415 | bool |
421 | 416 | ||
diff --git a/arch/powerpc/platforms/82xx/mpc82xx_ads.c b/arch/powerpc/platforms/82xx/mpc82xx_ads.c index da20832b27f1..2d1b05b9f8ef 100644 --- a/arch/powerpc/platforms/82xx/mpc82xx_ads.c +++ b/arch/powerpc/platforms/82xx/mpc82xx_ads.c | |||
@@ -553,7 +553,8 @@ static void __init mpc82xx_add_bridge(struct device_node *np) | |||
553 | 553 | ||
554 | setup_indirect_pci(hose, | 554 | setup_indirect_pci(hose, |
555 | r.start + offsetof(pci_cpm2_t, pci_cfg_addr), | 555 | r.start + offsetof(pci_cpm2_t, pci_cfg_addr), |
556 | r.start + offsetof(pci_cpm2_t, pci_cfg_data)); | 556 | r.start + offsetof(pci_cpm2_t, pci_cfg_data), |
557 | 0); | ||
557 | 558 | ||
558 | pci_process_bridge_OF_ranges(hose, np, 1); | 559 | pci_process_bridge_OF_ranges(hose, np, 1); |
559 | } | 560 | } |
diff --git a/arch/powerpc/platforms/83xx/pci.c b/arch/powerpc/platforms/83xx/pci.c index c0e2b89154e5..92069469de20 100644 --- a/arch/powerpc/platforms/83xx/pci.c +++ b/arch/powerpc/platforms/83xx/pci.c | |||
@@ -74,11 +74,11 @@ int __init mpc83xx_add_bridge(struct device_node *dev) | |||
74 | */ | 74 | */ |
75 | /* PCI 1 */ | 75 | /* PCI 1 */ |
76 | if ((rsrc.start & 0xfffff) == 0x8500) { | 76 | if ((rsrc.start & 0xfffff) == 0x8500) { |
77 | setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304); | 77 | setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304, 0); |
78 | } | 78 | } |
79 | /* PCI 2 */ | 79 | /* PCI 2 */ |
80 | if ((rsrc.start & 0xfffff) == 0x8600) { | 80 | if ((rsrc.start & 0xfffff) == 0x8600) { |
81 | setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384); | 81 | setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384, 0); |
82 | primary = 0; | 82 | primary = 0; |
83 | } | 83 | } |
84 | 84 | ||
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig index 526ddde2f186..4661fccdaa5a 100644 --- a/arch/powerpc/platforms/85xx/Kconfig +++ b/arch/powerpc/platforms/85xx/Kconfig | |||
@@ -51,7 +51,6 @@ config MPC85xx | |||
51 | bool | 51 | bool |
52 | select PPC_UDBG_16550 | 52 | select PPC_UDBG_16550 |
53 | select PPC_INDIRECT_PCI if PCI | 53 | select PPC_INDIRECT_PCI if PCI |
54 | select PPC_INDIRECT_PCI_BE if PCI | ||
55 | select MPIC | 54 | select MPIC |
56 | select FSL_PCI if PCI | 55 | select FSL_PCI if PCI |
57 | select SERIAL_8250_SHARE_IRQ if SERIAL_8250 | 56 | select SERIAL_8250_SHARE_IRQ if SERIAL_8250 |
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig index d1c8115200bc..343b76d0d793 100644 --- a/arch/powerpc/platforms/86xx/Kconfig +++ b/arch/powerpc/platforms/86xx/Kconfig | |||
@@ -14,7 +14,6 @@ endchoice | |||
14 | 14 | ||
15 | config MPC8641 | 15 | config MPC8641 |
16 | bool | 16 | bool |
17 | select PPC_INDIRECT_PCI_BE if PCI | ||
18 | select FSL_PCI if PCI | 17 | select FSL_PCI if PCI |
19 | select PPC_UDBG_16550 | 18 | select PPC_UDBG_16550 |
20 | select MPIC | 19 | select MPIC |
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c index 3690624e49d4..28d1647b204e 100644 --- a/arch/powerpc/platforms/chrp/pci.c +++ b/arch/powerpc/platforms/chrp/pci.c | |||
@@ -181,7 +181,7 @@ setup_python(struct pci_controller *hose, struct device_node *dev) | |||
181 | } | 181 | } |
182 | iounmap(reg); | 182 | iounmap(reg); |
183 | 183 | ||
184 | setup_indirect_pci(hose, r.start + 0xf8000, r.start + 0xf8010); | 184 | setup_indirect_pci(hose, r.start + 0xf8000, r.start + 0xf8010, 0); |
185 | } | 185 | } |
186 | 186 | ||
187 | /* Marvell Discovery II based Pegasos 2 */ | 187 | /* Marvell Discovery II based Pegasos 2 */ |
@@ -277,13 +277,14 @@ chrp_find_bridges(void) | |||
277 | hose->cfg_data = p; | 277 | hose->cfg_data = p; |
278 | gg2_pci_config_base = p; | 278 | gg2_pci_config_base = p; |
279 | } else if (is_pegasos == 1) { | 279 | } else if (is_pegasos == 1) { |
280 | setup_indirect_pci(hose, 0xfec00cf8, 0xfee00cfc); | 280 | setup_indirect_pci(hose, 0xfec00cf8, 0xfee00cfc, 0); |
281 | } else if (is_pegasos == 2) { | 281 | } else if (is_pegasos == 2) { |
282 | setup_peg2(hose, dev); | 282 | setup_peg2(hose, dev); |
283 | } else if (!strncmp(model, "IBM,CPC710", 10)) { | 283 | } else if (!strncmp(model, "IBM,CPC710", 10)) { |
284 | setup_indirect_pci(hose, | 284 | setup_indirect_pci(hose, |
285 | r.start + 0x000f8000, | 285 | r.start + 0x000f8000, |
286 | r.start + 0x000f8010); | 286 | r.start + 0x000f8010, |
287 | 0); | ||
287 | if (index == 0) { | 288 | if (index == 0) { |
288 | dma = of_get_property(dev, "system-dma-base", | 289 | dma = of_get_property(dev, "system-dma-base", |
289 | &len); | 290 | &len); |
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c index f4d0a7a603f5..bd5ca58345a1 100644 --- a/arch/powerpc/platforms/embedded6xx/linkstation.c +++ b/arch/powerpc/platforms/embedded6xx/linkstation.c | |||
@@ -73,7 +73,7 @@ static int __init linkstation_add_bridge(struct device_node *dev) | |||
73 | return -ENOMEM; | 73 | return -ENOMEM; |
74 | hose->first_busno = bus_range ? bus_range[0] : 0; | 74 | hose->first_busno = bus_range ? bus_range[0] : 0; |
75 | hose->last_busno = bus_range ? bus_range[1] : 0xff; | 75 | hose->last_busno = bus_range ? bus_range[1] : 0xff; |
76 | setup_indirect_pci(hose, 0xfec00000, 0xfee00000); | 76 | setup_indirect_pci(hose, 0xfec00000, 0xfee00000, 0); |
77 | 77 | ||
78 | /* Interpret the "ranges" property */ | 78 | /* Interpret the "ranges" property */ |
79 | /* This also maps the I/O region and sets isa_io/mem_base */ | 79 | /* This also maps the I/O region and sets isa_io/mem_base */ |
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index c6a30f9c2073..d7747e05d1da 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c | |||
@@ -185,7 +185,8 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary) | |||
185 | hose->first_busno = bus_range ? bus_range[0] : 0x0; | 185 | hose->first_busno = bus_range ? bus_range[0] : 0x0; |
186 | hose->last_busno = bus_range ? bus_range[1] : 0xff; | 186 | hose->last_busno = bus_range ? bus_range[1] : 0xff; |
187 | 187 | ||
188 | setup_indirect_pci(hose, rsrc.start, rsrc.start + 0x4); | 188 | setup_indirect_pci(hose, rsrc.start, rsrc.start + 0x4, |
189 | PPC_INDIRECT_TYPE_BIG_ENDIAN); | ||
189 | setup_pci_cmd(hose); | 190 | setup_pci_cmd(hose); |
190 | 191 | ||
191 | /* check PCI express link status */ | 192 | /* check PCI express link status */ |
diff --git a/arch/powerpc/sysdev/grackle.c b/arch/powerpc/sysdev/grackle.c index 42053625f498..11ad5622eb76 100644 --- a/arch/powerpc/sysdev/grackle.c +++ b/arch/powerpc/sysdev/grackle.c | |||
@@ -55,7 +55,7 @@ static inline void grackle_set_loop_snoop(struct pci_controller *bp, int enable) | |||
55 | 55 | ||
56 | void __init setup_grackle(struct pci_controller *hose) | 56 | void __init setup_grackle(struct pci_controller *hose) |
57 | { | 57 | { |
58 | setup_indirect_pci(hose, 0xfec00000, 0xfee00000); | 58 | setup_indirect_pci(hose, 0xfec00000, 0xfee00000, 0); |
59 | if (machine_is_compatible("PowerMac1,1")) | 59 | if (machine_is_compatible("PowerMac1,1")) |
60 | pci_assign_all_buses = 1; | 60 | pci_assign_all_buses = 1; |
61 | if (machine_is_compatible("AAPL,PowerBook1998")) | 61 | if (machine_is_compatible("AAPL,PowerBook1998")) |
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 | |||
29 | static int | 23 | static int |
30 | indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset, | 24 | indirect_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 | ||
151 | void __init | 151 | void __init |
152 | setup_indirect_pci(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data) | 152 | setup_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; |
diff --git a/arch/powerpc/sysdev/mv64x60_pci.c b/arch/powerpc/sysdev/mv64x60_pci.c index 45db86c2363c..9b3baa7317d7 100644 --- a/arch/powerpc/sysdev/mv64x60_pci.c +++ b/arch/powerpc/sysdev/mv64x60_pci.c | |||
@@ -144,7 +144,7 @@ static int __init mv64x60_add_bridge(struct device_node *dev) | |||
144 | hose->first_busno = bus_range ? bus_range[0] : 0; | 144 | hose->first_busno = bus_range ? bus_range[0] : 0; |
145 | hose->last_busno = bus_range ? bus_range[1] : 0xff; | 145 | hose->last_busno = bus_range ? bus_range[1] : 0xff; |
146 | 146 | ||
147 | setup_indirect_pci(hose, rsrc.start, rsrc.start + 4); | 147 | setup_indirect_pci(hose, rsrc.start, rsrc.start + 4, 0); |
148 | hose->self_busno = hose->first_busno; | 148 | hose->self_busno = hose->first_busno; |
149 | 149 | ||
150 | printk(KERN_INFO "Found MV64x60 PCI host bridge at 0x%016llx. " | 150 | printk(KERN_INFO "Found MV64x60 PCI host bridge at 0x%016llx. " |
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h index 13cb0a973478..9ce8f2991acf 100644 --- a/include/asm-powerpc/pci-bridge.h +++ b/include/asm-powerpc/pci-bridge.h | |||
@@ -49,11 +49,13 @@ struct pci_controller { | |||
49 | * hanging if we don't have link and try to do config cycles to | 49 | * hanging if we don't have link and try to do config cycles to |
50 | * anything but the PHB. Only allow talking to the PHB if this is | 50 | * anything but the PHB. Only allow talking to the PHB if this is |
51 | * set. | 51 | * set. |
52 | * BIG_ENDIAN - cfg_addr is a big endian register | ||
52 | */ | 53 | */ |
53 | #define PPC_INDIRECT_TYPE_SET_CFG_TYPE (0x00000001) | 54 | #define PPC_INDIRECT_TYPE_SET_CFG_TYPE (0x00000001) |
54 | #define PPC_INDIRECT_TYPE_EXT_REG (0x00000002) | 55 | #define PPC_INDIRECT_TYPE_EXT_REG (0x00000002) |
55 | #define PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS (0x00000004) | 56 | #define PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS (0x00000004) |
56 | #define PPC_INDIRECT_TYPE_NO_PCIE_LINK (0x00000008) | 57 | #define PPC_INDIRECT_TYPE_NO_PCIE_LINK (0x00000008) |
58 | #define PPC_INDIRECT_TYPE_BIG_ENDIAN (0x00000010) | ||
57 | u32 indirect_type; | 59 | u32 indirect_type; |
58 | 60 | ||
59 | /* Currently, we limit ourselves to 1 IO range and 3 mem | 61 | /* Currently, we limit ourselves to 1 IO range and 3 mem |
@@ -88,7 +90,7 @@ extern int early_find_capability(struct pci_controller *hose, int bus, | |||
88 | int dev_fn, int cap); | 90 | int dev_fn, int cap); |
89 | 91 | ||
90 | extern void setup_indirect_pci(struct pci_controller* hose, | 92 | extern void setup_indirect_pci(struct pci_controller* hose, |
91 | u32 cfg_addr, u32 cfg_data); | 93 | u32 cfg_addr, u32 cfg_data, u32 flags); |
92 | extern void setup_grackle(struct pci_controller *hose); | 94 | extern void setup_grackle(struct pci_controller *hose); |
93 | 95 | ||
94 | #else | 96 | #else |