summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-05-10 07:01:21 +0000
committerWolfgang Denk <wd@denx.de>2011-07-26 16:47:39 +0200
commit9146d13821a20c49703e1f8f7e4a4f028678883d (patch)
tree2ebc8611bc6d3e706f9ce50e4354b7b19d6ec1f3
parent7b826c2f3510eaf185c7b4b0d709b9e766831bd6 (diff)
downloadu-boot-imx-9146d13821a20c49703e1f8f7e4a4f028678883d.zip
u-boot-imx-9146d13821a20c49703e1f8f7e4a4f028678883d.tar.gz
u-boot-imx-9146d13821a20c49703e1f8f7e4a4f028678883d.tar.bz2
post: add gpio hotkey support
Now that we have the generic GPIO layer, we can easily provide a common implementation for the post_hotkeys_pressed() function based on it. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--post/post.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/post/post.c b/post/post.c
index 1b7f2aa..ecea1e1 100644
--- a/post/post.c
+++ b/post/post.c
@@ -26,6 +26,10 @@
#include <watchdog.h>
#include <post.h>
+#ifdef CONFIG_SYS_POST_HOTKEYS_GPIO
+#include <asm/gpio.h>
+#endif
+
#ifdef CONFIG_LOGBUFFER
#include <logbuff.h>
#endif
@@ -68,6 +72,23 @@ int post_init_f (void)
*/
int __post_hotkeys_pressed(void)
{
+#ifdef CONFIG_SYS_POST_HOTKEYS_GPIO
+ int ret;
+ unsigned gpio = CONFIG_SYS_POST_HOTKEYS_GPIO;
+
+ ret = gpio_request(gpio, "hotkeys");
+ if (ret) {
+ printf("POST: gpio hotkey request failed\n");
+ return 0;
+ }
+
+ gpio_direction_input(gpio);
+ ret = gpio_get_value(gpio);
+ gpio_free(gpio);
+
+ return ret;
+#endif
+
return 0; /* No hotkeys supported */
}
int post_hotkeys_pressed(void)