2 * Copyright (C) 2009 Michal Simek <monstr@monstr.eu>
3 * Copyright (C) 2009 PetaLogix
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
10 #include <linux/init.h>
11 #include <linux/of_platform.h>
14 /* Trigger specific functions */
17 #include <linux/of_gpio.h>
19 static int handle
; /* reset pin handle */
20 static unsigned int reset_val
;
22 void of_platform_reset_gpio_probe(void)
25 handle
= of_get_named_gpio(of_find_node_by_path("/"),
26 "hard-reset-gpios", 0);
28 if (!gpio_is_valid(handle
)) {
29 printk(KERN_INFO
"Skipping unavailable RESET gpio %d (%s)\n",
33 ret
= gpio_request(handle
, "reset");
35 printk(KERN_INFO
"GPIO pin is already allocated\n");
39 /* get current setup value */
40 reset_val
= gpio_get_value(handle
);
41 /* FIXME maybe worth to perform any action */
42 pr_debug("Reset: Gpio output state: 0x%x\n", reset_val
);
44 /* Setup GPIO as output */
45 ret
= gpio_direction_output(handle
, 0);
49 /* Setup output direction */
50 gpio_set_value(handle
, 0);
52 printk(KERN_INFO
"RESET: Registered gpio device: %d, current val: %d\n",
61 static void gpio_system_reset(void)
63 gpio_set_value(handle
, 1 - reset_val
);
66 #define gpio_system_reset() do {} while (0)
67 void of_platform_reset_gpio_probe(void)
73 void machine_restart(char *cmd
)
75 printk(KERN_NOTICE
"Machine restart...\n");
82 void machine_shutdown(void)
84 printk(KERN_NOTICE
"Machine shutdown...\n");
89 void machine_halt(void)
91 printk(KERN_NOTICE
"Machine halt...\n");
96 void machine_power_off(void)
98 printk(KERN_NOTICE
"Machine power off...\n");