From 9f85221135745f7f20c9b00a241a8331a7f5b190 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Sat, 28 Mar 2015 18:35:36 +0100 Subject: [PATCH] sunxi: Pass serial number through ATAG Signed-off-by: Paul Kocialkowski Acked-by: Hans de Goede Signed-off-by: Hans de Goede --- board/sunxi/board.c | 20 ++++++++++++++++++++ include/configs/sunxi-common.h | 1 + 2 files changed, 21 insertions(+) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index d9f7691373..4c51468cf2 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -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) { diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 2d6b815739..723067ea74 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -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)