Merge branch 'from-linus' into upstream
[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
19 #include <asm/mach-types.h>
20 #include <asm/mach/arch.h>
21 #include <asm/mach/flash.h>
22
23 static struct flash_platform_data nas100d_flash_data = {
24         .map_name               = "cfi_probe",
25         .width                  = 2,
26 };
27
28 static struct resource nas100d_flash_resource = {
29         .flags                  = IORESOURCE_MEM,
30 };
31
32 static struct platform_device nas100d_flash = {
33         .name                   = "IXP4XX-Flash",
34         .id                     = 0,
35         .dev.platform_data      = &nas100d_flash_data,
36         .num_resources          = 1,
37         .resource               = &nas100d_flash_resource,
38 };
39
40 static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = {
41         .sda_pin                = NAS100D_SDA_PIN,
42         .scl_pin                = NAS100D_SCL_PIN,
43 };
44
45 static struct platform_device nas100d_i2c_controller = {
46         .name                   = "IXP4XX-I2C",
47         .id                     = 0,
48         .dev.platform_data      = &nas100d_i2c_gpio_pins,
49         .num_resources          = 0,
50 };
51
52 static struct resource nas100d_uart_resources[] = {
53         {
54                 .start          = IXP4XX_UART1_BASE_PHYS,
55                 .end            = IXP4XX_UART1_BASE_PHYS + 0x0fff,
56                 .flags          = IORESOURCE_MEM,
57         },
58         {
59                 .start          = IXP4XX_UART2_BASE_PHYS,
60                 .end            = IXP4XX_UART2_BASE_PHYS + 0x0fff,
61                 .flags          = IORESOURCE_MEM,
62         }
63 };
64
65 static struct plat_serial8250_port nas100d_uart_data[] = {
66         {
67                 .mapbase        = IXP4XX_UART1_BASE_PHYS,
68                 .membase        = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
69                 .irq            = IRQ_IXP4XX_UART1,
70                 .flags          = UPF_BOOT_AUTOCONF,
71                 .iotype         = UPIO_MEM,
72                 .regshift       = 2,
73                 .uartclk        = IXP4XX_UART_XTAL,
74         },
75         {
76                 .mapbase        = IXP4XX_UART2_BASE_PHYS,
77                 .membase        = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
78                 .irq            = IRQ_IXP4XX_UART2,
79                 .flags          = UPF_BOOT_AUTOCONF,
80                 .iotype         = UPIO_MEM,
81                 .regshift       = 2,
82                 .uartclk        = IXP4XX_UART_XTAL,
83         },
84         { }
85 };
86
87 static struct platform_device nas100d_uart = {
88         .name                   = "serial8250",
89         .id                     = PLAT8250_DEV_PLATFORM,
90         .dev.platform_data      = nas100d_uart_data,
91         .num_resources          = 2,
92         .resource               = nas100d_uart_resources,
93 };
94
95 static struct platform_device *nas100d_devices[] __initdata = {
96         &nas100d_i2c_controller,
97         &nas100d_flash,
98         &nas100d_uart,
99 };
100
101 static void nas100d_power_off(void)
102 {
103         /* This causes the box to drop the power and go dead. */
104
105         /* enable the pwr cntl gpio */
106         gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT);
107
108         /* do the deed */
109         gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
110 }
111
112 static void __init nas100d_init(void)
113 {
114         ixp4xx_sys_init();
115
116         /* gpio 14 and 15 are _not_ clocks */
117         *IXP4XX_GPIO_GPCLKR = 0;
118
119         nas100d_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
120         nas100d_flash_resource.end =
121                 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
122
123         pm_power_off = nas100d_power_off;
124
125         platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
126 }
127
128 MACHINE_START(NAS100D, "Iomega NAS 100d")
129         /* Maintainer: www.nslu2-linux.org */
130         .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
131         .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
132         .boot_params    = 0x00000100,
133         .map_io         = ixp4xx_map_io,
134         .init_irq       = ixp4xx_init_irq,
135         .timer          = &ixp4xx_timer,
136         .init_machine   = nas100d_init,
137 MACHINE_END