Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / arm / mach-ixp4xx / coyote-setup.c
index 1d06d36..13f8a7a 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Board setup for ADI Engineering and IXDGP425 boards
  *
- * Copyright (C) 2003-2004 MontaVista Software, Inc.
+ * Copyright (C) 2003-2005 MontaVista Software, Inc.
  *
  * Author: Deepak Saxena <dsaxena@plexity.net>
  */
@@ -13,7 +13,8 @@
 #include <linux/device.h>
 #include <linux/serial.h>
 #include <linux/tty.h>
-#include <linux/serial_core.h>
+#include <linux/serial_8250.h>
+#include <linux/slab.h>
 
 #include <asm/types.h>
 #include <asm/setup.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
-#ifdef __ARMEB__
-#define        REG_OFFSET      3
-#else
-#define        REG_OFFSET      0
-#endif
-
-/*
- * Only one serial port is connected on the Coyote & IXDPG425
- */
-static struct uart_port coyote_serial_port = {
-       .membase        = (char*)(IXP4XX_UART2_BASE_VIRT + REG_OFFSET),
-       .mapbase        = (IXP4XX_UART2_BASE_PHYS),
-       .irq            = IRQ_IXP4XX_UART2,
-       .flags          = UPF_SKIP_TEST,
-       .iotype         = UPIO_MEM,     
-       .regshift       = 2,
-       .uartclk        = IXP4XX_UART_XTAL,
-       .line           = 0,
-       .type           = PORT_XSCALE,
-       .fifosize       = 32
-};
-
-void __init coyote_map_io(void)
-{
-       if (machine_is_ixdpg425()) {
-               coyote_serial_port.membase =
-                       (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET);
-               coyote_serial_port.mapbase = IXP4XX_UART1_BASE_PHYS;
-               coyote_serial_port.irq = IRQ_IXP4XX_UART1;
-       }
-
-       early_serial_setup(&coyote_serial_port);
-
-       ixp4xx_map_io();
-}
-
 static struct flash_platform_data coyote_flash_data = {
        .map_name       = "cfi_probe",
        .width          = 2,
 };
 
 static struct resource coyote_flash_resource = {
-       .start          = COYOTE_FLASH_BASE,
-       .end            = COYOTE_FLASH_BASE + COYOTE_FLASH_SIZE,
        .flags          = IORESOURCE_MEM,
 };
 
@@ -81,29 +44,70 @@ static struct platform_device coyote_flash = {
        .resource       = &coyote_flash_resource,
 };
 
+static struct resource coyote_uart_resource = {
+       .start  = IXP4XX_UART2_BASE_PHYS,
+       .end    = IXP4XX_UART2_BASE_PHYS + 0x0fff,
+       .flags  = IORESOURCE_MEM,
+};
+
+static struct plat_serial8250_port coyote_uart_data[] = {
+       {
+               .mapbase        = IXP4XX_UART2_BASE_PHYS,
+               .membase        = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+               .irq            = IRQ_IXP4XX_UART2,
+               .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+               .iotype         = UPIO_MEM,
+               .regshift       = 2,
+               .uartclk        = IXP4XX_UART_XTAL,
+       },
+       { },
+};
+
+static struct platform_device coyote_uart = {
+       .name           = "serial8250",
+       .id             = PLAT8250_DEV_PLATFORM,
+       .dev                    = {
+               .platform_data  = coyote_uart_data,
+       },
+       .num_resources  = 1,
+       .resource       = &coyote_uart_resource,
+};
+
 static struct platform_device *coyote_devices[] __initdata = {
-       &coyote_flash
+       &coyote_flash,
+       &coyote_uart
 };
 
 static void __init coyote_init(void)
 {
+       ixp4xx_sys_init();
+
+       coyote_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
+       coyote_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
+
        *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
        *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
 
-       ixp4xx_sys_init();
+       if (machine_is_ixdpg425()) {
+               coyote_uart_data[0].membase =
+                       (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET);
+               coyote_uart_data[0].mapbase = IXP4XX_UART1_BASE_PHYS;
+               coyote_uart_data[0].irq = IRQ_IXP4XX_UART1;
+       }
+
        platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices));
 }
 
 #ifdef CONFIG_ARCH_ADI_COYOTE
 MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote")
-        MAINTAINER("MontaVista Software, Inc.")
-        BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS,
-                IXP4XX_PERIPHERAL_BASE_VIRT)
-        MAPIO(coyote_map_io)
-        INITIRQ(ixp4xx_init_irq)
+       /* Maintainer: MontaVista Software, Inc. */
+       .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
+       .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
+       .map_io         = ixp4xx_map_io,
+       .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
-        BOOT_PARAMS(0x0100)
-       INIT_MACHINE(coyote_init)
+       .boot_params    = 0x0100,
+       .init_machine   = coyote_init,
 MACHINE_END
 #endif
 
@@ -113,14 +117,14 @@ MACHINE_END
  */
 #ifdef CONFIG_MACH_IXDPG425
 MACHINE_START(IXDPG425, "Intel IXDPG425")
-        MAINTAINER("MontaVista Software, Inc.")
-        BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS,
-                IXP4XX_PERIPHERAL_BASE_VIRT)
-        MAPIO(coyote_map_io)
-        INITIRQ(ixp4xx_init_irq)
+       /* Maintainer: MontaVista Software, Inc. */
+       .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
+       .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
+       .map_io         = ixp4xx_map_io,
+       .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
-        BOOT_PARAMS(0x0100)
-       INIT_MACHINE(coyote_init)
+       .boot_params    = 0x0100,
+       .init_machine   = coyote_init,
 MACHINE_END
 #endif