xilinx: common: Add function to print SoC info
authorT Karthik Reddy <t.karthik.reddy@xilinx.com>
Tue, 10 Aug 2021 12:50:20 +0000 (06:50 -0600)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 26 Aug 2021 06:08:11 +0000 (08:08 +0200)
Add print_cpuinfo() to print SoC info like family & revision.
This function depends on CONFIG_DISPLAY_CPUINFO config.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Reviewed-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
board/xilinx/common/board.c

index 92b61d8..90c87ba 100644 (file)
@@ -18,6 +18,7 @@
 #include <i2c_eeprom.h>
 #include <net.h>
 #include <generated/dt.h>
+#include <soc.h>
 
 #include "fru.h"
 
@@ -440,3 +441,28 @@ int __maybe_unused board_fit_config_name_match(const char *name)
 
        return -1;
 }
+
+#if defined(CONFIG_DISPLAY_CPUINFO) && !defined(CONFIG_ARCH_ZYNQ)
+int print_cpuinfo(void)
+{
+       struct udevice *soc;
+       char name[SOC_MAX_STR_SIZE];
+       int ret;
+
+       ret = soc_get(&soc);
+       if (ret) {
+               printf("CPU:   UNKNOWN\n");
+               return 0;
+       }
+
+       ret = soc_get_family(soc, name, SOC_MAX_STR_SIZE);
+       if (ret)
+               printf("CPU:   %s\n", name);
+
+       ret = soc_get_revision(soc, name, SOC_MAX_STR_SIZE);
+       if (ret)
+               printf("Silicon: %s\n", name);
+
+       return 0;
+}
+#endif