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-iop3xx / iop331-setup.c
index 622e791..7b7b6ee 100644 (file)
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/config.h>
-#include <linux/init.h>
 #include <linux/major.h>
 #include <linux/fs.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/serial.h>
 #include <linux/tty.h>
-#include <linux/serial_core.h>
+#include <linux/serial_8250.h>
 
 #include <asm/io.h>
 #include <asm/pgtable.h>
  * Standard IO mapping for all IOP331 based systems
  */
 static struct map_desc iop331_std_desc[] __initdata = {
- /* virtual     physical      length      type */
+       {       /* mem mapped registers */
+               .virtual        = IOP331_VIRT_MEM_BASE,
+               .pfn            = __phys_to_pfn(IOP331_PHYS_MEM_BASE),
+               .length         = 0x00002000,
+               .type           = MT_DEVICE
+       }, {    /* PCI IO space */
+               .virtual        = IOP331_PCI_LOWER_IO_VA,
+               .pfn            = __phys_to_pfn(IOP331_PCI_LOWER_IO_PA),
+               .length         = IOP331_PCI_IO_WINDOW_SIZE,
+               .type           = MT_DEVICE
+       }
+};
 
- /* mem mapped registers */
- { IOP331_VIRT_MEM_BASE,  IOP331_PHYS_MEM_BASE,   0x00002000,  MT_DEVICE },
+static struct resource iop33x_uart0_resources[] = {
+       [0] = {
+               .start = IOP331_UART0_PHYS,
+               .end = IOP331_UART0_PHYS + 0x3f,
+               .flags = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start = IRQ_IOP331_UART0,
+               .end = IRQ_IOP331_UART0,
+               .flags = IORESOURCE_IRQ
+       }
+};
+
+static struct resource iop33x_uart1_resources[] = {
+       [0] = {
+               .start = IOP331_UART1_PHYS,
+               .end = IOP331_UART1_PHYS + 0x3f,
+               .flags = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start = IRQ_IOP331_UART1,
+               .end = IRQ_IOP331_UART1,
+               .flags = IORESOURCE_IRQ
+       }
+};
 
- /* PCI IO space */
- { IOP331_PCI_LOWER_IO_VA,  IOP331_PCI_LOWER_IO_PA,   IOP331_PCI_IO_WINDOW_SIZE,  MT_DEVICE }
+static struct plat_serial8250_port iop33x_uart0_data[] = {
+       {
+       .membase     = (char*)(IOP331_UART0_VIRT),
+       .mapbase     = (IOP331_UART0_PHYS),
+       .irq         = IRQ_IOP331_UART0,
+       .uartclk     = IOP331_UART_XTAL,
+       .regshift    = 2,
+       .iotype      = UPIO_MEM,
+       .flags       = UPF_SKIP_TEST,
+       },
+       {  },
 };
 
-static struct uart_port iop331_serial_ports[] = {
+static struct plat_serial8250_port iop33x_uart1_data[] = {
        {
-               .membase        = (char*)(IOP331_UART0_VIRT),
-               .mapbase        = (IOP331_UART0_PHYS),
-               .irq            = IRQ_IOP331_UART0,
-               .flags          = UPF_SKIP_TEST,
-               .iotype         = UPIO_MEM,
-               .regshift       = 2,
-               .uartclk        = IOP331_UART_XTAL,
-               .line           = 0,
-               .type           = PORT_XSCALE,
-               .fifosize       = 32
-       } , {
-               .membase        = (char*)(IOP331_UART1_VIRT),
-               .mapbase        = (IOP331_UART1_PHYS),
-               .irq            = IRQ_IOP331_UART1,
-               .flags          = UPF_SKIP_TEST,
-               .iotype         = UPIO_MEM,
-               .regshift       = 2,
-               .uartclk        = IOP331_UART_XTAL,
-               .line           = 1,
-               .type           = PORT_XSCALE,
-               .fifosize       = 32
-       }
+       .membase     = (char*)(IOP331_UART1_VIRT),
+       .mapbase     = (IOP331_UART1_PHYS),
+       .irq         = IRQ_IOP331_UART1,
+       .uartclk     = IOP331_UART_XTAL,
+       .regshift    = 2,
+       .iotype      = UPIO_MEM,
+       .flags       = UPF_SKIP_TEST,
+       },
+       {  },
+};
+
+static struct platform_device iop33x_uart0 = {
+       .name = "serial8250",
+       .id = PLAT8250_DEV_PLATFORM,
+       .dev.platform_data = iop33x_uart0_data,
+       .num_resources = 2,
+       .resource = iop33x_uart0_resources,
+};
+
+static struct platform_device iop33x_uart1 = {
+       .name = "serial8250",
+       .id = PLAT8250_DEV_PLATFORM1,
+       .dev.platform_data = iop33x_uart1_data,
+       .num_resources = 2,
+       .resource = iop33x_uart1_resources,
 };
 
 static struct resource iop33x_i2c_0_resources[] = {
@@ -113,6 +158,8 @@ static struct platform_device iop33x_i2c_1_controller = {
 };
 
 static struct platform_device *iop33x_devices[] __initdata = {
+       &iop33x_uart0,
+       &iop33x_uart1,
        &iop33x_i2c_0_controller,
        &iop33x_i2c_1_controller
 };
@@ -129,8 +176,6 @@ void __init iop33x_init(void)
 void __init iop331_map_io(void)
 {
        iotable_init(iop331_std_desc, ARRAY_SIZE(iop331_std_desc));
-       early_serial_setup(&iop331_serial_ports[0]);
-       early_serial_setup(&iop331_serial_ports[1]);
 }
 
 #ifdef CONFIG_ARCH_IOP331
@@ -148,26 +193,26 @@ extern void iq80332_map_io(void);
 
 #if defined(CONFIG_ARCH_IQ80331)
 MACHINE_START(IQ80331, "Intel IQ80331")
-    MAINTAINER("Intel Corp.")
-    BOOT_MEM(PHYS_OFFSET, 0xfefff000, 0xfffff000) // virtual, physical
-    //BOOT_MEM(PHYS_OFFSET, IOP331_UART0_VIRT, IOP331_UART0_PHYS)
-    MAPIO(iq80331_map_io)
-    INITIRQ(iop331_init_irq)
+       /* Maintainer: Intel Corp. */
+       .phys_io        = 0xfefff000,
+       .io_pg_offst    = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
+       .map_io         = iq80331_map_io,
+       .init_irq       = iop331_init_irq,
        .timer          = &iop331_timer,
-    BOOT_PARAMS(0x0100)
-       INIT_MACHINE(iop33x_init)
+       .boot_params    = 0x0100,
+       .init_machine   = iop33x_init,
 MACHINE_END
 
 #elif defined(CONFIG_MACH_IQ80332)
 MACHINE_START(IQ80332, "Intel IQ80332")
-    MAINTAINER("Intel Corp.")
-    BOOT_MEM(PHYS_OFFSET, 0xfefff000, 0xfffff000) // virtual, physical
-    //BOOT_MEM(PHYS_OFFSET, IOP331_UART0_VIRT, IOP331_UART0_PHYS)
-    MAPIO(iq80332_map_io)
-    INITIRQ(iop331_init_irq)
+       /* Maintainer: Intel Corp. */
+       .phys_io        = 0xfefff000,
+       .io_pg_offst    = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
+       .map_io         = iq80332_map_io,
+       .init_irq       = iop331_init_irq,
        .timer          = &iop331_timer,
-    BOOT_PARAMS(0x0100)
-       INIT_MACHINE(iop33x_init)
+       .boot_params    = 0x0100,
+       .init_machine   = iop33x_init,
 MACHINE_END
 
 #else