Skip to content

Commit

Permalink
soc: nordic: nrf52: add support for DT-based regulators config
Browse files Browse the repository at this point in the history
In addition to Kconfig options (soon to be deprecated), allow
configuring the regulators using DT.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
  • Loading branch information
gmarull authored and fabiobaltieri committed Aug 6, 2024
1 parent af03532 commit e189fb0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions soc/nordic/nrf52/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* for the Nordic Semiconductor nRF52 family processor.
*/

#include <zephyr/devicetree.h>
#include <zephyr/dt-bindings/regulator/nrf5x.h>
#include <zephyr/kernel.h>
#include <zephyr/init.h>
#include <hal/nrf_power.h>
Expand All @@ -30,10 +32,12 @@ static int nordicsemi_nrf52_init(void)
NRF_NVMC->ICACHECNF = NVMC_ICACHECNF_CACHEEN_Msk;
#endif

#if defined(CONFIG_SOC_DCDC_NRF52X)
#if defined(CONFIG_SOC_DCDC_NRF52X) || \
(DT_PROP(DT_INST(0, nordic_nrf5x_regulator), regulator_initial_mode) == NRF_REG_MODE_DCDC)
nrf_power_dcdcen_set(NRF_POWER, true);
#endif
#if NRF_POWER_HAS_DCDCEN_VDDH && defined(CONFIG_SOC_DCDC_NRF52X_HV)
#if NRF_POWER_HAS_DCDCEN_VDDH && (defined(CONFIG_SOC_DCDC_NRF52X_HV) || \
DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf52x_regulator_hv), okay))
nrf_power_dcdcen_vddh_set(NRF_POWER, true);
#endif

Expand Down

0 comments on commit e189fb0

Please sign in to comment.