Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Silabs SoC families #69402

Merged
merged 6 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boards/silabs/efr32_radio/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ config LOG_BACKEND_SWO_FREQ_HZ
if SOC_GECKO_USE_RAIL

config FPU
default n if SOC_GECKO_SERIES1
default n if SOC_FAMILY_SILABS_S1
default y

endif # SOC_GECKO_USE_RAIL
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwinfo/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ config HWINFO_PSOC6
config HWINFO_GECKO
bool "GECKO hwinfo"
default y
depends on SOC_FAMILY_SILABS_EXX32 && !SOC_SERIES_EFR32MG21 && !SOC_SERIES_EFR32BG22
depends on SOC_VENDOR_SILABS && !SOC_SERIES_EFR32MG21 && !SOC_SERIES_EFR32BG22
select SOC_GECKO_RMU
help
Enable Silabs GECKO hwinfo driver.
Expand Down
14 changes: 7 additions & 7 deletions drivers/pinctrl/pinctrl_gecko.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintp
{
USART_TypeDef *base = (USART_TypeDef *)reg;
uint8_t loc;
#ifdef CONFIG_SOC_GECKO_SERIES1
#ifdef CONFIG_SOC_FAMILY_SILABS_S1
LEUART_TypeDef *lebase = (LEUART_TypeDef *)reg;
#else
int usart_num = USART_NUM(base);
Expand Down Expand Up @@ -50,7 +50,7 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintp
txpin.out);
break;

#ifdef CONFIG_SOC_GECKO_SERIES1
#ifdef CONFIG_SOC_FAMILY_SILABS_S1
case GECKO_FUN_UART_RTS:
pin_config.mode = gpioModePushPull;
pin_config.out = 1;
Expand Down Expand Up @@ -100,7 +100,7 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintp
lebase->ROUTELOC0 &= ~_LEUART_ROUTELOC0_TXLOC_MASK;
lebase->ROUTELOC0 |= (loc << _LEUART_ROUTELOC0_TXLOC_SHIFT);
break;
#else /* CONFIG_SOC_GECKO_SERIES1 */
#else /* CONFIG_SOC_FAMILY_SILABS_S1 */
case GECKO_FUN_UART_LOC:
#ifdef CONFIG_SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION
/* For SOCs with configurable pin_cfg locations (set in SOC Kconfig) */
Expand Down Expand Up @@ -156,11 +156,11 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintp
}
#endif /* UART_GECKO_HW_FLOW_CONTROL */
break;
#endif /* CONFIG_SOC_GECKO_SERIES1 */
#endif /* CONFIG_SOC_FAMILY_SILABS_S1 */
#endif /* CONFIG_UART_GECKO */

#ifdef CONFIG_SPI_GECKO
#ifdef CONFIG_SOC_GECKO_SERIES1
#ifdef CONFIG_SOC_FAMILY_SILABS_S1
case GECKO_FUN_SPIM_SCK:
pin_config.mode = gpioModePushPull;
pin_config.out = 1;
Expand Down Expand Up @@ -241,7 +241,7 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintp
base->ROUTELOC0 |= (loc << _USART_ROUTELOC0_CSLOC_SHIFT);
break;

#else /* CONFIG_SOC_GECKO_SERIES1 */
#else /* CONFIG_SOC_FAMILY_SILABS_S1 */
case GECKO_FUN_SPI_SCK:
pin_config.mode = gpioModePushPull;
pin_config.out = 1;
Expand Down Expand Up @@ -274,7 +274,7 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintp
GPIO_PinModeSet(pin_config.port, pin_config.pin, pin_config.mode,
pin_config.out);
break;
#endif /* CONFIG_SOC_GECKO_SERIES1 */
#endif /* CONFIG_SOC_FAMILY_SILABS_S1 */
#endif /* CONFIG_SPI_GECKO */

default:
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/Kconfig.gecko
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ config UART_GECKO
select SERIAL_HAS_DRIVER
select SERIAL_SUPPORT_INTERRUPT
select SOC_GECKO_USART
select PINCTRL if SOC_GECKO_SERIES1
select PINCTRL if SOC_FAMILY_SILABS_S1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(unrelated to change) but why is pinctrl only selected for a specific series and not the rest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think PINCTRL is also needed for Series 2. For Series 2, the symbol is set in defconfigs of the boards. Obviously, this does not make sense. I believe this symbol should relocate in soc/silabs/s*/Kconfig.soc.

help
Enable the Gecko uart driver.
2 changes: 1 addition & 1 deletion drivers/timer/Kconfig.gecko
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

config GECKO_BURTC_TIMER
bool "SiLabs Gecko BURTC system clock driver"
depends on SOC_GECKO_SERIES2
depends on SOC_FAMILY_SILABS_S2
depends on DT_HAS_SILABS_GECKO_BURTC_ENABLED
select SOC_GECKO_BURTC
select TICKLESS_CAPABLE
Expand Down
2 changes: 1 addition & 1 deletion modules/Kconfig.silabs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
config HAS_SILABS_GECKO
bool
select HAS_CMSIS_CORE
depends on SOC_FAMILY_SILABS_EXX32
depends on SOC_VENDOR_SILABS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

add_subdirectory(common)
zephyr_include_directories(${SOC_SERIES})
zephyr_include_directories(${SOC_FAMILY}/${SOC_SERIES})
35 changes: 10 additions & 25 deletions soc/silabs/exx32/Kconfig → soc/silabs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,19 @@
# Copyright (c) 2018 Gil Benkoe
# SPDX-License-Identifier: Apache-2.0

config SOC_FAMILY_SILABS_EXX32
config SOC_VENDOR_SILABS
select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE
select BUILD_OUTPUT_HEX

if SOC_FAMILY_SILABS_EXX32
if SOC_VENDOR_SILABS

rsource "*/Kconfig"
rsource "*/*/Kconfig"

config SOC_GECKO_SERIES0
bool
help
Set if we're building for Gecko Series 0 SoC.
This is equivalent of _SILICON_LABS_32B_SERIES_0 definition in HAL
code.

config SOC_GECKO_SERIES1
bool
help
Set if we're building for Gecko Series 1 SoC.
This is equivalent of _SILICON_LABS_32B_SERIES_1 definition in HAL
code.

config SOC_GECKO_SERIES2
bool
config SOC_GECKO_SDID
int
help
Set if we're building for Gecko Series 2 SoC.
This is equivalent of _SILICON_LABS_32B_SERIES_2 definition in HAL
code.
Gecko SDK sometime refere to the chipset using the internal ID. This
entry reflects this ID.

config SOC_GECKO_BURTC
bool
Expand Down Expand Up @@ -139,7 +124,7 @@ if PM
config SOC_GECKO_PM_BACKEND_PMGR
bool
depends on SOC_GECKO_DEV_INIT
default y if SOC_GECKO_SERIES2
default y if SOC_FAMILY_SILABS_S2
help
Implement PM using sl_power_manager service from Gecko SDK

Expand Down Expand Up @@ -190,7 +175,7 @@ config SOC_GECKO_DEV_INIT
configures DPLLs and manages the Energy Management Unit.

Disabling these services may negatively impact counter and timer
routines in EXX32 series SoCs.
routines in Silabs SoCs.

config COUNTER_GECKO_STIMER
bool
Expand Down Expand Up @@ -337,4 +322,4 @@ config SOC_GECKO_CUSTOM_RADIO_PHY
management, sending and receiving packets on radio phy. User has
to provide the radio_config.c and radio_config.h files for the phy.

endif # SOC_FAMILY_SILABS_EXX32
endif # SOC_VENDOR_SILABS
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: Apache-2.0

if SOC_FAMILY_SILABS_EXX32
if SOC_VENDOR_SILABS

rsource "*/Kconfig.defconfig"
rsource "*/*/Kconfig.defconfig"

config SOC_GECKO_EMU
default y
Expand Down
12 changes: 12 additions & 0 deletions soc/silabs/Kconfig.soc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) 2017 Christian Taedcke
# SPDX-License-Identifier: Apache-2.0

config SOC_VENDOR_SILABS
bool

config SOC_FAMILY
default "silabs_s0" if SOC_FAMILY_SILABS_S0
default "silabs_s1" if SOC_FAMILY_SILABS_S1
default "silabs_s2" if SOC_FAMILY_SILABS_S2

rsource "*/Kconfig.soc"
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <stdint.h>

#include <zephyr/devicetree.h>
#if CONFIG_SOC_GECKO_SERIES1
#if CONFIG_SOC_FAMILY_SILABS_S1
#include <zephyr/dt-bindings/pinctrl/gecko-pinctrl-s1.h>
#else
#include <zephyr/dt-bindings/pinctrl/gecko-pinctrl.h>
Expand Down
6 changes: 3 additions & 3 deletions soc/silabs/exx32/common/soc.c → soc/silabs/common/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/**
* @file
* @brief Common SoC initialization for the EXX32
* @brief Common SoC initialization for the Silabs products
*/

#include <zephyr/init.h>
Expand Down Expand Up @@ -206,7 +206,7 @@ static void swo_init(void)
*
* @return 0
*/
static int silabs_exx32_init(void)
static int silabs_init(void)
{
/* handle chip errata */
CHIP_Init();
Expand Down Expand Up @@ -244,4 +244,4 @@ static int silabs_exx32_init(void)
return 0;
}

SYS_INIT(silabs_exx32_init, PRE_KERNEL_1, 0);
SYS_INIT(silabs_init, PRE_KERNEL_1, 0);
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
*/

/** @file
* @brief Silabs EXX32 MCU family General Purpose Input Output (GPIO)
* @brief Silabs MCU family General Purpose Input Output (GPIO)
* module HAL driver.
*/

#ifndef _SILABS_EXX32_SOC_GPIO_H_
#define _SILABS_EXX32_SOC_GPIO_H_
#ifndef _SILABS_COMMON_SOC_GPIO_H_
#define _SILABS_COMMON_SOC_GPIO_H_

#include <soc.h>
#include <em_gpio.h>
Expand All @@ -29,4 +29,4 @@ struct soc_gpio_pin {
}
#endif

#endif /* _SILABS_EXX32_SOC_GPIO_H_ */
#endif /* _SILABS_COMMON_SOC_GPIO_H_ */
File renamed without changes.
8 changes: 0 additions & 8 deletions soc/silabs/exx32/efm32gg11b/Kconfig.defconfig.efm32gg11b

This file was deleted.

7 changes: 0 additions & 7 deletions soc/silabs/exx32/efm32gg12b/Kconfig.defconfig.efm32gg12b

This file was deleted.

7 changes: 0 additions & 7 deletions soc/silabs/exx32/efr32bg22/Kconfig.defconfig.efr32bg22

This file was deleted.

7 changes: 0 additions & 7 deletions soc/silabs/exx32/efr32bg27/Kconfig.defconfig.efr32bg27

This file was deleted.

8 changes: 0 additions & 8 deletions soc/silabs/exx32/efr32mg21/Kconfig.defconfig.efr32mg21

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Copyright (c) 2017 Christian Taedcke
# SPDX-License-Identifier: Apache-2.0

config SOC_FAMILY_SILABS_EXX32
config SOC_FAMILY_SILABS_S0
bool

config SOC_FAMILY
default "silabs_exx32" if SOC_FAMILY_SILABS_EXX32
select SOC_VENDOR_SILABS

rsource "*/Kconfig.soc"
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ config SOC_SERIES_EFM32HG
select SOC_GECKO_CMU
select SOC_GECKO_GPIO
select HAS_PM
select SOC_GECKO_SERIES0

config SOC_GECKO_SDID
default 77 if SOC_SERIES_EFM32HG
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

config SOC_SERIES_EFM32HG
bool
select SOC_FAMILY_SILABS_EXX32
select SOC_FAMILY_SILABS_S0
help
EFM32HG Series MCU

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ config SOC_SERIES_EFM32WG
select SOC_GECKO_CMU
select SOC_GECKO_GPIO
select HAS_PM
select SOC_GECKO_SERIES0

config SOC_GECKO_SDID
default 74 if SOC_SERIES_EFM32WG
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

config SOC_SERIES_EFM32WG
bool
select SOC_FAMILY_SILABS_EXX32
select SOC_FAMILY_SILABS_S0
help
EFM32WG Series MCU

Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions soc/silabs/silabs_s1/Kconfig.soc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2017 Christian Taedcke
# SPDX-License-Identifier: Apache-2.0

config SOC_FAMILY_SILABS_S1
bool
select SOC_VENDOR_SILABS

rsource "*/Kconfig.soc"
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ config SOC_SERIES_EFM32GG11B
select SOC_GECKO_EMU
select SOC_GECKO_GPIO
select SOC_GECKO_TRNG
select SOC_GECKO_SERIES1

config SOC_GECKO_SDID
default 100 if SOC_SERIES_EFM32GG11B
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ config NUM_IRQS
# must be >= the highest interrupt number used
default 68

rsource "Kconfig.defconfig.efm32gg11b"
config GPIO_GECKO
default y
depends on GPIO || LOG_BACKEND_SWO

endif # SOC_SERIES_EFM32GG11B
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

config SOC_SERIES_EFM32GG11B
bool
select SOC_FAMILY_SILABS_EXX32
select SOC_FAMILY_SILABS_S1
help
EFM32GG11B Series MCU

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ config SOC_SERIES_EFM32GG12B
select SOC_GECKO_EMU
select SOC_GECKO_GPIO
select SOC_GECKO_TRNG
select SOC_GECKO_SERIES1

config SOC_GECKO_SDID
default 106 if SOC_SERIES_EFM32GG12B
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ config NUM_IRQS
# must be >= the highest interrupt number used
default 68

rsource "Kconfig.defconfig.efm32gg12b"
config GPIO_GECKO
default y
depends on GPIO || LOG_BACKEND_SWO

endif # SOC_SERIES_EFM32GG12B
Loading
Loading