soc: nordic: nrf53: allow configuring regulators using DT

Instead of Kconfig options which are about to be deprecated.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
Gerard Marull-Paretas 2024-06-25 11:33:53 +02:00 committed by Fabio Baltieri
commit 2c3270db43
2 changed files with 11 additions and 3 deletions

View file

@ -37,9 +37,14 @@ config SOC_NRF5340_CPUNET
if SOC_SERIES_NRF53X
VREGMAIN_PATH := $(dt_nodelabel_path,vregmain)
VREGRADIO_PATH := $(dt_nodelabel_path,vregradio)
config SOC_NRF53_ANOMALY_160_WORKAROUND_NEEDED
bool "Workaround for nRF5340 anomaly 160"
imply SOC_NRF53_ANOMALY_160_WORKAROUND
default y if "$(dt_node_int_prop_int,$(VREGMAIN_PATH),regulator-initial-mode)" = 1
default y if "$(dt_node_int_prop_int,$(VREGRADIO_PATH),regulator-initial-mode)" = 1
help
Indicates that the workaround for the anomaly 160 that affects
the nRF5340 SoC should be applied.

View file

@ -15,6 +15,7 @@
#include <zephyr/kernel.h>
#include <zephyr/init.h>
#include <zephyr/sys/barrier.h>
#include <zephyr/dt-bindings/regulator/nrf5x.h>
#include <soc/nrfx_coredep.h>
#include <zephyr/logging/log.h>
#include <nrf_erratas.h>
@ -522,13 +523,15 @@ static int nordicsemi_nrf53_init(void)
nrf_oscillators_hfxo_cap_set(NRF_OSCILLATORS, false, 0);
#endif
#if defined(CONFIG_SOC_DCDC_NRF53X_APP)
#if defined(CONFIG_SOC_DCDC_NRF53X_APP) || \
(DT_PROP(DT_NODELABEL(vregmain), regulator_initial_mode) == NRF5X_REG_MODE_DCDC)
nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_MAIN, true);
#endif
#if defined(CONFIG_SOC_DCDC_NRF53X_NET)
#if defined(CONFIG_SOC_DCDC_NRF53X_NET) || \
(DT_PROP(DT_NODELABEL(vregradio), regulator_initial_mode) == NRF5X_REG_MODE_DCDC)
nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_RADIO, true);
#endif
#if defined(CONFIG_SOC_DCDC_NRF53X_HV)
#if defined(CONFIG_SOC_DCDC_NRF53X_HV) || DT_NODE_HAS_STATUS(DT_NODELABEL(vregh), okay)
nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_HIGH, true);
#endif