Skip to content

Commit

Permalink
soc: arm: silabs_exx32: DT_GPIO_GECKO_SWO_LOCATION rework
Browse files Browse the repository at this point in the history
Change DT_GPIO_GECKO_SWO_LOCATION to use new DT_INST and DT_PROP macros
and remove defining it in dts_fixup.h.

Signed-off-by: Kumar Gala <[email protected]>
  • Loading branch information
galak committed Apr 23, 2020
1 parent 22e65cb commit 0e86210
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 44 deletions.
4 changes: 2 additions & 2 deletions soc/arm/silabs_exx32/common/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 0 additions & 2 deletions soc/arm/silabs_exx32/efm32gg11b/dts_fixup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
15 changes: 10 additions & 5 deletions soc/arm/silabs_exx32/efm32gg11b/soc_pinmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@
#include <soc.h>
#include <em_gpio.h>

#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 */
Expand Down
2 changes: 0 additions & 2 deletions soc/arm/silabs_exx32/efm32jg12b/dts_fixup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
15 changes: 10 additions & 5 deletions soc/arm/silabs_exx32/efm32jg12b/soc_pinmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@
#include <soc.h>
#include <em_gpio.h>

#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

Expand Down
2 changes: 0 additions & 2 deletions soc/arm/silabs_exx32/efm32pg12b/dts_fixup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
15 changes: 10 additions & 5 deletions soc/arm/silabs_exx32/efm32pg12b/soc_pinmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@
#include <soc.h>
#include <em_gpio.h>

#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

Expand Down
2 changes: 0 additions & 2 deletions soc/arm/silabs_exx32/efr32bg13p/dts_fixup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
16 changes: 11 additions & 5 deletions soc/arm/silabs_exx32/efr32bg13p/soc_pinmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,24 @@
#ifndef SOC_PINMAP_H_
#define SOC_PINMAP_H_

#include <devicetree.h>
#include <em_gpio.h>

#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

Expand Down
2 changes: 0 additions & 2 deletions soc/arm/silabs_exx32/efr32fg1p/dts_fixup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
15 changes: 10 additions & 5 deletions soc/arm/silabs_exx32/efr32fg1p/soc_pinmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@
#include <soc.h>
#include <em_gpio.h>

#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

Expand Down
2 changes: 0 additions & 2 deletions soc/arm/silabs_exx32/efr32mg12p/dts_fixup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
15 changes: 10 additions & 5 deletions soc/arm/silabs_exx32/efr32mg12p/soc_pinmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,21 @@

#include <em_gpio.h>

#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

Expand Down

0 comments on commit 0e86210

Please sign in to comment.