arm: silabs: Enable DCDC before setting up clk

This enables DCDC for Silabs devices before initializing the
clock.

Signed-off-by: Endre Karlson <endre.karslon@gmail.com>
This commit is contained in:
Endre Karlson 2018-11-08 13:48:12 +01:00 committed by Kumar Gala
parent d1b3efd98b
commit 91c4d20214
6 changed files with 56 additions and 5 deletions

View file

@ -11,3 +11,5 @@ CONFIG_CORTEX_M_SYSTICK=y
CONFIG_GPIO=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=38400000
CONFIG_CMU_HFCLK_HFRCO=y
CONFIG_SOC_GECKO_EMU_DCDC=y
CONFIG_SOC_GECKO_EMU_DCDC_MODE_ON=y

View file

@ -24,7 +24,7 @@ zephyr_compile_definitions(
zephyr_sources( emlib/src/em_system.c)
zephyr_sources_ifdef(CONFIG_HAS_CMU emlib/src/em_cmu.c)
zephyr_sources_ifdef(CONFIG_HAS_EMU emlib/src/em_emu.c)
zephyr_sources_ifdef(CONFIG_SOC_GECKO_EMU emlib/src/em_emu.c)
zephyr_sources_ifdef(CONFIG_GPIO_GECKO emlib/src/em_gpio.c)
zephyr_sources_ifdef(CONFIG_UART_GECKO emlib/src/em_usart.c)
zephyr_sources_ifdef(CONFIG_LEUART_GECKO emlib/src/em_leuart.c)

View file

@ -29,10 +29,35 @@ config SOC_PART_NUMBER
that you should not set directly. The part number selection choice defines
the default value for this string.
config HAS_EMU
config SOC_GECKO_EMU
bool
help
Set if the energy management unit (EMU) is present in the SoC.
Set if the energy management unit (EMU) is used.
config SOC_GECKO_EMU_DCDC
bool "Enable SoC DC/DC regulator"
select SOC_GECKO_EMU
help
Enable the on chip DC/DC regulator
choice SOC_GECKO_EMU_DCDC_MODE
prompt "DC/DC mode"
depends on SOC_GECKO_EMU_DCDC
help
Select power configuration mode of the on chip DC/DC converter.
config SOC_GECKO_EMU_DCDC_MODE_UNCONFIGURED
bool "Initial / Unconfigured"
config SOC_GECKO_EMU_DCDC_MODE_ON
bool "DC/DC On"
config SOC_GECKO_EMU_DCDC_MODE_OFF
bool "DC/DC Off"
config SOC_GECKO_EMU_DCDC_MODE_BYPASS
bool "Bypass"
endchoice
config HAS_CMU
bool

View file

@ -13,6 +13,7 @@
#include <init.h>
#include <soc.h>
#include <em_cmu.h>
#include <em_emu.h>
#include <em_chip.h>
#include <arch/cpu.h>
#include <cortex_m/exc.h>
@ -70,6 +71,25 @@ static ALWAYS_INLINE void clkInit(void)
#endif
}
#ifdef CONFIG_SOC_GECKO_EMU_DCDC
static ALWAYS_INLINE void dcdc_init(void)
{
#if defined(CONFIG_SOC_GECKO_EMU_DCDC_MODE_UNCONFIGURED)
/* Nothing to do, leave DC/DC converter in unconfigured, safe state. */
#elif defined(CONFIG_SOC_GECKO_EMU_DCDC_MODE_ON) || defined(CONFIG_SOC_GECKO_EMU_DCDC_MODE_BYPASS)
EMU_DCDCInit_TypeDef init_cfg = EMU_DCDCINIT_DEFAULT;
#if defined(CONFIG_SOC_GECKO_EMU_DCDC_MODE_BYPASS)
init_cfg.dcdcMode = emuDcdcMode_Bypass;
#endif
EMU_DCDCInit(&init_cfg);
#elif defined(CONFIG_SOC_GECKO_EMU_DCDC_MODE_OFF)
EMU_DCDCPowerOff();
#else
#error "Unsupported power configuration mode of the on chip DC/DC converter."
#endif
}
#endif
/**
* @brief Perform basic hardware initialization
*
@ -92,6 +112,10 @@ static int silabs_exx32_init(struct device *arg)
_ClearFaults();
#ifdef CONFIG_SOC_GECKO_EMU_DCDC
dcdc_init();
#endif
/* Initialize system clock according to CONFIG_CMU settings */
clkInit();

View file

@ -12,7 +12,7 @@ depends on SOC_SERIES_EFM32PG12B
config SOC_EFM32PG12B
bool "SOC_EFM32PG12B"
select HAS_CMU
select HAS_EMU
select SOC_GECKO_EMU
endchoice

View file

@ -13,7 +13,7 @@ config SOC_EFR32MG12P
bool "SOC_EFR32MG12P"
select HAS_SILABS_GECKO
select HAS_CMU
select HAS_EMU
select SOC_GECKO_EMU
endchoice