update config, make 2.6.26-rc8 the default for ixp4xx
[openwrt.git] / target / linux / ixp4xx / patches-2.6.24 / 016-dsmg600_auto_power_on.patch
1 From 67e494e3e03ef807255f084800d8658b89ff5fec Mon Sep 17 00:00:00 2001
2 From: Rod Whitby <rod@whitby.id.au>
3 Date: Tue, 29 Jan 2008 10:00:25 +1030
4 Subject: ixp4xx: Button updates for the dsmg600 board (Patch #4769)
5
6 * Remove the superfluous declaration of ctrl_alt_del().
7 * Convert GPIO and IRQ handling to use the <asm/gpio.h> api.
8 * Perform the reset on the release of the power button, so that
9 NAS devices which have been set to auto-power-on (by solder
10 bridging the power button) do not continuously power cycle.
11 * Remove all superflous constants from dsmg600.h
12
13 Signed-off-by: Rod Whitby <rod@whitby.id.au>
14 Acked-by: Lennert Buytenhek <buytenh@wantstofly.org>
15
16 PATCH FOLLOWS
17 KernelVersion: 2.6.24-git5
18
19 Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-power.c
20 ===================================================================
21 --- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/dsmg600-power.c
22 +++ linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-power.c
23 @@ -26,14 +26,13 @@
24 #include <linux/jiffies.h>
25 #include <linux/timer.h>
26
27 +#include <asm/gpio.h>
28 #include <asm/mach-types.h>
29
30 -extern void ctrl_alt_del(void);
31 -
32 /* This is used to make sure the power-button pusher is serious. The button
33 * must be held until the value of this counter reaches zero.
34 */
35 -static volatile int power_button_countdown;
36 +static int power_button_countdown;
37
38 /* Must hold the button down for at least this many counts to be processed */
39 #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
40 @@ -47,22 +46,27 @@ static void dsmg600_power_handler(unsign
41 * state of the power button.
42 */
43
44 - if (*IXP4XX_GPIO_GPINR & DSMG600_PB_BM) {
45 + if (gpio_get_value(DSMG600_PB_GPIO)) {
46
47 /* IO Pin is 1 (button pushed) */
48 + if (power_button_countdown > 0)
49 + power_button_countdown--;
50 +
51 + } else {
52 +
53 + /* Done on button release, to allow for auto-power-on mods. */
54 if (power_button_countdown == 0) {
55 - /* Signal init to do the ctrlaltdel action, this will bypass
56 - * init if it hasn't started and do a kernel_restart.
57 + /* Signal init to do the ctrlaltdel action,
58 + * this will bypass init if it hasn't started
59 + * and do a kernel_restart.
60 */
61 ctrl_alt_del();
62
63 /* Change the state of the power LED to "blink" */
64 gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW);
65 + } else {
66 + power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
67 }
68 - power_button_countdown--;
69 -
70 - } else {
71 - power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
72 }
73
74 mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500));
75 @@ -81,12 +85,12 @@ static int __init dsmg600_power_init(voi
76 if (!(machine_is_dsmg600()))
77 return 0;
78
79 - if (request_irq(DSMG600_RB_IRQ, &dsmg600_reset_handler,
80 + if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler,
81 IRQF_DISABLED | IRQF_TRIGGER_LOW, "DSM-G600 reset button",
82 NULL) < 0) {
83
84 printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
85 - DSMG600_RB_IRQ);
86 + gpio_to_irq(DSMG600_RB_GPIO));
87
88 return -EIO;
89 }
90 @@ -114,7 +118,7 @@ static void __exit dsmg600_power_exit(vo
91
92 del_timer_sync(&dsmg600_power_timer);
93
94 - free_irq(DSMG600_RB_IRQ, NULL);
95 + free_irq(gpio_to_irq(DSMG600_RB_GPIO), NULL);
96 }
97
98 module_init(dsmg600_power_init);
99 Index: linux-2.6.24.7/include/asm-arm/arch-ixp4xx/dsmg600.h
100 ===================================================================
101 --- linux-2.6.24.7.orig/include/asm-arm/arch-ixp4xx/dsmg600.h
102 +++ linux-2.6.24.7/include/asm-arm/arch-ixp4xx/dsmg600.h
103 @@ -40,18 +40,13 @@
104 /* Buttons */
105
106 #define DSMG600_PB_GPIO 15 /* power button */
107 -#define DSMG600_PB_BM (1L << DSMG600_PB_GPIO)
108 -
109 #define DSMG600_RB_GPIO 3 /* reset button */
110
111 -#define DSMG600_RB_IRQ IRQ_IXP4XX_GPIO3
112 +/* Power control */
113
114 #define DSMG600_PO_GPIO 2 /* power off */
115
116 /* LEDs */
117
118 #define DSMG600_LED_PWR_GPIO 0
119 -#define DSMG600_LED_PWR_BM (1L << DSMG600_LED_PWR_GPIO)
120 -
121 #define DSMG600_LED_WLAN_GPIO 14
122 -#define DSMG600_LED_WLAN_BM (1L << DSMG600_LED_WLAN_GPIO)
This page took 0.043776 seconds and 5 git commands to generate.