fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / arm / mach-ixp2000 / pci.c
index 831f8ff..5a09a90 100644 (file)
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/system.h>
-#include <asm/mach-types.h>
 #include <asm/hardware.h>
 
 #include <asm/mach/pci.h>
 
-static int pci_master_aborts = 0;
+static volatile int pci_master_aborts = 0;
 
 static int clear_master_aborts(void);
 
-static u32 *
+u32 *
 ixp2000_pci_config_addr(unsigned int bus_nr, unsigned int devfn, int where)
 {
        u32 *paddress;
@@ -149,7 +148,7 @@ int ixp2000_pci_abort_handler(unsigned long addr, unsigned int fsr, struct pt_re
        local_irq_save(flags);
        temp = *(IXP2000_PCI_CONTROL);
        if (temp & ((1 << 8) | (1 << 5))) {
-               ixp2000_reg_write(IXP2000_PCI_CONTROL, temp);
+               ixp2000_reg_wrb(IXP2000_PCI_CONTROL, temp);
        }
 
        temp = *(IXP2000_PCI_CMDSTAT);
@@ -179,8 +178,8 @@ clear_master_aborts(void)
 
        local_irq_save(flags);
        temp = *(IXP2000_PCI_CONTROL);
-       if (temp & ((1 << 8) | (1 << 5))) {     
-               ixp2000_reg_write(IXP2000_PCI_CONTROL, temp);
+       if (temp & ((1 << 8) | (1 << 5))) {
+               ixp2000_reg_wrb(IXP2000_PCI_CONTROL, temp);
        }
 
        temp = *(IXP2000_PCI_CMDSTAT);
@@ -198,6 +197,19 @@ clear_master_aborts(void)
 void __init
 ixp2000_pci_preinit(void)
 {
+#ifndef CONFIG_IXP2000_SUPPORT_BROKEN_PCI_IO
+       /*
+        * Configure the PCI unit to properly byteswap I/O transactions,
+        * and verify that it worked.
+        */
+       ixp2000_reg_write(IXP2000_PCI_CONTROL,
+                         (*IXP2000_PCI_CONTROL | PCI_CONTROL_IEE));
+
+       if ((*IXP2000_PCI_CONTROL & PCI_CONTROL_IEE) == 0)
+               panic("IXP2000: PCI I/O is broken on this ixp model, and "
+                       "the needed workaround has not been configured in");
+#endif
+
        hook_fault_code(16+6, ixp2000_pci_abort_handler, SIGBUS,
                                "PCI config cycle to non-existent device");
 }
@@ -208,15 +220,15 @@ ixp2000_pci_preinit(void)
  * use our own resource space.
  */
 static struct resource ixp2000_pci_mem_space = {
-       .start  = 0x00000000,
+       .start  = 0xe0000000,
        .end    = 0xffffffff,
        .flags  = IORESOURCE_MEM,
        .name   = "PCI Mem Space"
 };
 
 static struct resource ixp2000_pci_io_space = {
-       .start  = 0x00000000,
-       .end    = 0xffffffff,
+       .start  = 0x00010000,
+       .end    = 0x0001ffff,
        .flags  = IORESOURCE_IO,
        .name   = "PCI I/O Space"
 };