From patchwork Tue Aug 23 13:07:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Hui X-Patchwork-Id: 3624 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 99E6C23FA2 for ; Tue, 23 Aug 2011 13:04:13 +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 83A90A18728 for ; Tue, 23 Aug 2011 13:04:13 +0000 (UTC) Received: by bkbzs2 with SMTP id zs2so101257bkb.11 for ; Tue, 23 Aug 2011 06:04:13 -0700 (PDT) Received: by 10.204.13.81 with SMTP id b17mr1535294bka.278.1314104653129; Tue, 23 Aug 2011 06:04:13 -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 n11cs209844bke; Tue, 23 Aug 2011 06:04:12 -0700 (PDT) Received: by 10.227.121.138 with SMTP id h10mr227196wbr.60.1314104652667; Tue, 23 Aug 2011 06:04:12 -0700 (PDT) Received: from DB3EHSOBE005.bigfish.com (db3ehsobe005.messaging.microsoft.com [213.199.154.143]) by mx.google.com with ESMTPS id el1si411289wbb.64.2011.08.23.06.04.11 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 23 Aug 2011 06:04:11 -0700 (PDT) Received-SPF: neutral (google.com: 213.199.154.143 is neither permitted nor denied by best guess record for domain of jason.hui@linaro.org) client-ip=213.199.154.143; Authentication-Results: mx.google.com; spf=neutral (google.com: 213.199.154.143 is neither permitted nor denied by best guess record for domain of jason.hui@linaro.org) smtp.mail=jason.hui@linaro.org Received: from mail58-db3-R.bigfish.com (10.3.81.254) by DB3EHSOBE005.bigfish.com (10.3.84.25) with Microsoft SMTP Server id 14.1.225.22; Tue, 23 Aug 2011 13:04:10 +0000 Received: from mail58-db3 (localhost.localdomain [127.0.0.1]) by mail58-db3-R.bigfish.com (Postfix) with ESMTP id BAF0913C8407; Tue, 23 Aug 2011 13:04:10 +0000 (UTC) X-SpamScore: 7 X-BigFish: VS7(z1039ozzz1202hzz8275bh8275dhz2dh87h2a8h668h839h62h) X-Spam-TCS-SCL: 1: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 mail58-db3 (localhost.localdomain [127.0.0.1]) by mail58-db3 (MessageSwitch) id 1314104615791939_18693; Tue, 23 Aug 2011 13:03:35 +0000 (UTC) Received: from DB3EHSMHS005.bigfish.com (unknown [10.3.81.247]) by mail58-db3.bigfish.com (Postfix) with ESMTP id 94E26A01D5; Tue, 23 Aug 2011 13:02:44 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS005.bigfish.com (10.3.87.105) with Microsoft SMTP Server (TLS) id 14.1.225.22; Tue, 23 Aug 2011 13:02:41 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server id 14.1.323.2; Tue, 23 Aug 2011 08:02:41 -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 p7ND2Wd5022085; Tue, 23 Aug 2011 08:02:39 -0500 (CDT) From: Jason Liu To: CC: , Subject: [PATCH 4/6] ARM: mx31: use generic function for displaying silicon revision Date: Tue, 23 Aug 2011 21:07:42 +0800 Message-ID: <1314104864-3725-5-git-send-email-jason.hui@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1314104864-3725-1-git-send-email-jason.hui@linaro.org> References: <1314104864-3725-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-imx31.c | 5 +++-- arch/arm/mach-imx/cpu-imx31.c | 21 +++++++++++++-------- arch/arm/plat-mxc/include/mach/mx3x.h | 11 ++--------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/arch/arm/mach-imx/clock-imx31.c b/arch/arm/mach-imx/clock-imx31.c index d973770..dd8373e 100644 --- a/arch/arm/mach-imx/clock-imx31.c +++ b/arch/arm/mach-imx/clock-imx31.c @@ -610,11 +610,12 @@ int __init mx31_clocks_init(unsigned long fref) clk_enable(&gpt_clk); clk_enable(&emi_clk); - clk_enable(&iim_clk); clk_enable(&serial_pll_clk); - mx31_read_cpu_rev(); + clk_enable(&iim_clk); + imx_print_silicon_rev("i.MX31", mx31_revision()); + clk_disable(&iim_clk); if (mx31_revision() >= IMX_CHIP_REVISION_2_0) { reg = __raw_readl(MXC_CCM_PMCR1); diff --git a/arch/arm/mach-imx/cpu-imx31.c b/arch/arm/mach-imx/cpu-imx31.c index a378070..a5b8686 100644 --- a/arch/arm/mach-imx/cpu-imx31.c +++ b/arch/arm/mach-imx/cpu-imx31.c @@ -14,15 +14,14 @@ #include #include -unsigned int mx31_cpu_rev; -EXPORT_SYMBOL(mx31_cpu_rev); +static int mx31_cpu_rev = -1; static struct { u8 srev; const char *name; const char *v; unsigned int rev; -} mx31_cpu_type[] __initdata = { +} mx31_cpu_type[] = { { .srev = 0x00, .name = "i.MX31(L)", .v = "1.0", .rev = IMX_CHIP_REVISION_1_0 }, { .srev = 0x10, .name = "i.MX31", .v = "1.1", .rev = IMX_CHIP_REVISION_1_1 }, { .srev = 0x11, .name = "i.MX31L", .v = "1.1", .rev = IMX_CHIP_REVISION_1_1 }, @@ -34,7 +33,7 @@ static struct { { .srev = 0x29, .name = "i.MX31L", .v = "2.0", .rev = IMX_CHIP_REVISION_2_0 }, }; -void __init mx31_read_cpu_rev(void) +static int mx31_read_cpu_rev(void) { u32 i, srev; @@ -47,11 +46,17 @@ void __init mx31_read_cpu_rev(void) "CPU identified as %s, silicon rev %s\n", mx31_cpu_type[i].name, mx31_cpu_type[i].v); - mx31_cpu_rev = mx31_cpu_type[i].rev; - return; + return mx31_cpu_type[i].rev; } - mx31_cpu_rev = IMX_CHIP_REVISION_UNKNOWN; + return IMX_CHIP_REVISION_UNKNOWN; +} + +int mx31_revision(void) +{ + if (mx31_cpu_rev == -1) + mx31_cpu_rev = mx31_read_cpu_rev(); - printk(KERN_WARNING "Unknown CPU identifier. srev = %02x\n", srev); + return mx31_cpu_rev; } +EXPORT_SYMBOL(mx31_revision); diff --git a/arch/arm/plat-mxc/include/mach/mx3x.h b/arch/arm/plat-mxc/include/mach/mx3x.h index 388a407..e1850f4 100644 --- a/arch/arm/plat-mxc/include/mach/mx3x.h +++ b/arch/arm/plat-mxc/include/mach/mx3x.h @@ -187,15 +187,6 @@ /* Mandatory defines used globally */ #if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS) - -extern unsigned int mx31_cpu_rev; -extern void mx31_read_cpu_rev(void); - -static inline int mx31_revision(void) -{ - return mx31_cpu_rev; -} - extern unsigned int mx35_cpu_rev; extern void mx35_read_cpu_rev(void); @@ -203,6 +194,8 @@ static inline int mx35_revision(void) { return mx35_cpu_rev; } + +extern int mx31_revision(void); #endif #endif /* ifndef __MACH_MX3x_H__ */