blob: 00fe4670bbc10a28b1625e284493fb9ff00dbb36 [file] [log] [blame]
Anatolij Gustschinef156d22019-06-12 13:35:25 +02001// SPDX-License-Identifier: GPL-2.0+
2#include <common.h>
3#include <asm/arch/sci/sci.h>
Anatolij Gustschina8d77972019-10-26 16:24:04 +02004#include <asm/mach-imx/sys_proto.h>
Anatolij Gustschinef156d22019-06-12 13:35:25 +02005
6int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate)
7{
8 sc_pm_clock_rate_t rate = clk_rate;
9 int ret;
10
11 /* Power up UARTn */
12 ret = sc_pm_set_resource_power_mode(-1, uart_rsrc, SC_PM_PW_MODE_ON);
13 if (ret)
14 return ret;
15
16 /* Set UARTn clock root to 'rate' MHz */
17 ret = sc_pm_set_clock_rate(-1, uart_rsrc, SC_PM_CLK_PER, &rate);
18 if (ret)
19 return ret;
20
21 /* Enable UARTn clock root */
22 ret = sc_pm_clock_enable(-1, uart_rsrc, SC_PM_CLK_PER, true, false);
23 if (ret)
24 return ret;
25
26 return 0;
27}
Anatolij Gustschin21f27472019-06-12 13:35:26 +020028
Anatolij Gustschina8d77972019-10-26 16:24:04 +020029#define FSL_SIP_BUILDINFO 0xC2000003
30#define FSL_SIP_BUILDINFO_GET_COMMITHASH 0x00
31
Anatolij Gustschin21f27472019-06-12 13:35:26 +020032void build_info(void)
33{
Anatolij Gustschina8d77972019-10-26 16:24:04 +020034 u32 seco_build = 0, seco_commit = 0;
Anatolij Gustschin21f27472019-06-12 13:35:26 +020035 u32 sc_build = 0, sc_commit = 0;
Anatolij Gustschina8d77972019-10-26 16:24:04 +020036 ulong atf_commit = 0;
Anatolij Gustschin21f27472019-06-12 13:35:26 +020037
38 /* Get SCFW build and commit id */
39 sc_misc_build_info(-1, &sc_build, &sc_commit);
40 if (!sc_build) {
41 printf("SCFW does not support build info\n");
42 sc_commit = 0; /* Display 0 if build info not supported */
43 }
Anatolij Gustschina8d77972019-10-26 16:24:04 +020044
45 /* Get SECO FW build and commit id */
46 sc_seco_build_info(-1, &seco_build, &seco_commit);
47 if (!seco_build) {
48 debug("SECO FW does not support build info\n");
49 /* Display 0 when the build info is not supported */
50 seco_commit = 0;
51 }
52
53 /* Get ARM Trusted Firmware commit id */
54 atf_commit = call_imx_sip(FSL_SIP_BUILDINFO,
55 FSL_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0);
56 if (atf_commit == 0xffffffff) {
57 debug("ATF does not support build info\n");
58 atf_commit = 0x30; /* Display 0 */
59 }
60
61 printf("Build: SCFW %08x, SECO-FW %08x, ATF %s\n",
62 sc_commit, seco_commit, (char *)&atf_commit);
Anatolij Gustschin21f27472019-06-12 13:35:26 +020063}