From patchwork Wed Aug 24 05:04:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Hui X-Patchwork-Id: 3638 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 DA78223F22 for ; Wed, 24 Aug 2011 04:59:46 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id C8B99A18277 for ; Wed, 24 Aug 2011 04:59:46 +0000 (UTC) Received: by mail-bw0-f52.google.com with SMTP id zs2so991010bkb.11 for ; Tue, 23 Aug 2011 21:59:46 -0700 (PDT) Received: by 10.204.13.81 with SMTP id b17mr95919bka.278.1314161986508; Tue, 23 Aug 2011 21:59:46 -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.204.41.75 with SMTP id n11cs629bke; Tue, 23 Aug 2011 21:59:46 -0700 (PDT) Received: by 10.52.100.97 with SMTP id ex1mr4535863vdb.474.1314161979446; Tue, 23 Aug 2011 21:59:39 -0700 (PDT) Received: from ch1outboundpool.messaging.microsoft.com (ch1ehsobe004.messaging.microsoft.com [216.32.181.184]) by mx.google.com with ESMTPS id a9si574465vcw.62.2011.08.23.21.59.38 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 23 Aug 2011 21:59:39 -0700 (PDT) Received-SPF: neutral (google.com: 216.32.181.184 is neither permitted nor denied by best guess record for domain of jason.hui@linaro.org) client-ip=216.32.181.184; Authentication-Results: mx.google.com; spf=neutral (google.com: 216.32.181.184 is neither permitted nor denied by best guess record for domain of jason.hui@linaro.org) smtp.mail=jason.hui@linaro.org Received: from mail107-ch1-R.bigfish.com (216.32.181.171) by CH1EHSOBE002.bigfish.com (10.43.70.52) with Microsoft SMTP Server id 14.1.225.22; Wed, 24 Aug 2011 04:59:38 +0000 Received: from mail107-ch1 (localhost.localdomain [127.0.0.1]) by mail107-ch1-R.bigfish.com (Postfix) with ESMTP id 301F61A48309; Wed, 24 Aug 2011 04:59:38 +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 mail107-ch1 (localhost.localdomain [127.0.0.1]) by mail107-ch1 (MessageSwitch) id 1314161977811805_17765; Wed, 24 Aug 2011 04:59:37 +0000 (UTC) Received: from CH1EHSMHS002.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.253]) by mail107-ch1.bigfish.com (Postfix) with ESMTP id B70551080050; Wed, 24 Aug 2011 04:59:37 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS002.bigfish.com (10.43.70.2) with Microsoft SMTP Server (TLS) id 14.1.225.22; Wed, 24 Aug 2011 04:59:35 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.323.2; Tue, 23 Aug 2011 23:59:34 -0500 Received: from r64343-desktop.ap.freescale.net (r64343-desktop.ap.freescale.net [10.192.242.36]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p7O4xOaC004658; Tue, 23 Aug 2011 23:59:33 -0500 (CDT) From: Jason Liu To: CC: , Subject: [[PATCH v2 5/6] ARM: mx35: use generic function for displaying silicon revision Date: Wed, 24 Aug 2011 13:04:36 +0800 Message-ID: <1314162277-2840-6-git-send-email-jason.hui@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1314162277-2840-1-git-send-email-jason.hui@linaro.org> References: <1314162277-2840-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