Commit | Line | Data |
---|---|---|
3145d8a6 RW |
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 | .start = NAS100D_FLASH_BASE, | |
30 | .end = NAS100D_FLASH_BASE + NAS100D_FLASH_SIZE, | |
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 | static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = { | |
43 | .sda_pin = NAS100D_SDA_PIN, | |
44 | .scl_pin = NAS100D_SCL_PIN, | |
45 | }; | |
46 | ||
47 | static struct platform_device nas100d_i2c_controller = { | |
48 | .name = "IXP4XX-I2C", | |
49 | .id = 0, | |
50 | .dev.platform_data = &nas100d_i2c_gpio_pins, | |
51 | .num_resources = 0, | |
52 | }; | |
53 | ||
54 | static struct resource nas100d_uart_resources[] = { | |
55 | { | |
56 | .start = IXP4XX_UART1_BASE_PHYS, | |
57 | .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, | |
58 | .flags = IORESOURCE_MEM, | |
59 | }, | |
60 | { | |
61 | .start = IXP4XX_UART2_BASE_PHYS, | |
62 | .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, | |
63 | .flags = IORESOURCE_MEM, | |
64 | } | |
65 | }; | |
66 | ||
67 | static struct plat_serial8250_port nas100d_uart_data[] = { | |
68 | { | |
69 | .mapbase = IXP4XX_UART1_BASE_PHYS, | |
70 | .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, | |
71 | .irq = IRQ_IXP4XX_UART1, | |
72 | .flags = UPF_BOOT_AUTOCONF, | |
73 | .iotype = UPIO_MEM, | |
74 | .regshift = 2, | |
75 | .uartclk = IXP4XX_UART_XTAL, | |
76 | }, | |
77 | { | |
78 | .mapbase = IXP4XX_UART2_BASE_PHYS, | |
79 | .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, | |
80 | .irq = IRQ_IXP4XX_UART2, | |
81 | .flags = UPF_BOOT_AUTOCONF, | |
82 | .iotype = UPIO_MEM, | |
83 | .regshift = 2, | |
84 | .uartclk = IXP4XX_UART_XTAL, | |
85 | }, | |
86 | { } | |
87 | }; | |
88 | ||
89 | static struct platform_device nas100d_uart = { | |
90 | .name = "serial8250", | |
91 | .id = PLAT8250_DEV_PLATFORM, | |
92 | .dev.platform_data = nas100d_uart_data, | |
93 | .num_resources = 2, | |
94 | .resource = nas100d_uart_resources, | |
95 | }; | |
96 | ||
97 | static struct platform_device *nas100d_devices[] __initdata = { | |
98 | &nas100d_i2c_controller, | |
99 | &nas100d_flash, | |
100 | &nas100d_uart, | |
101 | }; | |
102 | ||
103 | static void nas100d_power_off(void) | |
104 | { | |
105 | /* This causes the box to drop the power and go dead. */ | |
106 | ||
107 | /* enable the pwr cntl gpio */ | |
108 | gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT); | |
109 | ||
110 | /* do the deed */ | |
111 | gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH); | |
112 | } | |
113 | ||
114 | static void __init nas100d_init(void) | |
115 | { | |
116 | ixp4xx_sys_init(); | |
117 | ||
118 | pm_power_off = nas100d_power_off; | |
119 | ||
120 | platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices)); | |
121 | } | |
122 | ||
123 | MACHINE_START(NAS100D, "Iomega NAS 100d") | |
124 | /* Maintainer: www.nslu2-linux.org */ | |
125 | .phys_ram = PHYS_OFFSET, | |
126 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | |
127 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, | |
128 | .boot_params = 0x00000100, | |
129 | .map_io = ixp4xx_map_io, | |
130 | .init_irq = ixp4xx_init_irq, | |
131 | .timer = &ixp4xx_timer, | |
132 | .init_machine = nas100d_init, | |
133 | MACHINE_END |