]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: mx35: use generic function for displaying silicon revision
authorJason Liu <jason.hui@linaro.org>
Fri, 26 Aug 2011 05:35:22 +0000 (13:35 +0800)
committerSascha Hauer <s.hauer@pengutronix.de>
Fri, 26 Aug 2011 06:50:59 +0000 (08:50 +0200)
update to use generic function for displaying silicon revision

Signed-off-by: Jason Liu <jason.hui@linaro.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
arch/arm/mach-imx/clock-imx35.c
arch/arm/mach-imx/cpu-imx35.c
arch/arm/plat-mxc/include/mach/mx3x.h

index 88b62a071aead0aac8093f38eff3bdb5fb7be4f3..abf30d48161f983ba35fb1ddbeca67927ae8257d 100644 (file)
@@ -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,
index 6637cd819ecb9ee45eb7252bd411f9ee98cede43..846e46eb8cbfd87f2ad61131e7794fc27ca14e2a 100644 (file)
 #include <mach/hardware.h>
 #include <mach/iim.h>
 
-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);
index e1850f417226da79654d5c9d7dad46a08f545bdf..30dbf424583eddc5b83a6693ebca15de5ade0997 100644 (file)
 /* 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