Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux/fpc-iii.git] / arch / arm / mach-ixp4xx / omixp-setup.c
blob75ef03dc996490893c70c23ceea874b42747a679
1 /*
2 * arch/arm/mach-ixp4xx/omixp-setup.c
4 * omicron ixp4xx board setup
5 * Copyright (C) 2009 OMICRON electronics GmbH
7 * based nslu2-setup.c, ixdp425-setup.c:
8 * Copyright (C) 2003-2004 MontaVista Software, Inc.
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.
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>
20 #ifdef CONFIG_LEDS_CLASS
21 #include <linux/leds.h>
22 #endif
24 #include <asm/setup.h>
25 #include <asm/memory.h>
26 #include <asm/mach-types.h>
27 #include <asm/mach/arch.h>
28 #include <asm/mach/flash.h>
30 #include <mach/hardware.h>
32 static struct resource omixp_flash_resources[] = {
34 .flags = IORESOURCE_MEM,
35 }, {
36 .flags = IORESOURCE_MEM,
40 static struct mtd_partition omixp_partitions[] = {
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,
76 static struct flash_platform_data omixp_flash_data[] = {
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,
88 static struct platform_device omixp_flash_device[] = {
90 .name = "IXP4XX-Flash",
91 .id = 0,
92 .dev = {
93 .platform_data = &omixp_flash_data[0],
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],
103 .resource = &omixp_flash_resources[1],
104 .num_resources = 1,
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.
115 static struct resource omixp_uart_resources[] = {
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,
127 static struct plat_serial8250_port omixp_uart_data[] = {
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 */
149 static 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,
157 static struct gpio_led mic256_led_pins[] = {
159 .name = "LED-A",
160 .gpio = 7,
164 static struct gpio_led_platform_data mic256_led_data = {
165 .num_leds = ARRAY_SIZE(mic256_led_pins),
166 .leds = mic256_led_pins,
169 static struct platform_device mic256_leds = {
170 .name = "leds-gpio",
171 .id = -1,
172 .dev.platform_data = &mic256_led_data,
175 /* Built-in 10/100 Ethernet MAC interfaces */
176 static struct eth_plat_info ixdp425_plat_eth[] = {
178 .phy = 0,
179 .rxq = 3,
180 .txreadyq = 20,
181 }, {
182 .phy = 1,
183 .rxq = 4,
184 .txreadyq = 21,
188 static struct platform_device ixdp425_eth[] = {
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,
201 static struct platform_device *devixp_pldev[] __initdata = {
202 &omixp_uart,
203 &omixp_flash_device[0],
204 &ixdp425_eth[0],
205 &ixdp425_eth[1],
208 static 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],
216 static 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],
224 static void __init omixp_init(void)
226 ixp4xx_sys_init();
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);
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);
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));
244 #ifdef CONFIG_MACH_DEVIXP
245 MACHINE_START(DEVIXP, "Omicron DEVIXP")
246 .atag_offset = 0x100,
247 .map_io = ixp4xx_map_io,
248 .init_early = ixp4xx_init_early,
249 .init_irq = ixp4xx_init_irq,
250 .init_time = ixp4xx_timer_init,
251 .init_machine = omixp_init,
252 .restart = ixp4xx_restart,
253 MACHINE_END
254 #endif
256 #ifdef CONFIG_MACH_MICCPT
257 MACHINE_START(MICCPT, "Omicron MICCPT")
258 .atag_offset = 0x100,
259 .map_io = ixp4xx_map_io,
260 .init_early = ixp4xx_init_early,
261 .init_irq = ixp4xx_init_irq,
262 .init_time = ixp4xx_timer_init,
263 .init_machine = omixp_init,
264 #if defined(CONFIG_PCI)
265 .dma_zone_size = SZ_64M,
266 #endif
267 .restart = ixp4xx_restart,
268 MACHINE_END
269 #endif
271 #ifdef CONFIG_MACH_MIC256
272 MACHINE_START(MIC256, "Omicron MIC256")
273 .atag_offset = 0x100,
274 .map_io = ixp4xx_map_io,
275 .init_early = ixp4xx_init_early,
276 .init_irq = ixp4xx_init_irq,
277 .init_time = ixp4xx_timer_init,
278 .init_machine = omixp_init,
279 .restart = ixp4xx_restart,
280 MACHINE_END
281 #endif