imx8m: acquire ATF commit hash
authorPeng Fan <peng.fan@nxp.com>
Wed, 22 Apr 2020 02:51:13 +0000 (10:51 +0800)
committerStefano Babic <sbabic@denx.de>
Fri, 1 May 2020 11:46:21 +0000 (13:46 +0200)
Acquire ATF commit hash when booting U-Boot to make user easy
to know the ATF version.

Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
arch/arm/mach-imx/imx8m/soc.c

index 871179509caca086ad72ca59440b40da0b1d0a5d..8b6be7bc1996d28a7f9604b8e5f5052b95495ac2 100644 (file)
@@ -425,3 +425,27 @@ void reset_cpu(ulong addr)
        }
 }
 #endif
+
+#if defined(CONFIG_ARCH_MISC_INIT)
+static void acquire_buildinfo(void)
+{
+       u64 atf_commit = 0;
+
+       /* Get ARM Trusted Firmware commit id */
+       atf_commit = call_imx_sip(IMX_SIP_BUILDINFO,
+                                 IMX_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0);
+       if (atf_commit == 0xffffffff) {
+               debug("ATF does not support build info\n");
+               atf_commit = 0x30; /* Display 0, 0 ascii is 0x30 */
+       }
+
+       printf("\n BuildInfo:\n  - ATF %s\n\n", (char *)&atf_commit);
+}
+
+int arch_misc_init(void)
+{
+       acquire_buildinfo();
+
+       return 0;
+}
+#endif