aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ixp4xx/nslu2-setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-ixp4xx/nslu2-setup.c')
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c51
1 files changed, 45 insertions, 6 deletions
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index fd9ec17c8b86..acaebcbce53a 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -3,22 +3,26 @@
3 * 3 *
4 * NSLU2 board-setup 4 * NSLU2 board-setup
5 * 5 *
6 * based ixdp425-setup.c: 6 * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au>
7 *
8 * based on ixdp425-setup.c:
7 * Copyright (C) 2003-2004 MontaVista Software, Inc. 9 * Copyright (C) 2003-2004 MontaVista Software, Inc.
10 * based on nslu2-power.c:
11 * Copyright (C) 2005 Tower Technologies
8 * 12 *
9 * Author: Mark Rakes <mrakes at mac.com> 13 * Author: Mark Rakes <mrakes at mac.com>
10 * Author: Rod Whitby <rod@whitby.id.au> 14 * Author: Rod Whitby <rod@whitby.id.au>
15 * Author: Alessandro Zummo <a.zummo@towertech.it>
11 * Maintainers: http://www.nslu2-linux.org/ 16 * Maintainers: http://www.nslu2-linux.org/
12 * 17 *
13 * Fixed missing init_time in MACHINE_START kas11 10/22/04
14 * Changed to conform to new style __init ixdp425 kas11 10/22/04
15 */ 18 */
16 19
17#include <linux/if_ether.h> 20#include <linux/if_ether.h>
18#include <linux/kernel.h> 21#include <linux/irq.h>
19#include <linux/serial.h> 22#include <linux/serial.h>
20#include <linux/serial_8250.h> 23#include <linux/serial_8250.h>
21#include <linux/leds.h> 24#include <linux/leds.h>
25#include <linux/reboot.h>
22#include <linux/i2c.h> 26#include <linux/i2c.h>
23#include <linux/i2c-gpio.h> 27#include <linux/i2c-gpio.h>
24 28
@@ -27,6 +31,7 @@
27#include <asm/mach/flash.h> 31#include <asm/mach/flash.h>
28#include <asm/mach/time.h> 32#include <asm/mach/time.h>
29#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/gpio.h>
30 35
31static struct flash_platform_data nslu2_flash_data = { 36static struct flash_platform_data nslu2_flash_data = {
32 .map_name = "cfi_probe", 37 .map_name = "cfi_probe",
@@ -181,6 +186,25 @@ static void nslu2_power_off(void)
181 gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH); 186 gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH);
182} 187}
183 188
189static irqreturn_t nslu2_power_handler(int irq, void *dev_id)
190{
191 /* Signal init to do the ctrlaltdel action, this will bypass init if
192 * it hasn't started and do a kernel_restart.
193 */
194 ctrl_alt_del();
195
196 return IRQ_HANDLED;
197}
198
199static irqreturn_t nslu2_reset_handler(int irq, void *dev_id)
200{
201 /* This is the paper-clip reset, it shuts the machine down directly.
202 */
203 machine_power_off();
204
205 return IRQ_HANDLED;
206}
207
184static void __init nslu2_timer_init(void) 208static void __init nslu2_timer_init(void)
185{ 209{
186 /* The xtal on this machine is non-standard. */ 210 /* The xtal on this machine is non-standard. */
@@ -206,8 +230,6 @@ static void __init nslu2_init(void)
206 nslu2_flash_resource.end = 230 nslu2_flash_resource.end =
207 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; 231 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
208 232
209 pm_power_off = nslu2_power_off;
210
211 i2c_register_board_info(0, nslu2_i2c_board_info, 233 i2c_register_board_info(0, nslu2_i2c_board_info,
212 ARRAY_SIZE(nslu2_i2c_board_info)); 234 ARRAY_SIZE(nslu2_i2c_board_info));
213 235
@@ -220,6 +242,23 @@ static void __init nslu2_init(void)
220 242
221 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices)); 243 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
222 244
245 pm_power_off = nslu2_power_off;
246
247 if (request_irq(gpio_to_irq(NSLU2_RB_GPIO), &nslu2_reset_handler,
248 IRQF_DISABLED | IRQF_TRIGGER_LOW,
249 "NSLU2 reset button", NULL) < 0) {
250
251 printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
252 gpio_to_irq(NSLU2_RB_GPIO));
253 }
254
255 if (request_irq(gpio_to_irq(NSLU2_PB_GPIO), &nslu2_power_handler,
256 IRQF_DISABLED | IRQF_TRIGGER_HIGH,
257 "NSLU2 power button", NULL) < 0) {
258
259 printk(KERN_DEBUG "Power Button IRQ %d not available\n",
260 gpio_to_irq(NSLU2_PB_GPIO));
261 }
223 262
224 /* 263 /*
225 * Map in a portion of the flash and read the MAC address. 264 * Map in a portion of the flash and read the MAC address.