blob: 2cd794d54a30b0d81cf24ca713e0c702765930f0 [file] [log] [blame]
Anatolij Gustschinef156d22019-06-12 13:35:25 +02001// SPDX-License-Identifier: GPL-2.0+
2#include <common.h>
Simon Glass0f2af882020-05-10 11:40:05 -06003#include <log.h>
Anatolij Gustschinef156d22019-06-12 13:35:25 +02004#include <asm/arch/sci/sci.h>
Anatolij Gustschina8d77972019-10-26 16:24:04 +02005#include <asm/mach-imx/sys_proto.h>
Peng Fanf1863a52020-04-22 10:50:04 +08006#include <imx_sip.h>
Anatolij Gustschinef156d22019-06-12 13:35:25 +02007
8int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate)
9{
10 sc_pm_clock_rate_t rate = clk_rate;
11 int ret;
12
13 /* Power up UARTn */
14 ret = sc_pm_set_resource_power_mode(-1, uart_rsrc, SC_PM_PW_MODE_ON);
15 if (ret)
16 return ret;
17
18 /* Set UARTn clock root to 'rate' MHz */
19 ret = sc_pm_set_clock_rate(-1, uart_rsrc, SC_PM_CLK_PER, &rate);
20 if (ret)
21 return ret;
22
23 /* Enable UARTn clock root */
24 ret = sc_pm_clock_enable(-1, uart_rsrc, SC_PM_CLK_PER, true, false);
25 if (ret)
26 return ret;
27
28 return 0;
29}
Anatolij Gustschin21f27472019-06-12 13:35:26 +020030
31void build_info(void)
32{
Anatolij Gustschina8d77972019-10-26 16:24:04 +020033 u32 seco_build = 0, seco_commit = 0;
Anatolij Gustschin21f27472019-06-12 13:35:26 +020034 u32 sc_build = 0, sc_commit = 0;
Anatolij Gustschina8d77972019-10-26 16:24:04 +020035 ulong atf_commit = 0;
Anatolij Gustschin21f27472019-06-12 13:35:26 +020036
37 /* Get SCFW build and commit id */
38 sc_misc_build_info(-1, &sc_build, &sc_commit);
39 if (!sc_build) {
40 printf("SCFW does not support build info\n");
41 sc_commit = 0; /* Display 0 if build info not supported */
42 }
Anatolij Gustschina8d77972019-10-26 16:24:04 +020043
44 /* Get SECO FW build and commit id */
45 sc_seco_build_info(-1, &seco_build, &seco_commit);
46 if (!seco_build) {
47 debug("SECO FW does not support build info\n");
48 /* Display 0 when the build info is not supported */
49 seco_commit = 0;
50 }
51
52 /* Get ARM Trusted Firmware commit id */
Peng Fanf1863a52020-04-22 10:50:04 +080053 atf_commit = call_imx_sip(IMX_SIP_BUILDINFO,
54 IMX_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0);
Anatolij Gustschina8d77972019-10-26 16:24:04 +020055 if (atf_commit == 0xffffffff) {
56 debug("ATF does not support build info\n");
57 atf_commit = 0x30; /* Display 0 */
58 }
59
60 printf("Build: SCFW %08x, SECO-FW %08x, ATF %s\n",
61 sc_commit, seco_commit, (char *)&atf_commit);
Anatolij Gustschin21f27472019-06-12 13:35:26 +020062}