Merge /spare/repo/linux-2.6/
[linux-2.6] / arch / arm / mach-ixp4xx / coyote-setup.c
1 /*
2  * arch/arm/mach-ixp4xx/coyote-setup.c
3  *
4  * Board setup for ADI Engineering and IXDGP425 boards
5  *
6  * Copyright (C) 2003-2005 MontaVista Software, Inc.
7  *
8  * Author: Deepak Saxena <dsaxena@plexity.net>
9  */
10
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/device.h>
14 #include <linux/serial.h>
15 #include <linux/tty.h>
16 #include <linux/serial_8250.h>
17
18 #include <asm/types.h>
19 #include <asm/setup.h>
20 #include <asm/memory.h>
21 #include <asm/hardware.h>
22 #include <asm/irq.h>
23 #include <asm/mach-types.h>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/flash.h>
26
27 void __init coyote_map_io(void)
28 {
29         ixp4xx_map_io();
30 }
31
32 static struct flash_platform_data coyote_flash_data = {
33         .map_name       = "cfi_probe",
34         .width          = 2,
35 };
36
37 static struct resource coyote_flash_resource = {
38         .start          = COYOTE_FLASH_BASE,
39         .end            = COYOTE_FLASH_BASE + COYOTE_FLASH_SIZE,
40         .flags          = IORESOURCE_MEM,
41 };
42
43 static struct platform_device coyote_flash = {
44         .name           = "IXP4XX-Flash",
45         .id             = 0,
46         .dev            = {
47                 .platform_data = &coyote_flash_data,
48         },
49         .num_resources  = 1,
50         .resource       = &coyote_flash_resource,
51 };
52
53 static struct resource coyote_uart_resource = {
54         .start  = IXP4XX_UART2_BASE_PHYS,
55         .end    = IXP4XX_UART2_BASE_PHYS + 0x0fff,
56         .flags  = IORESOURCE_MEM,
57 };
58
59 static struct plat_serial8250_port coyote_uart_data[] = {
60         {
61                 .mapbase        = IXP4XX_UART2_BASE_PHYS,
62                 .membase        = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
63                 .irq            = IRQ_IXP4XX_UART2,
64                 .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
65                 .iotype         = UPIO_MEM,
66                 .regshift       = 2,
67                 .uartclk        = IXP4XX_UART_XTAL,
68         },
69         { },
70 };
71
72 static struct platform_device coyote_uart = {
73         .name           = "serial8250",
74         .id             = 0,
75         .dev                    = {
76                 .platform_data  = coyote_uart_data,
77         },
78         .num_resources  = 1,
79         .resource       = &coyote_uart_resource,
80 };
81
82 static struct platform_device *coyote_devices[] __initdata = {
83         &coyote_flash,
84         &coyote_uart
85 };
86
87 static void __init coyote_init(void)
88 {
89         *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
90         *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
91
92         if (machine_is_ixdpg425()) {
93                 coyote_uart_data[0].membase =
94                         (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET);
95                 coyote_uart_data[0].mapbase = IXP4XX_UART1_BASE_PHYS;
96                 coyote_uart_data[0].irq = IRQ_IXP4XX_UART1;
97         }
98
99
100         ixp4xx_sys_init();
101         platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices));
102 }
103
104 #ifdef CONFIG_ARCH_ADI_COYOTE
105 MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote")
106         /* Maintainer: MontaVista Software, Inc. */
107         .phys_ram       = PHYS_OFFSET,
108         .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
109         .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
110         .map_io         = coyote_map_io,
111         .init_irq       = ixp4xx_init_irq,
112         .timer          = &ixp4xx_timer,
113         .boot_params    = 0x0100,
114         .init_machine   = coyote_init,
115 MACHINE_END
116 #endif
117
118 /*
119  * IXDPG425 is identical to Coyote except for which serial port
120  * is connected.
121  */
122 #ifdef CONFIG_MACH_IXDPG425
123 MACHINE_START(IXDPG425, "Intel IXDPG425")
124         /* Maintainer: MontaVista Software, Inc. */
125         .phys_ram       = PHYS_OFFSET,
126         .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
127         .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
128         .map_io         = coyote_map_io,
129         .init_irq       = ixp4xx_init_irq,
130         .timer          = &ixp4xx_timer,
131         .boot_params    = 0x0100,
132         .init_machine   = coyote_init,
133 MACHINE_END
134 #endif
135