refactor(st-pmic): split initialize_pmic()

print_pmic_info_and_debug() prints the PMIC version ID and displays
regulator information if debug is enabled.
It is under DEBUG flag and called after initialize_pmic() in BL2.

Change-Id: Ib81a625740b7ec6abb49cfca05e44c69efaa4718
Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
This commit is contained in:
Nicolas Le Bayon 2019-11-18 13:13:36 +01:00 committed by Yann Gautier
parent bba9fdee58
commit ae7792e058
3 changed files with 21 additions and 9 deletions

View File

@ -270,8 +270,6 @@ static void register_pmic_shared_peripherals(void)
void initialize_pmic(void)
{
unsigned long pmic_version;
if (!initialize_pmic_i2c()) {
VERBOSE("No PMIC\n");
return;
@ -279,6 +277,16 @@ void initialize_pmic(void)
register_pmic_shared_peripherals();
if (dt_pmic_configure_boot_on_regulators() < 0) {
panic();
};
}
#if DEBUG
void print_pmic_info_and_debug(void)
{
unsigned long pmic_version;
if (stpmic1_get_version(&pmic_version) != 0) {
ERROR("Failed to access PMIC\n");
panic();
@ -286,13 +294,8 @@ void initialize_pmic(void)
INFO("PMIC version = 0x%02lx\n", pmic_version);
stpmic1_dump_regulators();
#if defined(IMAGE_BL2)
if (dt_pmic_configure_boot_on_regulators() != 0) {
panic();
};
#endif
}
#endif
int pmic_ddr_power_init(enum ddr_type ddr_type)
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2019, STMicroelectronics - All Rights Reserved
* Copyright (c) 2017-2021, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -41,6 +41,14 @@ bool initialize_pmic_i2c(void);
*/
void initialize_pmic(void);
#if DEBUG
void print_pmic_info_and_debug(void);
#else
static inline void print_pmic_info_and_debug(void)
{
}
#endif
/*
* pmic_ddr_power_init - Initialize regulators required for DDR
*

View File

@ -273,6 +273,7 @@ void bl2_el3_plat_arch_setup(void)
skip_console_init:
if (dt_pmic_status() > 0) {
initialize_pmic();
print_pmic_info_and_debug();
}
stm32mp1_syscfg_init();