From: Eugen.Hristev at microchip.com Date: Fri, 29 Nov 2019 07:43:10 +0000 Subject: [U-Boot] [RFC PATCH] ARM: at91: Print CPU serial number in cpuinfo In-Reply-To: <20191127124432.2547-1-ada@thorsis.com> References: <20191127124432.2547-1-ada@thorsis.com> Message-ID: <6cfb77c1-abeb-b3d2-d470-e2493d90728d@microchip.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 27.11.2019 14:44, Alexander Dahl wrote: > 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 > --- > > 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? > Hi Alex, I do not have anything against it. Nor do I have a strong opinion about which way to go. Is it better to just have a CMD that prints out this serial or print it at boot ? Maybe some other people have a different idea ? Eugen > 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 > #include > #include > +#include > #include > > #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 > >