c2ba759e994611116101bb6719ed84d6bc069227
[linux-3.10.git] / arch / arm / mach-ixp4xx / ixdp425-setup.c
1 /*
2  * arch/arm/mach-ixp4xx/ixdp425-setup.c
3  *
4  * IXDP425/IXCDP1100 board-setup 
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/mach-types.h>
23 #include <asm/irq.h>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/flash.h>
26
27 void __init ixdp425_map_io(void) 
28 {
29         ixp4xx_map_io();
30 }
31
32 static struct flash_platform_data ixdp425_flash_data = {
33         .map_name       = "cfi_probe",
34         .width          = 2,
35 };
36
37 static struct resource ixdp425_flash_resource = {
38         .start          = IXDP425_FLASH_BASE,
39         .end            = IXDP425_FLASH_BASE + IXDP425_FLASH_SIZE,
40         .flags          = IORESOURCE_MEM,
41 };
42
43 static struct platform_device ixdp425_flash = {
44         .name           = "IXP4XX-Flash",
45         .id             = 0,
46         .dev            = {
47                 .platform_data = &ixdp425_flash_data,
48         },
49         .num_resources  = 1,
50         .resource       = &ixdp425_flash_resource,
51 };
52
53 static struct ixp4xx_i2c_pins ixdp425_i2c_gpio_pins = {
54         .sda_pin        = IXDP425_SDA_PIN,
55         .scl_pin        = IXDP425_SCL_PIN,
56 };
57
58 static struct platform_device ixdp425_i2c_controller = {
59         .name           = "IXP4XX-I2C",
60         .id             = 0,
61         .dev            = {
62                 .platform_data = &ixdp425_i2c_gpio_pins,
63         },
64         .num_resources  = 0
65 };
66
67 static struct resource ixdp425_uart_resources[] = {
68         {
69                 .start          = IXP4XX_UART1_BASE_PHYS,
70                 .end            = IXP4XX_UART1_BASE_PHYS + 0x0fff,
71                 .flags          = IORESOURCE_MEM
72         },
73         {
74                 .start          = IXP4XX_UART2_BASE_PHYS,
75                 .end            = IXP4XX_UART2_BASE_PHYS + 0x0fff,
76                 .flags          = IORESOURCE_MEM
77         }
78 };
79
80 static struct plat_serial8250_port ixdp425_uart_data[] = {
81         {
82                 .mapbase        = IXP4XX_UART1_BASE_PHYS,
83                 .membase        = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
84                 .irq            = IRQ_IXP4XX_UART1,
85                 .flags          = UPF_BOOT_AUTOCONF,
86                 .iotype         = UPIO_MEM,
87                 .regshift       = 2,
88                 .uartclk        = IXP4XX_UART_XTAL,
89         },
90         {
91                 .mapbase        = IXP4XX_UART2_BASE_PHYS,
92                 .membase        = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
93                 .irq            = IRQ_IXP4XX_UART1,
94                 .flags          = UPF_BOOT_AUTOCONF,
95                 .iotype         = UPIO_MEM,
96                 .regshift       = 2,
97                 .uartclk        = IXP4XX_UART_XTAL,
98         },
99         { },
100 };
101
102 static struct platform_device ixdp425_uart = {
103         .name                   = "serial8250",
104         .id                     = 0,
105         .dev.platform_data      = ixdp425_uart_data,
106         .num_resources          = 2,
107         .resource               = ixdp425_uart_resources
108 };
109
110 static struct platform_device *ixdp425_devices[] __initdata = {
111         &ixdp425_i2c_controller,
112         &ixdp425_flash,
113         &ixdp425_uart
114 };
115
116
117 static void __init ixdp425_init(void)
118 {
119         ixp4xx_sys_init();
120
121         /*
122          * IXP465 has 32MB window
123          */
124         if (machine_is_ixdp465()) {
125                 ixdp425_flash_resource.end += IXDP425_FLASH_SIZE;
126         }
127
128         platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
129 }
130
131 MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")
132         /* Maintainer: MontaVista Software, Inc. */
133         .phys_ram       = PHYS_OFFSET,
134         .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
135         .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
136         .map_io         = ixdp425_map_io,
137         .init_irq       = ixp4xx_init_irq,
138         .timer          = &ixp4xx_timer,
139         .boot_params    = 0x0100,
140         .init_machine   = ixdp425_init,
141 MACHINE_END
142
143 MACHINE_START(IXDP465, "Intel IXDP465 Development Platform")
144         /* Maintainer: MontaVista Software, Inc. */
145         .phys_ram       = PHYS_OFFSET,
146         .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
147         .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
148         .map_io         = ixdp425_map_io,
149         .init_irq       = ixp4xx_init_irq,
150         .timer          = &ixp4xx_timer,
151         .boot_params    = 0x0100,
152         .init_machine   = ixdp425_init,
153 MACHINE_END
154
155 MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform")
156         /* Maintainer: MontaVista Software, Inc. */
157         .phys_ram       = PHYS_OFFSET,
158         .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
159         .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
160         .map_io         = ixdp425_map_io,
161         .init_irq       = ixp4xx_init_irq,
162         .timer          = &ixp4xx_timer,
163         .boot_params    = 0x0100,
164         .init_machine   = ixdp425_init,
165 MACHINE_END
166
167 /*
168  * Avila is functionally equivalent to IXDP425 except that it adds
169  * a CF IDE slot hanging off the expansion bus. When we have a 
170  * driver for IXP4xx CF IDE with driver model support we'll move
171  * Avila to it's own setup file.
172  */
173 #ifdef CONFIG_ARCH_AVILA
174 MACHINE_START(AVILA, "Gateworks Avila Network Platform")
175         /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
176         .phys_ram       = PHYS_OFFSET,
177         .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
178         .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
179         .map_io         = ixdp425_map_io,
180         .init_irq       = ixp4xx_init_irq,
181         .timer          = &ixp4xx_timer,
182         .boot_params    = 0x0100,
183         .init_machine   = ixdp425_init,
184 MACHINE_END
185 #endif
186