board: Add support for KEY1 status detection on K+P's HSC|DDC boards
authorLukasz Majewski <lukma@denx.de>
Sun, 20 May 2018 06:33:16 +0000 (08:33 +0200)
committerStefano Babic <sbabic@denx.de>
Mon, 18 Jun 2018 14:42:04 +0000 (16:42 +0200)
This code provides information if the K+P's imx53 boards had KEY1
pressed.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
arch/arm/dts/imx53-kp.dts
board/k+p/kp_imx53/kp_imx53.c

index 6322ef13232d9c5a0fe5cd3f9f80c8955454bc71..ca98fb59c61c450888dce9dcc2c6eae281873122 100644 (file)
@@ -88,6 +88,8 @@
                                MX53_PAD_EIM_CS0__GPIO2_23 0x1e4
                                /* LCD BACKLIGHT */
                                MX53_PAD_GPIO_1__GPIO1_1 0x1e4
+                               /* KEY1 GPIO */
+                               MX53_PAD_EIM_RW__GPIO2_26 0x1e4
                        >;
                };
 
index 6b0db6b8de10ef22f8b10e5bf3e5ace2f9bf3355..7e947fb6176f03f19bd53bea9c9b95a5c9b7b8e0 100644 (file)
@@ -23,6 +23,7 @@
 #define PHY_nRST IMX_GPIO_NR(7, 6)
 #define BOOSTER_OFF IMX_GPIO_NR(2, 23)
 #define LCD_BACKLIGHT IMX_GPIO_NR(1, 1)
+#define KEY1 IMX_GPIO_NR(2, 26)
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -196,6 +197,17 @@ void board_disable_display(void)
        gpio_direction_output(LCD_BACKLIGHT, 0);
 }
 
+void board_misc_setup(void)
+{
+       gpio_request(KEY1, "KEY1_GPIO");
+       gpio_direction_input(KEY1);
+
+       if (gpio_get_value(KEY1))
+               env_set("key1", "off");
+       else
+               env_set("key1", "on");
+}
+
 int board_late_init(void)
 {
        int ret = 0;
@@ -215,5 +227,7 @@ int board_late_init(void)
        show_eeprom();
        read_board_id();
 
+       board_misc_setup();
+
        return ret;
 }