a4b54430f121b49d573e9503e00ce25963fb47c2
[linux-2.6.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-2004 MontaVista Software, Inc.
7  *
8  * Author: Deepak Saxena <dsaxena@plexity.net>
9  */
10
11 #include <linux/init.h>
12 #include <linux/device.h>
13 #include <linux/serial.h>
14 #include <linux/tty.h>
15 #include <linux/serial_core.h>
16
17 #include <asm/types.h>
18 #include <asm/setup.h>
19 #include <asm/memory.h>
20 #include <asm/hardware.h>
21 #include <asm/irq.h>
22 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/flash.h>
25
26 #ifdef  __ARMEB__
27 #define REG_OFFSET      3
28 #else
29 #define REG_OFFSET      0
30 #endif
31
32 /*
33  * Only one serial port is connected on the Coyote & IXDPG425
34  */
35 static struct uart_port coyote_serial_port = {
36         .membase        = (char*)(IXP4XX_UART2_BASE_VIRT + REG_OFFSET),
37         .mapbase        = (IXP4XX_UART2_BASE_PHYS),
38         .irq            = IRQ_IXP4XX_UART2,
39         .flags          = UPF_SKIP_TEST,
40         .iotype         = UPIO_MEM,     
41         .regshift       = 2,
42         .uartclk        = IXP4XX_UART_XTAL,
43         .line           = 0,
44         .type           = PORT_XSCALE,
45         .fifosize       = 32
46 };
47
48 void __init coyote_map_io(void)
49 {
50         if (machine_is_ixdpg425()) {
51                 coyote_serial_port.membase =
52                         (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET);
53                 coyote_serial_port.mapbase = IXP4XX_UART1_BASE_PHYS;
54                 coyote_serial_port.irq = IRQ_IXP4XX_UART1;
55         }
56
57         early_serial_setup(&coyote_serial_port);
58
59         ixp4xx_map_io();
60 }
61
62 static struct flash_platform_data coyote_flash_data = {
63         .map_name       = "cfi_probe",
64         .width          = 2,
65 };
66
67 static struct resource coyote_flash_resource = {
68         .start          = COYOTE_FLASH_BASE,
69         .end            = COYOTE_FLASH_BASE + COYOTE_FLASH_SIZE,
70         .flags          = IORESOURCE_MEM,
71 };
72
73 static struct platform_device coyote_flash = {
74         .name           = "IXP4XX-Flash",
75         .id             = 0,
76         .dev            = {
77                 .platform_data = &coyote_flash_data,
78         },
79         .num_resources  = 1,
80         .resource       = &coyote_flash_resource,
81 };
82
83 static struct platform_device *coyote_devices[] __initdata = {
84         &coyote_flash
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         platform_add_devices(&coyote_devices, ARRAY_SIZE(coyote_devices));
93 }
94
95 #ifdef CONFIG_ARCH_ADI_COYOTE
96 MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote")
97         MAINTAINER("MontaVista Software, Inc.")
98         BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS,
99                 IXP4XX_PERIPHERAL_BASE_VIRT)
100         MAPIO(coyote_map_io)
101         INITIRQ(ixp4xx_init_irq)
102         .timer          = &ixp4xx_timer,
103         BOOT_PARAMS(0x0100)
104         INIT_MACHINE(coyote_init)
105 MACHINE_END
106 #endif
107
108 /*
109  * IXDPG425 is identical to Coyote except for which serial port
110  * is connected.
111  */
112 #ifdef CONFIG_MACH_IXDPG425
113 MACHINE_START(IXDPG425, "Intel IXDPG425")
114         MAINTAINER("MontaVista Software, Inc.")
115         BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS,
116                 IXP4XX_PERIPHERAL_BASE_VIRT)
117         MAPIO(coyote_map_io)
118         INITIRQ(ixp4xx_init_irq)
119         .timer          = &ixp4xx_timer,
120         BOOT_PARAMS(0x0100)
121         INIT_MACHINE(coyote_init)
122 MACHINE_END
123 #endif
124