diff --git a/boards/arm/efm32hg_slstk3400a/Kconfig.defconfig b/boards/arm/efm32hg_slstk3400a/Kconfig.defconfig index 4ab661cf39a..2212388e9c4 100644 --- a/boards/arm/efm32hg_slstk3400a/Kconfig.defconfig +++ b/boards/arm/efm32hg_slstk3400a/Kconfig.defconfig @@ -38,11 +38,4 @@ config GPIO_GECKO_PORTF endif # GPIO_GECKO -if UART_GECKO - -config USART_GECKO_1 - default y - -endif # UART_GECKO - endif # BOARD_EFM32HG_SLSTK3400A diff --git a/boards/arm/efm32hg_slstk3400a/efm32hg_slstk3400a.dts b/boards/arm/efm32hg_slstk3400a/efm32hg_slstk3400a.dts index e2da72c0942..1b2c4438cf9 100644 --- a/boards/arm/efm32hg_slstk3400a/efm32hg_slstk3400a.dts +++ b/boards/arm/efm32hg_slstk3400a/efm32hg_slstk3400a.dts @@ -56,6 +56,7 @@ &usart1 { current-speed = <115200>; - location = <4>; + location-rx = ; + location-tx = ; status = "ok"; }; diff --git a/boards/arm/efm32pg_stk3402a/Kconfig.defconfig b/boards/arm/efm32pg_stk3402a/Kconfig.defconfig index 3bb9526ea5f..c673513723e 100644 --- a/boards/arm/efm32pg_stk3402a/Kconfig.defconfig +++ b/boards/arm/efm32pg_stk3402a/Kconfig.defconfig @@ -38,13 +38,6 @@ config GPIO_GECKO_PORTF endif # GPIO_GECKO -if UART_GECKO - -config USART_GECKO_0 - default y - -endif # UART_GECKO - if LEUART_GECKO config LEUART_GECKO_0 diff --git a/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a.dts b/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a.dts index f89f1c09170..ce84043078a 100644 --- a/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a.dts +++ b/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a.dts @@ -55,7 +55,8 @@ &usart0 { current-speed = <115200>; - location = <0>; + location-rx = ; + location-tx = ; status = "ok"; }; diff --git a/boards/arm/efm32wg_stk3800/Kconfig.defconfig b/boards/arm/efm32wg_stk3800/Kconfig.defconfig index 4450b1126c8..361f34fc6df 100644 --- a/boards/arm/efm32wg_stk3800/Kconfig.defconfig +++ b/boards/arm/efm32wg_stk3800/Kconfig.defconfig @@ -38,11 +38,4 @@ config GPIO_GECKO_PORTF endif # GPIO_GECKO -if UART_GECKO - -config UART_GECKO_0 - default y - -endif # UART_GECKO - endif # BOARD_EFM32WG_STK3800 diff --git a/boards/arm/efm32wg_stk3800/efm32wg_stk3800.dts b/boards/arm/efm32wg_stk3800/efm32wg_stk3800.dts index 79ccd96df34..f91b0f1911e 100644 --- a/boards/arm/efm32wg_stk3800/efm32wg_stk3800.dts +++ b/boards/arm/efm32wg_stk3800/efm32wg_stk3800.dts @@ -55,6 +55,7 @@ &uart0 { current-speed = <115200>; - location = <1>; + location-rx = ; + location-tx = ; status = "ok"; }; diff --git a/boards/arm/efr32_slwstk6061a/Kconfig.defconfig b/boards/arm/efr32_slwstk6061a/Kconfig.defconfig index 5eedcdcdfd4..b7accca30b5 100644 --- a/boards/arm/efr32_slwstk6061a/Kconfig.defconfig +++ b/boards/arm/efr32_slwstk6061a/Kconfig.defconfig @@ -38,11 +38,4 @@ config GPIO_GECKO_PORTF endif # GPIO_GECKO -if UART_GECKO - -config USART_GECKO_0 - default y - -endif # UART_GECKO - endif # BOARD_EFR32_SLWSTK6061A diff --git a/boards/arm/efr32_slwstk6061a/efr32_slwstk6061a.dts b/boards/arm/efr32_slwstk6061a/efr32_slwstk6061a.dts index 78e3d25e904..95828264a10 100644 --- a/boards/arm/efr32_slwstk6061a/efr32_slwstk6061a.dts +++ b/boards/arm/efr32_slwstk6061a/efr32_slwstk6061a.dts @@ -56,7 +56,8 @@ &usart0 { current-speed = <115200>; - location = <0>; + location-rx = ; + location-tx = ; status = "ok"; }; diff --git a/boards/arm/efr32mg_sltb004a/Kconfig.defconfig b/boards/arm/efr32mg_sltb004a/Kconfig.defconfig index 68c3ba3c2a4..89f5a6b02a3 100644 --- a/boards/arm/efr32mg_sltb004a/Kconfig.defconfig +++ b/boards/arm/efr32mg_sltb004a/Kconfig.defconfig @@ -29,13 +29,6 @@ config GPIO_GECKO_PORTF endif # GPIO_GECKO -if UART_GECKO - -config USART_GECKO_0 - default y - -endif # UART_GECKO - if LEUART_GECKO config LEUART_GECKO_0 diff --git a/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a.dts b/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a.dts index ca7c0460c42..5c8f24c9b95 100644 --- a/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a.dts +++ b/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a.dts @@ -54,7 +54,8 @@ &usart0 { current-speed = <115200>; - location = <0>; + location-rx = ; + location-tx = ; status = "ok"; }; diff --git a/drivers/serial/Kconfig.gecko b/drivers/serial/Kconfig.gecko index 7424021a3fa..2835d01a4a0 100644 --- a/drivers/serial/Kconfig.gecko +++ b/drivers/serial/Kconfig.gecko @@ -17,40 +17,4 @@ menuconfig UART_GECKO if UART_GECKO -config UART_GECKO_0 - bool "Enable Gecko UART 0" - help - Enable support for Gecko UART0 port in the driver. Say y here if you - want to use UART0 device. - -config UART_GECKO_1 - bool "Enable Gecko UART 1" - help - Enable support for Gecko UART1 port in the driver. Say y here if you - want to use UART1 device. - -config USART_GECKO_0 - bool "Enable Gecko USART 0" - help - Enable support for Gecko USART0 port in the driver. Say y here if you - want to use USART0 device. - -config USART_GECKO_1 - bool "Enable Gecko USART 1" - help - Enable support for Gecko USART1 port in the driver. Say y here if you - want to use USART1 device. - -config USART_GECKO_2 - bool "Enable Gecko USART 2" - help - Enable support for Gecko USART2 port in the driver. Say y here if you - want to use USART2 device. - -config USART_GECKO_3 - bool "Enable Gecko USART 3" - help - Enable support for Gecko USART3 port in the driver. Say y here if you - want to use USART3 device. - endif # UART_GECKO diff --git a/drivers/serial/uart_gecko.c b/drivers/serial/uart_gecko.c index af663c0cff0..fb096a8baef 100644 --- a/drivers/serial/uart_gecko.c +++ b/drivers/serial/uart_gecko.c @@ -15,11 +15,16 @@ struct uart_gecko_config { USART_TypeDef *base; CMU_Clock_TypeDef clock; u32_t baud_rate; - struct soc_gpio_pin pin_rx; - struct soc_gpio_pin pin_tx; - unsigned int loc; #ifdef CONFIG_UART_INTERRUPT_DRIVEN void (*irq_config_func)(struct device *dev); +#endif + struct soc_gpio_pin pin_rx; + struct soc_gpio_pin pin_tx; +#ifdef CONFIG_SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION + u8_t loc_rx; + u8_t loc_tx; +#else + u8_t loc; #endif }; @@ -228,11 +233,11 @@ static void uart_gecko_init_pins(struct device *dev) soc_gpio_configure(&config->pin_rx); soc_gpio_configure(&config->pin_tx); -#if defined(_USART_ROUTEPEN_MASK) || defined(_UART_ROUTEPEN_MASK) +#ifdef CONFIG_SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION config->base->ROUTEPEN = USART_ROUTEPEN_RXPEN | USART_ROUTEPEN_TXPEN; config->base->ROUTELOC0 = - (config->loc << _USART_ROUTELOC0_TXLOC_SHIFT) | - (config->loc << _USART_ROUTELOC0_RXLOC_SHIFT); + (config->loc_tx << _USART_ROUTELOC0_TXLOC_SHIFT) | + (config->loc_rx << _USART_ROUTELOC0_RXLOC_SHIFT); config->base->ROUTELOC1 = _USART_ROUTELOC1_RESETVALUE; #else config->base->ROUTE = USART_ROUTE_RXPEN | USART_ROUTE_TXPEN @@ -289,19 +294,33 @@ static const struct uart_driver_api uart_gecko_driver_api = { #endif }; -#ifdef CONFIG_UART_GECKO_0 +#ifdef DT_SILABS_GECKO_UART_0 + +#define PIN_UART0_RXD {DT_SILABS_GECKO_UART_0_LOCATION_RX_1, \ + DT_SILABS_GECKO_UART_0_LOCATION_RX_2, gpioModeInput, 1} +#define PIN_UART0_TXD {DT_SILABS_GECKO_UART_0_LOCATION_TX_1, \ + DT_SILABS_GECKO_UART_0_LOCATION_TX_2, gpioModePushPull, 1} #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_gecko_config_func_0(struct device *dev); #endif static const struct uart_gecko_config uart_gecko_0_config = { - .base = (USART_TypeDef *)DT_SILABS_GECKO_UART_UART_0_BASE_ADDRESS, + .base = (USART_TypeDef *)DT_SILABS_GECKO_UART_0_BASE_ADDRESS, .clock = cmuClock_UART0, - .baud_rate = DT_SILABS_GECKO_UART_UART_0_CURRENT_SPEED, + .baud_rate = DT_SILABS_GECKO_UART_0_CURRENT_SPEED, .pin_rx = PIN_UART0_RXD, .pin_tx = PIN_UART0_TXD, - .loc = DT_SILABS_GECKO_UART_UART_0_LOCATION, +#ifdef CONFIG_SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION + .loc_rx = DT_SILABS_GECKO_UART_0_LOCATION_RX_0, + .loc_tx = DT_SILABS_GECKO_UART_0_LOCATION_TX_0, +#else +#if DT_SILABS_GECKO_UART_0_LOCATION_RX_0 \ + != DT_SILABS_GECKO_UART_0_LOCATION_TX_0 +#error UART_0 DTS location-* properties must have identical value +#endif + .loc = DT_SILABS_GECKO_UART_0_LOCATION_RX_0, +#endif #ifdef CONFIG_UART_INTERRUPT_DRIVEN .irq_config_func = uart_gecko_config_func_0, #endif @@ -309,40 +328,54 @@ static const struct uart_gecko_config uart_gecko_0_config = { static struct uart_gecko_data uart_gecko_0_data; -DEVICE_AND_API_INIT(uart_0, DT_SILABS_GECKO_UART_UART_0_LABEL, &uart_gecko_init, +DEVICE_AND_API_INIT(uart_0, DT_SILABS_GECKO_UART_0_LABEL, &uart_gecko_init, &uart_gecko_0_data, &uart_gecko_0_config, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &uart_gecko_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_gecko_config_func_0(struct device *dev) { - IRQ_CONNECT(DT_SILABS_GECKO_UART_UART_0_IRQ_RX, - DT_SILABS_GECKO_UART_UART_0_IRQ_RX_PRIORITY, uart_gecko_isr, + IRQ_CONNECT(DT_SILABS_GECKO_UART_0_IRQ_RX, + DT_SILABS_GECKO_UART_0_IRQ_RX_PRIORITY, uart_gecko_isr, DEVICE_GET(uart_0), 0); - IRQ_CONNECT(DT_SILABS_GECKO_UART_UART_0_IRQ_TX, - DT_SILABS_GECKO_UART_UART_0_IRQ_TX_PRIORITY, uart_gecko_isr, + IRQ_CONNECT(DT_SILABS_GECKO_UART_0_IRQ_TX, + DT_SILABS_GECKO_UART_0_IRQ_TX_PRIORITY, uart_gecko_isr, DEVICE_GET(uart_0), 0); - irq_enable(DT_SILABS_GECKO_UART_UART_0_IRQ_RX); - irq_enable(DT_SILABS_GECKO_UART_UART_0_IRQ_TX); + irq_enable(DT_SILABS_GECKO_UART_0_IRQ_RX); + irq_enable(DT_SILABS_GECKO_UART_0_IRQ_TX); } #endif -#endif /* CONFIG_UART_GECKO_0 */ +#endif /* DT_SILABS_GECKO_UART_0 */ -#ifdef CONFIG_UART_GECKO_1 +#ifdef DT_SILABS_GECKO_UART_1 + +#define PIN_UART1_RXD {DT_SILABS_GECKO_UART_1_LOCATION_RX_1, \ + DT_SILABS_GECKO_UART_1_LOCATION_RX_2, gpioModeInput, 1} +#define PIN_UART1_TXD {DT_SILABS_GECKO_UART_1_LOCATION_TX_1, \ + DT_SILABS_GECKO_UART_1_LOCATION_TX_2, gpioModePushPull, 1} #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_gecko_config_func_1(struct device *dev); #endif static const struct uart_gecko_config uart_gecko_1_config = { - .base = (USART_TypeDef *)DT_SILABS_GECKO_UART_UART_1_BASE_ADDRESS, + .base = (USART_TypeDef *)DT_SILABS_GECKO_UART_1_BASE_ADDRESS, .clock = cmuClock_UART1, - .baud_rate = DT_SILABS_GECKO_UART_UART_1_CURRENT_SPEED, + .baud_rate = DT_SILABS_GECKO_UART_1_CURRENT_SPEED, .pin_rx = PIN_UART1_RXD, .pin_tx = PIN_UART1_TXD, - .loc = DT_SILABS_GECKO_UART_UART_1_LOCATION, +#ifdef CONFIG_SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION + .loc_rx = DT_SILABS_GECKO_UART_1_LOCATION_RX_0, + .loc_tx = DT_SILABS_GECKO_UART_1_LOCATION_TX_0, +#else +#if DT_SILABS_GECKO_UART_1_LOCATION_RX_0 \ + != DT_SILABS_GECKO_UART_1_LOCATION_TX_0 +#error UART_1 DTS location-* properties must have identical value +#endif + .loc = DT_SILABS_GECKO_UART_1_LOCATION_RX_0, +#endif #ifdef CONFIG_UART_INTERRUPT_DRIVEN .irq_config_func = uart_gecko_config_func_1, #endif @@ -350,40 +383,54 @@ static const struct uart_gecko_config uart_gecko_1_config = { static struct uart_gecko_data uart_gecko_1_data; -DEVICE_AND_API_INIT(uart_1, DT_SILABS_GECKO_UART_UART_1_LABEL, &uart_gecko_init, +DEVICE_AND_API_INIT(uart_1, DT_SILABS_GECKO_UART_1_LABEL, &uart_gecko_init, &uart_gecko_1_data, &uart_gecko_1_config, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &uart_gecko_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_gecko_config_func_1(struct device *dev) { - IRQ_CONNECT(DT_SILABS_GECKO_UART_UART_1_IRQ_RX, - DT_SILABS_GECKO_UART_UART_1_IRQ_RX_PRIORITY, uart_gecko_isr, + IRQ_CONNECT(DT_SILABS_GECKO_UART_1_IRQ_RX, + DT_SILABS_GECKO_UART_1_IRQ_RX_PRIORITY, uart_gecko_isr, DEVICE_GET(uart_1), 0); - IRQ_CONNECT(DT_SILABS_GECKO_UART_UART_1_IRQ_TX, - DT_SILABS_GECKO_UART_UART_1_IRQ_TX_PRIORITY, uart_gecko_isr, + IRQ_CONNECT(DT_SILABS_GECKO_UART_1_IRQ_TX, + DT_SILABS_GECKO_UART_1_IRQ_TX_PRIORITY, uart_gecko_isr, DEVICE_GET(uart_1), 0); - irq_enable(DT_SILABS_GECKO_UART_UART_1_IRQ_RX); - irq_enable(DT_SILABS_GECKO_UART_UART_1_IRQ_TX); + irq_enable(DT_SILABS_GECKO_UART_1_IRQ_RX); + irq_enable(DT_SILABS_GECKO_UART_1_IRQ_TX); } #endif -#endif /* CONFIG_UART_GECKO_1 */ +#endif /* DT_SILABS_GECKO_UART_1 */ -#ifdef CONFIG_USART_GECKO_0 +#ifdef DT_SILABS_GECKO_USART_0 + +#define PIN_USART0_RXD {DT_SILABS_GECKO_USART_0_LOCATION_RX_1, \ + DT_SILABS_GECKO_USART_0_LOCATION_RX_2, gpioModeInput, 1} +#define PIN_USART0_TXD {DT_SILABS_GECKO_USART_0_LOCATION_TX_1, \ + DT_SILABS_GECKO_USART_0_LOCATION_TX_2, gpioModePushPull, 1} #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void usart_gecko_config_func_0(struct device *dev); #endif static const struct uart_gecko_config usart_gecko_0_config = { - .base = (USART_TypeDef *)DT_SILABS_GECKO_USART_USART_0_BASE_ADDRESS, + .base = (USART_TypeDef *)DT_SILABS_GECKO_USART_0_BASE_ADDRESS, .clock = cmuClock_USART0, - .baud_rate = DT_SILABS_GECKO_USART_USART_0_CURRENT_SPEED, + .baud_rate = DT_SILABS_GECKO_USART_0_CURRENT_SPEED, .pin_rx = PIN_USART0_RXD, .pin_tx = PIN_USART0_TXD, - .loc = DT_SILABS_GECKO_USART_USART_0_LOCATION, +#ifdef CONFIG_SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION + .loc_rx = DT_SILABS_GECKO_USART_0_LOCATION_RX_0, + .loc_tx = DT_SILABS_GECKO_USART_0_LOCATION_TX_0, +#else +#if DT_SILABS_GECKO_USART_0_LOCATION_RX_0 \ + != DT_SILABS_GECKO_USART_0_LOCATION_TX_0 +#error USART_0 DTS location-* properties must have identical value +#endif + .loc = DT_SILABS_GECKO_USART_0_LOCATION_RX_0, +#endif #ifdef CONFIG_UART_INTERRUPT_DRIVEN .irq_config_func = usart_gecko_config_func_0, #endif @@ -391,7 +438,7 @@ static const struct uart_gecko_config usart_gecko_0_config = { static struct uart_gecko_data usart_gecko_0_data; -DEVICE_AND_API_INIT(usart_0, DT_SILABS_GECKO_USART_USART_0_LABEL, +DEVICE_AND_API_INIT(usart_0, DT_SILABS_GECKO_USART_0_LABEL, &uart_gecko_init, &usart_gecko_0_data, &usart_gecko_0_config, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &uart_gecko_driver_api); @@ -399,33 +446,47 @@ DEVICE_AND_API_INIT(usart_0, DT_SILABS_GECKO_USART_USART_0_LABEL, #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void usart_gecko_config_func_0(struct device *dev) { - IRQ_CONNECT(DT_SILABS_GECKO_USART_USART_0_IRQ_RX, - DT_SILABS_GECKO_USART_USART_0_IRQ_RX_PRIORITY, + IRQ_CONNECT(DT_SILABS_GECKO_USART_0_IRQ_RX, + DT_SILABS_GECKO_USART_0_IRQ_RX_PRIORITY, uart_gecko_isr, DEVICE_GET(usart_0), 0); - IRQ_CONNECT(DT_SILABS_GECKO_USART_USART_0_IRQ_TX, - DT_SILABS_GECKO_USART_USART_0_IRQ_TX_PRIORITY, + IRQ_CONNECT(DT_SILABS_GECKO_USART_0_IRQ_TX, + DT_SILABS_GECKO_USART_0_IRQ_TX_PRIORITY, uart_gecko_isr, DEVICE_GET(usart_0), 0); - irq_enable(DT_SILABS_GECKO_USART_USART_0_IRQ_RX); - irq_enable(DT_SILABS_GECKO_USART_USART_0_IRQ_TX); + irq_enable(DT_SILABS_GECKO_USART_0_IRQ_RX); + irq_enable(DT_SILABS_GECKO_USART_0_IRQ_TX); } #endif -#endif /* CONFIG_USART_GECKO_0 */ +#endif /* DT_SILABS_GECKO_USART_0 */ -#ifdef CONFIG_USART_GECKO_1 +#ifdef DT_SILABS_GECKO_USART_1 + +#define PIN_USART1_RXD {DT_SILABS_GECKO_USART_1_LOCATION_RX_1, \ + DT_SILABS_GECKO_USART_1_LOCATION_RX_2, gpioModeInput, 1} +#define PIN_USART1_TXD {DT_SILABS_GECKO_USART_1_LOCATION_TX_1, \ + DT_SILABS_GECKO_USART_1_LOCATION_TX_2, gpioModePushPull, 1} #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void usart_gecko_config_func_1(struct device *dev); #endif static const struct uart_gecko_config usart_gecko_1_config = { - .base = (USART_TypeDef *)DT_SILABS_GECKO_USART_USART_1_BASE_ADDRESS, + .base = (USART_TypeDef *)DT_SILABS_GECKO_USART_1_BASE_ADDRESS, .clock = cmuClock_USART1, - .baud_rate = DT_SILABS_GECKO_USART_USART_1_CURRENT_SPEED, + .baud_rate = DT_SILABS_GECKO_USART_1_CURRENT_SPEED, .pin_rx = PIN_USART1_RXD, .pin_tx = PIN_USART1_TXD, - .loc = DT_SILABS_GECKO_USART_USART_1_LOCATION, +#ifdef CONFIG_SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION + .loc_rx = DT_SILABS_GECKO_USART_1_LOCATION_RX_0, + .loc_tx = DT_SILABS_GECKO_USART_1_LOCATION_TX_0, +#else +#if DT_SILABS_GECKO_USART_1_LOCATION_RX_0 \ + != DT_SILABS_GECKO_USART_1_LOCATION_TX_0 +#error USART_1 DTS location-* properties must have identical value +#endif + .loc = DT_SILABS_GECKO_USART_1_LOCATION_RX_0, +#endif #ifdef CONFIG_UART_INTERRUPT_DRIVEN .irq_config_func = usart_gecko_config_func_1, #endif @@ -433,7 +494,7 @@ static const struct uart_gecko_config usart_gecko_1_config = { static struct uart_gecko_data usart_gecko_1_data; -DEVICE_AND_API_INIT(usart_1, DT_SILABS_GECKO_USART_USART_1_LABEL, +DEVICE_AND_API_INIT(usart_1, DT_SILABS_GECKO_USART_1_LABEL, &uart_gecko_init, &usart_gecko_1_data, &usart_gecko_1_config, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &uart_gecko_driver_api); @@ -441,33 +502,47 @@ DEVICE_AND_API_INIT(usart_1, DT_SILABS_GECKO_USART_USART_1_LABEL, #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void usart_gecko_config_func_1(struct device *dev) { - IRQ_CONNECT(DT_SILABS_GECKO_USART_USART_1_IRQ_RX, - DT_SILABS_GECKO_USART_USART_1_IRQ_RX_PRIORITY, + IRQ_CONNECT(DT_SILABS_GECKO_USART_1_IRQ_RX, + DT_SILABS_GECKO_USART_1_IRQ_RX_PRIORITY, uart_gecko_isr, DEVICE_GET(usart_1), 0); - IRQ_CONNECT(DT_SILABS_GECKO_USART_USART_1_IRQ_TX, - DT_SILABS_GECKO_USART_USART_1_IRQ_TX_PRIORITY, + IRQ_CONNECT(DT_SILABS_GECKO_USART_1_IRQ_TX, + DT_SILABS_GECKO_USART_1_IRQ_TX_PRIORITY, uart_gecko_isr, DEVICE_GET(usart_1), 0); - irq_enable(DT_SILABS_GECKO_USART_USART_1_IRQ_RX); - irq_enable(DT_SILABS_GECKO_USART_USART_1_IRQ_TX); + irq_enable(DT_SILABS_GECKO_USART_1_IRQ_RX); + irq_enable(DT_SILABS_GECKO_USART_1_IRQ_TX); } #endif -#endif /* CONFIG_USART_GECKO_1 */ +#endif /* DT_SILABS_GECKO_USART_1 */ -#ifdef CONFIG_USART_GECKO_2 +#ifdef DT_SILABS_GECKO_USART_2 + +#define PIN_USART2_RXD {DT_SILABS_GECKO_USART_2_LOCATION_RX_1, \ + DT_SILABS_GECKO_USART_2_LOCATION_RX_2, gpioModeInput, 1} +#define PIN_USART2_TXD {DT_SILABS_GECKO_USART_2_LOCATION_TX_1, \ + DT_SILABS_GECKO_USART_2_LOCATION_TX_2, gpioModePushPull, 1} #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void usart_gecko_config_func_2(struct device *dev); #endif static const struct uart_gecko_config usart_gecko_2_config = { - .base = (USART_TypeDef *)DT_SILABS_GECKO_USART_USART_2_BASE_ADDRESS, + .base = (USART_TypeDef *)DT_SILABS_GECKO_USART_2_BASE_ADDRESS, .clock = cmuClock_USART2, - .baud_rate = DT_SILABS_GECKO_USART_USART_2_CURRENT_SPEED, + .baud_rate = DT_SILABS_GECKO_USART_2_CURRENT_SPEED, .pin_rx = PIN_USART2_RXD, .pin_tx = PIN_USART2_TXD, - .loc = DT_SILABS_GECKO_USART_USART_2_LOCATION, +#ifdef CONFIG_SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION + .loc_rx = DT_SILABS_GECKO_USART_2_LOCATION_RX_0, + .loc_tx = DT_SILABS_GECKO_USART_2_LOCATION_TX_0, +#else +#if DT_SILABS_GECKO_USART_2_LOCATION_RX_0 \ + != DT_SILABS_GECKO_USART_2_LOCATION_TX_0 +#error USART_2 DTS location-* properties must have identical value +#endif + .loc = DT_SILABS_GECKO_USART_2_LOCATION_RX_0, +#endif #ifdef CONFIG_UART_INTERRUPT_DRIVEN .irq_config_func = usart_gecko_config_func_2, #endif @@ -475,7 +550,7 @@ static const struct uart_gecko_config usart_gecko_2_config = { static struct uart_gecko_data usart_gecko_2_data; -DEVICE_AND_API_INIT(usart_2, DT_SILABS_GECKO_USART_USART_2_LABEL, +DEVICE_AND_API_INIT(usart_2, DT_SILABS_GECKO_USART_2_LABEL, &uart_gecko_init, &usart_gecko_2_data, &usart_gecko_2_config, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &uart_gecko_driver_api); @@ -483,33 +558,47 @@ DEVICE_AND_API_INIT(usart_2, DT_SILABS_GECKO_USART_USART_2_LABEL, #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void usart_gecko_config_func_2(struct device *dev) { - IRQ_CONNECT(DT_SILABS_GECKO_USART_USART_2_IRQ_RX, - DT_SILABS_GECKO_USART_USART_2_IRQ_RX_PRIORITY, + IRQ_CONNECT(DT_SILABS_GECKO_USART_2_IRQ_RX, + DT_SILABS_GECKO_USART_2_IRQ_RX_PRIORITY, uart_gecko_isr, DEVICE_GET(usart_2), 0); - IRQ_CONNECT(DT_SILABS_GECKO_USART_USART_2_IRQ_TX, - DT_SILABS_GECKO_USART_USART_2_IRQ_TX_PRIORITY, + IRQ_CONNECT(DT_SILABS_GECKO_USART_2_IRQ_TX, + DT_SILABS_GECKO_USART_2_IRQ_TX_PRIORITY, uart_gecko_isr, DEVICE_GET(usart_2), 0); - irq_enable(DT_SILABS_GECKO_USART_USART_2_IRQ_RX); - irq_enable(DT_SILABS_GECKO_USART_USART_2_IRQ_TX); + irq_enable(DT_SILABS_GECKO_USART_2_IRQ_RX); + irq_enable(DT_SILABS_GECKO_USART_2_IRQ_TX); } #endif -#endif /* CONFIG_USART_GECKO_2 */ +#endif /* DT_SILABS_GECKO_USART_2 */ -#ifdef CONFIG_USART_GECKO_3 +#ifdef DT_SILABS_GECKO_USART_3 + +#define PIN_USART3_RXD {DT_SILABS_GECKO_USART_3_LOCATION_RX_1, \ + DT_SILABS_GECKO_USART_3_LOCATION_RX_2, gpioModeInput, 1} +#define PIN_USART3_TXD {DT_SILABS_GECKO_USART_3_LOCATION_TX_1, \ + DT_SILABS_GECKO_USART_3_LOCATION_TX_2, gpioModePushPull, 1} #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void usart_gecko_config_func_3(struct device *dev); #endif static const struct uart_gecko_config usart_gecko_3_config = { - .base = (USART_TypeDef *)DT_SILABS_GECKO_USART_USART_3_BASE_ADDRESS, + .base = (USART_TypeDef *)DT_SILABS_GECKO_USART_3_BASE_ADDRESS, .clock = cmuClock_USART3, - .baud_rate = DT_SILABS_GECKO_USART_USART_3_CURRENT_SPEED, + .baud_rate = DT_SILABS_GECKO_USART_3_CURRENT_SPEED, .pin_rx = PIN_USART3_RXD, .pin_tx = PIN_USART3_TXD, - .loc = DT_SILABS_GECKO_USART_USART_3_LOCATION, +#ifdef CONFIG_SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION + .loc_rx = DT_SILABS_GECKO_USART_3_LOCATION_RX_0, + .loc_tx = DT_SILABS_GECKO_USART_3_LOCATION_TX_0, +#else +#if DT_SILABS_GECKO_USART_3_LOCATION_RX_0 \ + != DT_SILABS_GECKO_USART_3_LOCATION_TX_0 +#error USART_3 DTS location-* properties must have identical value +#endif + .loc = DT_SILABS_GECKO_USART_3_LOCATION_RX_0, +#endif #ifdef CONFIG_UART_INTERRUPT_DRIVEN .irq_config_func = usart_gecko_config_func_3, #endif @@ -517,7 +606,7 @@ static const struct uart_gecko_config usart_gecko_3_config = { static struct uart_gecko_data usart_gecko_3_data; -DEVICE_AND_API_INIT(usart_3, DT_SILABS_GECKO_USART_USART_3_LABEL, +DEVICE_AND_API_INIT(usart_3, DT_SILABS_GECKO_USART_3_LABEL, &uart_gecko_init, &usart_gecko_3_data, &usart_gecko_3_config, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &uart_gecko_driver_api); @@ -525,16 +614,16 @@ DEVICE_AND_API_INIT(usart_3, DT_SILABS_GECKO_USART_USART_3_LABEL, #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void usart_gecko_config_func_3(struct device *dev) { - IRQ_CONNECT(DT_SILABS_GECKO_USART_USART_3_IRQ_RX, - DT_SILABS_GECKO_USART_USART_3_IRQ_RX_PRIORITY, + IRQ_CONNECT(DT_SILABS_GECKO_USART_3_IRQ_RX, + DT_SILABS_GECKO_USART_3_IRQ_RX_PRIORITY, uart_gecko_isr, DEVICE_GET(usart_3), 0); - IRQ_CONNECT(DT_SILABS_GECKO_USART_USART_3_IRQ_TX, - DT_SILABS_GECKO_USART_USART_3_IRQ_TX_PRIORITY, + IRQ_CONNECT(DT_SILABS_GECKO_USART_3_IRQ_TX, + DT_SILABS_GECKO_USART_3_IRQ_TX_PRIORITY, uart_gecko_isr, DEVICE_GET(usart_3), 0); - irq_enable(DT_SILABS_GECKO_USART_USART_3_IRQ_RX); - irq_enable(DT_SILABS_GECKO_USART_USART_3_IRQ_TX); + irq_enable(DT_SILABS_GECKO_USART_3_IRQ_RX); + irq_enable(DT_SILABS_GECKO_USART_3_IRQ_TX); } #endif -#endif /* CONFIG_USART_GECKO_3 */ +#endif /* DT_SILABS_GECKO_USART_3 */ diff --git a/dts/arm/silabs/efm32hg.dtsi b/dts/arm/silabs/efm32hg.dtsi index e0c24e71176..dc4c094d292 100644 --- a/dts/arm/silabs/efm32hg.dtsi +++ b/dts/arm/silabs/efm32hg.dtsi @@ -1,5 +1,6 @@ #include #include +#include "gpio_gecko.h" / { cpus { @@ -17,11 +18,6 @@ compatible = "mmio-sram"; }; - aliases { - usart-0 = &usart0; - usart-1 = &usart1; - }; - soc { flash-controller@400c0000 { compatible = "silabs,gecko-flash-controller"; diff --git a/dts/arm/silabs/efm32pg12b.dtsi b/dts/arm/silabs/efm32pg12b.dtsi index 688dd45cf97..6ac51f23fc8 100644 --- a/dts/arm/silabs/efm32pg12b.dtsi +++ b/dts/arm/silabs/efm32pg12b.dtsi @@ -7,6 +7,7 @@ #include #include #include +#include "gpio_gecko.h" / { cpus { @@ -25,10 +26,6 @@ }; aliases { - usart-0 = &usart0; - usart-1 = &usart1; - usart-2 = &usart2; - usart-3 = &usart3; leuart-0 = &leuart0; i2c-0 = &i2c0; i2c-1 = &i2c1; diff --git a/dts/arm/silabs/efm32wg.dtsi b/dts/arm/silabs/efm32wg.dtsi index cc0a2b101e7..d7743499ac2 100644 --- a/dts/arm/silabs/efm32wg.dtsi +++ b/dts/arm/silabs/efm32wg.dtsi @@ -1,5 +1,6 @@ #include #include +#include "gpio_gecko.h" / { cpus { @@ -17,14 +18,6 @@ compatible = "mmio-sram"; }; - aliases { - usart-0 = &usart0; - usart-1 = &usart1; - usart-2 = &usart2; - uart-0 = &uart0; - uart-1 = &uart1; - }; - soc { flash-controller@400c0000 { compatible = "silabs,gecko-flash-controller"; diff --git a/dts/arm/silabs/efr32fg1p.dtsi b/dts/arm/silabs/efr32fg1p.dtsi index 9eecb8d31d6..facff1f6ea8 100644 --- a/dts/arm/silabs/efr32fg1p.dtsi +++ b/dts/arm/silabs/efr32fg1p.dtsi @@ -1,5 +1,6 @@ #include #include +#include "gpio_gecko.h" / { cpus { @@ -17,11 +18,6 @@ compatible = "mmio-sram"; }; - aliases { - usart-0 = &usart0; - usart-1 = &usart1; - }; - soc { flash-controller@400e0000 { compatible = "silabs,gecko-flash-controller"; diff --git a/dts/arm/silabs/efr32mg.dtsi b/dts/arm/silabs/efr32mg.dtsi index a5c8c02ed08..19c66893247 100644 --- a/dts/arm/silabs/efr32mg.dtsi +++ b/dts/arm/silabs/efr32mg.dtsi @@ -1,6 +1,7 @@ #include #include #include +#include "gpio_gecko.h" / { cpus { @@ -19,10 +20,6 @@ }; aliases { - usart-0 = &usart0; - usart-1 = &usart1; - usart-2 = &usart2; - usart-3 = &usart3; leuart-0 = &leuart0; i2c-0 = &i2c0; i2c-1 = &i2c1; diff --git a/dts/arm/silabs/gpio_gecko.h b/dts/arm/silabs/gpio_gecko.h new file mode 100644 index 00000000000..2e43ce54ce5 --- /dev/null +++ b/dts/arm/silabs/gpio_gecko.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2019 Piotr Mienkowski + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef SILABS_GPIO_GECKO_H_ +#define SILABS_GPIO_GECKO_H_ + +#define GECKO_PORT_A 0 +#define GECKO_PORT_B 1 +#define GECKO_PORT_C 2 +#define GECKO_PORT_D 3 +#define GECKO_PORT_E 4 +#define GECKO_PORT_F 5 +#define GECKO_PORT_G 6 +#define GECKO_PORT_H 7 +#define GECKO_PORT_I 8 +#define GECKO_PORT_J 9 +#define GECKO_PORT_K 10 + +#define GECKO_PIN(n) (n) +#define GECKO_LOCATION(n) (n) + +#endif /* SILABS_GPIO_GECKO_H_ */ diff --git a/dts/bindings/serial/silabs,gecko-uart.yaml b/dts/bindings/serial/silabs,gecko-uart.yaml index cf6a15d8038..3cc4bac5084 100644 --- a/dts/bindings/serial/silabs,gecko-uart.yaml +++ b/dts/bindings/serial/silabs,gecko-uart.yaml @@ -24,9 +24,18 @@ properties: description: required interrupts generation: define - location: - type: int - category: required - description: PIN location - generation: define + # Note: Not all SoC series support setting individual pin location. If this + # is a case all location-* properties need to have identical value. + + location-rx: + type: array + category: required + description: RX pin configuration defined as + generation: define + + location-tx: + type: array + category: required + description: TX pin configuration defined as + generation: define ... diff --git a/dts/bindings/serial/silabs,gecko-usart.yaml b/dts/bindings/serial/silabs,gecko-usart.yaml index 4a1bd963d5d..5589e2c0d38 100644 --- a/dts/bindings/serial/silabs,gecko-usart.yaml +++ b/dts/bindings/serial/silabs,gecko-usart.yaml @@ -24,9 +24,18 @@ properties: description: required interrupts generation: define - location: - type: int - category: required - description: PIN location - generation: define + # Note: Not all SoC series support setting individual pin location. If this + # is a case all location-* properties need to have identical value. + + location-rx: + type: array + category: required + description: RX pin configuration defined as + generation: define + + location-tx: + type: array + category: required + description: TX pin configuration defined as + generation: define ... diff --git a/soc/arm/silabs_exx32/Kconfig b/soc/arm/silabs_exx32/Kconfig index ad67291c74c..ba18a392799 100644 --- a/soc/arm/silabs_exx32/Kconfig +++ b/soc/arm/silabs_exx32/Kconfig @@ -169,4 +169,14 @@ config CMU_LFXO_FREQ board's defconfig. endif # SOC_GECKO_CMU + +config SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION + bool + # omit prompt to signify a "hidden" option + help + If enabled, indicates that SoC allows to configure individual pin + locations. This is supported by e.g. efr32fg1p, efr32mg12p series. + If disabled, indicates that pin locations are configured in groups. + This is supported by e.g. efm32hg, efm32wg series. + endif # SOC_FAMILY_EXX32 diff --git a/soc/arm/silabs_exx32/efm32hg/soc_pinmap.h b/soc/arm/silabs_exx32/efm32hg/soc_pinmap.h index 92146c7d5a0..3e1b73b65c3 100644 --- a/soc/arm/silabs_exx32/efm32hg/soc_pinmap.h +++ b/soc/arm/silabs_exx32/efm32hg/soc_pinmap.h @@ -16,42 +16,4 @@ #include #include -#ifdef CONFIG_USART_GECKO_0 -#if (DT_SILABS_GECKO_USART_USART_0_LOCATION == 0) -#define PIN_USART0_TXD {gpioPortE, 10, gpioModePushPull, 1} -#define PIN_USART0_RXD {gpioPortE, 11, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_0_LOCATION == 3) -#define PIN_USART0_TXD {gpioPortE, 13, gpioModePushPull, 1} -#define PIN_USART0_RXD {gpioPortE, 12, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_0_LOCATION == 4) -#define PIN_USART0_TXD {gpioPortB, 7, gpioModePushPull, 1} -#define PIN_USART0_RXD {gpioPortB, 8, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_0_LOCATION == 5) || \ - (DT_SILABS_GECKO_USART_USART_0_LOCATION == 6) -#define PIN_USART0_TXD {gpioPortC, 0, gpioModePushPull, 1} -#define PIN_USART0_RXD {gpioPortC, 1, gpioModeInput, 1} -#else -#error ("Serial Driver for Gecko MCUs not implemented for this location index") -#endif -#endif /* CONFIG_USART_GECKO_0 */ - -#ifdef CONFIG_USART_GECKO_1 -#if (DT_SILABS_GECKO_USART_USART_1_LOCATION == 0) -#define PIN_USART1_TXD {gpioPortC, 0, gpioModePushPull, 1} -#define PIN_USART1_RXD {gpioPortC, 1, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_1_LOCATION == 2) || \ - (DT_SILABS_GECKO_USART_USART_1_LOCATION == 3) -#define PIN_USART1_TXD {gpioPortD, 7, gpioModePushPull, 1} -#define PIN_USART1_RXD {gpioPortD, 6, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_1_LOCATION == 4) -#define PIN_USART1_TXD {gpioPortF, 2, gpioModePushPull, 1} -#define PIN_USART1_RXD {gpioPortA, 0, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_1_LOCATION == 5) -#define PIN_USART1_TXD {gpioPortC, 1, gpioModePushPull, 1} -#define PIN_USART1_RXD {gpioPortC, 2, gpioModeInput, 1} -#else -#error ("Serial Driver for Gecko MCUs not implemented for this location index") -#endif -#endif /* CONFIG_USART_GECKO_1 */ - #endif /* _SILABS_EFM32HG_SOC_PINMAP_H_ */ diff --git a/soc/arm/silabs_exx32/efm32pg12b/Kconfig.series b/soc/arm/silabs_exx32/efm32pg12b/Kconfig.series index c34b2ace4d5..28fb152be5c 100644 --- a/soc/arm/silabs_exx32/efm32pg12b/Kconfig.series +++ b/soc/arm/silabs_exx32/efm32pg12b/Kconfig.series @@ -14,6 +14,7 @@ config SOC_SERIES_EFM32PG12B select SOC_FAMILY_EXX32 select SYS_POWER_LOW_POWER_STATE_SUPPORTED select CPU_HAS_SYSTICK + select SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION select SOC_GECKO_CMU select SOC_GECKO_EMU select SOC_GECKO_GPIO diff --git a/soc/arm/silabs_exx32/efm32pg12b/soc_pinmap.h b/soc/arm/silabs_exx32/efm32pg12b/soc_pinmap.h index 0bb76d18fff..9f6e35d0795 100644 --- a/soc/arm/silabs_exx32/efm32pg12b/soc_pinmap.h +++ b/soc/arm/silabs_exx32/efm32pg12b/soc_pinmap.h @@ -31,41 +31,6 @@ #endif #endif /* CONFIG_GPIO_GECKO */ -#ifdef CONFIG_USART_GECKO_0 -#if (DT_SILABS_GECKO_USART_USART_0_GPIO_LOC == 0) -#define PIN_USART0_TXD {gpioPortA, 0, gpioModePushPull, 1} -#define PIN_USART0_RXD {gpioPortA, 1, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_0_GPIO_LOC == 1) -#define PIN_USART0_TXD {gpioPortA, 1, gpioModePushPull, 1} -#define PIN_USART0_RXD {gpioPortA, 2, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_0_GPIO_LOC == 2) -#define PIN_USART0_TXD {gpioPortA, 2, gpioModePushPull, 1} -#define PIN_USART0_RXD {gpioPortA, 3, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_0_GPIO_LOC == 18) -#define PIN_USART0_TXD {gpioPortD, 10, gpioModePushPull, 1} -#define PIN_USART0_RXD {gpioPortD, 11, gpioModeInput, 1} -#else -#error ("Serial Driver for Gecko MCUs not implemented for this location index") -#endif -#endif /* CONFIG_USART_GECKO_0 */ - -#ifdef CONFIG_USART_GECKO_1 -#if (CONFIG_USART_GECKO_1_GPIO_LOC == 0) -#error ("Serial Driver for Gecko MCUs not implemented for this location index") -#elif (DT_SILABS_GECKO_USART_USART_1_GPIO_LOC == 1) -#define PIN_USART1_TXD {gpioPortA, 1, gpioModePushPull, 1} -#define PIN_USART1_RXD {gpioPortA, 2, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_1_GPIO_LOC == 2) -#define PIN_USART1_TXD {gpioPortA, 2, gpioModePushPull, 1} -#define PIN_USART1_RXD {gpioPortA, 3, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_1_GPIO_LOC == 3) -#define PIN_USART1_TXD {gpioPortA, 3, gpioModePushPull, 1} -#define PIN_USART1_RXD {gpioPortA, 4, gpioModeInput, 1} -#else -#error ("Serial Driver for Gecko MCUs not implemented for this location index") -#endif -#endif /* CONFIG_USART_GECKO_1 */ - #ifdef CONFIG_LEUART_GECKO #ifdef CONFIG_LEUART_GECKO_0 #if (DT_SILABS_GECKO_LEUART_LEUART_0_LOCATION == 18) diff --git a/soc/arm/silabs_exx32/efm32wg/soc_pinmap.h b/soc/arm/silabs_exx32/efm32wg/soc_pinmap.h index d95a82be1f2..7a4d4255c18 100644 --- a/soc/arm/silabs_exx32/efm32wg/soc_pinmap.h +++ b/soc/arm/silabs_exx32/efm32wg/soc_pinmap.h @@ -16,36 +16,4 @@ #include #include -#ifdef CONFIG_UART_GECKO_0 -#if (DT_SILABS_GECKO_UART_UART_0_LOCATION == 0) -#define PIN_UART0_TXD {gpioPortF, 6, gpioModePushPull, 1} -#define PIN_UART0_RXD {gpioPortF, 7, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_UART_UART_0_LOCATION == 1) -#define PIN_UART0_TXD {gpioPortE, 0, gpioModePushPull, 1} -#define PIN_UART0_RXD {gpioPortE, 1, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_UART_UART_0_LOCATION == 2) -#define PIN_UART0_TXD {gpioPortA, 3, gpioModePushPull, 1} -#define PIN_UART0_RXD {gpioPortA, 4, gpioModeInput, 1} -#else -#error ("Serial Driver for Gecko MCUs not implemented for this location index") -#endif -#endif /* CONFIG_UART_GECKO_0 */ - -#ifdef CONFIG_UART_GECKO_1 -#if (DT_SILABS_GECKO_UART_UART_1_LOCATION == 0) -#error ("Serial Driver for Gecko MCUs not implemented for this location index") -#elif (DT_SILABS_GECKO_UART_UART_1_LOCATION == 1) -#define PIN_UART1_TXD {gpioPortF, 10, gpioModePushPull, 1} -#define PIN_UART1_RXD {gpioPortF, 11, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_UART_UART_1_LOCATION == 2) -#define PIN_UART1_TXD {gpioPortB, 9, gpioModePushPull, 1} -#define PIN_UART1_RXD {gpioPortB, 10, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_UART_UART_1_LOCATION == 3) -#define PIN_UART1_TXD {gpioPortE, 2, gpioModePushPull, 1} -#define PIN_UART1_RXD {gpioPortE, 3, gpioModeInput, 1} -#else -#error ("Serial Driver for Gecko MCUs not implemented for this location index") -#endif -#endif /* CONFIG_UART_GECKO_0 */ - #endif /* _SILABS_EFM32WG_SOC_PINMAP_H_ */ diff --git a/soc/arm/silabs_exx32/efr32fg1p/Kconfig.series b/soc/arm/silabs_exx32/efr32fg1p/Kconfig.series index 2d36c347a00..a1d0a74a8f2 100644 --- a/soc/arm/silabs_exx32/efr32fg1p/Kconfig.series +++ b/soc/arm/silabs_exx32/efr32fg1p/Kconfig.series @@ -14,6 +14,7 @@ config SOC_SERIES_EFR32FG1P select SOC_FAMILY_EXX32 select SYS_POWER_LOW_POWER_STATE_SUPPORTED select CPU_HAS_SYSTICK + select SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION select SOC_GECKO_CMU select SOC_GECKO_GPIO help diff --git a/soc/arm/silabs_exx32/efr32fg1p/soc_pinmap.h b/soc/arm/silabs_exx32/efr32fg1p/soc_pinmap.h index eec98a064df..af2b1a4b02b 100644 --- a/soc/arm/silabs_exx32/efr32fg1p/soc_pinmap.h +++ b/soc/arm/silabs_exx32/efr32fg1p/soc_pinmap.h @@ -31,36 +31,4 @@ #endif #endif /* CONFIG_GPIO_GECKO */ -#ifdef CONFIG_USART_GECKO_0 -#if (DT_SILABS_GECKO_USART_USART_0_LOCATION == 0) -#define PIN_USART0_TXD {gpioPortA, 0, gpioModePushPull, 1} -#define PIN_USART0_RXD {gpioPortA, 1, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_0_LOCATION == 1) -#define PIN_USART0_TXD {gpioPortA, 1, gpioModePushPull, 1} -#define PIN_USART0_RXD {gpioPortA, 2, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_0_LOCATION == 2) -#define PIN_USART0_TXD {gpioPortA, 2, gpioModePushPull, 1} -#define PIN_USART0_RXD {gpioPortA, 3, gpioModeInput, 1} -#else -#error ("Serial Driver for Gecko MCUs not implemented for this location index") -#endif -#endif /* CONFIG_USART_GECKO_0 */ - -#ifdef CONFIG_USART_GECKO_1 -#if (DT_SILABS_GECKO_USART_USART_1_LOCATION == 0) -#error ("Serial Driver for Gecko MCUs not implemented for this location index") -#elif (DT_SILABS_GECKO_USART_USART_1_LOCATION == 1) -#define PIN_USART1_TXD {gpioPortF, 10, gpioModePushPull, 1} -#define PIN_USART1_RXD {gpioPortF, 11, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_1_LOCATION == 2) -#define PIN_USART1_TXD {gpioPortB, 9, gpioModePushPull, 1} -#define PIN_USART1_RXD {gpioPortB, 10, gpioModeInput, 1} -#elif (DT_SILABS_GECKO_USART_USART_1_LOCATION == 3) -#define PIN_USART1_TXD {gpioPortE, 2, gpioModePushPull, 1} -#define PIN_USART1_RXD {gpioPortE, 3, gpioModeInput, 1} -#else -#error ("Serial Driver for Gecko MCUs not implemented for this location index") -#endif -#endif /* CONFIG_USART_GECKO_1 */ - #endif /* _SILABS_EFR32FG1P_SOC_PINMAP_H_ */ diff --git a/soc/arm/silabs_exx32/efr32mg12p/Kconfig.series b/soc/arm/silabs_exx32/efr32mg12p/Kconfig.series index 877ebfa52a5..c84c0a67cdb 100644 --- a/soc/arm/silabs_exx32/efr32mg12p/Kconfig.series +++ b/soc/arm/silabs_exx32/efr32mg12p/Kconfig.series @@ -14,6 +14,7 @@ config SOC_SERIES_EFR32MG12P select CPU_HAS_SYSTICK select HAS_SILABS_GECKO select HAS_SWO + select SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION select SOC_GECKO_CMU select SOC_GECKO_EMU select SOC_GECKO_GPIO diff --git a/soc/arm/silabs_exx32/efr32mg12p/soc_pinmap.h b/soc/arm/silabs_exx32/efr32mg12p/soc_pinmap.h index 5b5af41a849..81a21a35420 100644 --- a/soc/arm/silabs_exx32/efr32mg12p/soc_pinmap.h +++ b/soc/arm/silabs_exx32/efr32mg12p/soc_pinmap.h @@ -30,17 +30,6 @@ #endif #endif /* CONFIG_GPIO_GECKO */ -#ifdef CONFIG_UART_GECKO -#ifdef CONFIG_USART_GECKO_0 -#if (DT_SILABS_GECKO_USART_USART_0_LOCATION == 0) -#define PIN_USART0_TXD {gpioPortA, 0, gpioModePushPull, 1} -#define PIN_USART0_RXD {gpioPortA, 1, gpioModeInput, 0} -#else -#error ("Serial Driver for Gecko MCUs not implemented for this location index") -#endif -#endif /* CONFIG_USART_GECKO_0 */ -#endif /* CONFIG_UART_GECKO */ - #ifdef CONFIG_LEUART_GECKO #ifdef CONFIG_LEUART_GECKO_0 #if (DT_SILABS_GECKO_LEUART_LEUART_0_LOCATION == 27)