]> git.ipfire.org Git - thirdparty/kernel/linux.git/blame - arch/arm/mach-ixp4xx/omixp-setup.c
ARM: ixp4xx: include irqs.h where needed
[thirdparty/kernel/linux.git] / arch / arm / mach-ixp4xx / omixp-setup.c
CommitLineData
2b8f0119
RC
1/*
2 * arch/arm/mach-ixp4xx/omixp-setup.c
3 *
4 * omicron ixp4xx board setup
5 * Copyright (C) 2009 OMICRON electronics GmbH
6 *
7 * based nslu2-setup.c, ixdp425-setup.c:
8 * Copyright (C) 2003-2004 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/serial.h>
17#include <linux/serial_8250.h>
18#include <linux/mtd/mtd.h>
19#include <linux/mtd/partitions.h>
2b8f0119 20#include <linux/leds.h>
2b8f0119
RC
21
22#include <asm/setup.h>
23#include <asm/memory.h>
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26#include <asm/mach/flash.h>
27
39f1601c
AB
28#include <mach/hardware.h>
29
140d9009
AB
30#include "irqs.h"
31
2b8f0119
RC
32static struct resource omixp_flash_resources[] = {
33 {
34 .flags = IORESOURCE_MEM,
35 }, {
36 .flags = IORESOURCE_MEM,
37 },
38};
39
40static struct mtd_partition omixp_partitions[] = {
41 {
42 .name = "Recovery Bootloader",
43 .size = 0x00020000,
44 .offset = 0,
45 }, {
46 .name = "Calibration Data",
47 .size = 0x00020000,
48 .offset = 0x00020000,
49 }, {
50 .name = "Recovery FPGA",
51 .size = 0x00020000,
52 .offset = 0x00040000,
53 }, {
54 .name = "Release Bootloader",
55 .size = 0x00020000,
56 .offset = 0x00060000,
57 }, {
58 .name = "Release FPGA",
59 .size = 0x00020000,
60 .offset = 0x00080000,
61 }, {
62 .name = "Kernel",
63 .size = 0x00160000,
64 .offset = 0x000a0000,
65 }, {
66 .name = "Filesystem",
67 .size = 0x00C00000,
68 .offset = 0x00200000,
69 }, {
70 .name = "Persistent Storage",
71 .size = 0x00200000,
72 .offset = 0x00E00000,
73 },
74};
75
76static struct flash_platform_data omixp_flash_data[] = {
77 {
78 .map_name = "cfi_probe",
79 .parts = omixp_partitions,
80 .nr_parts = ARRAY_SIZE(omixp_partitions),
81 }, {
82 .map_name = "cfi_probe",
83 .parts = NULL,
84 .nr_parts = 0,
85 },
86};
87
88static struct platform_device omixp_flash_device[] = {
89 {
90 .name = "IXP4XX-Flash",
91 .id = 0,
92 .dev = {
93 .platform_data = &omixp_flash_data[0],
94 },
95 .resource = &omixp_flash_resources[0],
96 .num_resources = 1,
97 }, {
98 .name = "IXP4XX-Flash",
99 .id = 1,
100 .dev = {
101 .platform_data = &omixp_flash_data[1],
102 },
103 .resource = &omixp_flash_resources[1],
104 .num_resources = 1,
105 },
106};
107
108/* Swap UART's - These boards have the console on UART2. The following
109 * configuration is used:
110 * ttyS0 .. UART2
111 * ttyS1 .. UART1
112 * This way standard images can be used with the kernel that expect
113 * the console on ttyS0.
114 */
115static struct resource omixp_uart_resources[] = {
116 {
117 .start = IXP4XX_UART2_BASE_PHYS,
118 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
119 .flags = IORESOURCE_MEM,
120 }, {
121 .start = IXP4XX_UART1_BASE_PHYS,
122 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
123 .flags = IORESOURCE_MEM,
124 },
125};
126
127static struct plat_serial8250_port omixp_uart_data[] = {
128 {
129 .mapbase = IXP4XX_UART2_BASE_PHYS,
130 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
131 .irq = IRQ_IXP4XX_UART2,
132 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
133 .iotype = UPIO_MEM,
134 .regshift = 2,
135 .uartclk = IXP4XX_UART_XTAL,
136 }, {
137 .mapbase = IXP4XX_UART1_BASE_PHYS,
138 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
139 .irq = IRQ_IXP4XX_UART1,
140 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
141 .iotype = UPIO_MEM,
142 .regshift = 2,
143 .uartclk = IXP4XX_UART_XTAL,
144 }, {
145 /* list termination */
146 }
147};
148
149static struct platform_device omixp_uart = {
150 .name = "serial8250",
151 .id = PLAT8250_DEV_PLATFORM,
152 .dev.platform_data = omixp_uart_data,
153 .num_resources = 2,
154 .resource = omixp_uart_resources,
155};
156
157static struct gpio_led mic256_led_pins[] = {
158 {
159 .name = "LED-A",
160 .gpio = 7,
161 },
162};
163
164static struct gpio_led_platform_data mic256_led_data = {
165 .num_leds = ARRAY_SIZE(mic256_led_pins),
166 .leds = mic256_led_pins,
167};
168
169static struct platform_device mic256_leds = {
170 .name = "leds-gpio",
171 .id = -1,
172 .dev.platform_data = &mic256_led_data,
173};
174
175/* Built-in 10/100 Ethernet MAC interfaces */
176static struct eth_plat_info ixdp425_plat_eth[] = {
177 {
178 .phy = 0,
179 .rxq = 3,
180 .txreadyq = 20,
181 }, {
182 .phy = 1,
183 .rxq = 4,
184 .txreadyq = 21,
185 },
186};
187
188static struct platform_device ixdp425_eth[] = {
189 {
190 .name = "ixp4xx_eth",
191 .id = IXP4XX_ETH_NPEB,
192 .dev.platform_data = ixdp425_plat_eth,
193 }, {
194 .name = "ixp4xx_eth",
195 .id = IXP4XX_ETH_NPEC,
196 .dev.platform_data = ixdp425_plat_eth + 1,
197 },
198};
199
200
201static struct platform_device *devixp_pldev[] __initdata = {
202 &omixp_uart,
203 &omixp_flash_device[0],
204 &ixdp425_eth[0],
205 &ixdp425_eth[1],
206};
207
208static struct platform_device *mic256_pldev[] __initdata = {
209 &omixp_uart,
210 &omixp_flash_device[0],
211 &mic256_leds,
212 &ixdp425_eth[0],
213 &ixdp425_eth[1],
214};
215
216static struct platform_device *miccpt_pldev[] __initdata = {
217 &omixp_uart,
218 &omixp_flash_device[0],
219 &omixp_flash_device[1],
220 &ixdp425_eth[0],
221 &ixdp425_eth[1],
222};
223
224static void __init omixp_init(void)
225{
226 ixp4xx_sys_init();
227
228 /* 16MiB Boot Flash */
229 omixp_flash_resources[0].start = IXP4XX_EXP_BUS_BASE(0);
230 omixp_flash_resources[0].end = IXP4XX_EXP_BUS_END(0);
231
232 /* 32 MiB Data Flash */
233 omixp_flash_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
234 omixp_flash_resources[1].end = IXP4XX_EXP_BUS_END(2);
235
236 if (machine_is_devixp())
237 platform_add_devices(devixp_pldev, ARRAY_SIZE(devixp_pldev));
238 else if (machine_is_miccpt())
239 platform_add_devices(miccpt_pldev, ARRAY_SIZE(miccpt_pldev));
240 else if (machine_is_mic256())
241 platform_add_devices(mic256_pldev, ARRAY_SIZE(mic256_pldev));
242}
243
244#ifdef CONFIG_MACH_DEVIXP
245MACHINE_START(DEVIXP, "Omicron DEVIXP")
a7fadac1 246 .atag_offset = 0x100,
2b8f0119 247 .map_io = ixp4xx_map_io,
f449588c 248 .init_early = ixp4xx_init_early,
2b8f0119 249 .init_irq = ixp4xx_init_irq,
6bb27d73 250 .init_time = ixp4xx_timer_init,
2b8f0119 251 .init_machine = omixp_init,
d1b860fb 252 .restart = ixp4xx_restart,
2b8f0119
RC
253MACHINE_END
254#endif
255
256#ifdef CONFIG_MACH_MICCPT
257MACHINE_START(MICCPT, "Omicron MICCPT")
a7fadac1 258 .atag_offset = 0x100,
2b8f0119 259 .map_io = ixp4xx_map_io,
f449588c 260 .init_early = ixp4xx_init_early,
2b8f0119 261 .init_irq = ixp4xx_init_irq,
6bb27d73 262 .init_time = ixp4xx_timer_init,
2b8f0119
RC
263 .init_machine = omixp_init,
264#if defined(CONFIG_PCI)
265 .dma_zone_size = SZ_64M,
266#endif
d1b860fb 267 .restart = ixp4xx_restart,
2b8f0119
RC
268MACHINE_END
269#endif
270
271#ifdef CONFIG_MACH_MIC256
272MACHINE_START(MIC256, "Omicron MIC256")
a7fadac1 273 .atag_offset = 0x100,
2b8f0119 274 .map_io = ixp4xx_map_io,
f449588c 275 .init_early = ixp4xx_init_early,
2b8f0119 276 .init_irq = ixp4xx_init_irq,
6bb27d73 277 .init_time = ixp4xx_timer_init,
2b8f0119 278 .init_machine = omixp_init,
d1b860fb 279 .restart = ixp4xx_restart,
2b8f0119
RC
280MACHINE_END
281#endif