Merge "drivers/stm32mp_pmic: register PMIC resources as secure or not" into integration
This commit is contained in:
commit
f4d5b6a78a
|
@ -54,6 +54,15 @@ int dt_pmic_status(void)
|
|||
return fdt_get_status(node);
|
||||
}
|
||||
|
||||
static bool dt_pmic_is_secure(void)
|
||||
{
|
||||
int status = dt_pmic_status();
|
||||
|
||||
return (status >= 0) &&
|
||||
(status == DT_SECURE) &&
|
||||
(i2c_handle.dt_status == DT_SECURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get PMIC and its I2C bus configuration from the device tree.
|
||||
* Return 0 on success, negative on error, 1 if no PMIC node is found.
|
||||
|
@ -223,6 +232,19 @@ bool initialize_pmic_i2c(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void register_pmic_shared_peripherals(void)
|
||||
{
|
||||
uintptr_t i2c_base = i2c_handle.i2c_base_addr;
|
||||
|
||||
if (dt_pmic_is_secure()) {
|
||||
stm32mp_register_secure_periph_iomem(i2c_base);
|
||||
} else {
|
||||
if (i2c_base != 0U) {
|
||||
stm32mp_register_non_secure_periph_iomem(i2c_base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void initialize_pmic(void)
|
||||
{
|
||||
unsigned long pmic_version;
|
||||
|
@ -232,6 +254,8 @@ void initialize_pmic(void)
|
|||
return;
|
||||
}
|
||||
|
||||
register_pmic_shared_peripherals();
|
||||
|
||||
if (stpmic1_get_version(&pmic_version) != 0) {
|
||||
ERROR("Failed to access PMIC\n");
|
||||
panic();
|
||||
|
|
Loading…
Reference in New Issue