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> |
| 4 | |
| 5 | int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate) |
| 6 | { |
| 7 | sc_pm_clock_rate_t rate = clk_rate; |
| 8 | int ret; |
| 9 | |
| 10 | /* Power up UARTn */ |
| 11 | ret = sc_pm_set_resource_power_mode(-1, uart_rsrc, SC_PM_PW_MODE_ON); |
| 12 | if (ret) |
| 13 | return ret; |
| 14 | |
| 15 | /* Set UARTn clock root to 'rate' MHz */ |
| 16 | ret = sc_pm_set_clock_rate(-1, uart_rsrc, SC_PM_CLK_PER, &rate); |
| 17 | if (ret) |
| 18 | return ret; |
| 19 | |
| 20 | /* Enable UARTn clock root */ |
| 21 | ret = sc_pm_clock_enable(-1, uart_rsrc, SC_PM_CLK_PER, true, false); |
| 22 | if (ret) |
| 23 | return ret; |
| 24 | |
| 25 | return 0; |
| 26 | } |
Anatolij Gustschin | 21f2747 | 2019-06-12 13:35:26 +0200 | [diff] [blame] | 27 | |
| 28 | void build_info(void) |
| 29 | { |
| 30 | u32 sc_build = 0, sc_commit = 0; |
| 31 | |
| 32 | /* Get SCFW build and commit id */ |
| 33 | sc_misc_build_info(-1, &sc_build, &sc_commit); |
| 34 | if (!sc_build) { |
| 35 | printf("SCFW does not support build info\n"); |
| 36 | sc_commit = 0; /* Display 0 if build info not supported */ |
| 37 | } |
| 38 | printf("Build: SCFW %x\n", sc_commit); |
| 39 | } |