2006-01-05 01:17:11 +08:00
|
|
|
/*
|
|
|
|
* arch/arm/mach-ixp4xx/nas100d-power.c
|
|
|
|
*
|
|
|
|
* NAS 100d Power/Reset driver
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Tower Technologies
|
|
|
|
*
|
|
|
|
* based on nas100d-io.c
|
|
|
|
* Copyright (C) 2004 Karen Spearel
|
|
|
|
*
|
|
|
|
* Author: Alessandro Zummo <a.zummo@towertech.it>
|
|
|
|
* Maintainers: http://www.nslu2-linux.org/
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/interrupt.h>
|
2006-07-02 06:01:49 +08:00
|
|
|
#include <linux/irq.h>
|
|
|
|
#include <linux/module.h>
|
2006-06-25 20:47:41 +08:00
|
|
|
#include <linux/reboot.h>
|
2006-01-05 01:17:11 +08:00
|
|
|
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
|
2006-10-07 01:53:39 +08:00
|
|
|
static irqreturn_t nas100d_reset_handler(int irq, void *dev_id)
|
2006-01-05 01:17:11 +08:00
|
|
|
{
|
|
|
|
/* Signal init to do the ctrlaltdel action, this will bypass init if
|
|
|
|
* it hasn't started and do a kernel_restart.
|
|
|
|
*/
|
|
|
|
ctrl_alt_del();
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int __init nas100d_power_init(void)
|
|
|
|
{
|
|
|
|
if (!(machine_is_nas100d()))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
set_irq_type(NAS100D_RB_IRQ, IRQT_LOW);
|
|
|
|
|
|
|
|
if (request_irq(NAS100D_RB_IRQ, &nas100d_reset_handler,
|
2006-07-03 08:20:05 +08:00
|
|
|
IRQF_DISABLED, "NAS100D reset button", NULL) < 0) {
|
2006-01-05 01:17:11 +08:00
|
|
|
|
|
|
|
printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
|
|
|
|
NAS100D_RB_IRQ);
|
|
|
|
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit nas100d_power_exit(void)
|
|
|
|
{
|
2006-03-08 06:48:29 +08:00
|
|
|
if (!(machine_is_nas100d()))
|
|
|
|
return;
|
|
|
|
|
2006-01-05 01:17:11 +08:00
|
|
|
free_irq(NAS100D_RB_IRQ, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
module_init(nas100d_power_init);
|
|
|
|
module_exit(nas100d_power_exit);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
|
|
|
|
MODULE_DESCRIPTION("NAS100D Power/Reset driver");
|
|
|
|
MODULE_LICENSE("GPL");
|