aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/u-boot/u-boot-git/beagleboard/0045-BeagleBoard-Added-userbutton-command.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/u-boot/u-boot-git/beagleboard/0045-BeagleBoard-Added-userbutton-command.patch')
-rw-r--r--recipes/u-boot/u-boot-git/beagleboard/0045-BeagleBoard-Added-userbutton-command.patch97
1 files changed, 97 insertions, 0 deletions
diff --git a/recipes/u-boot/u-boot-git/beagleboard/0045-BeagleBoard-Added-userbutton-command.patch b/recipes/u-boot/u-boot-git/beagleboard/0045-BeagleBoard-Added-userbutton-command.patch
new file mode 100644
index 0000000000..d454d73c16
--- /dev/null
+++ b/recipes/u-boot/u-boot-git/beagleboard/0045-BeagleBoard-Added-userbutton-command.patch
@@ -0,0 +1,97 @@
+From f5146ac9d3af9c9cd4f4bc940c343d3ef75ac6f0 Mon Sep 17 00:00:00 2001
+From: Jason Kridner <jkridner@beagleboard.org>
+Date: Wed, 21 Jul 2010 07:41:25 -0500
+Subject: [PATCH 45/50] BeagleBoard: Added userbutton command
+
+Based on commit f1099c7c43caf5bac3bf6a65aa266fade4747072
+ Author: Greg Turner <gregturner@ti.com>
+ Date: Tue May 25 09:19:06 2010 -0500
+
+ New u-boot command for status of USER button on BeagleBoard-xM
+
+ Modified bootcmd to check the staus at boot time and set
+ filename of the boot script.
+
+* Moved to a BeagleBoard specific file.
+* Removed changes to default boot command from adding userbutton
+ command.
+* Made to handle pre-xM boards.
+* Flipped polarity of the return value to avoid confusion. Success (0)
+ is when the button is pressed. Failure (1) is when the button is NOT
+ pressed.
+---
+ board/ti/beagle/beagle.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 54 insertions(+), 0 deletions(-)
+
+diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
+index a6a4961..66df719 100644
+--- a/board/ti/beagle/beagle.c
++++ b/board/ti/beagle/beagle.c
+@@ -40,6 +40,7 @@
+ #include <asm/arch/gpio.h>
+ #include <asm/mach-types.h>
+ #include "beagle.h"
++#include <command.h>
+
+ static struct {
+ unsigned int device_vendor;
+@@ -290,3 +291,56 @@ void set_muxconf_regs(void)
+ MUX_BEAGLE();
+ }
+
++/*
++ * This command returns the status of the user button on beagle xM
++ * Input - none
++ * Returns - 1 if button is held down
++ * 0 if button is not held down
++ */
++int do_userbutton (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
++{
++ int button = 0;
++ int gpio;
++
++ /*
++ * pass address parameter as argv[0] (aka command name),
++ * and all remaining args
++ */
++ switch (beagle_revision) {
++ case REVISION_AXBX:
++ case REVISION_CX:
++ case REVISION_C4:
++ gpio = 7;
++ break;
++ case REVISION_XM:
++ default:
++ gpio = 4;
++ break;
++ }
++ omap_request_gpio(gpio);
++ omap_set_gpio_direction(gpio, 1);
++ printf("The user button is currently ");
++ if(omap_get_gpio_datain(gpio))
++ {
++ button = 1;
++ printf("PRESSED.\n");
++ }
++ else
++ {
++ button = 0;
++ printf("NOT pressed.\n");
++ }
++
++ omap_free_gpio(gpio);
++
++ return !button;
++}
++
++/* -------------------------------------------------------------------- */
++
++U_BOOT_CMD(
++ userbutton, CONFIG_SYS_MAXARGS, 1, do_userbutton,
++ "Return the status of the BeagleBoard USER button",
++ ""
++);
++
+--
+1.6.6.1
+