[ARM] 4809/2: ixp4xx: Merge dsmg600-power.c into dsmg600-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 43816bcb c7d1623e

+88 -135
+1 -1
arch/arm/mach-ixp4xx/Makefile
··· 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 31
··· 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 29 obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o 30 obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o 31
-129
arch/arm/mach-ixp4xx/dsmg600-power.c
··· 1 - /* 2 - * arch/arm/mach-ixp4xx/dsmg600-power.c 3 - * 4 - * DSM-G600 Power/Reset driver 5 - * Author: Michael Westerhof <mwester@dls.net> 6 - * 7 - * Based on nslu2-power.c 8 - * Copyright (C) 2005 Tower Technologies 9 - * Author: Alessandro Zummo <a.zummo@towertech.it> 10 - * 11 - * which was based on nslu2-io.c 12 - * Copyright (C) 2004 Karen Spearel 13 - * 14 - * Maintainers: http://www.nslu2-linux.org/ 15 - * 16 - * This program is free software; you can redistribute it and/or modify 17 - * it under the terms of the GNU General Public License version 2 as 18 - * published by the Free Software Foundation. 19 - * 20 - */ 21 - 22 - #include <linux/module.h> 23 - #include <linux/reboot.h> 24 - #include <linux/interrupt.h> 25 - #include <linux/irq.h> 26 - #include <linux/jiffies.h> 27 - #include <linux/timer.h> 28 - 29 - #include <asm/gpio.h> 30 - #include <asm/mach-types.h> 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 int power_button_countdown; 36 - 37 - /* Must hold the button down for at least this many counts to be processed */ 38 - #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ 39 - 40 - static void dsmg600_power_handler(unsigned long data); 41 - static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0); 42 - 43 - static void dsmg600_power_handler(unsigned long data) 44 - { 45 - /* This routine is called twice per second to check the 46 - * state of the power button. 47 - */ 48 - 49 - if (gpio_get_value(DSMG600_PB_GPIO)) { 50 - 51 - /* IO Pin is 1 (button pushed) */ 52 - if (power_button_countdown > 0) 53 - power_button_countdown--; 54 - 55 - } else { 56 - 57 - /* Done on button release, to allow for auto-power-on mods. */ 58 - if (power_button_countdown == 0) { 59 - /* Signal init to do the ctrlaltdel action, 60 - * this will bypass init if it hasn't started 61 - * and do a kernel_restart. 62 - */ 63 - ctrl_alt_del(); 64 - 65 - /* Change the state of the power LED to "blink" */ 66 - gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW); 67 - } else { 68 - power_button_countdown = PBUTTON_HOLDDOWN_COUNT; 69 - } 70 - } 71 - 72 - mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500)); 73 - } 74 - 75 - static irqreturn_t dsmg600_reset_handler(int irq, void *dev_id) 76 - { 77 - /* This is the paper-clip reset, it shuts the machine down directly. */ 78 - machine_power_off(); 79 - 80 - return IRQ_HANDLED; 81 - } 82 - 83 - static int __init dsmg600_power_init(void) 84 - { 85 - if (!(machine_is_dsmg600())) 86 - return 0; 87 - 88 - if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler, 89 - IRQF_DISABLED | IRQF_TRIGGER_LOW, "DSM-G600 reset button", 90 - NULL) < 0) { 91 - 92 - printk(KERN_DEBUG "Reset Button IRQ %d not available\n", 93 - gpio_to_irq(DSMG600_RB_GPIO)); 94 - 95 - return -EIO; 96 - } 97 - 98 - /* The power button on the D-Link DSM-G600 is on GPIO 15, but 99 - * it cannot handle interrupts on that GPIO line. So we'll 100 - * have to poll it with a kernel timer. 101 - */ 102 - 103 - /* Make sure that the power button GPIO is set up as an input */ 104 - gpio_line_config(DSMG600_PB_GPIO, IXP4XX_GPIO_IN); 105 - 106 - /* Set the initial value for the power button IRQ handler */ 107 - power_button_countdown = PBUTTON_HOLDDOWN_COUNT; 108 - 109 - mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500)); 110 - 111 - return 0; 112 - } 113 - 114 - static void __exit dsmg600_power_exit(void) 115 - { 116 - if (!(machine_is_dsmg600())) 117 - return; 118 - 119 - del_timer_sync(&dsmg600_power_timer); 120 - 121 - free_irq(gpio_to_irq(DSMG600_RB_GPIO), NULL); 122 - } 123 - 124 - module_init(dsmg600_power_init); 125 - module_exit(dsmg600_power_exit); 126 - 127 - MODULE_AUTHOR("Michael Westerhof <mwester@dls.net>"); 128 - MODULE_DESCRIPTION("DSM-G600 Power/Reset driver"); 129 - MODULE_LICENSE("GPL");
···
+87 -5
arch/arm/mach-ixp4xx/dsmg600-setup.c
··· 1 /* 2 * DSM-G600 board-setup 3 * 4 * Copyright (C) 2006 Tower Technologies 5 - * Author: Alessandro Zummo <a.zummo@towertech.it> 6 * 7 - * based ixdp425-setup.c: 8 * Copyright (C) 2003-2004 MontaVista Software, Inc. 9 * 10 * Author: Alessandro Zummo <a.zummo@towertech.it> 11 * Maintainers: http://www.nslu2-linux.org/ 12 */ 13 14 - #include <linux/kernel.h> 15 #include <linux/serial.h> 16 #include <linux/serial_8250.h> 17 #include <linux/leds.h> 18 #include <linux/i2c.h> 19 #include <linux/i2c-gpio.h> 20 ··· 31 #include <asm/mach/arch.h> 32 #include <asm/mach/flash.h> 33 #include <asm/mach/time.h> 34 35 static struct flash_platform_data dsmg600_flash_data = { 36 .map_name = "cfi_probe", ··· 150 gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH); 151 } 152 153 static void __init dsmg600_timer_init(void) 154 { 155 /* The xtal on this machine is non-standard. */ ··· 225 dsmg600_flash_resource.end = 226 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; 227 228 - pm_power_off = dsmg600_power_off; 229 - 230 i2c_register_board_info(0, dsmg600_i2c_board_info, 231 ARRAY_SIZE(dsmg600_i2c_board_info)); 232 ··· 235 (void)platform_device_register(&dsmg600_uart); 236 237 platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices)); 238 } 239 240 MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
··· 1 /* 2 * DSM-G600 board-setup 3 * 4 + * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au> 5 * Copyright (C) 2006 Tower Technologies 6 * 7 + * based on ixdp425-setup.c: 8 * Copyright (C) 2003-2004 MontaVista Software, Inc. 9 + * based on nslu2-power.c: 10 + * Copyright (C) 2005 Tower Technologies 11 + * based on nslu2-io.c: 12 + * Copyright (C) 2004 Karen Spearel 13 * 14 * Author: Alessandro Zummo <a.zummo@towertech.it> 15 + * Author: Michael Westerhof <mwester@dls.net> 16 + * Author: Rod Whitby <rod@whitby.id.au> 17 * Maintainers: http://www.nslu2-linux.org/ 18 */ 19 20 + #include <linux/irq.h> 21 + #include <linux/jiffies.h> 22 + #include <linux/timer.h> 23 #include <linux/serial.h> 24 #include <linux/serial_8250.h> 25 #include <linux/leds.h> 26 + #include <linux/reboot.h> 27 #include <linux/i2c.h> 28 #include <linux/i2c-gpio.h> 29 ··· 22 #include <asm/mach/arch.h> 23 #include <asm/mach/flash.h> 24 #include <asm/mach/time.h> 25 + #include <asm/gpio.h> 26 27 static struct flash_platform_data dsmg600_flash_data = { 28 .map_name = "cfi_probe", ··· 140 gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH); 141 } 142 143 + /* This is used to make sure the power-button pusher is serious. The button 144 + * must be held until the value of this counter reaches zero. 145 + */ 146 + static int power_button_countdown; 147 + 148 + /* Must hold the button down for at least this many counts to be processed */ 149 + #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */ 150 + 151 + static void dsmg600_power_handler(unsigned long data); 152 + static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0); 153 + 154 + static void dsmg600_power_handler(unsigned long data) 155 + { 156 + /* This routine is called twice per second to check the 157 + * state of the power button. 158 + */ 159 + 160 + if (gpio_get_value(DSMG600_PB_GPIO)) { 161 + 162 + /* IO Pin is 1 (button pushed) */ 163 + if (power_button_countdown > 0) 164 + power_button_countdown--; 165 + 166 + } else { 167 + 168 + /* Done on button release, to allow for auto-power-on mods. */ 169 + if (power_button_countdown == 0) { 170 + /* Signal init to do the ctrlaltdel action, 171 + * this will bypass init if it hasn't started 172 + * and do a kernel_restart. 173 + */ 174 + ctrl_alt_del(); 175 + 176 + /* Change the state of the power LED to "blink" */ 177 + gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW); 178 + } else { 179 + power_button_countdown = PBUTTON_HOLDDOWN_COUNT; 180 + } 181 + } 182 + 183 + mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500)); 184 + } 185 + 186 + static irqreturn_t dsmg600_reset_handler(int irq, void *dev_id) 187 + { 188 + /* This is the paper-clip reset, it shuts the machine down directly. */ 189 + machine_power_off(); 190 + 191 + return IRQ_HANDLED; 192 + } 193 + 194 static void __init dsmg600_timer_init(void) 195 { 196 /* The xtal on this machine is non-standard. */ ··· 164 dsmg600_flash_resource.end = 165 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; 166 167 i2c_register_board_info(0, dsmg600_i2c_board_info, 168 ARRAY_SIZE(dsmg600_i2c_board_info)); 169 ··· 176 (void)platform_device_register(&dsmg600_uart); 177 178 platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices)); 179 + 180 + pm_power_off = dsmg600_power_off; 181 + 182 + if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler, 183 + IRQF_DISABLED | IRQF_TRIGGER_LOW, 184 + "DSM-G600 reset button", NULL) < 0) { 185 + 186 + printk(KERN_DEBUG "Reset Button IRQ %d not available\n", 187 + gpio_to_irq(DSMG600_RB_GPIO)); 188 + } 189 + 190 + /* The power button on the D-Link DSM-G600 is on GPIO 15, but 191 + * it cannot handle interrupts on that GPIO line. So we'll 192 + * have to poll it with a kernel timer. 193 + */ 194 + 195 + /* Make sure that the power button GPIO is set up as an input */ 196 + gpio_line_config(DSMG600_PB_GPIO, IXP4XX_GPIO_IN); 197 + 198 + /* Set the initial value for the power button IRQ handler */ 199 + power_button_countdown = PBUTTON_HOLDDOWN_COUNT; 200 + 201 + mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500)); 202 } 203 204 MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")