summaryrefslogtreecommitdiff
path: root/packages/linux/ixp4xx-kernel/2.6.16/97-ds101-power.patch
blob: 3c309f35361c92e5fa3d588bcdccfe5d809b6333 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
diff -ruN linux-2.6.15.orig/arch/arm/mach-ixp4xx/ds101-power.c linux-2.6.15.new/arch/arm/mach-ixp4xx/ds101-power.c
--- linux-2.6.15.orig/arch/arm/mach-ixp4xx/ds101-power.c        1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15.new/arch/arm/mach-ixp4xx/ds101-power.c 2006-02-10 23:54:40.000000000 +0100
@@ -0,0 +1,71 @@
+/*
+ * arch/arm/mach-ixp4xx/ds101-power.c
+ *
+ * DS101 Power/Reset driver
+ *
+ * Copyright (C) 2005 Tower Technologies
+ *
+ * based on ds101-io.c
+ *  Copyright (C) 2004 Karen Spearel
+ *
+ * Author: Alessandro Zummo <a.zummo@towertech.it>
+ * Author: OEyvind Repvik <oyvind@repvik.org>
+ * 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/module.h>
+#include <linux/reboot.h>
+#include <linux/interrupt.h>
+
+#include <asm/mach-types.h>
+
+extern void ctrl_alt_del(void);
+
+static irqreturn_t ds101_reset_handler(int irq, void *dev_id, struct pt_regs *regs)
+{
+       /* 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 ds101_power_init(void)
+{
+       if (!(machine_is_ds101()))
+               return 0;
+
+       set_irq_type(DS101_RB_IRQ, IRQT_LOW);
+
+       if (request_irq(DS101_RB_IRQ, &ds101_reset_handler,
+               SA_INTERRUPT, "DS101 reset button", NULL) < 0) {
+
+               printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
+                       DS101_RB_IRQ);
+
+               return -EIO;
+       }
+
+       return 0;
+}
+
+static void __exit ds101_power_exit(void)
+{
+       if (!(machine_is_ds101()))
+               return;
+
+       free_irq(DS101_RB_IRQ, NULL);
+}
+
+module_init(ds101_power_init);
+module_exit(ds101_power_exit);
+
+MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
+MODULE_DESCRIPTION("DS101 Power/Reset driver");
+MODULE_LICENSE("GPL");