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