]> git.sur5r.net Git - u-boot/commitdiff
OMAP3: mcx: read hot-water-button after reset
authorStefano Babic <sbabic@denx.de>
Wed, 13 Jun 2012 22:34:44 +0000 (22:34 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sat, 1 Sep 2012 12:58:09 +0000 (14:58 +0200)
Detect hot-water-button to start a differnt image.

Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Tom Rini <trini@ti.com>
board/htkw/mcx/mcx.c
include/configs/mcx.h

index 8f75af19d4c4624ad967c0aa08b28239b0e5c1a9..454ff0a84687c055f6f0e92a426c9eb00bb14233 100644 (file)
@@ -37,6 +37,8 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#define HOT_WATER_BUTTON       38
+
 #ifdef CONFIG_USB_EHCI
 static struct omap_usbhs_board_data usbhs_bdata = {
        .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
@@ -68,6 +70,27 @@ int board_init(void)
        return 0;
 }
 
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+       if (gpio_request(HOT_WATER_BUTTON, "hot-water-button") < 0) {
+               puts("Failed to get hot-water-button pin\n");
+               return -ENODEV;
+       }
+       gpio_direction_input(HOT_WATER_BUTTON);
+
+       /*
+        * if hot-water-button is pressed
+        * change bootcmd
+        */
+       if (gpio_get_value(HOT_WATER_BUTTON))
+               return 0;
+
+       setenv("bootcmd", "run swupdate");
+       return 0;
+}
+#endif
+
 /*
  * Routine: set_muxconf_regs
  * Description: Setting up the configuration Mux registers specific to the
index 9d552a0f5193b2f6339416682555057da91b2598..ad7078c0f538ca9ce087416262f43b8138e3391b 100644 (file)
@@ -30,6 +30,7 @@
 
 #define MACH_TYPE_MCX                  3656
 #define CONFIG_MACH_TYPE       MACH_TYPE_MCX
+#define CONFIG_BOARD_LATE_INIT
 
 #define CONFIG_SYS_CACHELINE_SIZE      64
 
 #define CONFIG_MTD_PARTITIONS
 #define CONFIG_MTD_DEVICE
 #define CONFIG_CMD_MTDPARTS
+#define CONFIG_CMD_GPIO
 
 #undef CONFIG_CMD_FLASH                /* flinfo, erase, protect       */
 #undef CONFIG_CMD_FPGA         /* FPGA configuration Support   */