iop: unconditionally initialize the ATU on platforms known to be 'hosts'
authorDan Williams <dan.j.williams@intel.com>
Thu, 27 Mar 2008 02:12:38 +0000 (19:12 -0700)
committerDan Williams <dan.j.williams@intel.com>
Wed, 26 Mar 2008 19:33:41 +0000 (12:33 -0700)
Platforms like iq80321 and iq80331 which may be host-bus-adapters
require 'iop3xx_init_atu=y' to be specified on the kernel command line.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
arch/arm/mach-iop32x/Kconfig
arch/arm/mach-iop32x/iq31244.c
arch/arm/mach-iop32x/iq80321.c
arch/arm/mach-iop33x/Kconfig
arch/arm/mach-iop33x/iq80331.c
arch/arm/mach-iop33x/iq80332.c
arch/arm/plat-iop/pci.c
include/asm-arm/hardware/iop3xx.h
include/asm-arm/mach/pci.h

index dbe07c9..5e8c6f7 100644 (file)
@@ -34,14 +34,6 @@ config MACH_N2100
          Say Y here if you want to run your kernel on the Thecus n2100
          NAS appliance.
 
-config IOP3XX_ATU
-        bool "Enable the PCI Controller"
-        default y
-        help
-          Say Y here if you want the IOP to initialize its PCI Controller.
-          Say N if the IOP is an add in card, the host system owns the PCI
-          bus in this case.
-
 config MACH_EM7210
        bool "Enable support for the Lanner EM7210"
        help
index 98cfa1c..4a89823 100644 (file)
@@ -178,10 +178,9 @@ static struct hw_pci iq31244_pci __initdata = {
 
 static int __init iq31244_pci_init(void)
 {
-       if (is_ep80219()) {
-               if (iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE)
-                       pci_common_init(&ep80219_pci);
-       } else if (machine_is_iq31244()) {
+       if (is_ep80219())
+               pci_common_init(&ep80219_pci);
+       else if (machine_is_iq31244()) {
                if (is_80219()) {
                        printk("note: iq31244 board type has been selected\n");
                        printk("note: to select ep80219 operation:\n");
@@ -190,9 +189,7 @@ static int __init iq31244_pci_init(void)
                        printk("\t2/ update boot loader to pass"
                                " the ep80219 id: %d\n", MACH_TYPE_EP80219);
                }
-
-               if (iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE)
-                       pci_common_init(&iq31244_pci);
+               pci_common_init(&iq31244_pci);
        }
 
        return 0;
index 18ad29f..1da3c91 100644 (file)
@@ -106,7 +106,7 @@ static struct hw_pci iq80321_pci __initdata = {
        .swizzle        = pci_std_swizzle,
        .nr_controllers = 1,
        .setup          = iop3xx_pci_setup,
-       .preinit        = iop3xx_pci_preinit,
+       .preinit        = iop3xx_pci_preinit_cond,
        .scan           = iop3xx_pci_scan_bus,
        .map_irq        = iq80321_pci_map_irq,
 };
index 45598e0..9aa016b 100644 (file)
@@ -16,14 +16,6 @@ config MACH_IQ80332
          Say Y here if you want to run your kernel on the Intel IQ80332
          evaluation kit for the IOP332 chipset.
 
-config IOP3XX_ATU
-       bool "Enable the PCI Controller"
-       default y
-       help
-         Say Y here if you want the IOP to initialize its PCI Controller.
-         Say N if the IOP is an add in card, the host system owns the PCI
-         bus in this case.
-
 endmenu
 
 endif
index 433188e..de39fd7 100644 (file)
@@ -89,7 +89,7 @@ static struct hw_pci iq80331_pci __initdata = {
        .swizzle        = pci_std_swizzle,
        .nr_controllers = 1,
        .setup          = iop3xx_pci_setup,
-       .preinit        = iop3xx_pci_preinit,
+       .preinit        = iop3xx_pci_preinit_cond,
        .scan           = iop3xx_pci_scan_bus,
        .map_irq        = iq80331_pci_map_irq,
 };
index 416c095..4904fd7 100644 (file)
@@ -89,7 +89,7 @@ static struct hw_pci iq80332_pci __initdata = {
        .swizzle        = pci_std_swizzle,
        .nr_controllers = 1,
        .setup          = iop3xx_pci_setup,
-       .preinit        = iop3xx_pci_preinit,
+       .preinit        = iop3xx_pci_preinit_cond,
        .scan           = iop3xx_pci_scan_bus,
        .map_irq        = iq80332_pci_map_irq,
 };
index 6ed374f..d9bc15a 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/hardware.h>
 #include <asm/mach/pci.h>
 #include <asm/hardware/iop3xx.h>
+#include <asm/mach-types.h>
 
 // #define DEBUG
 
@@ -325,13 +326,16 @@ void __init iop3xx_atu_disable(void)
 /* Flag to determine whether the ATU is initialized and the PCI bus scanned */
 int init_atu;
 
-void __init iop3xx_pci_preinit(void)
-{
-       if (iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE) {
-               iop3xx_atu_disable();
-               iop3xx_atu_setup();
-       }
+int iop3xx_get_init_atu(void) {
+       /* check if default has been overridden */
+       if (init_atu != IOP3XX_INIT_ATU_DEFAULT)
+               return init_atu;
+       else
+               return IOP3XX_INIT_ATU_DISABLE;
+}
 
+static void __init iop3xx_atu_debug(void)
+{
        DBG("PCI: Intel IOP3xx PCI init.\n");
        DBG("PCI: Outbound memory window 0: PCI 0x%08x%08x\n",
                *IOP3XX_OUMWTVR0, *IOP3XX_OMWTVR0);
@@ -358,6 +362,23 @@ void __init iop3xx_pci_preinit(void)
        hook_fault_code(16+6, iop3xx_pci_abort, SIGBUS, "imprecise external abort");
 }
 
+/* for platforms that might be host-bus-adapters */
+void __init iop3xx_pci_preinit_cond(void)
+{
+       if (iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE) {
+               iop3xx_atu_disable();
+               iop3xx_atu_setup();
+               iop3xx_atu_debug();
+       }
+}
+
+void __init iop3xx_pci_preinit(void)
+{
+       iop3xx_atu_disable();
+       iop3xx_atu_setup();
+       iop3xx_atu_debug();
+}
+
 /* allow init_atu to be user overridden */
 static int __init iop3xx_init_atu_setup(char *str)
 {
index ede377e..18f6937 100644 (file)
@@ -29,6 +29,7 @@ extern void gpio_line_config(int line, int direction);
 extern int  gpio_line_get(int line);
 extern void gpio_line_set(int line, int value);
 extern int init_atu;
+extern int iop3xx_get_init_atu(void);
 #endif
 
 
@@ -112,14 +113,6 @@ extern int init_atu;
 #define IOP3XX_INIT_ATU_DISABLE -1
 #define IOP3XX_INIT_ATU_ENABLE  1
 
-#ifdef CONFIG_IOP3XX_ATU
-#define iop3xx_get_init_atu(x) (init_atu == IOP3XX_INIT_ATU_DEFAULT ?\
-                               IOP3XX_INIT_ATU_ENABLE : init_atu)
-#else
-#define iop3xx_get_init_atu(x) (init_atu == IOP3XX_INIT_ATU_DEFAULT ?\
-                               IOP3XX_INIT_ATU_DISABLE : init_atu)
-#endif
-
 /* Messaging Unit  */
 #define IOP3XX_IMR0            (volatile u32 *)IOP3XX_REG_ADDR(0x0310)
 #define IOP3XX_IMR1            (volatile u32 *)IOP3XX_REG_ADDR(0x0314)
index 24621c4..9d4f6b5 100644 (file)
@@ -55,6 +55,7 @@ void pci_common_init(struct hw_pci *);
 extern int iop3xx_pci_setup(int nr, struct pci_sys_data *);
 extern struct pci_bus *iop3xx_pci_scan_bus(int nr, struct pci_sys_data *);
 extern void iop3xx_pci_preinit(void);
+extern void iop3xx_pci_preinit_cond(void);
 
 extern int dc21285_setup(int nr, struct pci_sys_data *);
 extern struct pci_bus *dc21285_scan_bus(int nr, struct pci_sys_data *);