]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/lge/sniper/sniper.c
sniper: Pass serial number through ATAG
[karo-tx-uboot.git] / board / lge / sniper / sniper.c
index d5318c4f32823ec37e7b0d298257f9592ed03ae9..b211528e2b550f4878d693743f2130c5d539edc3 100644 (file)
@@ -9,6 +9,7 @@
 #include <config.h>
 #include <common.h>
 #include <dm.h>
 #include <config.h>
 #include <common.h>
 #include <dm.h>
+#include <linux/ctype.h>
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mem.h>
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mem.h>
@@ -67,6 +68,54 @@ int board_init(void)
        return 0;
 }
 
        return 0;
 }
 
+int misc_init_r(void)
+{
+       char serial_string[17] = { 0 };
+       char reboot_mode[2] = { 0 };
+       u32 dieid[4] = { 0 };
+
+       /* Reboot mode */
+
+       reboot_mode[0] = omap_reboot_mode();
+       if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
+               if (!getenv("reboot-mode"))
+                       setenv("reboot-mode", (char *)reboot_mode);
+
+               omap_reboot_mode_clear();
+       }
+
+       /* Serial number */
+
+       get_dieid((u32 *)&dieid);
+
+       if (!getenv("serial#")) {
+               snprintf(serial_string, sizeof(serial_string),
+                       "%08x%08x", dieid[0], dieid[3]);
+
+               setenv("serial#", serial_string);
+       }
+
+       return 0;
+}
+
+void get_board_serial(struct tag_serialnr *serialnr)
+{
+       char *serial_string;
+       unsigned long long serial;
+
+       serial_string = getenv("serial#");
+
+       if (serial_string) {
+               serial = simple_strtoull(serial_string, NULL, 16);
+
+               serialnr->high = (unsigned int) (serial >> 32);
+               serialnr->low = (unsigned int) (serial & 0xffffffff);
+       } else {
+               serialnr->high = 0;
+               serialnr->low = 0;
+       }
+}
+
 void set_muxconf_regs(void)
 {
        MUX_SNIPER();
 void set_muxconf_regs(void)
 {
        MUX_SNIPER();