diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2013-09-09 08:45:47 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-09-20 17:03:57 -0400 |
commit | 7111f8780fcf770d8624d758fd240e585adf7d3c (patch) | |
tree | 89237602dae060cb483153be7bc4f8cc44810a76 /arch/arm/mach-iop32x/n2100.c | |
parent | e9004f5039b3840089cb1cb0fe558a81e2bb55f0 (diff) |
ARM: iop32x: request and issue reset using gpio
As the IOP GPIO driver supports gpiolib we can use the standard
GPIO calls to issue a reset of the machine instead of using the
custom gpio_line_set/config calls. Also request the GPIO when
initializing the machine.
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Mikael Pettersson <mikpe@it.uu.se>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm/mach-iop32x/n2100.c')
-rw-r--r-- | arch/arm/mach-iop32x/n2100.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c index 069144300b77..6bace5bc7ebb 100644 --- a/arch/arm/mach-iop32x/n2100.c +++ b/arch/arm/mach-iop32x/n2100.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/reboot.h> | 31 | #include <linux/reboot.h> |
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | #include <linux/gpio.h> | ||
33 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
34 | #include <asm/irq.h> | 35 | #include <asm/irq.h> |
35 | #include <asm/mach/arch.h> | 36 | #include <asm/mach/arch.h> |
@@ -288,8 +289,14 @@ static void n2100_power_off(void) | |||
288 | 289 | ||
289 | static void n2100_restart(enum reboot_mode mode, const char *cmd) | 290 | static void n2100_restart(enum reboot_mode mode, const char *cmd) |
290 | { | 291 | { |
291 | gpio_line_set(N2100_HARDWARE_RESET, GPIO_LOW); | 292 | int ret; |
292 | gpio_line_config(N2100_HARDWARE_RESET, GPIO_OUT); | 293 | |
294 | ret = gpio_direction_output(N2100_HARDWARE_RESET, 0); | ||
295 | if (ret) { | ||
296 | pr_crit("could not drive reset GPIO low\n"); | ||
297 | return; | ||
298 | } | ||
299 | /* Wait for reset to happen */ | ||
293 | while (1) | 300 | while (1) |
294 | ; | 301 | ; |
295 | } | 302 | } |
@@ -308,6 +315,19 @@ static void power_button_poll(unsigned long dummy) | |||
308 | add_timer(&power_button_poll_timer); | 315 | add_timer(&power_button_poll_timer); |
309 | } | 316 | } |
310 | 317 | ||
318 | static int __init n2100_request_gpios(void) | ||
319 | { | ||
320 | int ret; | ||
321 | |||
322 | if (!machine_is_n2100()) | ||
323 | return 0; | ||
324 | |||
325 | ret = gpio_request(N2100_HARDWARE_RESET, "reset"); | ||
326 | if (ret) | ||
327 | pr_err("could not request reset GPIO\n"); | ||
328 | return 0; | ||
329 | } | ||
330 | device_initcall(n2100_request_gpios); | ||
311 | 331 | ||
312 | static void __init n2100_init_machine(void) | 332 | static void __init n2100_init_machine(void) |
313 | { | 333 | { |