aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-iop/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-iop/pci.c')
-rw-r--r--arch/arm/plat-iop/pci.c79
1 files changed, 54 insertions, 25 deletions
diff --git a/arch/arm/plat-iop/pci.c b/arch/arm/plat-iop/pci.c
index 98d01517b563..d9bc15a69e5d 100644
--- a/arch/arm/plat-iop/pci.c
+++ b/arch/arm/plat-iop/pci.c
@@ -24,6 +24,7 @@
24#include <asm/hardware.h> 24#include <asm/hardware.h>
25#include <asm/mach/pci.h> 25#include <asm/mach/pci.h>
26#include <asm/hardware/iop3xx.h> 26#include <asm/hardware/iop3xx.h>
27#include <asm/mach-types.h>
27 28
28// #define DEBUG 29// #define DEBUG
29 30
@@ -209,8 +210,11 @@ int iop3xx_pci_setup(int nr, struct pci_sys_data *sys)
209 res[1].flags = IORESOURCE_MEM; 210 res[1].flags = IORESOURCE_MEM;
210 request_resource(&iomem_resource, &res[1]); 211 request_resource(&iomem_resource, &res[1]);
211 212
212 sys->mem_offset = IOP3XX_PCI_LOWER_MEM_PA - IOP3XX_PCI_LOWER_MEM_BA; 213 /*
213 sys->io_offset = IOP3XX_PCI_LOWER_IO_PA - IOP3XX_PCI_LOWER_IO_BA; 214 * Use whatever translation is already setup.
215 */
216 sys->mem_offset = IOP3XX_PCI_LOWER_MEM_PA - *IOP3XX_OMWTVR0;
217 sys->io_offset = IOP3XX_PCI_LOWER_IO_PA - *IOP3XX_OIOWTVR;
214 218
215 sys->resource[0] = &res[0]; 219 sys->resource[0] = &res[0];
216 sys->resource[1] = &res[1]; 220 sys->resource[1] = &res[1];
@@ -250,11 +254,11 @@ void __init iop3xx_atu_setup(void)
250 *IOP3XX_IATVR2 = PHYS_OFFSET; 254 *IOP3XX_IATVR2 = PHYS_OFFSET;
251 255
252 /* Outbound window 0 */ 256 /* Outbound window 0 */
253 *IOP3XX_OMWTVR0 = IOP3XX_PCI_LOWER_MEM_PA; 257 *IOP3XX_OMWTVR0 = IOP3XX_PCI_LOWER_MEM_BA;
254 *IOP3XX_OUMWTVR0 = 0; 258 *IOP3XX_OUMWTVR0 = 0;
255 259
256 /* Outbound window 1 */ 260 /* Outbound window 1 */
257 *IOP3XX_OMWTVR1 = IOP3XX_PCI_LOWER_MEM_PA + IOP3XX_PCI_MEM_WINDOW_SIZE; 261 *IOP3XX_OMWTVR1 = IOP3XX_PCI_LOWER_MEM_BA + IOP3XX_PCI_MEM_WINDOW_SIZE;
258 *IOP3XX_OUMWTVR1 = 0; 262 *IOP3XX_OUMWTVR1 = 0;
259 263
260 /* BAR 3 ( Disabled ) */ 264 /* BAR 3 ( Disabled ) */
@@ -265,7 +269,7 @@ void __init iop3xx_atu_setup(void)
265 269
266 /* Setup the I/O Bar 270 /* Setup the I/O Bar
267 */ 271 */
268 *IOP3XX_OIOWTVR = IOP3XX_PCI_LOWER_IO_PA;; 272 *IOP3XX_OIOWTVR = IOP3XX_PCI_LOWER_IO_BA;
269 273
270 /* Enable inbound and outbound cycles 274 /* Enable inbound and outbound cycles
271 */ 275 */
@@ -322,34 +326,59 @@ void __init iop3xx_atu_disable(void)
322/* Flag to determine whether the ATU is initialized and the PCI bus scanned */ 326/* Flag to determine whether the ATU is initialized and the PCI bus scanned */
323int init_atu; 327int init_atu;
324 328
325void __init iop3xx_pci_preinit(void) 329int iop3xx_get_init_atu(void) {
330 /* check if default has been overridden */
331 if (init_atu != IOP3XX_INIT_ATU_DEFAULT)
332 return init_atu;
333 else
334 return IOP3XX_INIT_ATU_DISABLE;
335}
336
337static void __init iop3xx_atu_debug(void)
326{ 338{
327 if (iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE) { 339 DBG("PCI: Intel IOP3xx PCI init.\n");
328 iop3xx_atu_disable(); 340 DBG("PCI: Outbound memory window 0: PCI 0x%08x%08x\n",
329 iop3xx_atu_setup(); 341 *IOP3XX_OUMWTVR0, *IOP3XX_OMWTVR0);
330 } 342 DBG("PCI: Outbound memory window 1: PCI 0x%08x%08x\n",
343 *IOP3XX_OUMWTVR1, *IOP3XX_OMWTVR1);
344 DBG("PCI: Outbound IO window: PCI 0x%08x\n",
345 *IOP3XX_OIOWTVR);
346
347 DBG("PCI: Inbound memory window 0: PCI 0x%08x%08x 0x%08x -> 0x%08x\n",
348 *IOP3XX_IAUBAR0, *IOP3XX_IABAR0, *IOP3XX_IALR0, *IOP3XX_IATVR0);
349 DBG("PCI: Inbound memory window 1: PCI 0x%08x%08x 0x%08x\n",
350 *IOP3XX_IAUBAR1, *IOP3XX_IABAR1, *IOP3XX_IALR1);
351 DBG("PCI: Inbound memory window 2: PCI 0x%08x%08x 0x%08x -> 0x%08x\n",
352 *IOP3XX_IAUBAR2, *IOP3XX_IABAR2, *IOP3XX_IALR2, *IOP3XX_IATVR2);
353 DBG("PCI: Inbound memory window 3: PCI 0x%08x%08x 0x%08x -> 0x%08x\n",
354 *IOP3XX_IAUBAR3, *IOP3XX_IABAR3, *IOP3XX_IALR3, *IOP3XX_IATVR3);
355
356 DBG("PCI: Expansion ROM window: PCI 0x%08x%08x 0x%08x -> 0x%08x\n",
357 0, *IOP3XX_ERBAR, *IOP3XX_ERLR, *IOP3XX_ERTVR);
331 358
332 DBG("PCI: Intel 803xx PCI init code.\n");
333 DBG("ATU: IOP3XX_ATUCMD=0x%04x\n", *IOP3XX_ATUCMD); 359 DBG("ATU: IOP3XX_ATUCMD=0x%04x\n", *IOP3XX_ATUCMD);
334 DBG("ATU: IOP3XX_OMWTVR0=0x%04x, IOP3XX_OIOWTVR=0x%04x\n",
335 *IOP3XX_OMWTVR0,
336 *IOP3XX_OIOWTVR);
337 DBG("ATU: IOP3XX_ATUCR=0x%08x\n", *IOP3XX_ATUCR); 360 DBG("ATU: IOP3XX_ATUCR=0x%08x\n", *IOP3XX_ATUCR);
338 DBG("ATU: IOP3XX_IABAR0=0x%08x IOP3XX_IALR0=0x%08x IOP3XX_IATVR0=%08x\n",
339 *IOP3XX_IABAR0, *IOP3XX_IALR0, *IOP3XX_IATVR0);
340 DBG("ATU: IOP3XX_OMWTVR0=0x%08x\n", *IOP3XX_OMWTVR0);
341 DBG("ATU: IOP3XX_IABAR1=0x%08x IOP3XX_IALR1=0x%08x\n",
342 *IOP3XX_IABAR1, *IOP3XX_IALR1);
343 DBG("ATU: IOP3XX_ERBAR=0x%08x IOP3XX_ERLR=0x%08x IOP3XX_ERTVR=%08x\n",
344 *IOP3XX_ERBAR, *IOP3XX_ERLR, *IOP3XX_ERTVR);
345 DBG("ATU: IOP3XX_IABAR2=0x%08x IOP3XX_IALR2=0x%08x IOP3XX_IATVR2=%08x\n",
346 *IOP3XX_IABAR2, *IOP3XX_IALR2, *IOP3XX_IATVR2);
347 DBG("ATU: IOP3XX_IABAR3=0x%08x IOP3XX_IALR3=0x%08x IOP3XX_IATVR3=%08x\n",
348 *IOP3XX_IABAR3, *IOP3XX_IALR3, *IOP3XX_IATVR3);
349 361
350 hook_fault_code(16+6, iop3xx_pci_abort, SIGBUS, "imprecise external abort"); 362 hook_fault_code(16+6, iop3xx_pci_abort, SIGBUS, "imprecise external abort");
351} 363}
352 364
365/* for platforms that might be host-bus-adapters */
366void __init iop3xx_pci_preinit_cond(void)
367{
368 if (iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE) {
369 iop3xx_atu_disable();
370 iop3xx_atu_setup();
371 iop3xx_atu_debug();
372 }
373}
374
375void __init iop3xx_pci_preinit(void)
376{
377 iop3xx_atu_disable();
378 iop3xx_atu_setup();
379 iop3xx_atu_debug();
380}
381
353/* allow init_atu to be user overridden */ 382/* allow init_atu to be user overridden */
354static int __init iop3xx_init_atu_setup(char *str) 383static int __init iop3xx_init_atu_setup(char *str)
355{ 384{