nfsd: link returns nfserr_delay when breaking lease
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-orion5x / ls-chl-setup.c
blob6ae12aa6d7592b23ed1c8852e885fc481a1126d4
1 /*
2 * arch/arm/mach-orion5x/ls-chl-setup.c
4 * Maintainer: Ash Hughes <ashley.hughes@blueyonder.co.uk>
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/mtd/physmap.h>
15 #include <linux/mv643xx_eth.h>
16 #include <linux/leds.h>
17 #include <linux/gpio_keys.h>
18 #include <linux/gpio-fan.h>
19 #include <linux/input.h>
20 #include <linux/i2c.h>
21 #include <linux/ata_platform.h>
22 #include <linux/gpio.h>
23 #include <asm/mach-types.h>
24 #include <asm/mach/arch.h>
25 #include <asm/system.h>
26 #include <mach/orion5x.h>
27 #include "common.h"
28 #include "mpp.h"
30 /*****************************************************************************
31 * Linkstation LS-CHL Info
32 ****************************************************************************/
35 * 256K NOR flash Device bus boot chip select
38 #define LSCHL_NOR_BOOT_BASE 0xf4000000
39 #define LSCHL_NOR_BOOT_SIZE SZ_256K
41 /*****************************************************************************
42 * 256KB NOR Flash on BOOT Device
43 ****************************************************************************/
45 static struct physmap_flash_data lschl_nor_flash_data = {
46 .width = 1,
49 static struct resource lschl_nor_flash_resource = {
50 .flags = IORESOURCE_MEM,
51 .start = LSCHL_NOR_BOOT_BASE,
52 .end = LSCHL_NOR_BOOT_BASE + LSCHL_NOR_BOOT_SIZE - 1,
55 static struct platform_device lschl_nor_flash = {
56 .name = "physmap-flash",
57 .id = 0,
58 .dev = {
59 .platform_data = &lschl_nor_flash_data,
61 .num_resources = 1,
62 .resource = &lschl_nor_flash_resource,
65 /*****************************************************************************
66 * Ethernet
67 ****************************************************************************/
69 static struct mv643xx_eth_platform_data lschl_eth_data = {
70 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
73 /*****************************************************************************
74 * RTC 5C372a on I2C bus
75 ****************************************************************************/
77 static struct i2c_board_info __initdata lschl_i2c_rtc = {
78 I2C_BOARD_INFO("rs5c372a", 0x32),
81 /*****************************************************************************
82 * LEDs attached to GPIO
83 ****************************************************************************/
85 #define LSCHL_GPIO_LED_ALARM 2
86 #define LSCHL_GPIO_LED_INFO 3
87 #define LSCHL_GPIO_LED_FUNC 17
88 #define LSCHL_GPIO_LED_PWR 0
90 static struct gpio_led lschl_led_pins[] = {
92 .name = "alarm:red",
93 .gpio = LSCHL_GPIO_LED_ALARM,
94 .active_low = 1,
95 }, {
96 .name = "info:amber",
97 .gpio = LSCHL_GPIO_LED_INFO,
98 .active_low = 1,
99 }, {
100 .name = "func:blue:top",
101 .gpio = LSCHL_GPIO_LED_FUNC,
102 .active_low = 1,
103 }, {
104 .name = "power:blue:bottom",
105 .gpio = LSCHL_GPIO_LED_PWR,
109 static struct gpio_led_platform_data lschl_led_data = {
110 .leds = lschl_led_pins,
111 .num_leds = ARRAY_SIZE(lschl_led_pins),
114 static struct platform_device lschl_leds = {
115 .name = "leds-gpio",
116 .id = -1,
117 .dev = {
118 .platform_data = &lschl_led_data,
122 /*****************************************************************************
123 * SATA
124 ****************************************************************************/
125 static struct mv_sata_platform_data lschl_sata_data = {
126 .n_ports = 2,
129 /*****************************************************************************
130 * LS-CHL specific power off method: reboot
131 ****************************************************************************/
133 * On the LS-CHL, the shutdown process is following:
134 * - Userland monitors key events until the power switch goes to off position
135 * - The board reboots
136 * - U-boot starts and goes into an idle mode waiting for the user
137 * to move the switch to ON position
141 static void lschl_power_off(void)
143 arm_machine_restart('h', NULL);
146 /*****************************************************************************
147 * General Setup
148 ****************************************************************************/
149 #define LSCHL_GPIO_USB_POWER 9
150 #define LSCHL_GPIO_AUTO_POWER 17
151 #define LSCHL_GPIO_POWER 18
153 /****************************************************************************
154 * GPIO Attached Keys
155 ****************************************************************************/
156 #define LSCHL_GPIO_KEY_FUNC 15
157 #define LSCHL_GPIO_KEY_POWER 8
158 #define LSCHL_GPIO_KEY_AUTOPOWER 10
159 #define LSCHL_SW_POWER 0x00
160 #define LSCHL_SW_AUTOPOWER 0x01
161 #define LSCHL_SW_FUNC 0x02
163 static struct gpio_keys_button lschl_buttons[] = {
165 .type = EV_SW,
166 .code = LSCHL_SW_POWER,
167 .gpio = LSCHL_GPIO_KEY_POWER,
168 .desc = "Power-on Switch",
169 .active_low = 1,
170 }, {
171 .type = EV_SW,
172 .code = LSCHL_SW_AUTOPOWER,
173 .gpio = LSCHL_GPIO_KEY_AUTOPOWER,
174 .desc = "Power-auto Switch",
175 .active_low = 1,
176 }, {
177 .type = EV_SW,
178 .code = LSCHL_SW_FUNC,
179 .gpio = LSCHL_GPIO_KEY_FUNC,
180 .desc = "Function Switch",
181 .active_low = 1,
185 static struct gpio_keys_platform_data lschl_button_data = {
186 .buttons = lschl_buttons,
187 .nbuttons = ARRAY_SIZE(lschl_buttons),
190 static struct platform_device lschl_button_device = {
191 .name = "gpio-keys",
192 .id = -1,
193 .num_resources = 0,
194 .dev = {
195 .platform_data = &lschl_button_data,
199 #define LSCHL_GPIO_HDD_POWER 1
201 /****************************************************************************
202 * GPIO Fan
203 ****************************************************************************/
205 #define LSCHL_GPIO_FAN_LOW 16
206 #define LSCHL_GPIO_FAN_HIGH 14
207 #define LSCHL_GPIO_FAN_LOCK 6
209 static struct gpio_fan_alarm lschl_alarm = {
210 .gpio = LSCHL_GPIO_FAN_LOCK,
213 static struct gpio_fan_speed lschl_speeds[] = {
215 .rpm = 0,
216 .ctrl_val = 3,
217 }, {
218 .rpm = 1500,
219 .ctrl_val = 2,
220 }, {
221 .rpm = 3250,
222 .ctrl_val = 1,
223 }, {
224 .rpm = 5000,
225 .ctrl_val = 0,
229 static int lschl_gpio_list[] = {
230 LSCHL_GPIO_FAN_HIGH, LSCHL_GPIO_FAN_LOW,
233 static struct gpio_fan_platform_data lschl_fan_data = {
234 .num_ctrl = ARRAY_SIZE(lschl_gpio_list),
235 .ctrl = lschl_gpio_list,
236 .alarm = &lschl_alarm,
237 .num_speed = ARRAY_SIZE(lschl_speeds),
238 .speed = lschl_speeds,
241 static struct platform_device lschl_fan_device = {
242 .name = "gpio-fan",
243 .id = -1,
244 .num_resources = 0,
245 .dev = {
246 .platform_data = &lschl_fan_data,
250 /****************************************************************************
251 * GPIO Data
252 ****************************************************************************/
254 static struct orion5x_mpp_mode lschl_mpp_modes[] __initdata = {
255 { 0, MPP_GPIO }, /* LED POWER */
256 { 1, MPP_GPIO }, /* HDD POWER */
257 { 2, MPP_GPIO }, /* LED ALARM */
258 { 3, MPP_GPIO }, /* LED INFO */
259 { 4, MPP_UNUSED },
260 { 5, MPP_UNUSED },
261 { 6, MPP_GPIO }, /* FAN LOCK */
262 { 7, MPP_GPIO }, /* SW INIT */
263 { 8, MPP_GPIO }, /* SW POWER */
264 { 9, MPP_GPIO }, /* USB POWER */
265 { 10, MPP_GPIO }, /* SW AUTO POWER */
266 { 11, MPP_UNUSED },
267 { 12, MPP_UNUSED },
268 { 13, MPP_UNUSED },
269 { 14, MPP_GPIO }, /* FAN HIGH */
270 { 15, MPP_GPIO }, /* SW FUNC */
271 { 16, MPP_GPIO }, /* FAN LOW */
272 { 17, MPP_GPIO }, /* LED FUNC */
273 { 18, MPP_UNUSED },
274 { 19, MPP_UNUSED },
275 { -1 },
278 static void __init lschl_init(void)
281 * Setup basic Orion functions. Needs to be called early.
283 orion5x_init();
285 orion5x_mpp_conf(lschl_mpp_modes);
288 * Configure peripherals.
290 orion5x_ehci0_init();
291 orion5x_ehci1_init();
292 orion5x_eth_init(&lschl_eth_data);
293 orion5x_i2c_init();
294 orion5x_sata_init(&lschl_sata_data);
295 orion5x_uart0_init();
296 orion5x_xor_init();
298 orion5x_setup_dev_boot_win(LSCHL_NOR_BOOT_BASE,
299 LSCHL_NOR_BOOT_SIZE);
300 platform_device_register(&lschl_nor_flash);
302 platform_device_register(&lschl_leds);
304 platform_device_register(&lschl_button_device);
306 platform_device_register(&lschl_fan_device);
308 i2c_register_board_info(0, &lschl_i2c_rtc, 1);
310 /* usb power on */
311 gpio_set_value(LSCHL_GPIO_USB_POWER, 1);
313 /* register power-off method */
314 pm_power_off = lschl_power_off;
316 pr_info("%s: finished\n", __func__);
319 MACHINE_START(LINKSTATION_LSCHL, "Buffalo Linkstation LiveV3 (LS-CHL)")
320 /* Maintainer: Ash Hughes <ashley.hughes@blueyonder.co.uk> */
321 .boot_params = 0x00000100,
322 .init_machine = lschl_init,
323 .map_io = orion5x_map_io,
324 .init_early = orion5x_init_early,
325 .init_irq = orion5x_init_irq,
326 .timer = &orion5x_timer,
327 .fixup = tag_fixup_mem32,
328 MACHINE_END