1 // SPDX-License-Identifier: GPL-2.0-only
3 * arch/arm/mach-ixp4xx/omixp-setup.c
5 * omicron ixp4xx board setup
6 * Copyright (C) 2009 OMICRON electronics GmbH
8 * based nslu2-setup.c, ixdp425-setup.c:
9 * Copyright (C) 2003-2004 MontaVista Software, Inc.
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>
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>
25 #include <mach/hardware.h>
29 static struct resource omixp_flash_resources
[] = {
31 .flags
= IORESOURCE_MEM
,
33 .flags
= IORESOURCE_MEM
,
37 static struct mtd_partition omixp_partitions
[] = {
39 .name
= "Recovery Bootloader",
43 .name
= "Calibration Data",
47 .name
= "Recovery FPGA",
51 .name
= "Release Bootloader",
55 .name
= "Release FPGA",
67 .name
= "Persistent Storage",
73 static struct flash_platform_data omixp_flash_data
[] = {
75 .map_name
= "cfi_probe",
76 .parts
= omixp_partitions
,
77 .nr_parts
= ARRAY_SIZE(omixp_partitions
),
79 .map_name
= "cfi_probe",
85 static struct platform_device omixp_flash_device
[] = {
87 .name
= "IXP4XX-Flash",
90 .platform_data
= &omixp_flash_data
[0],
92 .resource
= &omixp_flash_resources
[0],
95 .name
= "IXP4XX-Flash",
98 .platform_data
= &omixp_flash_data
[1],
100 .resource
= &omixp_flash_resources
[1],
105 /* Swap UART's - These boards have the console on UART2. The following
106 * configuration is used:
109 * This way standard images can be used with the kernel that expect
110 * the console on ttyS0.
112 static struct resource omixp_uart_resources
[] = {
114 .start
= IXP4XX_UART2_BASE_PHYS
,
115 .end
= IXP4XX_UART2_BASE_PHYS
+ 0x0fff,
116 .flags
= IORESOURCE_MEM
,
118 .start
= IXP4XX_UART1_BASE_PHYS
,
119 .end
= IXP4XX_UART1_BASE_PHYS
+ 0x0fff,
120 .flags
= IORESOURCE_MEM
,
124 static struct plat_serial8250_port omixp_uart_data
[] = {
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
,
132 .uartclk
= IXP4XX_UART_XTAL
,
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
,
140 .uartclk
= IXP4XX_UART_XTAL
,
142 /* list termination */
146 static struct platform_device omixp_uart
= {
147 .name
= "serial8250",
148 .id
= PLAT8250_DEV_PLATFORM
,
149 .dev
.platform_data
= omixp_uart_data
,
151 .resource
= omixp_uart_resources
,
154 static struct gpio_led mic256_led_pins
[] = {
161 static struct gpio_led_platform_data mic256_led_data
= {
162 .num_leds
= ARRAY_SIZE(mic256_led_pins
),
163 .leds
= mic256_led_pins
,
166 static struct platform_device mic256_leds
= {
169 .dev
.platform_data
= &mic256_led_data
,
172 /* Built-in 10/100 Ethernet MAC interfaces */
173 static struct resource ixp425_npeb_resources
[] = {
175 .start
= IXP4XX_EthB_BASE_PHYS
,
176 .end
= IXP4XX_EthB_BASE_PHYS
+ 0x0fff,
177 .flags
= IORESOURCE_MEM
,
181 static struct resource ixp425_npec_resources
[] = {
183 .start
= IXP4XX_EthC_BASE_PHYS
,
184 .end
= IXP4XX_EthC_BASE_PHYS
+ 0x0fff,
185 .flags
= IORESOURCE_MEM
,
189 static struct eth_plat_info ixdp425_plat_eth
[] = {
201 static struct platform_device ixdp425_eth
[] = {
203 .name
= "ixp4xx_eth",
204 .id
= IXP4XX_ETH_NPEB
,
205 .dev
.platform_data
= ixdp425_plat_eth
,
206 .num_resources
= ARRAY_SIZE(ixp425_npeb_resources
),
207 .resource
= ixp425_npeb_resources
,
209 .name
= "ixp4xx_eth",
210 .id
= IXP4XX_ETH_NPEC
,
211 .dev
.platform_data
= ixdp425_plat_eth
+ 1,
212 .num_resources
= ARRAY_SIZE(ixp425_npec_resources
),
213 .resource
= ixp425_npec_resources
,
218 static struct platform_device
*devixp_pldev
[] __initdata
= {
220 &omixp_flash_device
[0],
225 static struct platform_device
*mic256_pldev
[] __initdata
= {
227 &omixp_flash_device
[0],
233 static struct platform_device
*miccpt_pldev
[] __initdata
= {
235 &omixp_flash_device
[0],
236 &omixp_flash_device
[1],
241 static void __init
omixp_init(void)
245 /* 16MiB Boot Flash */
246 omixp_flash_resources
[0].start
= IXP4XX_EXP_BUS_BASE(0);
247 omixp_flash_resources
[0].end
= IXP4XX_EXP_BUS_END(0);
249 /* 32 MiB Data Flash */
250 omixp_flash_resources
[1].start
= IXP4XX_EXP_BUS_BASE(2);
251 omixp_flash_resources
[1].end
= IXP4XX_EXP_BUS_END(2);
253 if (machine_is_devixp())
254 platform_add_devices(devixp_pldev
, ARRAY_SIZE(devixp_pldev
));
255 else if (machine_is_miccpt())
256 platform_add_devices(miccpt_pldev
, ARRAY_SIZE(miccpt_pldev
));
257 else if (machine_is_mic256())
258 platform_add_devices(mic256_pldev
, ARRAY_SIZE(mic256_pldev
));
261 #ifdef CONFIG_MACH_DEVIXP
262 MACHINE_START(DEVIXP
, "Omicron DEVIXP")
263 .atag_offset
= 0x100,
264 .map_io
= ixp4xx_map_io
,
265 .init_early
= ixp4xx_init_early
,
266 .init_irq
= ixp4xx_init_irq
,
267 .init_time
= ixp4xx_timer_init
,
268 .init_machine
= omixp_init
,
269 .restart
= ixp4xx_restart
,
273 #ifdef CONFIG_MACH_MICCPT
274 MACHINE_START(MICCPT
, "Omicron MICCPT")
275 .atag_offset
= 0x100,
276 .map_io
= ixp4xx_map_io
,
277 .init_early
= ixp4xx_init_early
,
278 .init_irq
= ixp4xx_init_irq
,
279 .init_time
= ixp4xx_timer_init
,
280 .init_machine
= omixp_init
,
281 #if defined(CONFIG_PCI)
282 .dma_zone_size
= SZ_64M
,
284 .restart
= ixp4xx_restart
,
288 #ifdef CONFIG_MACH_MIC256
289 MACHINE_START(MIC256
, "Omicron MIC256")
290 .atag_offset
= 0x100,
291 .map_io
= ixp4xx_map_io
,
292 .init_early
= ixp4xx_init_early
,
293 .init_irq
= ixp4xx_init_irq
,
294 .init_time
= ixp4xx_timer_init
,
295 .init_machine
= omixp_init
,
296 .restart
= ixp4xx_restart
,