]> pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-ixp4xx/nas100d-setup.c
dc782d06c2b16bedbb51a87ae596a740469f3d25
[linux-2.6-omap-h63xx.git] / 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.h>
20 #include <linux/i2c-gpio.h>
21
22 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/flash.h>
25
26 static struct flash_platform_data nas100d_flash_data = {
27         .map_name               = "cfi_probe",
28         .width                  = 2,
29 };
30
31 static struct resource nas100d_flash_resource = {
32         .flags                  = IORESOURCE_MEM,
33 };
34
35 static struct platform_device nas100d_flash = {
36         .name                   = "IXP4XX-Flash",
37         .id                     = 0,
38         .dev.platform_data      = &nas100d_flash_data,
39         .num_resources          = 1,
40         .resource               = &nas100d_flash_resource,
41 };
42
43 static struct i2c_board_info __initdata nas100d_i2c_board_info [] = {
44         {
45                 I2C_BOARD_INFO("rtc-pcf8563", 0x51),
46         },
47 };
48
49 #ifdef CONFIG_LEDS_IXP4XX
50 static struct resource nas100d_led_resources[] = {
51         {
52                 .name           = "wlan",   /* green led */
53                 .start          = NAS100D_LED_WLAN_GPIO,
54                 .end            = NAS100D_LED_WLAN_GPIO,
55                 .flags          = IXP4XX_GPIO_LOW,
56         },
57         {
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,
62         },
63         {
64                 .name           = "disk",   /* yellow led */
65                 .start          = NAS100D_LED_DISK_GPIO,
66                 .end            = NAS100D_LED_DISK_GPIO,
67                 .flags          = IXP4XX_GPIO_LOW,
68         },
69 };
70
71 static struct platform_device nas100d_leds = {
72         .name                   = "IXP4XX-GPIO-LED",
73         .id                     = -1,
74         .num_resources          = ARRAY_SIZE(nas100d_led_resources),
75         .resource               = nas100d_led_resources,
76 };
77 #endif
78
79 static struct i2c_gpio_platform_data nas100d_i2c_gpio_data = {
80         .sda_pin                = NAS100D_SDA_PIN,
81         .scl_pin                = NAS100D_SCL_PIN,
82 };
83
84 static struct platform_device nas100d_i2c_gpio = {
85         .name                   = "i2c-gpio",
86         .id                     = 0,
87         .dev     = {
88                 .platform_data  = &nas100d_i2c_gpio_data,
89         },
90 };
91
92 static struct resource nas100d_uart_resources[] = {
93         {
94                 .start          = IXP4XX_UART1_BASE_PHYS,
95                 .end            = IXP4XX_UART1_BASE_PHYS + 0x0fff,
96                 .flags          = IORESOURCE_MEM,
97         },
98         {
99                 .start          = IXP4XX_UART2_BASE_PHYS,
100                 .end            = IXP4XX_UART2_BASE_PHYS + 0x0fff,
101                 .flags          = IORESOURCE_MEM,
102         }
103 };
104
105 static struct plat_serial8250_port nas100d_uart_data[] = {
106         {
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,
111                 .iotype         = UPIO_MEM,
112                 .regshift       = 2,
113                 .uartclk        = IXP4XX_UART_XTAL,
114         },
115         {
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,
120                 .iotype         = UPIO_MEM,
121                 .regshift       = 2,
122                 .uartclk        = IXP4XX_UART_XTAL,
123         },
124         { }
125 };
126
127 static struct platform_device nas100d_uart = {
128         .name                   = "serial8250",
129         .id                     = PLAT8250_DEV_PLATFORM,
130         .dev.platform_data      = nas100d_uart_data,
131         .num_resources          = 2,
132         .resource               = nas100d_uart_resources,
133 };
134
135 static struct platform_device *nas100d_devices[] __initdata = {
136         &nas100d_i2c_gpio,
137         &nas100d_flash,
138 #ifdef CONFIG_LEDS_IXP4XX
139         &nas100d_leds,
140 #endif
141 };
142
143 static void nas100d_power_off(void)
144 {
145         /* This causes the box to drop the power and go dead. */
146
147         /* enable the pwr cntl gpio */
148         gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT);
149
150         /* do the deed */
151         gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
152 }
153
154 static void __init nas100d_init(void)
155 {
156         ixp4xx_sys_init();
157
158         /* gpio 14 and 15 are _not_ clocks */
159         *IXP4XX_GPIO_GPCLKR = 0;
160
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;
164
165         pm_power_off = nas100d_power_off;
166
167         i2c_register_board_info(0, nas100d_i2c_board_info,
168                                 ARRAY_SIZE(nas100d_i2c_board_info));
169
170         /*
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!
174          */
175         (void)platform_device_register(&nas100d_uart);
176
177         platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
178 }
179
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,
189 MACHINE_END