sunxi: Pass serial number through ATAG
authorPaul Kocialkowski <contact@paulk.fr>
Sat, 28 Mar 2015 17:35:36 +0000 (18:35 +0100)
committerHans de Goede <hdegoede@redhat.com>
Tue, 19 May 2015 16:28:52 +0000 (18:28 +0200)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
board/sunxi/board.c
include/configs/sunxi-common.h

index d9f76913730fc3c06212e736209e157a83beab77..4c51468cf2b12db3e8a92c1966b9590567cfac6e 100644 (file)
@@ -480,6 +480,26 @@ int g_dnl_board_usb_cable_connected(void)
 }
 #endif
 
+#ifdef CONFIG_SERIAL_TAG
+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;
+       }
+}
+#endif
+
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
index 2d6b81573970d5f3fa29eee6f6fbd30e06c9df46..723067ea748e384b3a3c28face290ae563aec18b 100644 (file)
@@ -98,6 +98,7 @@
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_CMDLINE_TAG
 #define CONFIG_INITRD_TAG
+#define CONFIG_SERIAL_TAG
 
 /* mmc config */
 #if !defined(CONFIG_UART0_PORT_F)