ext4: Convert truncate_mutex to read write semaphore.
[linux-2.6/lfs.git] / arch / arm / mach-ixp4xx / nas100d-setup.c
blob54d884fb2517a5207b2b5699d5b89e936917d6c1
1 /*
2 * arch/arm/mach-ixp4xx/nas100d-setup.c
4 * NAS 100d board-setup
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-gpio.h>
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/flash.h>
25 static struct flash_platform_data nas100d_flash_data = {
26 .map_name = "cfi_probe",
27 .width = 2,
30 static struct resource nas100d_flash_resource = {
31 .flags = IORESOURCE_MEM,
34 static struct platform_device nas100d_flash = {
35 .name = "IXP4XX-Flash",
36 .id = 0,
37 .dev.platform_data = &nas100d_flash_data,
38 .num_resources = 1,
39 .resource = &nas100d_flash_resource,
42 #ifdef CONFIG_LEDS_IXP4XX
43 static struct resource nas100d_led_resources[] = {
45 .name = "wlan", /* green led */
46 .start = 0,
47 .end = 0,
48 .flags = IXP4XX_GPIO_LOW,
51 .name = "ready", /* blue power led (off is flashing!) */
52 .start = 15,
53 .end = 15,
54 .flags = IXP4XX_GPIO_LOW,
57 .name = "disk", /* yellow led */
58 .start = 3,
59 .end = 3,
60 .flags = IXP4XX_GPIO_LOW,
64 static struct platform_device nas100d_leds = {
65 .name = "IXP4XX-GPIO-LED",
66 .id = -1,
67 .num_resources = ARRAY_SIZE(nas100d_led_resources),
68 .resource = nas100d_led_resources,
70 #endif
72 static struct i2c_gpio_platform_data nas100d_i2c_gpio_data = {
73 .sda_pin = NAS100D_SDA_PIN,
74 .scl_pin = NAS100D_SCL_PIN,
77 static struct platform_device nas100d_i2c_gpio = {
78 .name = "i2c-gpio",
79 .id = 0,
80 .dev = {
81 .platform_data = &nas100d_i2c_gpio_data,
85 static struct resource nas100d_uart_resources[] = {
87 .start = IXP4XX_UART1_BASE_PHYS,
88 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
89 .flags = IORESOURCE_MEM,
92 .start = IXP4XX_UART2_BASE_PHYS,
93 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
94 .flags = IORESOURCE_MEM,
98 static struct plat_serial8250_port nas100d_uart_data[] = {
100 .mapbase = IXP4XX_UART1_BASE_PHYS,
101 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
102 .irq = IRQ_IXP4XX_UART1,
103 .flags = UPF_BOOT_AUTOCONF,
104 .iotype = UPIO_MEM,
105 .regshift = 2,
106 .uartclk = IXP4XX_UART_XTAL,
109 .mapbase = IXP4XX_UART2_BASE_PHYS,
110 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
111 .irq = IRQ_IXP4XX_UART2,
112 .flags = UPF_BOOT_AUTOCONF,
113 .iotype = UPIO_MEM,
114 .regshift = 2,
115 .uartclk = IXP4XX_UART_XTAL,
120 static struct platform_device nas100d_uart = {
121 .name = "serial8250",
122 .id = PLAT8250_DEV_PLATFORM,
123 .dev.platform_data = nas100d_uart_data,
124 .num_resources = 2,
125 .resource = nas100d_uart_resources,
128 static struct platform_device *nas100d_devices[] __initdata = {
129 &nas100d_i2c_gpio,
130 &nas100d_flash,
131 #ifdef CONFIG_LEDS_IXP4XX
132 &nas100d_leds,
133 #endif
136 static void nas100d_power_off(void)
138 /* This causes the box to drop the power and go dead. */
140 /* enable the pwr cntl gpio */
141 gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT);
143 /* do the deed */
144 gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
147 static void __init nas100d_init(void)
149 ixp4xx_sys_init();
151 /* gpio 14 and 15 are _not_ clocks */
152 *IXP4XX_GPIO_GPCLKR = 0;
154 nas100d_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
155 nas100d_flash_resource.end =
156 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
158 pm_power_off = nas100d_power_off;
161 * This is only useful on a modified machine, but it is valuable
162 * to have it first in order to see debug messages, and so that
163 * it does *not* get removed if platform_add_devices fails!
165 (void)platform_device_register(&nas100d_uart);
167 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
170 MACHINE_START(NAS100D, "Iomega NAS 100d")
171 /* Maintainer: www.nslu2-linux.org */
172 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
173 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
174 .boot_params = 0x00000100,
175 .map_io = ixp4xx_map_io,
176 .init_irq = ixp4xx_init_irq,
177 .timer = &ixp4xx_timer,
178 .init_machine = nas100d_init,
179 MACHINE_END