2 * arch/arm/mach-ixp4xx/nas100d-setup.c
6 * based ixdp425-setup.c:
7 * Copyright (C) 2003-2004 MontaVista Software, Inc.
9 * Author: Alessandro Zummo <a.zummo@towertech.it>
10 * Author: Rod Whitby <rod@whitby.id.au>
11 * Maintainers: http://www.nslu2-linux.org/
15 #include <linux/kernel.h>
16 #include <linux/serial.h>
17 #include <linux/serial_8250.h>
18 #include <linux/leds.h>
19 #include <linux/i2c.h>
20 #include <linux/i2c-gpio.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 nas100d_flash_data = {
27 .map_name = "cfi_probe",
31 static struct resource nas100d_flash_resource = {
32 .flags = IORESOURCE_MEM,
35 static struct platform_device nas100d_flash = {
36 .name = "IXP4XX-Flash",
38 .dev.platform_data = &nas100d_flash_data,
40 .resource = &nas100d_flash_resource,
43 static struct i2c_board_info __initdata nas100d_i2c_board_info [] = {
45 I2C_BOARD_INFO("rtc-pcf8563", 0x51),
49 #ifdef CONFIG_LEDS_IXP4XX
50 static struct resource nas100d_led_resources[] = {
52 .name = "wlan", /* green led */
53 .start = NAS100D_LED_WLAN_GPIO,
54 .end = NAS100D_LED_WLAN_GPIO,
55 .flags = IXP4XX_GPIO_LOW,
58 .name = "power", /* blue power led (off=flashing) */
59 .start = NAS100D_LED_PWR_GPIO,
60 .end = NAS100D_LED_PWR_GPIO,
61 .flags = IXP4XX_GPIO_LOW,
64 .name = "disk", /* yellow led */
65 .start = NAS100D_LED_DISK_GPIO,
66 .end = NAS100D_LED_DISK_GPIO,
67 .flags = IXP4XX_GPIO_LOW,
71 static struct platform_device nas100d_leds = {
72 .name = "IXP4XX-GPIO-LED",
74 .num_resources = ARRAY_SIZE(nas100d_led_resources),
75 .resource = nas100d_led_resources,
79 static struct i2c_gpio_platform_data nas100d_i2c_gpio_data = {
80 .sda_pin = NAS100D_SDA_PIN,
81 .scl_pin = NAS100D_SCL_PIN,
84 static struct platform_device nas100d_i2c_gpio = {
88 .platform_data = &nas100d_i2c_gpio_data,
92 static struct resource nas100d_uart_resources[] = {
94 .start = IXP4XX_UART1_BASE_PHYS,
95 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
96 .flags = IORESOURCE_MEM,
99 .start = IXP4XX_UART2_BASE_PHYS,
100 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
101 .flags = IORESOURCE_MEM,
105 static struct plat_serial8250_port nas100d_uart_data[] = {
107 .mapbase = IXP4XX_UART1_BASE_PHYS,
108 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
109 .irq = IRQ_IXP4XX_UART1,
110 .flags = UPF_BOOT_AUTOCONF,
113 .uartclk = IXP4XX_UART_XTAL,
116 .mapbase = IXP4XX_UART2_BASE_PHYS,
117 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
118 .irq = IRQ_IXP4XX_UART2,
119 .flags = UPF_BOOT_AUTOCONF,
122 .uartclk = IXP4XX_UART_XTAL,
127 static struct platform_device nas100d_uart = {
128 .name = "serial8250",
129 .id = PLAT8250_DEV_PLATFORM,
130 .dev.platform_data = nas100d_uart_data,
132 .resource = nas100d_uart_resources,
135 static struct platform_device *nas100d_devices[] __initdata = {
138 #ifdef CONFIG_LEDS_IXP4XX
143 static void nas100d_power_off(void)
145 /* This causes the box to drop the power and go dead. */
147 /* enable the pwr cntl gpio */
148 gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT);
151 gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
154 static void __init nas100d_init(void)
158 /* gpio 14 and 15 are _not_ clocks */
159 *IXP4XX_GPIO_GPCLKR = 0;
161 nas100d_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
162 nas100d_flash_resource.end =
163 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
165 pm_power_off = nas100d_power_off;
167 i2c_register_board_info(0, nas100d_i2c_board_info,
168 ARRAY_SIZE(nas100d_i2c_board_info));
171 * This is only useful on a modified machine, but it is valuable
172 * to have it first in order to see debug messages, and so that
173 * it does *not* get removed if platform_add_devices fails!
175 (void)platform_device_register(&nas100d_uart);
177 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
180 MACHINE_START(NAS100D, "Iomega NAS 100d")
181 /* Maintainer: www.nslu2-linux.org */
182 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
183 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
184 .boot_params = 0x00000100,
185 .map_io = ixp4xx_map_io,
186 .init_irq = ixp4xx_init_irq,
187 .timer = &ixp4xx_timer,
188 .init_machine = nas100d_init,