[U-Boot] [RFC PATCH] ARM: at91: Print CPU serial number in cpuinfo

Alexander Dahl ada at thorsis.com
Wed Nov 27 12:44:32 UTC 2019


The SAMA5D2 and SAMA5D4 series SoCs have a 64-bit Serial Number (unique
ID) burned in, which is displayed with 'print_cpuinfo()' now (in the
same format the SAM-BA applet prints it).

Example output:

CPU: SAMA5D27 1G bits DDR2 SDRAM
Serial number 0: 0x4630394b
              1: 0x190d2750
Crystal frequency:       24 MHz
CPU clock        :      492 MHz
Master clock     :      164 MHz

Signed-off-by: Alexander Dahl <ada at thorsis.com>
---

I looked over lots of other 'print_cpuinfo()' implementations for
different SoCs and found none printing a unique ID at all. Is there
another place for this? Is it just few SoCs have such a serial number
at all? Or is it not desired to print those along with the other CPU
info?

Greets
Alex

---
 arch/arm/mach-at91/armv7/cpu.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/mach-at91/armv7/cpu.c b/arch/arm/mach-at91/armv7/cpu.c
index 5da067cda1..6d50e1aea4 100644
--- a/arch/arm/mach-at91/armv7/cpu.c
+++ b/arch/arm/mach-at91/armv7/cpu.c
@@ -13,6 +13,7 @@
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_pit.h>
 #include <asm/arch/at91_gpbr.h>
+#include <asm/arch/at91_sfr.h>
 #include <asm/arch/clk.h>
 
 #ifndef CONFIG_SYS_AT91_MAIN_CLOCK
@@ -42,9 +43,16 @@ void arch_preboot_os(void)
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void)
 {
+	struct atmel_sfr *sfr = (struct atmel_sfr *)ATMEL_BASE_SFR;
 	char buf[32];
 
 	printf("CPU: %s\n", get_cpu_name());
+
+#if defined(CONFIG_SAMA5D2) || defined(CONFIG_SAMA5D4)
+	printf("Serial number 0: 0x%08x\n", sfr->sn0);
+	printf("              1: 0x%08x\n", sfr->sn1);
+#endif
+
 	printf("Crystal frequency: %8s MHz\n",
 	       strmhz(buf, get_main_clk_rate()));
 	printf("CPU clock        : %8s MHz\n",
-- 
2.20.1



More information about the U-Boot mailing list