ARM: mx27: Print silicon revision on boot
authorJason Liu <jason.hui@linaro.org>
Fri, 26 Aug 2011 05:35:20 +0000 (13:35 +0800)
committerSascha Hauer <s.hauer@pengutronix.de>
Fri, 26 Aug 2011 06:50:58 +0000 (08:50 +0200)
Silicon revision is useful information to have during kernel boot.

Print the MX27 silicon revision.

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

index 6912b821b37bcff07ca40df884c807c0187dd05e..e6b1beb4282c77e466dcee401f2a279bbb79d259 100644 (file)
@@ -751,6 +751,8 @@ int __init mx27_clocks_init(unsigned long fref)
        clk_enable(&gpio_clk);
        clk_enable(&emi_clk);
        clk_enable(&iim_clk);
+       imx_print_silicon_rev("i.MX27", mx27_revision());
+       clk_disable(&iim_clk);
 
 #if defined(CONFIG_DEBUG_LL) && !defined(CONFIG_DEBUG_ICEDCC)
        clk_enable(&uart1_clk);
index 3b117be37bd2cd8cd6ce997ec294060045c44d11..ff38e1505f670306997d2aee412a9c71cc2e32a8 100644 (file)
 
 #include <mach/hardware.h>
 
-static int cpu_silicon_rev = -1;
-static int cpu_partnumber;
+static int mx27_cpu_rev = -1;
+static int mx27_cpu_partnumber;
 
 #define SYS_CHIP_ID             0x00    /* The offset of CHIP ID register */
 
-static void query_silicon_parameter(void)
+static int mx27_read_cpu_rev(void)
 {
        u32 val;
        /*
@@ -42,20 +42,18 @@ static void query_silicon_parameter(void)
        val = __raw_readl(MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR
                                + SYS_CHIP_ID));
 
+       mx27_cpu_partnumber = (int)((val >> 12) & 0xFFFF);
+
        switch (val >> 28) {
        case 0:
-               cpu_silicon_rev = IMX_CHIP_REVISION_1_0;
-               break;
+               return IMX_CHIP_REVISION_1_0;
        case 1:
-               cpu_silicon_rev = IMX_CHIP_REVISION_2_0;
-               break;
+               return IMX_CHIP_REVISION_2_0;
        case 2:
-               cpu_silicon_rev = IMX_CHIP_REVISION_2_1;
-               break;
+               return IMX_CHIP_REVISION_2_1;
        default:
-               cpu_silicon_rev = IMX_CHIP_REVISION_UNKNOWN;
+               return IMX_CHIP_REVISION_UNKNOWN;
        }
-       cpu_partnumber = (int)((val >> 12) & 0xFFFF);
 }
 
 /*
@@ -65,12 +63,12 @@ static void query_silicon_parameter(void)
  */
 int mx27_revision(void)
 {
-       if (cpu_silicon_rev == -1)
-               query_silicon_parameter();
+       if (mx27_cpu_rev == -1)
+               mx27_cpu_rev = mx27_read_cpu_rev();
 
-       if (cpu_partnumber != 0x8821)
+       if (mx27_cpu_partnumber != 0x8821)
                return -EINVAL;
 
-       return cpu_silicon_rev;
+       return mx27_cpu_rev;
 }
 EXPORT_SYMBOL(mx27_revision);