[ARM] 3337/1: Fix NSLU2 flash support according to window size configuration patch
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / mach-ixp4xx / nslu2-setup.c
CommitLineData
a7918f39
AZ
1/*
2 * arch/arm/mach-ixp4xx/nslu2-setup.c
3 *
4 * NSLU2 board-setup
5 *
6 * based ixdp425-setup.c:
7 * Copyright (C) 2003-2004 MontaVista Software, Inc.
8 *
9 * Author: Mark Rakes <mrakes at mac.com>
10 * Maintainers: http://www.nslu2-linux.org/
11 *
12 * Fixed missing init_time in MACHINE_START kas11 10/22/04
13 * Changed to conform to new style __init ixdp425 kas11 10/22/04
14 */
15
16#include <linux/kernel.h>
17#include <linux/serial.h>
18#include <linux/serial_8250.h>
19
20#include <asm/mach-types.h>
21#include <asm/mach/arch.h>
22#include <asm/mach/flash.h>
23
24static struct flash_platform_data nslu2_flash_data = {
25 .map_name = "cfi_probe",
26 .width = 2,
27};
28
29static struct resource nslu2_flash_resource = {
a7918f39
AZ
30 .flags = IORESOURCE_MEM,
31};
32
33static struct platform_device nslu2_flash = {
34 .name = "IXP4XX-Flash",
35 .id = 0,
36 .dev.platform_data = &nslu2_flash_data,
37 .num_resources = 1,
38 .resource = &nslu2_flash_resource,
39};
40
41static struct ixp4xx_i2c_pins nslu2_i2c_gpio_pins = {
42 .sda_pin = NSLU2_SDA_PIN,
43 .scl_pin = NSLU2_SCL_PIN,
44};
45
46static struct platform_device nslu2_i2c_controller = {
47 .name = "IXP4XX-I2C",
48 .id = 0,
49 .dev.platform_data = &nslu2_i2c_gpio_pins,
50 .num_resources = 0,
51};
52
53static struct resource nslu2_uart_resources[] = {
54 {
55 .start = IXP4XX_UART1_BASE_PHYS,
56 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
57 .flags = IORESOURCE_MEM,
58 },
59 {
60 .start = IXP4XX_UART2_BASE_PHYS,
61 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
62 .flags = IORESOURCE_MEM,
63 }
64};
65
66static struct plat_serial8250_port nslu2_uart_data[] = {
67 {
68 .mapbase = IXP4XX_UART1_BASE_PHYS,
69 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
70 .irq = IRQ_IXP4XX_UART1,
71 .flags = UPF_BOOT_AUTOCONF,
72 .iotype = UPIO_MEM,
73 .regshift = 2,
74 .uartclk = IXP4XX_UART_XTAL,
75 },
76 {
77 .mapbase = IXP4XX_UART2_BASE_PHYS,
78 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
79 .irq = IRQ_IXP4XX_UART2,
80 .flags = UPF_BOOT_AUTOCONF,
81 .iotype = UPIO_MEM,
82 .regshift = 2,
83 .uartclk = IXP4XX_UART_XTAL,
84 },
85 { }
86};
87
88static struct platform_device nslu2_uart = {
89 .name = "serial8250",
90 .id = PLAT8250_DEV_PLATFORM,
91 .dev.platform_data = nslu2_uart_data,
92 .num_resources = 2,
93 .resource = nslu2_uart_resources,
94};
95
96static struct platform_device *nslu2_devices[] __initdata = {
97 &nslu2_i2c_controller,
98 &nslu2_flash,
99 &nslu2_uart,
100};
101
102static void nslu2_power_off(void)
103{
104 /* This causes the box to drop the power and go dead. */
105
106 /* enable the pwr cntl gpio */
107 gpio_line_config(NSLU2_PO_GPIO, IXP4XX_GPIO_OUT);
108
109 /* do the deed */
110 gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH);
111}
112
113static void __init nslu2_init(void)
114{
115 ixp4xx_sys_init();
116
3dfaf7a6
MM
117 nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
118 nslu2_flash_resource.end =
119 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
120
a7918f39
AZ
121 pm_power_off = nslu2_power_off;
122
123 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
124}
125
126MACHINE_START(NSLU2, "Linksys NSLU2")
127 /* Maintainer: www.nslu2-linux.org */
a7918f39
AZ
128 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
129 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
130 .boot_params = 0x00000100,
131 .map_io = ixp4xx_map_io,
132 .init_irq = ixp4xx_init_irq,
133 .timer = &ixp4xx_timer,
134 .init_machine = nslu2_init,
135MACHINE_END