Linux-2.6.12-rc2
[pandora-kernel.git] / 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         .mapbase        = IXP4XX_UART2_BASE_PHYS,
61         .membase        = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
62         .irq            = IRQ_IXP4XX_UART2,
63         .flags          = UPF_BOOT_AUTOCONF,
64         .iotype         = UPIO_MEM,
65         .regshift       = 2,
66         .uartclk        = IXP4XX_UART_XTAL,
67 };
68
69 static struct platform_device coyote_uart = {
70         .name           = "serial8250",
71         .id             = 0,
72         .dev                    = {
73                 .platform_data  = &coyote_uart_data,
74         },
75         .num_resources  = 1,
76         .resource       = &coyote_uart_resource,
77 };
78
79 static struct platform_device *coyote_devices[] __initdata = {
80         &coyote_flash,
81         &coyote_uart
82 };
83
84 static void __init coyote_init(void)
85 {
86         *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
87         *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
88
89         if (machine_is_ixdpg425()) {
90                 coyote_uart_data.membase =
91                         (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET);
92                 coyote_uart_data.mapbase = IXP4XX_UART1_BASE_PHYS;
93                 coyote_uart_data.irq = IRQ_IXP4XX_UART1;
94         }
95
96
97         ixp4xx_sys_init();
98         platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices));
99 }
100
101 #ifdef CONFIG_ARCH_ADI_COYOTE
102 MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote")
103         MAINTAINER("MontaVista Software, Inc.")
104         BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS,
105                 IXP4XX_PERIPHERAL_BASE_VIRT)
106         MAPIO(coyote_map_io)
107         INITIRQ(ixp4xx_init_irq)
108         .timer          = &ixp4xx_timer,
109         BOOT_PARAMS(0x0100)
110         INIT_MACHINE(coyote_init)
111 MACHINE_END
112 #endif
113
114 /*
115  * IXDPG425 is identical to Coyote except for which serial port
116  * is connected.
117  */
118 #ifdef CONFIG_MACH_IXDPG425
119 MACHINE_START(IXDPG425, "Intel IXDPG425")
120         MAINTAINER("MontaVista Software, Inc.")
121         BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS,
122                 IXP4XX_PERIPHERAL_BASE_VIRT)
123         MAPIO(coyote_map_io)
124         INITIRQ(ixp4xx_init_irq)
125         .timer          = &ixp4xx_timer,
126         BOOT_PARAMS(0x0100)
127         INIT_MACHINE(coyote_init)
128 MACHINE_END
129 #endif
130