aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-24 23:26:25 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-24 23:26:25 -0400
commit0de085bb474f64e4fdb2f1ff3268590792648c7b (patch)
tree67c88c8215b85e01430531dba7d7c8ad73173b67 /arch/powerpc/sysdev
parent3836df6b520a2f93033bf53200b12a2cb5137395 (diff)
parente58712111fe6eb7573fd6dd12d80de3bec13f277 (diff)
Merge branch 'for_paulus' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc
* 'for_paulus' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc: (25 commits) [POWERPC] 85xx: Added needed MPC85xx PCI device IDs [POWERPC] Add Freescale PCI VENDOR ID and 8641 device IDs [POWERPC] 85xxCDS: MPC8548 DTS cleanup. [POWERPC] 85xxCDS: Misc 8548 PCI Corrections. [POWERPC] 85xxCDS: Delay 8259 cascade hookup. [POWERPC] 85xxCDS: Make sure restart resets the PCI bus. [POWERPC] 85xxCDS: Allow 8259 cascade to share an MPIC interrupt line. [POWERPC] FSL: Add support for PCI-X controllers [POWERPC] Make sure virtual P2P bridge registers are setup on PCIe PHB [POWERPC] Provide ability to setup P2P bridge registers from struct resource [POWERPC] Add basic PCI/PCI Express support for 8544DS board [POWERPC] Make endianess of cfg_addr for indirect pci ops runtime [POWERPC] Removed setup_indirect_pci_nomap [POWERPC] 85xx: Add quirk to ignore bogus FPGA on CDS [POWERPC] 85xx: Added 8568 PCIe support [POWERPC] Fixup resources on pci_bus for PCIe PHB when no device is connected [POWERPC] Add basic PCI node for mpc8568mds board [POWERPC] Use Freescale pci/pcie common code for 85xx boards [POWERPC] Update PCI nodes in the 83xx/85xx boards device tree [POWERPC] Add 8548 CDS PCI express controller node and PCI-X device node ...
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r--arch/powerpc/sysdev/Makefile1
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c257
-rw-r--r--arch/powerpc/sysdev/fsl_pci.h88
-rw-r--r--arch/powerpc/sysdev/fsl_pcie.h94
-rw-r--r--arch/powerpc/sysdev/grackle.c2
-rw-r--r--arch/powerpc/sysdev/indirect_pci.c59
-rw-r--r--arch/powerpc/sysdev/mv64x60_pci.c2
7 files changed, 380 insertions, 123 deletions
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 484eb4e0e9d..08ce31e612c 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_PPC_PMI) += pmi.o
12obj-$(CONFIG_U3_DART) += dart_iommu.o 12obj-$(CONFIG_U3_DART) += dart_iommu.o
13obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o 13obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o
14obj-$(CONFIG_FSL_SOC) += fsl_soc.o 14obj-$(CONFIG_FSL_SOC) += fsl_soc.o
15obj-$(CONFIG_FSL_PCI) += fsl_pci.o
15obj-$(CONFIG_TSI108_BRIDGE) += tsi108_pci.o tsi108_dev.o 16obj-$(CONFIG_TSI108_BRIDGE) += tsi108_pci.o tsi108_dev.o
16obj-$(CONFIG_QUICC_ENGINE) += qe_lib/ 17obj-$(CONFIG_QUICC_ENGINE) += qe_lib/
17mv64x60-$(CONFIG_PCI) += mv64x60_pci.o 18mv64x60-$(CONFIG_PCI) += mv64x60_pci.o
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
new file mode 100644
index 00000000000..51c223385fe
--- /dev/null
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -0,0 +1,257 @@
1/*
2 * MPC85xx/86xx PCI/PCIE support routing.
3 *
4 * Copyright 2007 Freescale Semiconductor, Inc
5 *
6 * Initial author: Xianghua Xiao <x.xiao@freescale.com>
7 * Recode: ZHANG WEI <wei.zhang@freescale.com>
8 * Rewrite the routing for Frescale PCI and PCI Express
9 * Roy Zang <tie-fei.zang@freescale.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16#include <linux/kernel.h>
17#include <linux/pci.h>
18#include <linux/delay.h>
19#include <linux/string.h>
20#include <linux/init.h>
21#include <linux/bootmem.h>
22
23#include <asm/io.h>
24#include <asm/prom.h>
25#include <asm/pci-bridge.h>
26#include <asm/machdep.h>
27#include <sysdev/fsl_soc.h>
28#include <sysdev/fsl_pci.h>
29
30/* atmu setup for fsl pci/pcie controller */
31void __init setup_pci_atmu(struct pci_controller *hose, struct resource *rsrc)
32{
33 struct ccsr_pci __iomem *pci;
34 int i;
35
36 pr_debug("PCI memory map start 0x%x, size 0x%x\n", rsrc->start,
37 rsrc->end - rsrc->start + 1);
38 pci = ioremap(rsrc->start, rsrc->end - rsrc->start + 1);
39
40 /* Disable all windows (except powar0 since its ignored) */
41 for(i = 1; i < 5; i++)
42 out_be32(&pci->pow[i].powar, 0);
43 for(i = 0; i < 3; i++)
44 out_be32(&pci->piw[i].piwar, 0);
45
46 /* Setup outbound MEM window */
47 for(i = 0; i < 3; i++)
48 if (hose->mem_resources[i].flags & IORESOURCE_MEM){
49 pr_debug("PCI MEM resource start 0x%08x, size 0x%08x.\n",
50 hose->mem_resources[i].start,
51 hose->mem_resources[i].end
52 - hose->mem_resources[i].start + 1);
53 out_be32(&pci->pow[i+1].potar,
54 (hose->mem_resources[i].start >> 12)
55 & 0x000fffff);
56 out_be32(&pci->pow[i+1].potear, 0);
57 out_be32(&pci->pow[i+1].powbar,
58 (hose->mem_resources[i].start >> 12)
59 & 0x000fffff);
60 /* Enable, Mem R/W */
61 out_be32(&pci->pow[i+1].powar, 0x80044000
62 | (__ilog2(hose->mem_resources[i].end
63 - hose->mem_resources[i].start + 1) - 1));
64 }
65
66 /* Setup outbound IO window */
67 if (hose->io_resource.flags & IORESOURCE_IO){
68 pr_debug("PCI IO resource start 0x%08x, size 0x%08x, phy base 0x%08x.\n",
69 hose->io_resource.start,
70 hose->io_resource.end - hose->io_resource.start + 1,
71 hose->io_base_phys);
72 out_be32(&pci->pow[i+1].potar, (hose->io_resource.start >> 12)
73 & 0x000fffff);
74 out_be32(&pci->pow[i+1].potear, 0);
75 out_be32(&pci->pow[i+1].powbar, (hose->io_base_phys >> 12)
76 & 0x000fffff);
77 /* Enable, IO R/W */
78 out_be32(&pci->pow[i+1].powar, 0x80088000
79 | (__ilog2(hose->io_resource.end
80 - hose->io_resource.start + 1) - 1));
81 }
82
83 /* Setup 2G inbound Memory Window @ 1 */
84 out_be32(&pci->piw[2].pitar, 0x00000000);
85 out_be32(&pci->piw[2].piwbar,0x00000000);
86 out_be32(&pci->piw[2].piwar, PIWAR_2G);
87}
88
89void __init setup_pci_cmd(struct pci_controller *hose)
90{
91 u16 cmd;
92 int cap_x;
93
94 early_read_config_word(hose, 0, 0, PCI_COMMAND, &cmd);
95 cmd |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY
96 | PCI_COMMAND_IO;
97 early_write_config_word(hose, 0, 0, PCI_COMMAND, cmd);
98
99 cap_x = early_find_capability(hose, 0, 0, PCI_CAP_ID_PCIX);
100 if (cap_x) {
101 int pci_x_cmd = cap_x + PCI_X_CMD;
102 cmd = PCI_X_CMD_MAX_SPLIT | PCI_X_CMD_MAX_READ
103 | PCI_X_CMD_ERO | PCI_X_CMD_DPERR_E;
104 early_write_config_word(hose, 0, 0, pci_x_cmd, cmd);
105 } else {
106 early_write_config_byte(hose, 0, 0, PCI_LATENCY_TIMER, 0x80);
107 }
108}
109
110static void __devinit quirk_fsl_pcie_transparent(struct pci_dev *dev)
111{
112 struct resource *res;
113 int i, res_idx = PCI_BRIDGE_RESOURCES;
114 struct pci_controller *hose;
115
116 /* if we aren't a PCIe don't bother */
117 if (!pci_find_capability(dev, PCI_CAP_ID_EXP))
118 return ;
119
120 /*
121 * Make the bridge be transparent.
122 */
123 dev->transparent = 1;
124
125 hose = pci_bus_to_host(dev->bus);
126 if (!hose) {
127 printk(KERN_ERR "Can't find hose for bus %d\n",
128 dev->bus->number);
129 return;
130 }
131
132 /* Clear out any of the virtual P2P bridge registers */
133 pci_write_config_word(dev, PCI_IO_BASE_UPPER16, 0);
134 pci_write_config_word(dev, PCI_IO_LIMIT_UPPER16, 0);
135 pci_write_config_byte(dev, PCI_IO_BASE, 0x10);
136 pci_write_config_byte(dev, PCI_IO_LIMIT, 0);
137 pci_write_config_word(dev, PCI_MEMORY_BASE, 0x10);
138 pci_write_config_word(dev, PCI_MEMORY_LIMIT, 0);
139 pci_write_config_word(dev, PCI_PREF_BASE_UPPER32, 0x0);
140 pci_write_config_word(dev, PCI_PREF_LIMIT_UPPER32, 0x0);
141 pci_write_config_word(dev, PCI_PREF_MEMORY_BASE, 0x10);
142 pci_write_config_word(dev, PCI_PREF_MEMORY_LIMIT, 0);
143
144 if (hose->io_resource.flags) {
145 res = &dev->resource[res_idx++];
146 res->start = hose->io_resource.start;
147 res->end = hose->io_resource.end;
148 res->flags = hose->io_resource.flags;
149 update_bridge_resource(dev, res);
150 }
151
152 for (i = 0; i < 3; i++) {
153 res = &dev->resource[res_idx + i];
154 res->start = hose->mem_resources[i].start;
155 res->end = hose->mem_resources[i].end;
156 res->flags = hose->mem_resources[i].flags;
157 update_bridge_resource(dev, res);
158 }
159}
160
161int __init fsl_pcie_check_link(struct pci_controller *hose)
162{
163 u16 val;
164 early_read_config_word(hose, 0, 0, PCIE_LTSSM, &val);
165 if (val < PCIE_LTSSM_L0)
166 return 1;
167 return 0;
168}
169
170void fsl_pcibios_fixup_bus(struct pci_bus *bus)
171{
172 struct pci_controller *hose = (struct pci_controller *) bus->sysdata;
173 int i;
174
175 /* deal with bogus pci_bus when we don't have anything connected on PCIe */
176 if (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK) {
177 if (bus->parent) {
178 for (i = 0; i < 4; ++i)
179 bus->resource[i] = bus->parent->resource[i];
180 }
181 }
182}
183
184int __init fsl_add_bridge(struct device_node *dev, int is_primary)
185{
186 int len;
187 struct pci_controller *hose;
188 struct resource rsrc;
189 const int *bus_range;
190
191 pr_debug("Adding PCI host bridge %s\n", dev->full_name);
192
193 /* Fetch host bridge registers address */
194 if (of_address_to_resource(dev, 0, &rsrc)) {
195 printk(KERN_WARNING "Can't get pci register base!");
196 return -ENOMEM;
197 }
198
199 /* Get bus range if any */
200 bus_range = of_get_property(dev, "bus-range", &len);
201 if (bus_range == NULL || len < 2 * sizeof(int))
202 printk(KERN_WARNING "Can't get bus-range for %s, assume"
203 " bus 0\n", dev->full_name);
204
205 pci_assign_all_buses = 1;
206 hose = pcibios_alloc_controller(dev);
207 if (!hose)
208 return -ENOMEM;
209
210 hose->first_busno = bus_range ? bus_range[0] : 0x0;
211 hose->last_busno = bus_range ? bus_range[1] : 0xff;
212
213 setup_indirect_pci(hose, rsrc.start, rsrc.start + 0x4,
214 PPC_INDIRECT_TYPE_BIG_ENDIAN);
215 setup_pci_cmd(hose);
216
217 /* check PCI express link status */
218 if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) {
219 hose->indirect_type = PPC_INDIRECT_TYPE_EXT_REG |
220 PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS;
221 if (fsl_pcie_check_link(hose))
222 hose->indirect_type |= PPC_INDIRECT_TYPE_NO_PCIE_LINK;
223 }
224
225 printk(KERN_INFO "Found FSL PCI host bridge at 0x%016llx."
226 "Firmware bus number: %d->%d\n",
227 (unsigned long long)rsrc.start, hose->first_busno,
228 hose->last_busno);
229
230 pr_debug(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
231 hose, hose->cfg_addr, hose->cfg_data);
232
233 /* Interpret the "ranges" property */
234 /* This also maps the I/O region and sets isa_io/mem_base */
235 pci_process_bridge_OF_ranges(hose, dev, is_primary);
236
237 /* Setup PEX window registers */
238 setup_pci_atmu(hose, &rsrc);
239
240 return 0;
241}
242
243DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8548E, quirk_fsl_pcie_transparent);
244DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8548, quirk_fsl_pcie_transparent);
245DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8543E, quirk_fsl_pcie_transparent);
246DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8543, quirk_fsl_pcie_transparent);
247DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8547E, quirk_fsl_pcie_transparent);
248DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8545E, quirk_fsl_pcie_transparent);
249DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8545, quirk_fsl_pcie_transparent);
250DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8568E, quirk_fsl_pcie_transparent);
251DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8568, quirk_fsl_pcie_transparent);
252DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8567E, quirk_fsl_pcie_transparent);
253DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8567, quirk_fsl_pcie_transparent);
254DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8544E, quirk_fsl_pcie_transparent);
255DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8544, quirk_fsl_pcie_transparent);
256DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8641, quirk_fsl_pcie_transparent);
257DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8641D, quirk_fsl_pcie_transparent);
diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h
new file mode 100644
index 00000000000..37b04ad2657
--- /dev/null
+++ b/arch/powerpc/sysdev/fsl_pci.h
@@ -0,0 +1,88 @@
1/*
2 * MPC85xx/86xx PCI Express structure define
3 *
4 * Copyright 2007 Freescale Semiconductor, Inc
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifdef __KERNEL__
14#ifndef __POWERPC_FSL_PCI_H
15#define __POWERPC_FSL_PCI_H
16
17#define PCIE_LTSSM 0x0404 /* PCIE Link Training and Status */
18#define PCIE_LTSSM_L0 0x16 /* L0 state */
19#define PIWAR_2G 0xa0f5501e /* Enable, Prefetch, Local Mem, Snoop R/W, 2G */
20
21/* PCI/PCI Express outbound window reg */
22struct pci_outbound_window_regs {
23 __be32 potar; /* 0x.0 - Outbound translation address register */
24 __be32 potear; /* 0x.4 - Outbound translation extended address register */
25 __be32 powbar; /* 0x.8 - Outbound window base address register */
26 u8 res1[4];
27 __be32 powar; /* 0x.10 - Outbound window attributes register */
28 u8 res2[12];
29};
30
31/* PCI/PCI Express inbound window reg */
32struct pci_inbound_window_regs {
33 __be32 pitar; /* 0x.0 - Inbound translation address register */
34 u8 res1[4];
35 __be32 piwbar; /* 0x.8 - Inbound window base address register */
36 __be32 piwbear; /* 0x.c - Inbound window base extended address register */
37 __be32 piwar; /* 0x.10 - Inbound window attributes register */
38 u8 res2[12];
39};
40
41/* PCI/PCI Express IO block registers for 85xx/86xx */
42struct ccsr_pci {
43 __be32 config_addr; /* 0x.000 - PCI/PCIE Configuration Address Register */
44 __be32 config_data; /* 0x.004 - PCI/PCIE Configuration Data Register */
45 __be32 int_ack; /* 0x.008 - PCI Interrupt Acknowledge Register */
46 __be32 pex_otb_cpl_tor; /* 0x.00c - PCIE Outbound completion timeout register */
47 __be32 pex_conf_tor; /* 0x.010 - PCIE configuration timeout register */
48 u8 res2[12];
49 __be32 pex_pme_mes_dr; /* 0x.020 - PCIE PME and message detect register */
50 __be32 pex_pme_mes_disr; /* 0x.024 - PCIE PME and message disable register */
51 __be32 pex_pme_mes_ier; /* 0x.028 - PCIE PME and message interrupt enable register */
52 __be32 pex_pmcr; /* 0x.02c - PCIE power management command register */
53 u8 res3[3024];
54
55/* PCI/PCI Express outbound window 0-4
56 * Window 0 is the default window and is the only window enabled upon reset.
57 * The default outbound register set is used when a transaction misses
58 * in all of the other outbound windows.
59 */
60 struct pci_outbound_window_regs pow[5];
61
62 u8 res14[256];
63
64/* PCI/PCI Express inbound window 3-1
65 * inbound window 1 supports only a 32-bit base address and does not
66 * define an inbound window base extended address register.
67 */
68 struct pci_inbound_window_regs piw[3];
69
70 __be32 pex_err_dr; /* 0x.e00 - PCI/PCIE error detect register */
71 u8 res21[4];
72 __be32 pex_err_en; /* 0x.e08 - PCI/PCIE error interrupt enable register */
73 u8 res22[4];
74 __be32 pex_err_disr; /* 0x.e10 - PCI/PCIE error disable register */
75 u8 res23[12];
76 __be32 pex_err_cap_stat; /* 0x.e20 - PCI/PCIE error capture status register */
77 u8 res24[4];
78 __be32 pex_err_cap_r0; /* 0x.e28 - PCIE error capture register 0 */
79 __be32 pex_err_cap_r1; /* 0x.e2c - PCIE error capture register 0 */
80 __be32 pex_err_cap_r2; /* 0x.e30 - PCIE error capture register 0 */
81 __be32 pex_err_cap_r3; /* 0x.e34 - PCIE error capture register 0 */
82};
83
84extern int fsl_add_bridge(struct device_node *dev, int is_primary);
85extern void fsl_pcibios_fixup_bus(struct pci_bus *bus);
86
87#endif /* __POWERPC_FSL_PCI_H */
88#endif /* __KERNEL__ */
diff --git a/arch/powerpc/sysdev/fsl_pcie.h b/arch/powerpc/sysdev/fsl_pcie.h
deleted file mode 100644
index 8d9779c84be..00000000000
--- a/arch/powerpc/sysdev/fsl_pcie.h
+++ /dev/null
@@ -1,94 +0,0 @@
1/*
2 * MPC85xx/86xx PCI Express structure define
3 *
4 * Copyright 2007 Freescale Semiconductor, Inc
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifdef __KERNEL__
14#ifndef __POWERPC_FSL_PCIE_H
15#define __POWERPC_FSL_PCIE_H
16
17/* PCIE Express IO block registers in 85xx/86xx */
18
19struct ccsr_pex {
20 __be32 __iomem pex_config_addr; /* 0x.000 - PCI Express Configuration Address Register */
21 __be32 __iomem pex_config_data; /* 0x.004 - PCI Express Configuration Data Register */
22 u8 __iomem res1[4];
23 __be32 __iomem pex_otb_cpl_tor; /* 0x.00c - PCI Express Outbound completion timeout register */
24 __be32 __iomem pex_conf_tor; /* 0x.010 - PCI Express configuration timeout register */
25 u8 __iomem res2[12];
26 __be32 __iomem pex_pme_mes_dr; /* 0x.020 - PCI Express PME and message detect register */
27 __be32 __iomem pex_pme_mes_disr; /* 0x.024 - PCI Express PME and message disable register */
28 __be32 __iomem pex_pme_mes_ier; /* 0x.028 - PCI Express PME and message interrupt enable register */
29 __be32 __iomem pex_pmcr; /* 0x.02c - PCI Express power management command register */
30 u8 __iomem res3[3024];
31 __be32 __iomem pexotar0; /* 0x.c00 - PCI Express outbound translation address register 0 */
32 __be32 __iomem pexotear0; /* 0x.c04 - PCI Express outbound translation extended address register 0*/
33 u8 __iomem res4[8];
34 __be32 __iomem pexowar0; /* 0x.c10 - PCI Express outbound window attributes register 0*/
35 u8 __iomem res5[12];
36 __be32 __iomem pexotar1; /* 0x.c20 - PCI Express outbound translation address register 1 */
37 __be32 __iomem pexotear1; /* 0x.c24 - PCI Express outbound translation extended address register 1*/
38 __be32 __iomem pexowbar1; /* 0x.c28 - PCI Express outbound window base address register 1*/
39 u8 __iomem res6[4];
40 __be32 __iomem pexowar1; /* 0x.c30 - PCI Express outbound window attributes register 1*/
41 u8 __iomem res7[12];
42 __be32 __iomem pexotar2; /* 0x.c40 - PCI Express outbound translation address register 2 */
43 __be32 __iomem pexotear2; /* 0x.c44 - PCI Express outbound translation extended address register 2*/
44 __be32 __iomem pexowbar2; /* 0x.c48 - PCI Express outbound window base address register 2*/
45 u8 __iomem res8[4];
46 __be32 __iomem pexowar2; /* 0x.c50 - PCI Express outbound window attributes register 2*/
47 u8 __iomem res9[12];
48 __be32 __iomem pexotar3; /* 0x.c60 - PCI Express outbound translation address register 3 */
49 __be32 __iomem pexotear3; /* 0x.c64 - PCI Express outbound translation extended address register 3*/
50 __be32 __iomem pexowbar3; /* 0x.c68 - PCI Express outbound window base address register 3*/
51 u8 __iomem res10[4];
52 __be32 __iomem pexowar3; /* 0x.c70 - PCI Express outbound window attributes register 3*/
53 u8 __iomem res11[12];
54 __be32 __iomem pexotar4; /* 0x.c80 - PCI Express outbound translation address register 4 */
55 __be32 __iomem pexotear4; /* 0x.c84 - PCI Express outbound translation extended address register 4*/
56 __be32 __iomem pexowbar4; /* 0x.c88 - PCI Express outbound window base address register 4*/
57 u8 __iomem res12[4];
58 __be32 __iomem pexowar4; /* 0x.c90 - PCI Express outbound window attributes register 4*/
59 u8 __iomem res13[12];
60 u8 __iomem res14[256];
61 __be32 __iomem pexitar3; /* 0x.da0 - PCI Express inbound translation address register 3 */
62 u8 __iomem res15[4];
63 __be32 __iomem pexiwbar3; /* 0x.da8 - PCI Express inbound window base address register 3 */
64 __be32 __iomem pexiwbear3; /* 0x.dac - PCI Express inbound window base extended address register 3 */
65 __be32 __iomem pexiwar3; /* 0x.db0 - PCI Express inbound window attributes register 3 */
66 u8 __iomem res16[12];
67 __be32 __iomem pexitar2; /* 0x.dc0 - PCI Express inbound translation address register 2 */
68 u8 __iomem res17[4];
69 __be32 __iomem pexiwbar2; /* 0x.dc8 - PCI Express inbound window base address register 2 */
70 __be32 __iomem pexiwbear2; /* 0x.dcc - PCI Express inbound window base extended address register 2 */
71 __be32 __iomem pexiwar2; /* 0x.dd0 - PCI Express inbound window attributes register 2 */
72 u8 __iomem res18[12];
73 __be32 __iomem pexitar1; /* 0x.de0 - PCI Express inbound translation address register 2 */
74 u8 __iomem res19[4];
75 __be32 __iomem pexiwbar1; /* 0x.de8 - PCI Express inbound window base address register 2 */
76 __be32 __iomem pexiwbear1; /* 0x.dec - PCI Express inbound window base extended address register 2 */
77 __be32 __iomem pexiwar1; /* 0x.df0 - PCI Express inbound window attributes register 2 */
78 u8 __iomem res20[12];
79 __be32 __iomem pex_err_dr; /* 0x.e00 - PCI Express error detect register */
80 u8 __iomem res21[4];
81 __be32 __iomem pex_err_en; /* 0x.e08 - PCI Express error interrupt enable register */
82 u8 __iomem res22[4];
83 __be32 __iomem pex_err_disr; /* 0x.e10 - PCI Express error disable register */
84 u8 __iomem res23[12];
85 __be32 __iomem pex_err_cap_stat; /* 0x.e20 - PCI Express error capture status register */
86 u8 __iomem res24[4];
87 __be32 __iomem pex_err_cap_r0; /* 0x.e28 - PCI Express error capture register 0 */
88 __be32 __iomem pex_err_cap_r1; /* 0x.e2c - PCI Express error capture register 0 */
89 __be32 __iomem pex_err_cap_r2; /* 0x.e30 - PCI Express error capture register 0 */
90 __be32 __iomem pex_err_cap_r3; /* 0x.e34 - PCI Express error capture register 0 */
91};
92
93#endif /* __POWERPC_FSL_PCIE_H */
94#endif /* __KERNEL__ */
diff --git a/arch/powerpc/sysdev/grackle.c b/arch/powerpc/sysdev/grackle.c
index 42053625f49..11ad5622eb7 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
56void __init setup_grackle(struct pci_controller *hose) 56void __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 c7e6e859b39..a8ac2dfdd3d 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)
@@ -35,10 +29,17 @@ indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
35 u8 cfg_type = 0; 29 u8 cfg_type = 0;
36 u32 bus_no, reg; 30 u32 bus_no, reg;
37 31
32 if (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK) {
33 if (bus->number != hose->first_busno)
34 return PCIBIOS_DEVICE_NOT_FOUND;
35 if (devfn != 0)
36 return PCIBIOS_DEVICE_NOT_FOUND;
37 }
38
38 if (ppc_md.pci_exclude_device) 39 if (ppc_md.pci_exclude_device)
39 if (ppc_md.pci_exclude_device(hose, bus->number, devfn)) 40 if (ppc_md.pci_exclude_device(hose, bus->number, devfn))
40 return PCIBIOS_DEVICE_NOT_FOUND; 41 return PCIBIOS_DEVICE_NOT_FOUND;
41 42
42 if (hose->indirect_type & PPC_INDIRECT_TYPE_SET_CFG_TYPE) 43 if (hose->indirect_type & PPC_INDIRECT_TYPE_SET_CFG_TYPE)
43 if (bus->number != hose->first_busno) 44 if (bus->number != hose->first_busno)
44 cfg_type = 1; 45 cfg_type = 1;
@@ -51,9 +52,12 @@ indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
51 else 52 else
52 reg = offset & 0xfc; 53 reg = offset & 0xfc;
53 54
54 PCI_CFG_OUT(hose->cfg_addr, 55 if (hose->indirect_type & PPC_INDIRECT_TYPE_BIG_ENDIAN)
55 (0x80000000 | (bus_no << 16) 56 out_be32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
56 | (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));
57 61
58 /* 62 /*
59 * Note: the caller has already checked that offset is 63 * Note: the caller has already checked that offset is
@@ -83,6 +87,13 @@ indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
83 u8 cfg_type = 0; 87 u8 cfg_type = 0;
84 u32 bus_no, reg; 88 u32 bus_no, reg;
85 89
90 if (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK) {
91 if (bus->number != hose->first_busno)
92 return PCIBIOS_DEVICE_NOT_FOUND;
93 if (devfn != 0)
94 return PCIBIOS_DEVICE_NOT_FOUND;
95 }
96
86 if (ppc_md.pci_exclude_device) 97 if (ppc_md.pci_exclude_device)
87 if (ppc_md.pci_exclude_device(hose, bus->number, devfn)) 98 if (ppc_md.pci_exclude_device(hose, bus->number, devfn))
88 return PCIBIOS_DEVICE_NOT_FOUND; 99 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -99,9 +110,12 @@ indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
99 else 110 else
100 reg = offset & 0xfc; 111 reg = offset & 0xfc;
101 112
102 PCI_CFG_OUT(hose->cfg_addr, 113 if (hose->indirect_type & PPC_INDIRECT_TYPE_BIG_ENDIAN)
103 (0x80000000 | (bus_no << 16) 114 out_be32(hose->cfg_addr, (0x80000000 | (bus_no << 16) |
104 | (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));
105 119
106 /* surpress setting of PCI_PRIMARY_BUS */ 120 /* surpress setting of PCI_PRIMARY_BUS */
107 if (hose->indirect_type & PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS) 121 if (hose->indirect_type & PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS)
@@ -135,24 +149,15 @@ static struct pci_ops indirect_pci_ops =
135}; 149};
136 150
137void __init 151void __init
138setup_indirect_pci_nomap(struct pci_controller* hose, void __iomem * cfg_addr, 152setup_indirect_pci(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data, u32 flags)
139 void __iomem * cfg_data)
140{
141 hose->cfg_addr = cfg_addr;
142 hose->cfg_data = cfg_data;
143 hose->ops = &indirect_pci_ops;
144}
145
146void __init
147setup_indirect_pci(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data)
148{ 153{
149 unsigned long base = cfg_addr & PAGE_MASK; 154 unsigned long base = cfg_addr & PAGE_MASK;
150 void __iomem *mbase, *addr, *data; 155 void __iomem *mbase;
151 156
152 mbase = ioremap(base, PAGE_SIZE); 157 mbase = ioremap(base, PAGE_SIZE);
153 addr = mbase + (cfg_addr & ~PAGE_MASK); 158 hose->cfg_addr = mbase + (cfg_addr & ~PAGE_MASK);
154 if ((cfg_data & PAGE_MASK) != base) 159 if ((cfg_data & PAGE_MASK) != base)
155 mbase = ioremap(cfg_data & PAGE_MASK, PAGE_SIZE); 160 mbase = ioremap(cfg_data & PAGE_MASK, PAGE_SIZE);
156 data = mbase + (cfg_data & ~PAGE_MASK); 161 hose->cfg_data = mbase + (cfg_data & ~PAGE_MASK);
157 setup_indirect_pci_nomap(hose, addr, data); 162 hose->ops = &indirect_pci_ops;
158} 163}
diff --git a/arch/powerpc/sysdev/mv64x60_pci.c b/arch/powerpc/sysdev/mv64x60_pci.c
index 45db86c2363..9b3baa7317d 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. "