am33xx: report silicon revision instead of code KARO-TX-2014-08-27
authorSergey Alyoshin <alyoshin.s@gmail.com>
Thu, 22 May 2014 07:56:03 +0000 (11:56 +0400)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 27 Aug 2014 11:20:00 +0000 (13:20 +0200)
As revision code 1 is for silicon revision 2.0, it is easily confused with
silicon revision 1.0.

Device type report also reworked in same style.

Signed-off-by: Sergey Alyoshin <alyoshin.s@gmail.com>
arch/arm/cpu/armv7/am33xx/sys_info.c

index 326d62a..ab327c8 100644 (file)
@@ -78,15 +78,25 @@ u32 get_sysboot_value(void)
 }
 
 #ifdef CONFIG_DISPLAY_CPUINFO
 }
 
 #ifdef CONFIG_DISPLAY_CPUINFO
-#define SYSBOOT_FREQ_SHIFT     22
-#define SYSBOOT_FREQ_MASK      (3 << SYSBOOT_FREQ_SHIFT)
+static char *cpu_revs[] = {
+       "1.0",
+       "2.0",
+       "2.1",
+};
+
+static char *dev_types[] = {
+       "TST",
+       "EMU",
+       "HS",
+       "GP",
+};
 
 /**
  * Print CPU information
  */
 int print_cpuinfo(void)
 {
 
 /**
  * Print CPU information
  */
 int print_cpuinfo(void)
 {
-       char *cpu_s, *sec_s;
+       char *cpu_s, *sec_s, *rev_s;
 
        switch (get_cpu_type()) {
        case AM335X:
 
        switch (get_cpu_type()) {
        case AM335X:
@@ -96,27 +106,20 @@ int print_cpuinfo(void)
                cpu_s = "TI81XX";
                break;
        default:
                cpu_s = "TI81XX";
                break;
        default:
-               cpu_s = "Unknown cpu type";
+               cpu_s = "Unknown CPU type";
        }
 
        }
 
-       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:
+       if (get_cpu_rev() < ARRAY_SIZE(cpu_revs))
+               rev_s = cpu_revs[get_cpu_rev()];
+       else
+               rev_s = "?";
+
+       if (get_device_type() < ARRAY_SIZE(dev_types))
+               sec_s = dev_types[get_device_type()];
+       else
                sec_s = "?";
                sec_s = "?";
-       }
 
 
-       printf("%s-%s rev %d\n", cpu_s, sec_s, get_cpu_rev());
+       printf("%s-%s rev %s\n", cpu_s, sec_s, rev_s);
 
        return 0;
 }
 
        return 0;
 }