OMAP3: Move print_cpuinfo() function to not duplicate code
authorEnric Balletbo i Serra <eballetbo@gmail.com>
Wed, 25 May 2011 08:12:38 +0000 (10:12 +0200)
committerAnand Gadiyar <gadiyar@ti.com>
Thu, 14 Jul 2011 12:10:48 +0000 (17:40 +0530)
The print_cpuinfo() function is implemented by various boards, this
patch moves this function to a common place to not duplicate code.

 board/igep00x0/igep00x0.c :129:int print_cpuinfo(void)
 board/overo/overo.c       :164:int print_cpuinfo(void)

Signed-off-by: Enric Balletbo i Serra <eballetbo@gmail.com>
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
board/igep00x0/igep00x0.c
board/overo/overo.c
cpu/omap3/sys_info.c

index a876da3..64cc023 100644 (file)
@@ -60,16 +60,6 @@ extern dpll_param *get_per_dpll_param(void);
 #define __raw_readw(a)         (*(volatile unsigned short *)(a))
 #define __raw_writew(v, a)     (*(volatile unsigned short *)(a) = (v))
 
-static char *rev_s[CPU_3XX_MAX_REV] = {
-                               "1.0",
-                               "2.0",
-                               "2.1",
-                               "3.0",
-                               "3.1",
-                               "UNKNOWN",
-                               "UNKNOWN",
-                               "3.1.2"};
-
 /*******************************************************
  * Routine: delay
  * Description: spinning delay to use before udelay works
@@ -123,87 +113,6 @@ u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
        } while (1);
 }
 
-/******************************************
- * Print CPU information
- ******************************************/
-int print_cpuinfo (void)
-{
-       char *cpu_family_s, *cpu_s, *sec_s;
-
-       switch (get_cpu_family()) {
-       case CPU_OMAP34XX:
-               cpu_family_s = "OMAP";
-               switch (get_cpu_type()) {
-               case OMAP3503:
-                       cpu_s = "3503";
-                       break;
-               case OMAP3515:
-                       cpu_s = "3515";
-                       break;
-               case OMAP3525:
-                       cpu_s = "3525";
-                       break;
-               case OMAP3530:
-                       cpu_s = "3530";
-                       break;
-               default:
-                       cpu_s = "35XX";
-                       break;
-               }
-               break;
-       case CPU_AM35XX:
-               cpu_family_s = "AM";
-               switch (get_cpu_type()) {
-               case AM3505:
-                       cpu_s = "3505";
-                       break;
-               case AM3517:
-                       cpu_s = "3517";
-                       break;
-               default:
-                       cpu_s = "35XX";
-                       break;
-               }
-               break;
-       case CPU_OMAP36XX:
-               cpu_family_s = "OMAP";
-               switch (get_cpu_type()) {
-               case OMAP3730:
-                       cpu_s = "3630/3730";
-                       break;
-               default:
-                       cpu_s = "36XX/37XX";
-                       break;
-               }
-               break;
-       default:
-               cpu_family_s = "OMAP";
-               cpu_s = "35XX";
-       }
-
-       switch (get_device_type()) {
-       case TST_DEVICE:
-               sec_s = "TST";
-               break;
-       case EMU_DEVICE:
-               sec_s = "EMU";
-               break;
-       case HS_DEVICE:
-               sec_s = "HS";
-               break;
-       case GP_DEVICE:
-               sec_s = "GP";
-               break;
-       default:
-               sec_s = "?";
-       }
-
-       printf("%s%s-%s ES%s\n",
-                       cpu_family_s, cpu_s, sec_s, rev_s[get_cpu_rev()]);
-
-       return 0;
-}
-
 /*************************************************************
  * get_sys_clk_speed - determine reference oscillator speed
  *  based on known 32kHz clock and gptimer.
index b3a73e6..d09b594 100644 (file)
@@ -66,16 +66,6 @@ extern dpll_param *get_per_dpll_param();
 #define __raw_readw(a)         (*(volatile unsigned short *)(a))
 #define __raw_writew(v, a)     (*(volatile unsigned short *)(a) = (v))
 
-static char *rev_s[CPU_3XX_MAX_REV] = {
-                               "1.0",
-                               "2.0",
-                               "2.1",
-                               "3.0",
-                               "3.1",
-                               "UNKNOWN",
-                               "UNKNOWN",
-                               "3.1.2"};
-
 /*******************************************************
  * Routine: delay
  * Description: spinning delay to use before udelay works
@@ -159,87 +149,6 @@ u32 get_mem_type(void)
 }
 
 /******************************************
- * Print CPU information
- ******************************************/
-int print_cpuinfo (void)
-{
-       char *cpu_family_s, *cpu_s, *sec_s;
-
-       switch (get_cpu_family()) {
-       case CPU_OMAP34XX:
-               cpu_family_s = "OMAP";
-               switch (get_cpu_type()) {
-               case OMAP3503:
-                       cpu_s = "3503";
-                       break;
-               case OMAP3515:
-                       cpu_s = "3515";
-                       break;
-               case OMAP3525:
-                       cpu_s = "3525";
-                       break;
-               case OMAP3530:
-                       cpu_s = "3530";
-                       break;
-               default:
-                       cpu_s = "35XX";
-                       break;
-               }
-               break;
-       case CPU_AM35XX:
-               cpu_family_s = "AM";
-               switch (get_cpu_type()) {
-               case AM3505:
-                       cpu_s = "3505";
-                       break;
-               case AM3517:
-                       cpu_s = "3517";
-                       break;
-               default:
-                       cpu_s = "35XX";
-                       break;
-               }
-               break;
-       case CPU_OMAP36XX:
-               cpu_family_s = "OMAP";
-               switch (get_cpu_type()) {
-               case OMAP3730:
-                       cpu_s = "3630/3730";
-                       break;
-               default:
-                       cpu_s = "36XX/37XX";
-                       break;
-               }
-               break;
-       default:
-               cpu_family_s = "OMAP";
-               cpu_s = "35XX";
-       }
-
-       switch (get_device_type()) {
-       case TST_DEVICE:
-               sec_s = "TST";
-               break;
-       case EMU_DEVICE:
-               sec_s = "EMU";
-               break;
-       case HS_DEVICE:
-               sec_s = "HS";
-               break;
-       case GP_DEVICE:
-               sec_s = "GP";
-               break;
-       default:
-               sec_s = "?";
-       }
-
-       printf("%s%s-%s ES%s\n",
-                       cpu_family_s, cpu_s, sec_s, rev_s[get_cpu_rev()]);
-
-       return 0;
-}
-
-/******************************************
  * cpu_is_3410(void) - returns true for 3410
  ******************************************/
 u32 cpu_is_3410(void)
index 9fd9c71..56b6c4d 100644 (file)
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/sys_info.h>
 
+static char *rev_s[CPU_3XX_MAX_REV] = {
+                               "1.0",
+                               "2.0",
+                               "2.1",
+                               "3.0",
+                               "3.1",
+                               "UNKNOWN",
+                               "UNKNOWN",
+                               "3.1.2"};
+
 /*
  *  get_device_type(): tell if GP/HS/EMU/TST
  */
@@ -107,3 +117,84 @@ u32 get_cpu_rev(void)
        else
                return (cpuid >> CPU_3XX_ID_SHIFT) & 0xf;
 }
+
+/*
+ * print_cpuinfo(void): print CPU information
+ */
+int print_cpuinfo(void)
+{
+       char *cpu_family_s, *cpu_s, *sec_s;
+
+       switch (get_cpu_family()) {
+       case CPU_OMAP34XX:
+               cpu_family_s = "OMAP";
+               switch (get_cpu_type()) {
+               case OMAP3503:
+                       cpu_s = "3503";
+                       break;
+               case OMAP3515:
+                       cpu_s = "3515";
+                       break;
+               case OMAP3525:
+                       cpu_s = "3525";
+                       break;
+               case OMAP3530:
+                       cpu_s = "3530";
+                       break;
+               default:
+                       cpu_s = "35XX";
+                       break;
+               }
+               break;
+       case CPU_AM35XX:
+               cpu_family_s = "AM";
+               switch (get_cpu_type()) {
+               case AM3505:
+                       cpu_s = "3505";
+                       break;
+               case AM3517:
+                       cpu_s = "3517";
+                       break;
+               default:
+                       cpu_s = "35XX";
+                       break;
+               }
+               break;
+       case CPU_OMAP36XX:
+               cpu_family_s = "OMAP";
+               switch (get_cpu_type()) {
+               case OMAP3730:
+                       cpu_s = "3630/3730";
+                       break;
+               default:
+                       cpu_s = "36XX/37XX";
+                       break;
+               }
+               break;
+       default:
+               cpu_family_s = "OMAP";
+               cpu_s = "35XX";
+       }
+
+       switch (get_device_type()) {
+       case TST_DEVICE:
+               sec_s = "TST";
+               break;
+       case EMU_DEVICE:
+               sec_s = "EMU";
+               break;
+       case HS_DEVICE:
+               sec_s = "HS";
+               break;
+       case GP_DEVICE:
+               sec_s = "GP";
+               break;
+       default:
+               sec_s = "?";
+       }
+
+       printf("%s%s-%s ES%s\n",
+                       cpu_family_s, cpu_s, sec_s, rev_s[get_cpu_rev()]);
+
+       return 0;
+}