blob: de19955e2f77a49f8f5195c2a863f5861e98ecd8 [file] [log] [blame]
Anatolij Gustschin64b5f462019-06-12 13:35:25 +02001// SPDX-License-Identifier: GPL-2.0+
2#include <common.h>
Simon Glassf7ae49f2020-05-10 11:40:05 -06003#include <log.h>
Anatolij Gustschin64b5f462019-06-12 13:35:25 +02004#include <asm/arch/sci/sci.h>
Anatolij Gustschin910b2fc2019-10-26 16:24:04 +02005#include <asm/mach-imx/sys_proto.h>
Peng Fan3f497422020-04-22 10:50:04 +08006#include <imx_sip.h>
Peng Fandc575202020-05-11 15:13:34 +08007#include <linux/arm-smccc.h>
Anatolij Gustschin64b5f462019-06-12 13:35:25 +02008
9int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate)
10{
11 sc_pm_clock_rate_t rate = clk_rate;
12 int ret;
13
14 /* Power up UARTn */
15 ret = sc_pm_set_resource_power_mode(-1, uart_rsrc, SC_PM_PW_MODE_ON);
16 if (ret)
17 return ret;
18
19 /* Set UARTn clock root to 'rate' MHz */
20 ret = sc_pm_set_clock_rate(-1, uart_rsrc, SC_PM_CLK_PER, &rate);
21 if (ret)
22 return ret;
23
24 /* Enable UARTn clock root */
25 ret = sc_pm_clock_enable(-1, uart_rsrc, SC_PM_CLK_PER, true, false);
26 if (ret)
27 return ret;
28
29 return 0;
30}
Anatolij Gustschind87b2482019-06-12 13:35:26 +020031
32void build_info(void)
33{
Peng Fandc575202020-05-11 15:13:34 +080034 struct arm_smccc_res res;
Anatolij Gustschin910b2fc2019-10-26 16:24:04 +020035 u32 seco_build = 0, seco_commit = 0;
Anatolij Gustschind87b2482019-06-12 13:35:26 +020036 u32 sc_build = 0, sc_commit = 0;
Anatolij Gustschin910b2fc2019-10-26 16:24:04 +020037 ulong atf_commit = 0;
Anatolij Gustschind87b2482019-06-12 13:35:26 +020038
39 /* Get SCFW build and commit id */
40 sc_misc_build_info(-1, &sc_build, &sc_commit);
41 if (!sc_build) {
42 printf("SCFW does not support build info\n");
43 sc_commit = 0; /* Display 0 if build info not supported */
44 }
Anatolij Gustschin910b2fc2019-10-26 16:24:04 +020045
46 /* Get SECO FW build and commit id */
47 sc_seco_build_info(-1, &seco_build, &seco_commit);
48 if (!seco_build) {
49 debug("SECO FW does not support build info\n");
50 /* Display 0 when the build info is not supported */
51 seco_commit = 0;
52 }
53
54 /* Get ARM Trusted Firmware commit id */
Peng Fandc575202020-05-11 15:13:34 +080055 arm_smccc_smc(IMX_SIP_BUILDINFO, IMX_SIP_BUILDINFO_GET_COMMITHASH,
56 0, 0, 0, 0, 0, 0, &res);
57 atf_commit = res.a0;
Anatolij Gustschin910b2fc2019-10-26 16:24:04 +020058 if (atf_commit == 0xffffffff) {
59 debug("ATF does not support build info\n");
60 atf_commit = 0x30; /* Display 0 */
61 }
62
63 printf("Build: SCFW %08x, SECO-FW %08x, ATF %s\n",
64 sc_commit, seco_commit, (char *)&atf_commit);
Anatolij Gustschind87b2482019-06-12 13:35:26 +020065}