aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2014-01-29 09:20:15 -0500
committerOlof Johansson <olof@lixom.net>2014-01-31 17:58:53 -0500
commitafbf1e156c1c17eccd4b2092ba4fed09279c5ccc (patch)
tree537e94fecd35da91ecc763cdd770a89af0b4d6d4 /arch/arm
parent608914b37688d9a67be8b6dfc216f24d95298502 (diff)
ARM: iop32x: fix power off handling for the EM7210 board
This board was missed when converting all the others to proper abstracted GPIO handling. Fix it up the right way by requesting and driving GPIO line 0 high through gpiolib to power off the machine. Cc: Arnaud Patard <arnaud.patard@rtp-net.org> Reported-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-iop32x/em7210.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/arch/arm/mach-iop32x/em7210.c b/arch/arm/mach-iop32x/em7210.c
index 177cd073a83b..77e1ff057303 100644
--- a/arch/arm/mach-iop32x/em7210.c
+++ b/arch/arm/mach-iop32x/em7210.c
@@ -23,6 +23,7 @@
23#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/gpio.h>
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27#include <linux/io.h> 28#include <linux/io.h>
28#include <linux/irq.h> 29#include <linux/irq.h>
@@ -176,11 +177,35 @@ static struct platform_device em7210_serial_device = {
176 .resource = &em7210_uart_resource, 177 .resource = &em7210_uart_resource,
177}; 178};
178 179
180#define EM7210_HARDWARE_POWER 0
181
179void em7210_power_off(void) 182void em7210_power_off(void)
180{ 183{
181 *IOP3XX_GPOE &= 0xfe; 184 int ret;
182 *IOP3XX_GPOD |= 0x01; 185
186 ret = gpio_direction_output(EM7210_HARDWARE_POWER, 1);
187 if (ret)
188 pr_crit("could not drive power off GPIO high\n");
189}
190
191static int __init em7210_request_gpios(void)
192{
193 int ret;
194
195 if (!machine_is_em7210())
196 return 0;
197
198 ret = gpio_request(EM7210_HARDWARE_POWER, "power");
199 if (ret) {
200 pr_err("could not request power off GPIO\n");
201 return 0;
202 }
203
204 pm_power_off = em7210_power_off;
205
206 return 0;
183} 207}
208device_initcall(em7210_request_gpios);
184 209
185static void __init em7210_init_machine(void) 210static void __init em7210_init_machine(void)
186{ 211{
@@ -194,9 +219,6 @@ static void __init em7210_init_machine(void)
194 219
195 i2c_register_board_info(0, em7210_i2c_devices, 220 i2c_register_board_info(0, em7210_i2c_devices,
196 ARRAY_SIZE(em7210_i2c_devices)); 221 ARRAY_SIZE(em7210_i2c_devices));
197
198
199 pm_power_off = em7210_power_off;
200} 222}
201 223
202MACHINE_START(EM7210, "Lanner EM7210") 224MACHINE_START(EM7210, "Lanner EM7210")