[ARM] 4808/2: ixp4xx: Merge nas100d-power.c into nas100d-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 and remove
superfluous header includes.

--

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 c7d1623e 0929ac3e

+87 -133
+1 -1
arch/arm/mach-ixp4xx/Makefile
··· 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 30 obj-$(CONFIG_MACH_WG302V2) += wg302v2-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 28 obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o 29 obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o 30 obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o
-128
arch/arm/mach-ixp4xx/nas100d-power.c
··· 1 - /* 2 - * arch/arm/mach-ixp4xx/nas100d-power.c 3 - * 4 - * NAS 100d Power/Reset driver 5 - * 6 - * Copyright (C) 2005 Tower Technologies 7 - * 8 - * based on nas100d-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/interrupt.h> 21 - #include <linux/irq.h> 22 - #include <linux/module.h> 23 - #include <linux/reboot.h> 24 - #include <linux/jiffies.h> 25 - #include <linux/timer.h> 26 - 27 - #include <asm/gpio.h> 28 - #include <asm/mach-types.h> 29 - 30 - /* This is used to make sure the power-button pusher is serious. The button 31 - * must be held until the value of this counter reaches zero. 32 - */ 33 - static int power_button_countdown; 34 - 35 - /* Must hold the button down for at least this many counts to be processed */ 36 - #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ 37 - 38 - static void nas100d_power_handler(unsigned long data); 39 - static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0); 40 - 41 - static void nas100d_power_handler(unsigned long data) 42 - { 43 - /* This routine is called twice per second to check the 44 - * state of the power button. 45 - */ 46 - 47 - if (gpio_get_value(NAS100D_PB_GPIO)) { 48 - 49 - /* IO Pin is 1 (button pushed) */ 50 - if (power_button_countdown > 0) 51 - power_button_countdown--; 52 - 53 - } else { 54 - 55 - /* Done on button release, to allow for auto-power-on mods. */ 56 - if (power_button_countdown == 0) { 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(NAS100D_LED_PWR_GPIO, IXP4XX_GPIO_LOW); 65 - } else { 66 - power_button_countdown = PBUTTON_HOLDDOWN_COUNT; 67 - } 68 - } 69 - 70 - mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500)); 71 - } 72 - 73 - static irqreturn_t nas100d_reset_handler(int irq, void *dev_id) 74 - { 75 - /* This is the paper-clip reset, it shuts the machine down directly. */ 76 - machine_power_off(); 77 - 78 - return IRQ_HANDLED; 79 - } 80 - 81 - static int __init nas100d_power_init(void) 82 - { 83 - if (!(machine_is_nas100d())) 84 - return 0; 85 - 86 - set_irq_type(gpio_to_irq(NAS100D_RB_GPIO), IRQT_LOW); 87 - 88 - if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler, 89 - IRQF_DISABLED, "NAS100D reset button", NULL) < 0) { 90 - 91 - printk(KERN_DEBUG "Reset Button IRQ %d not available\n", 92 - gpio_to_irq(NAS100D_RB_GPIO)); 93 - 94 - return -EIO; 95 - } 96 - 97 - /* The power button on the Iomega NAS100d is on GPIO 14, but 98 - * it cannot handle interrupts on that GPIO line. So we'll 99 - * have to poll it with a kernel timer. 100 - */ 101 - 102 - /* Make sure that the power button GPIO is set up as an input */ 103 - gpio_line_config(NAS100D_PB_GPIO, IXP4XX_GPIO_IN); 104 - 105 - /* Set the initial value for the power button IRQ handler */ 106 - power_button_countdown = PBUTTON_HOLDDOWN_COUNT; 107 - 108 - mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500)); 109 - 110 - return 0; 111 - } 112 - 113 - static void __exit nas100d_power_exit(void) 114 - { 115 - if (!(machine_is_nas100d())) 116 - return; 117 - 118 - del_timer_sync(&nas100d_power_timer); 119 - 120 - free_irq(gpio_to_irq(NAS100D_RB_GPIO), NULL); 121 - } 122 - 123 - module_init(nas100d_power_init); 124 - module_exit(nas100d_power_exit); 125 - 126 - MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); 127 - MODULE_DESCRIPTION("NAS100D Power/Reset driver"); 128 - MODULE_LICENSE("GPL");
···
+86 -4
arch/arm/mach-ixp4xx/nas100d-setup.c
··· 3 * 4 * NAS 100d board-setup 5 * 6 - * based ixdp425-setup.c: 7 * Copyright (C) 2003-2004 MontaVista Software, Inc. 8 * 9 * Author: Alessandro Zummo <a.zummo@towertech.it> 10 * Author: Rod Whitby <rod@whitby.id.au> ··· 19 */ 20 21 #include <linux/if_ether.h> 22 - #include <linux/kernel.h> 23 #include <linux/serial.h> 24 #include <linux/serial_8250.h> 25 #include <linux/leds.h> 26 #include <linux/i2c.h> 27 #include <linux/i2c-gpio.h> 28 ··· 33 #include <asm/mach/arch.h> 34 #include <asm/mach/flash.h> 35 #include <asm/io.h> 36 37 static struct flash_platform_data nas100d_flash_data = { 38 .map_name = "cfi_probe", ··· 178 gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH); 179 } 180 181 static void __init nas100d_init(void) 182 { 183 DECLARE_MAC_BUF(mac_buf); ··· 244 nas100d_flash_resource.end = 245 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; 246 247 - pm_power_off = nas100d_power_off; 248 - 249 i2c_register_board_info(0, nas100d_i2c_board_info, 250 ARRAY_SIZE(nas100d_i2c_board_info)); 251 ··· 255 (void)platform_device_register(&nas100d_uart); 256 257 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices)); 258 259 /* 260 * Map in a portion of the flash and read the MAC address.
··· 3 * 4 * NAS 100d 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 nas100d-power.c: 11 + * Copyright (C) 2005 Tower Technologies 12 + * based on nas100d-io.c 13 + * Copyright (C) 2004 Karen Spearel 14 * 15 * Author: Alessandro Zummo <a.zummo@towertech.it> 16 * Author: Rod Whitby <rod@whitby.id.au> ··· 13 */ 14 15 #include <linux/if_ether.h> 16 + #include <linux/irq.h> 17 + #include <linux/jiffies.h> 18 + #include <linux/timer.h> 19 #include <linux/serial.h> 20 #include <linux/serial_8250.h> 21 #include <linux/leds.h> 22 + #include <linux/reboot.h> 23 #include <linux/i2c.h> 24 #include <linux/i2c-gpio.h> 25 ··· 24 #include <asm/mach/arch.h> 25 #include <asm/mach/flash.h> 26 #include <asm/io.h> 27 + #include <asm/gpio.h> 28 29 static struct flash_platform_data nas100d_flash_data = { 30 .map_name = "cfi_probe", ··· 168 gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH); 169 } 170 171 + /* This is used to make sure the power-button pusher is serious. The button 172 + * must be held until the value of this counter reaches zero. 173 + */ 174 + static int power_button_countdown; 175 + 176 + /* Must hold the button down for at least this many counts to be processed */ 177 + #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ 178 + 179 + static void nas100d_power_handler(unsigned long data); 180 + static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0); 181 + 182 + static void nas100d_power_handler(unsigned long data) 183 + { 184 + /* This routine is called twice per second to check the 185 + * state of the power button. 186 + */ 187 + 188 + if (gpio_get_value(NAS100D_PB_GPIO)) { 189 + 190 + /* IO Pin is 1 (button pushed) */ 191 + if (power_button_countdown > 0) 192 + power_button_countdown--; 193 + 194 + } else { 195 + 196 + /* Done on button release, to allow for auto-power-on mods. */ 197 + if (power_button_countdown == 0) { 198 + /* Signal init to do the ctrlaltdel action, 199 + * this will bypass init if it hasn't started 200 + * and do a kernel_restart. 201 + */ 202 + ctrl_alt_del(); 203 + 204 + /* Change the state of the power LED to "blink" */ 205 + gpio_line_set(NAS100D_LED_PWR_GPIO, IXP4XX_GPIO_LOW); 206 + } else { 207 + power_button_countdown = PBUTTON_HOLDDOWN_COUNT; 208 + } 209 + } 210 + 211 + mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500)); 212 + } 213 + 214 + static irqreturn_t nas100d_reset_handler(int irq, void *dev_id) 215 + { 216 + /* This is the paper-clip reset, it shuts the machine down directly. */ 217 + machine_power_off(); 218 + 219 + return IRQ_HANDLED; 220 + } 221 + 222 static void __init nas100d_init(void) 223 { 224 DECLARE_MAC_BUF(mac_buf); ··· 183 nas100d_flash_resource.end = 184 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; 185 186 i2c_register_board_info(0, nas100d_i2c_board_info, 187 ARRAY_SIZE(nas100d_i2c_board_info)); 188 ··· 196 (void)platform_device_register(&nas100d_uart); 197 198 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices)); 199 + 200 + pm_power_off = nas100d_power_off; 201 + 202 + if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler, 203 + IRQF_DISABLED | IRQF_TRIGGER_LOW, 204 + "NAS100D reset button", NULL) < 0) { 205 + 206 + printk(KERN_DEBUG "Reset Button IRQ %d not available\n", 207 + gpio_to_irq(NAS100D_RB_GPIO)); 208 + } 209 + 210 + /* The power button on the Iomega NAS100d is on GPIO 14, but 211 + * it cannot handle interrupts on that GPIO line. So we'll 212 + * have to poll it with a kernel timer. 213 + */ 214 + 215 + /* Make sure that the power button GPIO is set up as an input */ 216 + gpio_line_config(NAS100D_PB_GPIO, IXP4XX_GPIO_IN); 217 + 218 + /* Set the initial value for the power button IRQ handler */ 219 + power_button_countdown = PBUTTON_HOLDDOWN_COUNT; 220 + 221 + mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500)); 222 223 /* 224 * Map in a portion of the flash and read the MAC address.