2 * arch/arm/mach-ixp4xx/nslu2-setup.c
6 * based ixdp425-setup.c:
7 * Copyright (C) 2003-2004 MontaVista Software, Inc.
9 * Author: Mark Rakes <mrakes at mac.com>
10 * Author: Rod Whitby <rod@whitby.id.au>
11 * Maintainers: http://www.nslu2-linux.org/
13 * Fixed missing init_time in MACHINE_START kas11 10/22/04
14 * Changed to conform to new style __init ixdp425 kas11 10/22/04
17 #include <linux/kernel.h>
18 #include <linux/serial.h>
19 #include <linux/serial_8250.h>
20 #include <linux/leds.h>
22 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/flash.h>
26 static struct flash_platform_data nslu2_flash_data = {
27 .map_name = "cfi_probe",
31 static struct resource nslu2_flash_resource = {
32 .flags = IORESOURCE_MEM,
35 static struct platform_device nslu2_flash = {
36 .name = "IXP4XX-Flash",
38 .dev.platform_data = &nslu2_flash_data,
40 .resource = &nslu2_flash_resource,
43 static struct ixp4xx_i2c_pins nslu2_i2c_gpio_pins = {
44 .sda_pin = NSLU2_SDA_PIN,
45 .scl_pin = NSLU2_SCL_PIN,
48 #ifdef CONFIG_LEDS_IXP4XX
49 static struct resource nslu2_led_resources[] = {
51 .name = "ready", /* green led */
52 .start = NSLU2_LED_GRN,
54 .flags = IXP4XX_GPIO_HIGH,
57 .name = "status", /* red led */
58 .start = NSLU2_LED_RED,
60 .flags = IXP4XX_GPIO_HIGH,
64 .start = NSLU2_LED_DISK1,
65 .end = NSLU2_LED_DISK1,
66 .flags = IXP4XX_GPIO_LOW,
70 .start = NSLU2_LED_DISK2,
71 .end = NSLU2_LED_DISK2,
72 .flags = IXP4XX_GPIO_LOW,
76 static struct platform_device nslu2_leds = {
77 .name = "IXP4XX-GPIO-LED",
79 .num_resources = ARRAY_SIZE(nslu2_led_resources),
80 .resource = nslu2_led_resources,
84 static struct platform_device nslu2_i2c_controller = {
87 .dev.platform_data = &nslu2_i2c_gpio_pins,
91 static struct platform_device nslu2_beeper = {
92 .name = "ixp4xx-beeper",
93 .id = NSLU2_GPIO_BUZZ,
97 static struct resource nslu2_uart_resources[] = {
99 .start = IXP4XX_UART1_BASE_PHYS,
100 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
101 .flags = IORESOURCE_MEM,
104 .start = IXP4XX_UART2_BASE_PHYS,
105 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
106 .flags = IORESOURCE_MEM,
110 static struct plat_serial8250_port nslu2_uart_data[] = {
112 .mapbase = IXP4XX_UART1_BASE_PHYS,
113 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
114 .irq = IRQ_IXP4XX_UART1,
115 .flags = UPF_BOOT_AUTOCONF,
118 .uartclk = IXP4XX_UART_XTAL,
121 .mapbase = IXP4XX_UART2_BASE_PHYS,
122 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
123 .irq = IRQ_IXP4XX_UART2,
124 .flags = UPF_BOOT_AUTOCONF,
127 .uartclk = IXP4XX_UART_XTAL,
132 static struct platform_device nslu2_uart = {
133 .name = "serial8250",
134 .id = PLAT8250_DEV_PLATFORM,
135 .dev.platform_data = nslu2_uart_data,
137 .resource = nslu2_uart_resources,
140 static struct platform_device *nslu2_devices[] __initdata = {
141 &nslu2_i2c_controller,
144 #ifdef CONFIG_LEDS_IXP4XX
149 static void nslu2_power_off(void)
151 /* This causes the box to drop the power and go dead. */
153 /* enable the pwr cntl gpio */
154 gpio_line_config(NSLU2_PO_GPIO, IXP4XX_GPIO_OUT);
157 gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH);
160 static void __init nslu2_init(void)
162 ixp4xx_timer_freq = NSLU2_FREQ;
166 nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
167 nslu2_flash_resource.end =
168 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
170 pm_power_off = nslu2_power_off;
172 /* This is only useful on a modified machine, but it is valuable
173 * to have it first in order to see debug messages, and so that
174 * it does *not* get removed if platform_add_devices fails!
176 (void)platform_device_register(&nslu2_uart);
178 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
181 MACHINE_START(NSLU2, "Linksys NSLU2")
182 /* Maintainer: www.nslu2-linux.org */
183 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
184 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
185 .boot_params = 0x00000100,
186 .map_io = ixp4xx_map_io,
187 .init_irq = ixp4xx_init_irq,
188 .timer = &ixp4xx_timer,
189 .init_machine = nslu2_init,