diff options
-rw-r--r-- | arch/arm/mach-ixp4xx/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/nslu2-power.c | 91 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/nslu2-setup.c | 51 | ||||
-rw-r--r-- | include/asm-arm/arch-ixp4xx/nslu2.h | 21 |
4 files changed, 48 insertions, 117 deletions
diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile index 4bb97e13f957..4fc7316191e9 100644 --- a/arch/arm/mach-ixp4xx/Makefile +++ b/arch/arm/mach-ixp4xx/Makefile | |||
@@ -23,7 +23,7 @@ obj-$(CONFIG_MACH_AVILA) += avila-setup.o | |||
23 | obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o | 23 | obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o |
24 | obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o | 24 | obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o |
25 | obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o | 25 | obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o |
26 | obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o | 26 | obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o |
27 | obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o | 27 | obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o |
28 | obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o | 28 | obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o |
29 | obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o | 29 | obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o |
diff --git a/arch/arm/mach-ixp4xx/nslu2-power.c b/arch/arm/mach-ixp4xx/nslu2-power.c deleted file mode 100644 index 6f10dc208320..000000000000 --- a/arch/arm/mach-ixp4xx/nslu2-power.c +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ixp4xx/nslu2-power.c | ||
3 | * | ||
4 | * NSLU2 Power/Reset driver | ||
5 | * | ||
6 | * Copyright (C) 2005 Tower Technologies | ||
7 | * | ||
8 | * based on nslu2-io.c | ||
9 | * Copyright (C) 2004 Karen Spearel | ||
10 | * | ||
11 | * Author: Alessandro Zummo <a.zummo@towertech.it> | ||
12 | * Maintainers: http://www.nslu2-linux.org/ | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License version 2 as | ||
16 | * published by the Free Software Foundation. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #include <linux/module.h> | ||
21 | #include <linux/reboot.h> | ||
22 | #include <linux/irq.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | |||
25 | #include <asm/mach-types.h> | ||
26 | |||
27 | static irqreturn_t nslu2_power_handler(int irq, void *dev_id) | ||
28 | { | ||
29 | /* Signal init to do the ctrlaltdel action, this will bypass init if | ||
30 | * it hasn't started and do a kernel_restart. | ||
31 | */ | ||
32 | ctrl_alt_del(); | ||
33 | |||
34 | return IRQ_HANDLED; | ||
35 | } | ||
36 | |||
37 | static irqreturn_t nslu2_reset_handler(int irq, void *dev_id) | ||
38 | { | ||
39 | /* This is the paper-clip reset, it shuts the machine down directly. | ||
40 | */ | ||
41 | machine_power_off(); | ||
42 | |||
43 | return IRQ_HANDLED; | ||
44 | } | ||
45 | |||
46 | static int __init nslu2_power_init(void) | ||
47 | { | ||
48 | if (!(machine_is_nslu2())) | ||
49 | return 0; | ||
50 | |||
51 | *IXP4XX_GPIO_GPISR = 0x20400000; /* read the 2 irqs to clr */ | ||
52 | |||
53 | set_irq_type(NSLU2_RB_IRQ, IRQT_LOW); | ||
54 | set_irq_type(NSLU2_PB_IRQ, IRQT_HIGH); | ||
55 | |||
56 | if (request_irq(NSLU2_RB_IRQ, &nslu2_reset_handler, | ||
57 | IRQF_DISABLED, "NSLU2 reset button", NULL) < 0) { | ||
58 | |||
59 | printk(KERN_DEBUG "Reset Button IRQ %d not available\n", | ||
60 | NSLU2_RB_IRQ); | ||
61 | |||
62 | return -EIO; | ||
63 | } | ||
64 | |||
65 | if (request_irq(NSLU2_PB_IRQ, &nslu2_power_handler, | ||
66 | IRQF_DISABLED, "NSLU2 power button", NULL) < 0) { | ||
67 | |||
68 | printk(KERN_DEBUG "Power Button IRQ %d not available\n", | ||
69 | NSLU2_PB_IRQ); | ||
70 | |||
71 | return -EIO; | ||
72 | } | ||
73 | |||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static void __exit nslu2_power_exit(void) | ||
78 | { | ||
79 | if (!(machine_is_nslu2())) | ||
80 | return; | ||
81 | |||
82 | free_irq(NSLU2_RB_IRQ, NULL); | ||
83 | free_irq(NSLU2_PB_IRQ, NULL); | ||
84 | } | ||
85 | |||
86 | module_init(nslu2_power_init); | ||
87 | module_exit(nslu2_power_exit); | ||
88 | |||
89 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); | ||
90 | MODULE_DESCRIPTION("NSLU2 Power/Reset driver"); | ||
91 | MODULE_LICENSE("GPL"); | ||
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 | ||
31 | static struct flash_platform_data nslu2_flash_data = { | 36 | static 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 | ||
189 | static 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 | |||
199 | static 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 | |||
184 | static void __init nslu2_timer_init(void) | 208 | static 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. |
diff --git a/include/asm-arm/arch-ixp4xx/nslu2.h b/include/asm-arm/arch-ixp4xx/nslu2.h index 850fdc5b45da..714bbc65126a 100644 --- a/include/asm-arm/arch-ixp4xx/nslu2.h +++ b/include/asm-arm/arch-ixp4xx/nslu2.h | |||
@@ -39,34 +39,17 @@ | |||
39 | 39 | ||
40 | /* Buttons */ | 40 | /* Buttons */ |
41 | 41 | ||
42 | #define NSLU2_PB_GPIO 5 | 42 | #define NSLU2_PB_GPIO 5 /* power button */ |
43 | #define NSLU2_PO_GPIO 8 /* power off */ | 43 | #define NSLU2_PO_GPIO 8 /* power off */ |
44 | #define NSLU2_RB_GPIO 12 | 44 | #define NSLU2_RB_GPIO 12 /* reset button */ |
45 | |||
46 | #define NSLU2_PB_IRQ IRQ_IXP4XX_GPIO5 | ||
47 | #define NSLU2_RB_IRQ IRQ_IXP4XX_GPIO12 | ||
48 | |||
49 | #define NSLU2_PB_BM (1L << NSLU2_PB_GPIO) | ||
50 | #define NSLU2_PO_BM (1L << NSLU2_PO_GPIO) | ||
51 | #define NSLU2_RB_BM (1L << NSLU2_RB_GPIO) | ||
52 | 45 | ||
53 | /* Buzzer */ | 46 | /* Buzzer */ |
54 | 47 | ||
55 | #define NSLU2_GPIO_BUZZ 4 | 48 | #define NSLU2_GPIO_BUZZ 4 |
56 | #define NSLU2_BZ_BM (1L << NSLU2_GPIO_BUZZ) | ||
57 | 49 | ||
58 | /* LEDs */ | 50 | /* LEDs */ |
59 | 51 | ||
60 | #define NSLU2_LED_RED_GPIO 0 | 52 | #define NSLU2_LED_RED_GPIO 0 |
61 | #define NSLU2_LED_GRN_GPIO 1 | 53 | #define NSLU2_LED_GRN_GPIO 1 |
62 | |||
63 | #define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED_GPIO) | ||
64 | #define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN_GPIO) | ||
65 | |||
66 | #define NSLU2_LED_DISK1_GPIO 3 | 54 | #define NSLU2_LED_DISK1_GPIO 3 |
67 | #define NSLU2_LED_DISK2_GPIO 2 | 55 | #define NSLU2_LED_DISK2_GPIO 2 |
68 | |||
69 | #define NSLU2_LED_DISK1_BM (1L << NSLU2_LED_DISK1_GPIO) | ||
70 | #define NSLU2_LED_DISK2_BM (1L << NSLU2_LED_DISK2_GPIO) | ||
71 | |||
72 | |||