diff --git a/soc/arm/silabs_exx32/common/soc.c b/soc/arm/silabs_exx32/common/soc.c index 5c1115007a50..1a331e5c585c 100644 --- a/soc/arm/silabs_exx32/common/soc.c +++ b/soc/arm/silabs_exx32/common/soc.c @@ -116,9 +116,9 @@ static void swo_init(void) GPIO->ROUTEPEN |= GPIO_ROUTEPEN_SWVPEN; /* Set SWO location */ GPIO->ROUTELOC0 = - DT_GPIO_GECKO_SWO_LOCATION << _GPIO_ROUTELOC0_SWVLOC_SHIFT; + SWO_LOCATION << _GPIO_ROUTELOC0_SWVLOC_SHIFT; #else - GPIO->ROUTE = GPIO_ROUTE_SWOPEN | (DT_GPIO_GECKO_SWO_LOCATION << 8); + GPIO->ROUTE = GPIO_ROUTE_SWOPEN | (SWO_LOCATION << 8); #endif soc_gpio_configure(&pin_swo); } diff --git a/soc/arm/silabs_exx32/efm32gg11b/dts_fixup.h b/soc/arm/silabs_exx32/efm32gg11b/dts_fixup.h index cfaaed5d6861..a4d2df55aa17 100644 --- a/soc/arm/silabs_exx32/efm32gg11b/dts_fixup.h +++ b/soc/arm/silabs_exx32/efm32gg11b/dts_fixup.h @@ -10,8 +10,6 @@ #define DT_FLASH_DEV_BASE_ADDRESS DT_SILABS_GECKO_FLASH_CONTROLLER_40000000_BASE_ADDRESS #define DT_FLASH_DEV_NAME DT_SILABS_GECKO_FLASH_CONTROLLER_40000000_LABEL -#define DT_GPIO_GECKO_SWO_LOCATION DT_SILABS_GECKO_GPIO_40088400_LOCATION_SWO - #define DT_RTC_0_NAME DT_LABEL(DT_INST(0, silabs_gecko_rtcc)) /* End of SoC Level DTS fixup file */ diff --git a/soc/arm/silabs_exx32/efm32gg11b/soc_pinmap.h b/soc/arm/silabs_exx32/efm32gg11b/soc_pinmap.h index 06ce60591144..c52bf1740c4a 100644 --- a/soc/arm/silabs_exx32/efm32gg11b/soc_pinmap.h +++ b/soc/arm/silabs_exx32/efm32gg11b/soc_pinmap.h @@ -18,17 +18,22 @@ #include #include +#define GPIO_NODE DT_INST(0, silabs_gecko_gpio) +#if DT_NODE_HAS_PROP(GPIO_NODE, location_swo) +#define SWO_LOCATION DT_PROP(GPIO_NODE, location_swo) +#endif + #ifdef CONFIG_GPIO_GECKO /* Serial Wire Output (SWO) */ -#if (DT_GPIO_GECKO_SWO_LOCATION == 0) +#if (SWO_LOCATION == 0) #define PIN_SWO {gpioPortF, 2, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 1) +#elif (SWO_LOCATION == 1) #define PIN_SWO {gpioPortC, 15, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 2) +#elif (SWO_LOCATION == 2) #define PIN_SWO {gpioPortD, 1, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 3) +#elif (SWO_LOCATION == 3) #define PIN_SWO {gpioPortD, 2, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION >= 4) +#elif (SWO_LOCATION >= 4) #error ("Invalid SWO pin location") #endif #endif /* CONFIG_GPIO_GECKO */ diff --git a/soc/arm/silabs_exx32/efm32jg12b/dts_fixup.h b/soc/arm/silabs_exx32/efm32jg12b/dts_fixup.h index d9f673305e25..5b7adc265254 100644 --- a/soc/arm/silabs_exx32/efm32jg12b/dts_fixup.h +++ b/soc/arm/silabs_exx32/efm32jg12b/dts_fixup.h @@ -11,6 +11,4 @@ #define DT_FLASH_DEV_BASE_ADDRESS DT_SILABS_GECKO_FLASH_CONTROLLER_400E0000_BASE_ADDRESS #define DT_FLASH_DEV_NAME DT_SILABS_GECKO_FLASH_CONTROLLER_400E0000_LABEL -#define DT_GPIO_GECKO_SWO_LOCATION DT_SILABS_GECKO_GPIO_4000A400_LOCATION_SWO - /* End of SoC Level DTS fixup file */ diff --git a/soc/arm/silabs_exx32/efm32jg12b/soc_pinmap.h b/soc/arm/silabs_exx32/efm32jg12b/soc_pinmap.h index 7cf3a2f2c391..5dd7eb47ceb6 100644 --- a/soc/arm/silabs_exx32/efm32jg12b/soc_pinmap.h +++ b/soc/arm/silabs_exx32/efm32jg12b/soc_pinmap.h @@ -16,16 +16,21 @@ #include #include +#define GPIO_NODE DT_INST(0, silabs_gecko_gpio) +#if DT_NODE_HAS_PROP(GPIO_NODE, location_swo) +#define SWO_LOCATION DT_PROP(GPIO_NODE, location_swo) +#endif + /* Serial Wire Output (SWO) */ -#if (DT_GPIO_GECKO_SWO_LOCATION == 0) +#if (SWO_LOCATION == 0) #define PIN_SWO {gpioPortF, 2, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 1) +#elif (SWO_LOCATION == 1) #define PIN_SWO {gpioPortB, 13, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 2) +#elif (SWO_LOCATION == 2) #define PIN_SWO {gpioPortD, 15, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 3) +#elif (SWO_LOCATION == 3) #define PIN_SWO {gpioPortC, 11, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION >= 4) +#elif (SWO_LOCATION >= 4) #error ("Invalid SWO pin location") #endif diff --git a/soc/arm/silabs_exx32/efm32pg12b/dts_fixup.h b/soc/arm/silabs_exx32/efm32pg12b/dts_fixup.h index 05787bd0af26..50a59ef92564 100644 --- a/soc/arm/silabs_exx32/efm32pg12b/dts_fixup.h +++ b/soc/arm/silabs_exx32/efm32pg12b/dts_fixup.h @@ -11,6 +11,4 @@ #define DT_FLASH_DEV_BASE_ADDRESS DT_SILABS_GECKO_FLASH_CONTROLLER_400E0000_BASE_ADDRESS #define DT_FLASH_DEV_NAME DT_SILABS_GECKO_FLASH_CONTROLLER_400E0000_LABEL -#define DT_GPIO_GECKO_SWO_LOCATION DT_SILABS_GECKO_GPIO_4000A400_LOCATION_SWO - /* End of SoC Level DTS fixup file */ diff --git a/soc/arm/silabs_exx32/efm32pg12b/soc_pinmap.h b/soc/arm/silabs_exx32/efm32pg12b/soc_pinmap.h index 2bd549b99449..d073cfc91b49 100644 --- a/soc/arm/silabs_exx32/efm32pg12b/soc_pinmap.h +++ b/soc/arm/silabs_exx32/efm32pg12b/soc_pinmap.h @@ -16,16 +16,21 @@ #include #include +#define GPIO_NODE DT_INST(0, silabs_gecko_gpio) +#if DT_NODE_HAS_PROP(GPIO_NODE, location_swo) +#define SWO_LOCATION DT_PROP(GPIO_NODE, location_swo) +#endif + /* Serial Wire Output (SWO) */ -#if (DT_GPIO_GECKO_SWO_LOCATION == 0) +#if (SWO_LOCATION == 0) #define PIN_SWO {gpioPortF, 2, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 1) +#elif (SWO_LOCATION == 1) #define PIN_SWO {gpioPortB, 13, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 2) +#elif (SWO_LOCATION == 2) #define PIN_SWO {gpioPortD, 15, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 3) +#elif (SWO_LOCATION == 3) #define PIN_SWO {gpioPortC, 11, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION >= 4) +#elif (SWO_LOCATION >= 4) #error ("Invalid SWO pin location") #endif diff --git a/soc/arm/silabs_exx32/efr32bg13p/dts_fixup.h b/soc/arm/silabs_exx32/efr32bg13p/dts_fixup.h index 9642e9e0ab27..c871eb35ff0b 100644 --- a/soc/arm/silabs_exx32/efr32bg13p/dts_fixup.h +++ b/soc/arm/silabs_exx32/efr32bg13p/dts_fixup.h @@ -17,6 +17,4 @@ #define DT_FLASH_DEV_BASE_ADDRESS DT_SILABS_GECKO_FLASH_CONTROLLER_400E0000_BASE_ADDRESS #define DT_FLASH_DEV_NAME DT_SILABS_GECKO_FLASH_CONTROLLER_400E0000_LABEL -#define DT_GPIO_GECKO_SWO_LOCATION DT_SILABS_GECKO_GPIO_4000A400_LOCATION_SWO - /* End of SoC Level DTS fixup file */ diff --git a/soc/arm/silabs_exx32/efr32bg13p/soc_pinmap.h b/soc/arm/silabs_exx32/efr32bg13p/soc_pinmap.h index 8e530db1bb38..47a1b471068d 100644 --- a/soc/arm/silabs_exx32/efr32bg13p/soc_pinmap.h +++ b/soc/arm/silabs_exx32/efr32bg13p/soc_pinmap.h @@ -10,18 +10,24 @@ #ifndef SOC_PINMAP_H_ #define SOC_PINMAP_H_ +#include #include +#define GPIO_NODE DT_INST(0, silabs_gecko_gpio) +#if DT_NODE_HAS_PROP(GPIO_NODE, location_swo) +#define SWO_LOCATION DT_PROP(GPIO_NODE, location_swo) +#endif + /* Serial Wire Output (SWO) */ -#if (DT_GPIO_GECKO_SWO_LOCATION == 0) +#if (SWO_LOCATION == 0) #define PIN_SWO {gpioPortF, 2, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 1) +#elif (SWO_LOCATION == 1) #define PIN_SWO {gpioPortB, 13, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 2) +#elif (SWO_LOCATION == 2) #define PIN_SWO {gpioPortD, 15, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 3) +#elif (SWO_LOCATION == 3) #define PIN_SWO {gpioPortC, 11, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION >= 4) +#elif (SWO_LOCATION >= 4) #error ("Invalid SWO pin location") #endif diff --git a/soc/arm/silabs_exx32/efr32fg1p/dts_fixup.h b/soc/arm/silabs_exx32/efr32fg1p/dts_fixup.h index 9a4b713bfafe..eddad2b8cc90 100644 --- a/soc/arm/silabs_exx32/efr32fg1p/dts_fixup.h +++ b/soc/arm/silabs_exx32/efr32fg1p/dts_fixup.h @@ -13,6 +13,4 @@ #define DT_FLASH_DEV_BASE_ADDRESS DT_SILABS_GECKO_FLASH_CONTROLLER_400E0000_BASE_ADDRESS #define DT_FLASH_DEV_NAME DT_SILABS_GECKO_FLASH_CONTROLLER_400E0000_LABEL -#define DT_GPIO_GECKO_SWO_LOCATION DT_SILABS_GECKO_GPIO_4000A400_LOCATION_SWO - /* End of SoC Level DTS fixup file */ diff --git a/soc/arm/silabs_exx32/efr32fg1p/soc_pinmap.h b/soc/arm/silabs_exx32/efr32fg1p/soc_pinmap.h index 02ae374a166a..83944e8b1541 100644 --- a/soc/arm/silabs_exx32/efr32fg1p/soc_pinmap.h +++ b/soc/arm/silabs_exx32/efr32fg1p/soc_pinmap.h @@ -16,16 +16,21 @@ #include #include +#define GPIO_NODE DT_INST(0, silabs_gecko_gpio) +#if DT_NODE_HAS_PROP(GPIO_NODE, location_swo) +#define SWO_LOCATION DT_PROP(GPIO_NODE, location_swo) +#endif + /* Serial Wire Output (SWO) */ -#if (DT_GPIO_GECKO_SWO_LOCATION == 0) +#if (SWO_LOCATION == 0) #define PIN_SWO {gpioPortF, 2, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 1) +#elif (SWO_LOCATION == 1) #define PIN_SWO {gpioPortB, 13, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 2) +#elif (SWO_LOCATION == 2) #define PIN_SWO {gpioPortD, 15, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 3) +#elif (SWO_LOCATION == 3) #define PIN_SWO {gpioPortC, 11, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION >= 4) +#elif (SWO_LOCATION >= 4) #error ("Invalid SWO pin location") #endif diff --git a/soc/arm/silabs_exx32/efr32mg12p/dts_fixup.h b/soc/arm/silabs_exx32/efr32mg12p/dts_fixup.h index 9a4b713bfafe..eddad2b8cc90 100644 --- a/soc/arm/silabs_exx32/efr32mg12p/dts_fixup.h +++ b/soc/arm/silabs_exx32/efr32mg12p/dts_fixup.h @@ -13,6 +13,4 @@ #define DT_FLASH_DEV_BASE_ADDRESS DT_SILABS_GECKO_FLASH_CONTROLLER_400E0000_BASE_ADDRESS #define DT_FLASH_DEV_NAME DT_SILABS_GECKO_FLASH_CONTROLLER_400E0000_LABEL -#define DT_GPIO_GECKO_SWO_LOCATION DT_SILABS_GECKO_GPIO_4000A400_LOCATION_SWO - /* End of SoC Level DTS fixup file */ diff --git a/soc/arm/silabs_exx32/efr32mg12p/soc_pinmap.h b/soc/arm/silabs_exx32/efr32mg12p/soc_pinmap.h index 020b8355cac1..a6de7301b241 100644 --- a/soc/arm/silabs_exx32/efr32mg12p/soc_pinmap.h +++ b/soc/arm/silabs_exx32/efr32mg12p/soc_pinmap.h @@ -15,16 +15,21 @@ #include +#define GPIO_NODE DT_INST(0, silabs_gecko_gpio) +#if DT_NODE_HAS_PROP(GPIO_NODE, location_swo) +#define SWO_LOCATION DT_PROP(GPIO_NODE, location_swo) +#endif + /* Serial Wire Output (SWO) */ -#if (DT_GPIO_GECKO_SWO_LOCATION == 0) +#if (SWO_LOCATION == 0) #define PIN_SWO {gpioPortF, 2, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 1) +#elif (SWO_LOCATION == 1) #define PIN_SWO {gpioPortB, 13, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 2) +#elif (SWO_LOCATION == 2) #define PIN_SWO {gpioPortD, 15, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION == 3) +#elif (SWO_LOCATION == 3) #define PIN_SWO {gpioPortC, 11, gpioModePushPull, 1} -#elif (DT_GPIO_GECKO_SWO_LOCATION >= 4) +#elif (SWO_LOCATION >= 4) #error ("Invalid SWO pin location") #endif