From patchwork Wed Nov 27 12:44:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Dahl X-Patchwork-Id: 1201573 X-Patchwork-Delegate: eugen.hristev@microchip.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=thorsis.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47NL886zxQz9sT6 for ; Wed, 27 Nov 2019 23:44:54 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 5AEB9C2205E; Wed, 27 Nov 2019 12:44:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3B3FDC21FB1; Wed, 27 Nov 2019 12:44:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AA570C21FB1; Wed, 27 Nov 2019 12:44:42 +0000 (UTC) Received: from mail.thorsis.com (mail.thorsis.com [92.198.35.195]) by lists.denx.de (Postfix) with ESMTPS id 83236C21E3A for ; Wed, 27 Nov 2019 12:44:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.thorsis.com (Postfix) with ESMTP id CF33936A9 for ; Wed, 27 Nov 2019 13:46:05 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.thorsis.com Received: from mail.thorsis.com ([127.0.0.1]) by localhost (mail.thorsis.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W3uGuaYoBN5k for ; Wed, 27 Nov 2019 13:46:01 +0100 (CET) Received: by mail.thorsis.com (Postfix, from userid 109) id E184B4DB; Wed, 27 Nov 2019 13:46:01 +0100 (CET) Received: from adahl by ada.ifak-system.com with local (Exim 4.89) (envelope-from ) id 1iZwgK-0000fn-Hw; Wed, 27 Nov 2019 13:44:32 +0100 From: Alexander Dahl To: u-boot@lists.denx.de Date: Wed, 27 Nov 2019 13:44:32 +0100 Message-Id: <20191127124432.2547-1-ada@thorsis.com> Subject: [U-Boot] [RFC PATCH] ARM: at91: Print CPU serial number in cpuinfo X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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? 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",