[U-Boot] [PATCH 7/7] omap-common: Common get_board_serial function to pass serial through ATAG

Paul Kocialkowski contact at paulk.fr
Thu Aug 27 19:37:14 CEST 2015


Since there is a common function to grab the serial number from the die id bits,
it makes sense have one to parse that serial number and feed it to the serial
ATAG.

Signed-off-by: Paul Kocialkowski <contact at paulk.fr>
---
 arch/arm/cpu/armv7/omap-common/utils.c | 18 ++++++++++++++++++
 arch/arm/include/asm/omap_common.h     |  1 +
 board/lge/sniper/sniper.c              | 15 +--------------
 3 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/utils.c b/arch/arm/cpu/armv7/omap-common/utils.c
index dc5a169..602d993 100644
--- a/arch/arm/cpu/armv7/omap-common/utils.c
+++ b/arch/arm/cpu/armv7/omap-common/utils.c
@@ -61,6 +61,24 @@ void omap_die_id_serial(void)
 	}
 }
 
+void omap_die_id_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 omap_die_id_usbethaddr(void)
 {
 	unsigned int die_id[4] = { 0 };
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 0f5758d..1e0b8f2 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -597,6 +597,7 @@ void abb_setup(u32 fuse, u32 ldovbb, u32 setup, u32 control,
 s8 abb_setup_ldovbb(u32 fuse, u32 ldovbb);
 
 void omap_die_id_serial(void);
+void omap_die_id_get_board_serial(struct tag_serialnr *serialnr);
 void omap_die_id_usbethaddr(void);
 void omap_die_id_display(void);
 
diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c
index cdda76b..4eff01a 100644
--- a/board/lge/sniper/sniper.c
+++ b/board/lge/sniper/sniper.c
@@ -149,20 +149,7 @@ int misc_init_r(void)
 
 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;
-	}
+	omap_die_id_get_board_serial(serialnr);
 }
 
 void reset_misc(void)
-- 
1.9.1



More information about the U-Boot mailing list