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>
21 #include <linux/i2c.h>
22 #include <linux/i2c-gpio.h>
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach/flash.h>
27 #include <asm/mach/time.h>
29 static struct flash_platform_data nslu2_flash_data = {
30 .map_name = "cfi_probe",
34 static struct resource nslu2_flash_resource = {
35 .flags = IORESOURCE_MEM,
38 static struct platform_device nslu2_flash = {
39 .name = "IXP4XX-Flash",
41 .dev.platform_data = &nslu2_flash_data,
43 .resource = &nslu2_flash_resource,
46 static struct i2c_gpio_platform_data nslu2_i2c_gpio_data = {
47 .sda_pin = NSLU2_SDA_PIN,
48 .scl_pin = NSLU2_SCL_PIN,
51 static struct i2c_board_info __initdata nslu2_i2c_board_info [] = {
53 I2C_BOARD_INFO("rtc-x1205", 0x6f),
57 static struct gpio_led nslu2_led_pins[] = {
59 .name = "ready", /* green led */
60 .gpio = NSLU2_LED_GRN_GPIO,
63 .name = "status", /* red led */
64 .gpio = NSLU2_LED_RED_GPIO,
68 .gpio = NSLU2_LED_DISK1_GPIO,
73 .gpio = NSLU2_LED_DISK2_GPIO,
78 static struct gpio_led_platform_data nslu2_led_data = {
79 .num_leds = ARRAY_SIZE(nslu2_led_pins),
80 .leds = nslu2_led_pins,
83 static struct platform_device nslu2_leds = {
86 .dev.platform_data = &nslu2_led_data,
89 static struct platform_device nslu2_i2c_gpio = {
93 .platform_data = &nslu2_i2c_gpio_data,
97 static struct platform_device nslu2_beeper = {
98 .name = "ixp4xx-beeper",
99 .id = NSLU2_GPIO_BUZZ,
103 static struct resource nslu2_uart_resources[] = {
105 .start = IXP4XX_UART1_BASE_PHYS,
106 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
107 .flags = IORESOURCE_MEM,
110 .start = IXP4XX_UART2_BASE_PHYS,
111 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
112 .flags = IORESOURCE_MEM,
116 static struct plat_serial8250_port nslu2_uart_data[] = {
118 .mapbase = IXP4XX_UART1_BASE_PHYS,
119 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
120 .irq = IRQ_IXP4XX_UART1,
121 .flags = UPF_BOOT_AUTOCONF,
124 .uartclk = IXP4XX_UART_XTAL,
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,
133 .uartclk = IXP4XX_UART_XTAL,
138 static struct platform_device nslu2_uart = {
139 .name = "serial8250",
140 .id = PLAT8250_DEV_PLATFORM,
141 .dev.platform_data = nslu2_uart_data,
143 .resource = nslu2_uart_resources,
146 static struct platform_device *nslu2_devices[] __initdata = {
153 static void nslu2_power_off(void)
155 /* This causes the box to drop the power and go dead. */
157 /* enable the pwr cntl gpio */
158 gpio_line_config(NSLU2_PO_GPIO, IXP4XX_GPIO_OUT);
161 gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH);
164 static void __init nslu2_timer_init(void)
166 /* The xtal on this machine is non-standard. */
167 ixp4xx_timer_freq = NSLU2_FREQ;
169 /* Call standard timer_init function. */
173 static struct sys_timer nslu2_timer = {
174 .init = nslu2_timer_init,
177 static void __init nslu2_init(void)
181 nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
182 nslu2_flash_resource.end =
183 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
185 pm_power_off = nslu2_power_off;
187 i2c_register_board_info(0, nslu2_i2c_board_info,
188 ARRAY_SIZE(nslu2_i2c_board_info));
191 * This is only useful on a modified machine, but it is valuable
192 * to have it first in order to see debug messages, and so that
193 * it does *not* get removed if platform_add_devices fails!
195 (void)platform_device_register(&nslu2_uart);
197 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
200 MACHINE_START(NSLU2, "Linksys NSLU2")
201 /* Maintainer: www.nslu2-linux.org */
202 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
203 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
204 .boot_params = 0x00000100,
205 .map_io = ixp4xx_map_io,
206 .init_irq = ixp4xx_init_irq,
207 .timer = &nslu2_timer,
208 .init_machine = nslu2_init,