Browse Source

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>
pull/1984/head
Nicolas Le Bayon 5 years ago
committed by Yann Gautier
parent
commit
ae7792e058
  1. 19
      drivers/st/pmic/stm32mp_pmic.c
  2. 10
      include/drivers/st/stm32mp_pmic.h
  3. 1
      plat/st/stm32mp1/bl2_plat_setup.c

19
drivers/st/pmic/stm32mp_pmic.c

@ -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)
{

10
include/drivers/st/stm32mp_pmic.h

@ -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
*

1
plat/st/stm32mp1/bl2_plat_setup.c

@ -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();

Loading…
Cancel
Save