Anatolij Gustschin | ef156d2 | 2019-06-12 13:35:25 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | #include <common.h> |
| 3 | #include <asm/arch/sci/sci.h> |
Anatolij Gustschin | a8d7797 | 2019-10-26 16:24:04 +0200 | [diff] [blame] | 4 | #include <asm/mach-imx/sys_proto.h> |
Peng Fan | f1863a5 | 2020-04-22 10:50:04 +0800 | [diff] [blame] | 5 | #include <imx_sip.h> |
Anatolij Gustschin | ef156d2 | 2019-06-12 13:35:25 +0200 | [diff] [blame] | 6 | |
| 7 | int 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 Gustschin | 21f2747 | 2019-06-12 13:35:26 +0200 | [diff] [blame] | 29 | |
| 30 | void build_info(void) |
| 31 | { |
Anatolij Gustschin | a8d7797 | 2019-10-26 16:24:04 +0200 | [diff] [blame] | 32 | u32 seco_build = 0, seco_commit = 0; |
Anatolij Gustschin | 21f2747 | 2019-06-12 13:35:26 +0200 | [diff] [blame] | 33 | u32 sc_build = 0, sc_commit = 0; |
Anatolij Gustschin | a8d7797 | 2019-10-26 16:24:04 +0200 | [diff] [blame] | 34 | ulong atf_commit = 0; |
Anatolij Gustschin | 21f2747 | 2019-06-12 13:35:26 +0200 | [diff] [blame] | 35 | |
| 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 Gustschin | a8d7797 | 2019-10-26 16:24:04 +0200 | [diff] [blame] | 42 | |
| 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 Fan | f1863a5 | 2020-04-22 10:50:04 +0800 | [diff] [blame] | 52 | atf_commit = call_imx_sip(IMX_SIP_BUILDINFO, |
| 53 | IMX_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0); |
Anatolij Gustschin | a8d7797 | 2019-10-26 16:24:04 +0200 | [diff] [blame] | 54 | 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 Gustschin | 21f2747 | 2019-06-12 13:35:26 +0200 | [diff] [blame] | 61 | } |