blob: 76d6571d8bfa760811939d05e0f85f94171411d7 [file] [log] [blame]
Anatolij Gustschin64b5f462019-06-12 13:35:25 +02001// SPDX-License-Identifier: GPL-2.0+
2#include <common.h>
3#include <asm/arch/sci/sci.h>
Anatolij Gustschin910b2fc2019-10-26 16:24:04 +02004#include <asm/mach-imx/sys_proto.h>
Peng Fan3f497422020-04-22 10:50:04 +08005#include <imx_sip.h>
Anatolij Gustschin64b5f462019-06-12 13:35:25 +02006
7int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate)
8{
9 sc_pm_clock_rate_t rate = clk_rate;
10 int ret;
11
12 /* Power up UARTn */
13 ret = sc_pm_set_resource_power_mode(-1, uart_rsrc, SC_PM_PW_MODE_ON);
14 if (ret)
15 return ret;
16
17 /* Set UARTn clock root to 'rate' MHz */
18 ret = sc_pm_set_clock_rate(-1, uart_rsrc, SC_PM_CLK_PER, &rate);
19 if (ret)
20 return ret;
21
22 /* Enable UARTn clock root */
23 ret = sc_pm_clock_enable(-1, uart_rsrc, SC_PM_CLK_PER, true, false);
24 if (ret)
25 return ret;
26
27 return 0;
28}
Anatolij Gustschind87b2482019-06-12 13:35:26 +020029
30void build_info(void)
31{
Anatolij Gustschin910b2fc2019-10-26 16:24:04 +020032 u32 seco_build = 0, seco_commit = 0;
Anatolij Gustschind87b2482019-06-12 13:35:26 +020033 u32 sc_build = 0, sc_commit = 0;
Anatolij Gustschin910b2fc2019-10-26 16:24:04 +020034 ulong atf_commit = 0;
Anatolij Gustschind87b2482019-06-12 13:35:26 +020035
36 /* Get SCFW build and commit id */
37 sc_misc_build_info(-1, &sc_build, &sc_commit);
38 if (!sc_build) {
39 printf("SCFW does not support build info\n");
40 sc_commit = 0; /* Display 0 if build info not supported */
41 }
Anatolij Gustschin910b2fc2019-10-26 16:24:04 +020042
43 /* Get SECO FW build and commit id */
44 sc_seco_build_info(-1, &seco_build, &seco_commit);
45 if (!seco_build) {
46 debug("SECO FW does not support build info\n");
47 /* Display 0 when the build info is not supported */
48 seco_commit = 0;
49 }
50
51 /* Get ARM Trusted Firmware commit id */
Peng Fan3f497422020-04-22 10:50:04 +080052 atf_commit = call_imx_sip(IMX_SIP_BUILDINFO,
53 IMX_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0);
Anatolij Gustschin910b2fc2019-10-26 16:24:04 +020054 if (atf_commit == 0xffffffff) {
55 debug("ATF does not support build info\n");
56 atf_commit = 0x30; /* Display 0 */
57 }
58
59 printf("Build: SCFW %08x, SECO-FW %08x, ATF %s\n",
60 sc_commit, seco_commit, (char *)&atf_commit);
Anatolij Gustschind87b2482019-06-12 13:35:26 +020061}