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 pr_info("Skipping unavailable RESET gpio %d (%s)\n",
34 ret
= gpio_request(handle
, "reset");
36 pr_info("GPIO pin is already allocated\n");
40 /* get current setup value */
41 reset_val
= gpio_get_value(handle
);
42 /* FIXME maybe worth to perform any action */
43 pr_debug("Reset: Gpio output state: 0x%x\n", reset_val
);
45 /* Setup GPIO as output */
46 ret
= gpio_direction_output(handle
, 0);
50 /* Setup output direction */
51 gpio_set_value(handle
, 0);
53 pr_info("RESET: Registered gpio device: %d, current val: %d\n",
62 static void gpio_system_reset(void)
64 if (gpio_is_valid(handle
))
65 gpio_set_value(handle
, 1 - reset_val
);
67 pr_notice("Reset GPIO unavailable - halting!\n");
70 #define gpio_system_reset() do {} while (0)
71 void of_platform_reset_gpio_probe(void)
77 void machine_restart(char *cmd
)
79 pr_notice("Machine restart...\n");
85 void machine_shutdown(void)
87 pr_notice("Machine shutdown...\n");
92 void machine_halt(void)
94 pr_notice("Machine halt...\n");
99 void machine_power_off(void)
101 pr_notice("Machine power off...\n");