[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>

authored by Rod Whitby and committed by Russell King 0929ac3e b7edc84a

+48 -117
+1 -1
arch/arm/mach-ixp4xx/Makefile
··· 23 obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o 24 obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o 25 obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o 26 - obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o 27 obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o 28 obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o 29 obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
··· 23 obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o 24 obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o 25 obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o 26 + obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o 27 obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o 28 obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o 29 obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
-91
arch/arm/mach-ixp4xx/nslu2-power.c
··· 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");
···
+45 -6
arch/arm/mach-ixp4xx/nslu2-setup.c
··· 3 * 4 * NSLU2 board-setup 5 * 6 - * based ixdp425-setup.c: 7 * Copyright (C) 2003-2004 MontaVista Software, Inc. 8 * 9 * Author: Mark Rakes <mrakes at mac.com> 10 * Author: Rod Whitby <rod@whitby.id.au> 11 * Maintainers: http://www.nslu2-linux.org/ 12 * 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 */ 16 17 #include <linux/if_ether.h> 18 - #include <linux/kernel.h> 19 #include <linux/serial.h> 20 #include <linux/serial_8250.h> 21 #include <linux/leds.h> 22 #include <linux/i2c.h> 23 #include <linux/i2c-gpio.h> 24 ··· 31 #include <asm/mach/flash.h> 32 #include <asm/mach/time.h> 33 #include <asm/io.h> 34 35 static struct flash_platform_data nslu2_flash_data = { 36 .map_name = "cfi_probe", ··· 186 gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH); 187 } 188 189 static void __init nslu2_timer_init(void) 190 { 191 /* The xtal on this machine is non-standard. */ ··· 230 nslu2_flash_resource.end = 231 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; 232 233 - pm_power_off = nslu2_power_off; 234 - 235 i2c_register_board_info(0, nslu2_i2c_board_info, 236 ARRAY_SIZE(nslu2_i2c_board_info)); 237 ··· 242 243 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices)); 244 245 246 /* 247 * Map in a portion of the flash and read the MAC address.
··· 3 * 4 * NSLU2 board-setup 5 * 6 + * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au> 7 + * 8 + * based on ixdp425-setup.c: 9 * Copyright (C) 2003-2004 MontaVista Software, Inc. 10 + * based on nslu2-power.c: 11 + * Copyright (C) 2005 Tower Technologies 12 * 13 * Author: Mark Rakes <mrakes at mac.com> 14 * Author: Rod Whitby <rod@whitby.id.au> 15 + * Author: Alessandro Zummo <a.zummo@towertech.it> 16 * Maintainers: http://www.nslu2-linux.org/ 17 * 18 */ 19 20 #include <linux/if_ether.h> 21 + #include <linux/irq.h> 22 #include <linux/serial.h> 23 #include <linux/serial_8250.h> 24 #include <linux/leds.h> 25 + #include <linux/reboot.h> 26 #include <linux/i2c.h> 27 #include <linux/i2c-gpio.h> 28 ··· 27 #include <asm/mach/flash.h> 28 #include <asm/mach/time.h> 29 #include <asm/io.h> 30 + #include <asm/gpio.h> 31 32 static struct flash_platform_data nslu2_flash_data = { 33 .map_name = "cfi_probe", ··· 181 gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH); 182 } 183 184 + static irqreturn_t nslu2_power_handler(int irq, void *dev_id) 185 + { 186 + /* Signal init to do the ctrlaltdel action, this will bypass init if 187 + * it hasn't started and do a kernel_restart. 188 + */ 189 + ctrl_alt_del(); 190 + 191 + return IRQ_HANDLED; 192 + } 193 + 194 + static irqreturn_t nslu2_reset_handler(int irq, void *dev_id) 195 + { 196 + /* This is the paper-clip reset, it shuts the machine down directly. 197 + */ 198 + machine_power_off(); 199 + 200 + return IRQ_HANDLED; 201 + } 202 + 203 static void __init nslu2_timer_init(void) 204 { 205 /* The xtal on this machine is non-standard. */ ··· 206 nslu2_flash_resource.end = 207 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; 208 209 i2c_register_board_info(0, nslu2_i2c_board_info, 210 ARRAY_SIZE(nslu2_i2c_board_info)); 211 ··· 220 221 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices)); 222 223 + pm_power_off = nslu2_power_off; 224 + 225 + if (request_irq(gpio_to_irq(NSLU2_RB_GPIO), &nslu2_reset_handler, 226 + IRQF_DISABLED | IRQF_TRIGGER_LOW, 227 + "NSLU2 reset button", NULL) < 0) { 228 + 229 + printk(KERN_DEBUG "Reset Button IRQ %d not available\n", 230 + gpio_to_irq(NSLU2_RB_GPIO)); 231 + } 232 + 233 + if (request_irq(gpio_to_irq(NSLU2_PB_GPIO), &nslu2_power_handler, 234 + IRQF_DISABLED | IRQF_TRIGGER_HIGH, 235 + "NSLU2 power button", NULL) < 0) { 236 + 237 + printk(KERN_DEBUG "Power Button IRQ %d not available\n", 238 + gpio_to_irq(NSLU2_PB_GPIO)); 239 + } 240 241 /* 242 * Map in a portion of the flash and read the MAC address.
+2 -19
include/asm-arm/arch-ixp4xx/nslu2.h
··· 39 40 /* Buttons */ 41 42 - #define NSLU2_PB_GPIO 5 43 #define NSLU2_PO_GPIO 8 /* power off */ 44 - #define NSLU2_RB_GPIO 12 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 53 /* Buzzer */ 54 55 #define NSLU2_GPIO_BUZZ 4 56 - #define NSLU2_BZ_BM (1L << NSLU2_GPIO_BUZZ) 57 58 /* LEDs */ 59 60 #define NSLU2_LED_RED_GPIO 0 61 #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 67 #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 -
··· 39 40 /* Buttons */ 41 42 + #define NSLU2_PB_GPIO 5 /* power button */ 43 #define NSLU2_PO_GPIO 8 /* power off */ 44 + #define NSLU2_RB_GPIO 12 /* reset button */ 45 46 /* Buzzer */ 47 48 #define NSLU2_GPIO_BUZZ 4 49 50 /* LEDs */ 51 52 #define NSLU2_LED_RED_GPIO 0 53 #define NSLU2_LED_GRN_GPIO 1 54 #define NSLU2_LED_DISK1_GPIO 3 55 #define NSLU2_LED_DISK2_GPIO 2