]> err.no Git - linux-2.6/blob - arch/arm/mach-ixp4xx/nas100d-setup.c
Merge branch 'linux-2.6'
[linux-2.6] / arch / arm / mach-ixp4xx / nas100d-setup.c
1 /*
2  * arch/arm/mach-ixp4xx/nas100d-setup.c
3  *
4  * NAS 100d board-setup
5  *
6  * based ixdp425-setup.c:
7  *      Copyright (C) 2003-2004 MontaVista Software, Inc.
8  *
9  * Author: Alessandro Zummo <a.zummo@towertech.it>
10  * Author: Rod Whitby <rod@whitby.id.au>
11  * Maintainers: http://www.nslu2-linux.org/
12  *
13  */
14
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>
20
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/flash.h>
24
25 static struct flash_platform_data nas100d_flash_data = {
26         .map_name               = "cfi_probe",
27         .width                  = 2,
28 };
29
30 static struct resource nas100d_flash_resource = {
31         .flags                  = IORESOURCE_MEM,
32 };
33
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,
40 };
41
42 #ifdef CONFIG_LEDS_IXP4XX
43 static struct resource nas100d_led_resources[] = {
44         {
45                 .name           = "wlan",   /* green led */
46                 .start          = 0,
47                 .end            = 0,
48                 .flags          = IXP4XX_GPIO_LOW,
49         },
50         {
51                 .name           = "ready",  /* blue power led (off is flashing!) */
52                 .start          = 15,
53                 .end            = 15,
54                 .flags          = IXP4XX_GPIO_LOW,
55         },
56         {
57                 .name           = "disk",   /* yellow led */
58                 .start          = 3,
59                 .end            = 3,
60                 .flags          = IXP4XX_GPIO_LOW,
61         },
62 };
63
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,
69 };
70 #endif
71
72 static struct i2c_gpio_platform_data nas100d_i2c_gpio_data = {
73         .sda_pin                = NAS100D_SDA_PIN,
74         .scl_pin                = NAS100D_SCL_PIN,
75 };
76
77 static struct platform_device nas100d_i2c_gpio = {
78         .name                   = "i2c-gpio",
79         .id                     = 0,
80         .dev     = {
81                 .platform_data  = &nas100d_i2c_gpio_data,
82         },
83 };
84
85 static struct resource nas100d_uart_resources[] = {
86         {
87                 .start          = IXP4XX_UART1_BASE_PHYS,
88                 .end            = IXP4XX_UART1_BASE_PHYS + 0x0fff,
89                 .flags          = IORESOURCE_MEM,
90         },
91         {
92                 .start          = IXP4XX_UART2_BASE_PHYS,
93                 .end            = IXP4XX_UART2_BASE_PHYS + 0x0fff,
94                 .flags          = IORESOURCE_MEM,
95         }
96 };
97
98 static struct plat_serial8250_port nas100d_uart_data[] = {
99         {
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,
107         },
108         {
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,
116         },
117         { }
118 };
119
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,
126 };
127
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
134 };
135
136 static void nas100d_power_off(void)
137 {
138         /* This causes the box to drop the power and go dead. */
139
140         /* enable the pwr cntl gpio */
141         gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT);
142
143         /* do the deed */
144         gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
145 }
146
147 static void __init nas100d_init(void)
148 {
149         ixp4xx_sys_init();
150
151         /* gpio 14 and 15 are _not_ clocks */
152         *IXP4XX_GPIO_GPCLKR = 0;
153
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;
157
158         pm_power_off = nas100d_power_off;
159
160         /*
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!
164          */
165         (void)platform_device_register(&nas100d_uart);
166
167         platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
168 }
169
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