From patchwork Tue Aug 30 13:54:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 112316 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 0D87AB6F92 for ; Tue, 30 Aug 2011 23:56:54 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0A0F628097; Tue, 30 Aug 2011 15:56:52 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jIfr4sLVFXYj; Tue, 30 Aug 2011 15:56:51 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BD6F828085; Tue, 30 Aug 2011 15:56:49 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B554528085 for ; Tue, 30 Aug 2011 15:56:47 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lzdzpDyWquug for ; Tue, 30 Aug 2011 15:56:46 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from TX2EHSOBE004.bigfish.com (tx2ehsobe002.messaging.microsoft.com [65.55.88.12]) by theia.denx.de (Postfix) with ESMTPS id 46E0D28082 for ; Tue, 30 Aug 2011 15:56:45 +0200 (CEST) Received: from mail19-tx2-R.bigfish.com (10.9.14.248) by TX2EHSOBE004.bigfish.com (10.9.40.24) with Microsoft SMTP Server id 14.1.225.22; Tue, 30 Aug 2011 13:56:41 +0000 Received: from mail19-tx2 (localhost.localdomain [127.0.0.1]) by mail19-tx2-R.bigfish.com (Postfix) with ESMTP id 606CF4E0226; Tue, 30 Aug 2011 13:56:41 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839h) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-FB-SS: 13, Received: from mail19-tx2 (localhost.localdomain [127.0.0.1]) by mail19-tx2 (MessageSwitch) id 1314712555227534_11754; Tue, 30 Aug 2011 13:55:55 +0000 (UTC) Received: from TX2EHSMHS043.bigfish.com (unknown [10.9.14.247]) by mail19-tx2.bigfish.com (Postfix) with ESMTP id 923A01700356; Tue, 30 Aug 2011 13:54:37 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS043.bigfish.com (10.9.99.143) with Microsoft SMTP Server (TLS) id 14.1.225.22; Tue, 30 Aug 2011 13:54:09 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.323.2; Tue, 30 Aug 2011 08:54:09 -0500 Received: from fabio-Latitude-E6410.am.freescale.net ([10.29.240.187]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p7UDs37v007208; Tue, 30 Aug 2011 08:54:08 -0500 (CDT) From: Fabio Estevam To: Date: Tue, 30 Aug 2011 10:54:09 -0300 Message-ID: <1314712450-571-1-git-send-email-fabio.estevam@freescale.com> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Cc: Fabio Estevam Subject: [U-Boot] [PATCH 1/2] ARM: mx25: Print the silicon revison X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Print the silicon revison during boot. Signed-off-by: Fabio Estevam --- arch/arm/cpu/arm926ejs/mx25/generic.c | 32 ++++++++++++++++++++++++++++- arch/arm/include/asm/arch-mx25/imx-regs.h | 4 +++ 2 files changed, 35 insertions(+), 1 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/mx25/generic.c b/arch/arm/cpu/arm926ejs/mx25/generic.c index 76e4b5c..a4e8c14 100644 --- a/arch/arm/cpu/arm926ejs/mx25/generic.c +++ b/arch/arm/cpu/arm926ejs/mx25/generic.c @@ -105,12 +105,42 @@ ulong imx_get_perclk (int clk) return lldiv (fref, div); } + +u32 get_cpu_rev(void) +{ + u32 srev; + u32 system_rev = 0x25000; + + /* read SREV register from IIM module */ + struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE; + srev = readl(&iim->iim_srev); + + switch (srev) { + case 0x00: + system_rev |= CHIP_REV_1_0; + break; + case 0x01: + system_rev |= CHIP_REV_1_1; + break; + default: + system_rev |= CHIP_REV_UNKNOWN; + break; + } + + return system_rev; +} + #if defined(CONFIG_DISPLAY_CPUINFO) int print_cpuinfo (void) { char buf[32]; + u32 cpurev; + + cpurev = get_cpu_rev(); - printf ("CPU: Freescale i.MX25 at %s MHz\n\n", + printf("CPU: Freescale i.MX25 rev%d.%d at %s MHz\n\n", + (cpurev & 0x000F0) >> 4, + (cpurev & 0x0000F) >> 0, strmhz (buf, imx_get_armclk ())); return 0; } diff --git a/arch/arm/include/asm/arch-mx25/imx-regs.h b/arch/arm/include/asm/arch-mx25/imx-regs.h index 9e30f7c..92b58be 100644 --- a/arch/arm/include/asm/arch-mx25/imx-regs.h +++ b/arch/arm/include/asm/arch-mx25/imx-regs.h @@ -351,4 +351,8 @@ struct aips_regs { #define GPIO3_BASE_ADDR IMX_GPIO3_BASE #define GPIO4_BASE_ADDR IMX_GPIO4_BASE +#define CHIP_REV_1_0 0x10 +#define CHIP_REV_1_1 0x11 +#define CHIP_REV_UNKNOWN 0xFF + #endif /* _IMX_REGS_H */