aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRod Whitby <rod@whitby.id.au>2008-02-03 06:05:42 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-02-04 08:15:26 -0500
commit0929ac3ea4c0bece16b0c5c5365181fa45fbf582 (patch)
treeb3cd775d5aba4c536d95d9860f7fe9f80b827ed3 /arch
parentb7edc84a9619eb2c8bfb5265d4079da9c70ad270 (diff)
[ARM] 4807/2: ixp4xx: Merge nslu2-power.c into nslu2-setup.c
There is no reason to have power control in a separate file from the board setup code. Merge it back into the board setup file, removing superfluous header includes and removing superfluous constants from the machine header file. -- Signed-off-by: Rod Whitby <rod@whitby.id.au> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-ixp4xx/Makefile2
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-power.c91
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c51
3 files changed, 46 insertions, 98 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
23obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o 23obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o
24obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o 24obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o
25obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o 25obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o
26obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o 26obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o
27obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o 27obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o
28obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o 28obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o
29obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o 29obj-$(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
27static 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
37static 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
46static 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
77static 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
86module_init(nslu2_power_init);
87module_exit(nslu2_power_exit);
88
89MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
90MODULE_DESCRIPTION("NSLU2 Power/Reset driver");
91MODULE_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
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.