]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/samsung/common/misc.c
Merge branch 'master' of git://git.denx.de/u-boot-imx
[karo-tx-uboot.git] / board / samsung / common / misc.c
index 03106fdb9fb15f8514884c6da9e41d8b48128fef..4538ac7f2a2fc2d2a91f840944d13ec542e35e11 100644 (file)
@@ -11,9 +11,9 @@
 #include <samsung/misc.h>
 #include <errno.h>
 #include <version.h>
+#include <malloc.h>
 #include <linux/sizes.h>
 #include <asm/arch/cpu.h>
-#include <asm/arch/gpio.h>
 #include <asm/gpio.h>
 #include <linux/input.h>
 #include <power/pmic.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_SET_DFU_ALT_INFO
+void set_dfu_alt_info(void)
+{
+       size_t buf_size = CONFIG_SET_DFU_ALT_BUF_LEN;
+       ALLOC_CACHE_ALIGN_BUFFER(char, buf, buf_size);
+       char *alt_info = "Settings not found!";
+       char *status = "error!\n";
+       char *alt_setting;
+       char *alt_sep;
+       int offset = 0;
+
+       puts("DFU alt info setting: ");
+
+       alt_setting = get_dfu_alt_boot();
+       if (alt_setting) {
+               setenv("dfu_alt_boot", alt_setting);
+               offset = snprintf(buf, buf_size, "%s", alt_setting);
+       }
+
+       alt_setting = get_dfu_alt_system();
+       if (alt_setting) {
+               if (offset)
+                       alt_sep = ";";
+               else
+                       alt_sep = "";
+
+               offset += snprintf(buf + offset, buf_size - offset,
+                                   "%s%s", alt_sep, alt_setting);
+       }
+
+       if (offset) {
+               alt_info = buf;
+               status = "done\n";
+       }
+
+       setenv("dfu_alt_info", alt_info);
+       puts(status);
+}
+#endif
+
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 void set_board_info(void)
 {
        char info[64];
 
-       snprintf(info, ARRAY_SIZE(info), "%d.%d", s5p_cpu_rev & 0x0f,
-                (s5p_cpu_rev & 0xf0) >> 0x04);
+       snprintf(info, ARRAY_SIZE(info), "%u.%u", (s5p_cpu_rev & 0xf0) >> 4,
+                s5p_cpu_rev & 0xf);
        setenv("soc_rev", info);
 
        snprintf(info, ARRAY_SIZE(info), "%x", s5p_cpu_id);
@@ -38,8 +78,16 @@ void set_board_info(void)
        setenv("board_rev", info);
 #endif
 #ifdef CONFIG_OF_LIBFDT
-       snprintf(info, ARRAY_SIZE(info),  "%s%x-%s.dtb",
-                CONFIG_SYS_SOC, s5p_cpu_id, CONFIG_SYS_BOARD);
+       const char *bdtype = "";
+       const char *bdname = CONFIG_SYS_BOARD;
+
+#ifdef CONFIG_BOARD_TYPES
+       bdtype = get_board_type();
+       sprintf(info, "%s%s", bdname, bdtype);
+       setenv("boardname", info);
+#endif
+       snprintf(info, ARRAY_SIZE(info),  "%s%x-%s%s.dtb",
+                CONFIG_SYS_SOC, s5p_cpu_id, bdname, bdtype);
        setenv("fdtfile", info);
 #endif
 }
@@ -363,6 +411,8 @@ void check_boot_mode(void)
 void keys_init(void)
 {
        /* Set direction to input */
+       gpio_request(KEY_VOL_UP_GPIO, "volume-up");
+       gpio_request(KEY_VOL_DOWN_GPIO, "volume-down");
        gpio_direction_input(KEY_VOL_UP_GPIO);
        gpio_direction_input(KEY_VOL_DOWN_GPIO);
 }