soc: silabs: Initialize DCDC from device tree
The DC-DC converter was unconditionally initialized with default settings on Series 2. Add device tree binding and nodes, and guard call to init function. Map DT options to config header from HAL. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
This commit is contained in:
parent
60462266e3
commit
3d0909ed18
16 changed files with 196 additions and 2 deletions
|
@ -86,6 +86,7 @@ if(CONFIG_SOC_GECKO_HAS_RADIO)
|
|||
endif()
|
||||
|
||||
zephyr_include_directories(
|
||||
config
|
||||
${DEVICE_DIR}/SiliconLabs/${SILABS_DEVICE_FAMILY}/Include
|
||||
${COMMON_DIR}/config
|
||||
${COMMON_DIR}/inc
|
||||
|
@ -146,8 +147,12 @@ zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_IADC ${EMLIB_DIR}/src/em_i
|
|||
zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_BURTC ${EMLIB_DIR}/src/em_burtc.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CMU ${EMLIB_DIR}/src/em_cmu.c)
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_DEV_INIT
|
||||
if(CONFIG_SOC_GECKO_DEV_INIT)
|
||||
zephyr_library_sources_ifdef(CONFIG_DT_HAS_SILABS_SERIES2_DCDC_ENABLED
|
||||
${SERVICE_DIR}/device_init/src/sl_device_init_dcdc_s2.c
|
||||
)
|
||||
endif()
|
||||
zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_DEV_INIT
|
||||
${SERVICE_DIR}/device_init/src/sl_device_init_dpll_s2.c
|
||||
${SERVICE_DIR}/device_init/src/sl_device_init_hfrco.c
|
||||
${SERVICE_DIR}/device_init/src/sl_device_init_hfxo_s2.c
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) 2024 Silicon Laboratories Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* This configuration header is used by the HAL driver device_init_dcdc from hal_silabs,
|
||||
* invoked through the soc_early_init hook. DeviceTree options are converted to config macros
|
||||
* expected by the HAL driver.
|
||||
*/
|
||||
|
||||
#ifndef SL_DEVICE_INIT_DCDC_CONFIG_H
|
||||
#define SL_DEVICE_INIT_DCDC_CONFIG_H
|
||||
|
||||
#include <zephyr/devicetree.h>
|
||||
|
||||
#if DT_HAS_COMPAT_STATUS_OKAY(silabs_series2_dcdc)
|
||||
|
||||
#define DCDC_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(silabs_series2_dcdc)
|
||||
|
||||
#define SL_DEVICE_INIT_DCDC_ENABLE DT_PROP(DCDC_NODE, regulator_boot_on)
|
||||
#define SL_DEVICE_INIT_DCDC_BYPASS DT_PROP(DCDC_NODE, regulator_allow_bypass)
|
||||
|
||||
#define SL_DEVICE_INIT_DCDC_TYPE DT_PROP_OR(DCDC_NODE, regulator_initial_mode, 0)
|
||||
|
||||
#define SL_DEVICE_INIT_DCDC_BOOST_OUTPUT DT_ENUM_IDX(DCDC_NODE, regulator_init_microvolt)
|
||||
|
||||
#define SL_DEVICE_INIT_DCDC_PFMX_IPKVAL_OVERRIDE \
|
||||
DT_NODE_HAS_PROP(DCDC_NODE, silabs_pfmx_peak_current_milliamp)
|
||||
|
||||
#define SL_DEVICE_INIT_DCDC_PFMX_IPKVAL \
|
||||
(DT_ENUM_IDX(DCDC_NODE, silabs_pfmx_peak_current_milliamp) + 3)
|
||||
|
||||
#endif /* DT_HAS_COMPAT_STATUS_OKAY */
|
||||
|
||||
#endif /* SL_DEVICE_INIT_DCDC_CONFIG_H */
|
Loading…
Add table
Add a link
Reference in a new issue