From patchwork Fri Aug 26 05:35:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Hui X-Patchwork-Id: 3707 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id EF2B523FA2 for ; Fri, 26 Aug 2011 05:30:20 +0000 (UTC) Received: from mail-gw0-f52.google.com (mail-gw0-f52.google.com [74.125.83.52]) by fiordland.canonical.com (Postfix) with ESMTP id BD9C7A18544 for ; Fri, 26 Aug 2011 05:30:20 +0000 (UTC) Received: by mail-gw0-f52.google.com with SMTP id 15so3494548gwj.11 for ; Thu, 25 Aug 2011 22:30:20 -0700 (PDT) Received: by 10.150.236.12 with SMTP id j12mr1767431ybh.212.1314336620525; Thu, 25 Aug 2011 22:30:20 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.151.27.20 with SMTP id e20cs269332ybj; Thu, 25 Aug 2011 22:30:20 -0700 (PDT) Received: by 10.227.197.141 with SMTP id ek13mr520789wbb.49.1314336619154; Thu, 25 Aug 2011 22:30:19 -0700 (PDT) Received: from DB3EHSOBE001.bigfish.com (db3ehsobe001.messaging.microsoft.com [213.199.154.139]) by mx.google.com with ESMTPS id ft20si3344740wbb.130.2011.08.25.22.30.17 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 25 Aug 2011 22:30:18 -0700 (PDT) Received-SPF: neutral (google.com: 213.199.154.139 is neither permitted nor denied by best guess record for domain of jason.hui@linaro.org) client-ip=213.199.154.139; Authentication-Results: mx.google.com; spf=neutral (google.com: 213.199.154.139 is neither permitted nor denied by best guess record for domain of jason.hui@linaro.org) smtp.mail=jason.hui@linaro.org Received: from mail116-db3-R.bigfish.com (10.3.81.252) by DB3EHSOBE001.bigfish.com (10.3.84.21) with Microsoft SMTP Server id 14.1.225.22; Fri, 26 Aug 2011 05:30:17 +0000 Received: from mail116-db3 (localhost.localdomain [127.0.0.1]) by mail116-db3-R.bigfish.com (Postfix) with ESMTP id 2E1DA1168130; Fri, 26 Aug 2011 05:30:17 +0000 (UTC) X-SpamScore: 7 X-BigFish: VS7(z1039ozzz1202hzz8275bh8275dhz2dh87h2a8h668h839h65h) X-Spam-TCS-SCL: 4:0 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-DOMAIN-IP-MATCH: fail Received: from mail116-db3 (localhost.localdomain [127.0.0.1]) by mail116-db3 (MessageSwitch) id 1314336616844035_2377; Fri, 26 Aug 2011 05:30:16 +0000 (UTC) Received: from DB3EHSMHS001.bigfish.com (unknown [10.3.81.254]) by mail116-db3.bigfish.com (Postfix) with ESMTP id BEDE869004B; Fri, 26 Aug 2011 05:30:16 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS001.bigfish.com (10.3.87.101) with Microsoft SMTP Server (TLS) id 14.1.225.22; Fri, 26 Aug 2011 05:30:16 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server id 14.1.323.2; Fri, 26 Aug 2011 00:30:15 -0500 Received: from r64343-desktop.ap.freescale.net (r64343-desktop.ap.freescale.net [10.192.242.36]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p7Q5U4oa001702; Fri, 26 Aug 2011 00:30:13 -0500 (CDT) From: Jason Liu To: CC: , Subject: [[PATCH v3 5/6] ARM: mx35: use generic function for displaying silicon revision Date: Fri, 26 Aug 2011 13:35:22 +0800 Message-ID: <1314336923-25162-6-git-send-email-jason.hui@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1314336923-25162-1-git-send-email-jason.hui@linaro.org> References: <1314336923-25162-1-git-send-email-jason.hui@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com update to use generic function for displaying silicon revision Signed-off-by: Jason Liu Cc: Fabio Estevam Cc: Sascha Hauer --- arch/arm/mach-imx/clock-imx35.c | 3 ++- arch/arm/mach-imx/cpu-imx35.c | 30 ++++++++++++++---------------- arch/arm/plat-mxc/include/mach/mx3x.h | 9 +-------- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/arch/arm/mach-imx/clock-imx35.c b/arch/arm/mach-imx/clock-imx35.c index 88b62a0..abf30d4 100644 --- a/arch/arm/mach-imx/clock-imx35.c +++ b/arch/arm/mach-imx/clock-imx35.c @@ -537,7 +537,8 @@ int __init mx35_clocks_init() __raw_writel(cgr3, CCM_BASE + CCM_CGR3); clk_enable(&iim_clk); - mx35_read_cpu_rev(); + imx_print_silicon_rev("i.MX35", mx35_revision()); + clk_disable(&iim_clk); #ifdef CONFIG_MXC_USE_EPIT epit_timer_init(&epit1_clk, diff --git a/arch/arm/mach-imx/cpu-imx35.c b/arch/arm/mach-imx/cpu-imx35.c index 6637cd8..846e46e 100644 --- a/arch/arm/mach-imx/cpu-imx35.c +++ b/arch/arm/mach-imx/cpu-imx35.c @@ -13,32 +13,30 @@ #include #include -unsigned int mx35_cpu_rev; -EXPORT_SYMBOL(mx35_cpu_rev); +static int mx35_cpu_rev = -1; -void __init mx35_read_cpu_rev(void) +static int mx35_read_cpu_rev(void) { u32 rev; - char *srev; rev = __raw_readl(MX35_IO_ADDRESS(MX35_IIM_BASE_ADDR + MXC_IIMSREV)); switch (rev) { case 0x00: - mx35_cpu_rev = IMX_CHIP_REVISION_1_0; - srev = "1.0"; - break; + return IMX_CHIP_REVISION_1_0; case 0x10: - mx35_cpu_rev = IMX_CHIP_REVISION_2_0; - srev = "2.0"; - break; + return IMX_CHIP_REVISION_2_0; case 0x11: - mx35_cpu_rev = IMX_CHIP_REVISION_2_1; - srev = "2.1"; - break; + return IMX_CHIP_REVISION_2_1; default: - mx35_cpu_rev = IMX_CHIP_REVISION_UNKNOWN; - srev = "unknown"; + return IMX_CHIP_REVISION_UNKNOWN; } +} + +int mx35_revision(void) +{ + if (mx35_cpu_rev == -1) + mx35_cpu_rev = mx35_read_cpu_rev(); - printk(KERN_INFO "CPU identified as i.MX35, silicon rev %s\n", srev); + return mx35_cpu_rev; } +EXPORT_SYMBOL(mx35_revision); diff --git a/arch/arm/plat-mxc/include/mach/mx3x.h b/arch/arm/plat-mxc/include/mach/mx3x.h index e1850f4..30dbf42 100644 --- a/arch/arm/plat-mxc/include/mach/mx3x.h +++ b/arch/arm/plat-mxc/include/mach/mx3x.h @@ -187,14 +187,7 @@ /* Mandatory defines used globally */ #if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS) -extern unsigned int mx35_cpu_rev; -extern void mx35_read_cpu_rev(void); - -static inline int mx35_revision(void) -{ - return mx35_cpu_rev; -} - +extern int mx35_revision(void); extern int mx31_revision(void); #endif