drivers: serial: Rework Silabs Gecko UART Driver

Introduces the location property and adds the ability to use values
generated by the device tree configuration.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Diego Sueiro 2018-10-16 17:51:01 +01:00 committed by Kumar Gala
commit 0c7a28c4cc
18 changed files with 326 additions and 145 deletions

View file

@ -43,9 +43,6 @@ if UART_GECKO
config USART_GECKO_1
def_bool y
config USART_GECKO_1_GPIO_LOC
default 4
endif # UART_GECKO
endif # BOARD_EFM32HG_SLSTK3400A

View file

@ -12,7 +12,7 @@
compatible = "silabs,efm32hg_slstk3400a", "silabs,efm32hg";
chosen {
zephyr,console = &uart1;
zephyr,console = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
@ -23,6 +23,7 @@
led1 = &led1;
sw0 = &button0;
sw1 = &button1;
usart-1 = &usart1;
};
leds {
@ -53,7 +54,8 @@
};
&uart1 {
&usart1 {
current-speed = <115200>;
location = <4>;
status = "ok";
};

View file

@ -43,9 +43,6 @@ if UART_GECKO
config UART_GECKO_0
def_bool y
config UART_GECKO_0_GPIO_LOC
default 1
endif # UART_GECKO
endif # BOARD_EFM32WG_STK3800

View file

@ -11,6 +11,10 @@
model = "Silicon Labs EFM32WG STK3800 board";
compatible = "silabs,efm32wg_stk3800", "silabs,efm32wg";
aliases {
uart-0 = &uart0;
};
chosen {
zephyr,console = &uart0;
zephyr,sram = &sram0;
@ -54,5 +58,6 @@
&uart0 {
current-speed = <115200>;
location = <1>;
status = "ok";
};

View file

@ -43,9 +43,6 @@ if UART_GECKO
config USART_GECKO_0
def_bool y
config USART_GECKO_0_GPIO_LOC
default 0
endif # UART_GECKO
endif # BOARD_EFR32_SLWSTK6061A

View file

@ -11,8 +11,12 @@
model = "Silicon Labs EFR32 SLWSTK6061A board";
compatible = "silabs,efr32_slwstk6061a", "silabs,efr32fg1p";
aliases {
usart-0 = &usart0;
};
chosen {
zephyr,console = &uart0;
zephyr,console = &usart0;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
@ -53,7 +57,8 @@
};
&uart0 {
&usart0 {
current-speed = <115200>;
location = <0>;
status = "ok";
};

View file

@ -232,7 +232,8 @@ static void uart_gecko_init_pins(struct device *dev)
soc_gpio_configure(&config->pin_tx);
#if defined(_USART_ROUTEPEN_MASK) || defined(_UART_ROUTEPEN_MASK)
config->base->ROUTEPEN = USART_ROUTEPEN_RXPEN | USART_ROUTEPEN_TXPEN;
config->base->ROUTELOC0 = (config->loc << _USART_ROUTELOC0_TXLOC_SHIFT) |
config->base->ROUTELOC0 =
(config->loc << _USART_ROUTELOC0_TXLOC_SHIFT) |
(config->loc << _USART_ROUTELOC0_RXLOC_SHIFT);
config->base->ROUTELOC1 = _USART_ROUTELOC1_RESETVALUE;
#else
@ -297,12 +298,12 @@ static void uart_gecko_config_func_0(struct device *dev);
#endif
static const struct uart_gecko_config uart_gecko_0_config = {
.base = UART0,
.base = (USART_TypeDef *)CONFIG_UART_GECKO_0_BASE_ADDRESS,
.clock = cmuClock_UART0,
.baud_rate = CONFIG_UART_GECKO_0_BAUD_RATE,
.baud_rate = CONFIG_UART_GECKO_0_CURRENT_SPEED,
.pin_rx = PIN_UART0_RXD,
.pin_tx = PIN_UART0_TXD,
.loc = CONFIG_UART_GECKO_0_GPIO_LOC,
.loc = CONFIG_UART_GECKO_0_LOCATION,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
.irq_config_func = uart_gecko_config_func_0,
#endif
@ -310,22 +311,22 @@ 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, CONFIG_UART_GECKO_0_NAME,
&uart_gecko_init,
&uart_gecko_0_data, &uart_gecko_0_config,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&uart_gecko_driver_api);
DEVICE_AND_API_INIT(uart_0, CONFIG_UART_GECKO_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(UART0_RX_IRQn, CONFIG_UART_GECKO_0_IRQ_PRI,
uart_gecko_isr, DEVICE_GET(uart_0), 0);
IRQ_CONNECT(UART0_TX_IRQn, CONFIG_UART_GECKO_0_IRQ_PRI,
uart_gecko_isr, DEVICE_GET(uart_0), 0);
IRQ_CONNECT(CONFIG_UART_GECKO_0_IRQ_RX,
CONFIG_UART_GECKO_0_IRQ_RX_PRIORITY, uart_gecko_isr,
DEVICE_GET(uart_0), 0);
IRQ_CONNECT(CONFIG_UART_GECKO_0_IRQ_TX,
CONFIG_UART_GECKO_0_IRQ_TX_PRIORITY, uart_gecko_isr,
DEVICE_GET(uart_0), 0);
irq_enable(UART0_TX_IRQn);
irq_enable(UART0_RX_IRQn);
irq_enable(CONFIG_UART_GECKO_0_IRQ_RX);
irq_enable(CONFIG_UART_GECKO_0_IRQ_TX);
}
#endif
@ -338,12 +339,12 @@ static void uart_gecko_config_func_1(struct device *dev);
#endif
static const struct uart_gecko_config uart_gecko_1_config = {
.base = UART1,
.base = (USART_TypeDef *)CONFIG_UART_GECKO_1_BASE_ADDRESS,
.clock = cmuClock_UART1,
.baud_rate = CONFIG_UART_GECKO_1_BAUD_RATE,
.baud_rate = CONFIG_UART_GECKO_1_CURRENT_SPEED,
.pin_rx = PIN_UART1_RXD,
.pin_tx = PIN_UART1_TXD,
.loc = CONFIG_UART_GECKO_1_GPIO_LOC,
.loc = CONFIG_UART_GECKO_1_LOCATION,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
.irq_config_func = uart_gecko_config_func_1,
#endif
@ -351,22 +352,22 @@ 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, CONFIG_UART_GECKO_1_NAME,
&uart_gecko_init,
&uart_gecko_1_data, &uart_gecko_1_config,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&uart_gecko_driver_api);
DEVICE_AND_API_INIT(uart_1, CONFIG_UART_GECKO_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(UART1_RX_IRQn, CONFIG_UART_GECKO_1_IRQ_PRI,
uart_gecko_isr, DEVICE_GET(uart_1), 0);
IRQ_CONNECT(UART1_TX_IRQn, CONFIG_UART_GECKO_1_IRQ_PRI,
uart_gecko_isr, DEVICE_GET(uart_1), 0);
IRQ_CONNECT(CONFIG_UART_GECKO_1_IRQ_RX,
CONFIG_UART_GECKO_1_IRQ_RX_PRIORITY, uart_gecko_isr,
DEVICE_GET(uart_1), 0);
IRQ_CONNECT(CONFIG_UART_GECKO_1_IRQ_TX,
CONFIG_UART_GECKO_1_IRQ_TX_PRIORITY, uart_gecko_isr,
DEVICE_GET(uart_1), 0);
irq_enable(UART1_RX_IRQn);
irq_enable(UART1_TX_IRQn);
irq_enable(CONFIG_UART_GECKO_1_IRQ_RX);
irq_enable(CONFIG_UART_GECKO_1_IRQ_TX);
}
#endif
@ -379,12 +380,12 @@ static void usart_gecko_config_func_0(struct device *dev);
#endif
static const struct uart_gecko_config usart_gecko_0_config = {
.base = USART0,
.base = (USART_TypeDef *)CONFIG_USART_GECKO_0_BASE_ADDRESS,
.clock = cmuClock_USART0,
.baud_rate = CONFIG_USART_GECKO_0_BAUD_RATE,
.baud_rate = CONFIG_USART_GECKO_0_CURRENT_SPEED,
.pin_rx = PIN_USART0_RXD,
.pin_tx = PIN_USART0_TXD,
.loc = CONFIG_USART_GECKO_0_GPIO_LOC,
.loc = CONFIG_USART_GECKO_0_LOCATION,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
.irq_config_func = usart_gecko_config_func_0,
#endif
@ -392,22 +393,22 @@ 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, CONFIG_USART_GECKO_0_NAME,
&uart_gecko_init,
&usart_gecko_0_data, &usart_gecko_0_config,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&uart_gecko_driver_api);
DEVICE_AND_API_INIT(usart_0, CONFIG_USART_GECKO_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);
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
static void usart_gecko_config_func_0(struct device *dev)
{
IRQ_CONNECT(USART0_RX_IRQn, CONFIG_USART_GECKO_0_IRQ_PRI,
uart_gecko_isr, DEVICE_GET(usart_0), 0);
IRQ_CONNECT(USART0_TX_IRQn, CONFIG_USART_GECKO_0_IRQ_PRI,
uart_gecko_isr, DEVICE_GET(usart_0), 0);
IRQ_CONNECT(CONFIG_USART_GECKO_0_IRQ_RX,
CONFIG_USART_GECKO_0_IRQ_RX_PRIORITY, uart_gecko_isr,
DEVICE_GET(usart_0), 0);
IRQ_CONNECT(CONFIG_USART_GECKO_0_IRQ_TX,
CONFIG_USART_GECKO_0_IRQ_TX_PRIORITY, uart_gecko_isr,
DEVICE_GET(usart_0), 0);
irq_enable(USART0_TX_IRQn);
irq_enable(USART0_RX_IRQn);
irq_enable(CONFIG_USART_GECKO_0_IRQ_RX);
irq_enable(CONFIG_USART_GECKO_0_IRQ_TX);
}
#endif
@ -420,12 +421,12 @@ static void usart_gecko_config_func_1(struct device *dev);
#endif
static const struct uart_gecko_config usart_gecko_1_config = {
.base = USART1,
.base = (USART_TypeDef *)CONFIG_USART_GECKO_1_BASE_ADDRESS,
.clock = cmuClock_USART1,
.baud_rate = CONFIG_USART_GECKO_1_BAUD_RATE,
.baud_rate = CONFIG_USART_GECKO_1_CURRENT_SPEED,
.pin_rx = PIN_USART1_RXD,
.pin_tx = PIN_USART1_TXD,
.loc = CONFIG_USART_GECKO_1_GPIO_LOC,
.loc = CONFIG_USART_GECKO_1_LOCATION,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
.irq_config_func = usart_gecko_config_func_1,
#endif
@ -433,23 +434,105 @@ 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, CONFIG_USART_GECKO_1_NAME,
&uart_gecko_init,
&usart_gecko_1_data, &usart_gecko_1_config,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&uart_gecko_driver_api);
DEVICE_AND_API_INIT(usart_1, CONFIG_USART_GECKO_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);
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
static void usart_gecko_config_func_1(struct device *dev)
{
IRQ_CONNECT(USART1_RX_IRQn, CONFIG_USART_GECKO_1_IRQ_PRI,
uart_gecko_isr, DEVICE_GET(usart_1), 0);
IRQ_CONNECT(USART1_TX_IRQn, CONFIG_USART_GECKO_1_IRQ_PRI,
uart_gecko_isr, DEVICE_GET(usart_1), 0);
IRQ_CONNECT(CONFIG_USART_GECKO_1_IRQ_RX,
CONFIG_USART_GECKO_1_IRQ_RX_PRIORITY, uart_gecko_isr,
DEVICE_GET(usart_1), 0);
IRQ_CONNECT(CONFIG_USART_GECKO_1_IRQ_TX,
CONFIG_USART_GECKO_1_IRQ_TX_PRIORITY, uart_gecko_isr,
DEVICE_GET(usart_1), 0);
irq_enable(USART1_RX_IRQn);
irq_enable(USART1_TX_IRQn);
irq_enable(CONFIG_USART_GECKO_1_IRQ_RX);
irq_enable(CONFIG_USART_GECKO_1_IRQ_TX);
}
#endif
#endif /* CONFIG_UART_GECKO_1 */
#endif /* CONFIG_USART_GECKO_1 */
#ifdef CONFIG_USART_GECKO_2
#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 *)CONFIG_USART_GECKO_2_BASE_ADDRESS,
.clock = cmuClock_USART2,
.baud_rate = CONFIG_USART_GECKO_2_CURRENT_SPEED,
.pin_rx = PIN_USART2_RXD,
.pin_tx = PIN_USART2_TXD,
.loc = CONFIG_USART_GECKO_2_LOCATION,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
.irq_config_func = usart_gecko_config_func_2,
#endif
};
static struct uart_gecko_data usart_gecko_2_data;
DEVICE_AND_API_INIT(usart_2, CONFIG_USART_GECKO_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);
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
static void usart_gecko_config_func_2(struct device *dev)
{
IRQ_CONNECT(CONFIG_USART_GECKO_2_IRQ_RX,
CONFIG_USART_GECKO_2_IRQ_RX_PRIORITY, uart_gecko_isr,
DEVICE_GET(usart_2), 0);
IRQ_CONNECT(CONFIG_USART_GECKO_2_IRQ_TX,
CONFIG_USART_GECKO_2_IRQ_TX_PRIORITY, uart_gecko_isr,
DEVICE_GET(usart_2), 0);
irq_enable(CONFIG_USART_GECKO_2_IRQ_RX);
irq_enable(CONFIG_USART_GECKO_2_IRQ_TX);
}
#endif
#endif /* CONFIG_USART_GECKO_2 */
#ifdef CONFIG_USART_GECKO_3
#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 *)CONFIG_USART_GECKO_3_BASE_ADDRESS,
.clock = cmuClock_USART3,
.baud_rate = CONFIG_USART_GECKO_3_CURRENT_SPEED,
.pin_rx = PIN_USART3_RXD,
.pin_tx = PIN_USART3_TXD,
.loc = CONFIG_USART_GECKO_3_LOCATION,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
.irq_config_func = usart_gecko_config_func_3,
#endif
};
static struct uart_gecko_data usart_gecko_3_data;
DEVICE_AND_API_INIT(usart_3, CONFIG_USART_GECKO_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);
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
static void usart_gecko_config_func_3(struct device *dev)
{
IRQ_CONNECT(CONFIG_USART_GECKO_3_IRQ_RX,
CONFIG_USART_GECKO_3_IRQ_RX_PRIORITY, uart_gecko_isr,
DEVICE_GET(usart_3), 0);
IRQ_CONNECT(CONFIG_USART_GECKO_3_IRQ_TX,
CONFIG_USART_GECKO_3_IRQ_TX_PRIORITY, uart_gecko_isr,
DEVICE_GET(usart_3), 0);
irq_enable(CONFIG_USART_GECKO_3_IRQ_RX);
irq_enable(CONFIG_USART_GECKO_3_IRQ_TX);
}
#endif
#endif /* CONFIG_USART_GECKO_3 */

View file

@ -23,18 +23,20 @@
};
soc {
uart0: uart@4000c000 { /* USART0 */
compatible = "silabs,efm32-usart";
usart0: usart@4000c000 { /* USART0 */
compatible = "silabs,gecko-usart";
reg = <0x4000c000 0x400>;
interrupts = <17 0 18 0>;
interrupts = <17 0>, <18 0>;
interrupt-names = "rx", "tx";
status = "disabled";
label = "UART_0";
};
uart1: uart@4000c400 { /* USART1 */
compatible = "silabs,efm32-usart";
usart1: usart@4000c400 { /* USART1 */
compatible = "silabs,gecko-usart";
reg = <0x4000c400 0x400>;
interrupts = <8 0 9 0>;
interrupts = <8 0>, <9 0>;
interrupt-names = "rx", "tx";
status = "disabled";
label = "UART_1";
};

View file

@ -23,42 +23,47 @@
};
soc {
uart0: uart@4000c000 { /* USART0 */
compatible = "silabs,efm32-usart";
usart0: usart@4000c000 { /* USART0 */
compatible = "silabs,gecko-usart";
reg = <0x4000c000 0x400>;
interrupts = <3 0 4 0>;
interrupts = <3 0>, <4 0>;
interrupt-names = "rx", "tx";
status = "disabled";
label = "UART_0";
};
uart1: uart@4000c400 { /* USART1 */
compatible = "silabs,efm32-usart";
usart1: usart@4000c400 { /* USART1 */
compatible = "silabs,gecko-usart";
reg = <0x4000c400 0x400>;
interrupts = <15 0 16 0>;
interrupts = <15 0>, <16 0>;
interrupt-names = "rx", "tx";
status = "disabled";
label = "UART_1";
};
uart2: uart@4000c800 { /* USART2 */
compatible = "silabs,efm32-usart";
usart2: usart@4000c800 { /* USART2 */
compatible = "silabs,gecko-usart";
reg = <0x4000c800 0x400>;
interrupts = <18 0 19 0>;
interrupts = <18 0>, <19 0>;
interrupt-names = "rx", "tx";
status = "disabled";
label = "UART_2";
};
uart3: uart@4000e000 { /* UART0 */
compatible = "silabs,efm32-uart";
uart0: uart@4000e000 { /* UART0 */
compatible = "silabs,gecko-uart";
reg = <0x4000e000 0x400>;
interrupts = <20 0 21 0>;
interrupts = <20 0>, <21 0>;
interrupt-names = "rx", "tx";
status = "disabled";
label = "UART_3";
};
uart4: uart@4000e400 { /* UART1 */
compatible = "silabs,efm32-uart";
uart1: uart@4000e400 { /* UART1 */
compatible = "silabs,gecko-uart";
reg = <0x4000e400 0x400>;
interrupts = <22 0 23 0>;
interrupts = <22 0>, <23 0>;
interrupt-names = "rx", "tx";
status = "disabled";
label = "UART_4";
};

View file

@ -23,20 +23,22 @@
};
soc {
uart0: uart@40010000 { /* USART0 */
compatible = "silabs,efm32-usart";
usart0: usart@40010000 { /* USART0 */
compatible = "silabs,gecko-usart";
reg = <0x40010000 0x400>;
interrupts = <11 0 12 0>;
interrupts = <11 0>, <12 0>;
interrupt-names = "rx", "tx";
status = "disabled";
label = "UART_0";
label = "USART_0";
};
uart1: uart@40010400 { /* USART1 */
compatible = "silabs,efm32-usart";
usart1: usart@40010400 { /* USART1 */
compatible = "silabs,gecko-usart";
reg = <0x40010400 0x400>;
interrupts = <19 0 20 0>;
interrupts = <19 0>, <20 0>;
interrupt-names = "rx", "tx";
status = "disabled";
label = "UART_1";
label = "USART_1";
};
gpio@4000a400 {

View file

@ -1,16 +1,16 @@
---
title: EFM32 UART
title: GECKO UART
version: 0.1
description: >
This binding gives a base representation of the EFM32 UART
This binding gives a base representation of the GECKO UART
inherits:
!include uart.yaml
properties:
compatible:
constraint: "silabs,efm32-uart"
constraint: "silabs,gecko-uart"
reg:
type: array
@ -19,8 +19,14 @@ properties:
category: required
interrupts:
type: array
type: compound
category: required
description: required interrupts
generation: define
location:
type: int
category: required
description: PIN location
generation: define
...

View file

@ -1,16 +1,16 @@
---
title: EFM32 USART
title: GECKO USART
version: 0.1
description: >
This binding gives a base representation of the EFM32 USART
This binding gives a base representation of the Gecko USART
inherits:
!include uart.yaml
properties:
compatible:
constraint: "silabs,efm32-usart"
constraint: "silabs,gecko-usart"
reg:
type: array
@ -19,8 +19,14 @@ properties:
category: required
interrupts:
type: array
type: compound
category: required
description: required interrupts
generation: define
location:
type: int
category: required
description: PIN location
generation: define
...

View file

@ -8,14 +8,25 @@
#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V6M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
#define CONFIG_USART_GECKO_0_NAME SILABS_EFM32_USART_4000C000_LABEL
#define CONFIG_USART_GECKO_0_BAUD_RATE SILABS_EFM32_USART_4000C000_CURRENT_SPEED
#define CONFIG_USART_GECKO_0_IRQ_PRI SILABS_EFM32_USART_4000C000_IRQ_0_PRIORITY
#define CONFIG_USART_GECKO_1_NAME SILABS_EFM32_USART_4000C400_LABEL
#define CONFIG_USART_GECKO_1_BAUD_RATE SILABS_EFM32_USART_4000C400_CURRENT_SPEED
#define CONFIG_USART_GECKO_1_IRQ_PRI SILABS_EFM32_USART_4000C400_IRQ_0_PRIORITY
#define CONFIG_USART_GECKO_0_BASE_ADDRESS SILABS_GECKO_USART_4000C000_BASE_ADDRESS
#define CONFIG_USART_GECKO_0_CURRENT_SPEED SILABS_GECKO_USART_4000C000_CURRENT_SPEED
#define CONFIG_USART_GECKO_0_IRQ_RX SILABS_GECKO_USART_4000C000_IRQ_0
#define CONFIG_USART_GECKO_0_IRQ_RX_PRIORITY SILABS_GECKO_USART_4000C000_IRQ_0_PRIORITY
#define CONFIG_USART_GECKO_0_IRQ_TX SILABS_GECKO_USART_4000C000_IRQ_1
#define CONFIG_USART_GECKO_0_IRQ_TX_PRIORITY SILABS_GECKO_USART_4000C000_IRQ_1_PRIORITY
#define CONFIG_USART_GECKO_0_LABEL SILABS_GECKO_USART_4000C000_LABEL
#define CONFIG_USART_GECKO_0_LOCATION SILABS_GECKO_USART_4000C000_LOCATION
#define CONFIG_USART_GECKO_0_SIZE SILABS_GECKO_USART_4000C000_SIZE
#define CONFIG_USART_GECKO_1_BASE_ADDRESS SILABS_GECKO_USART_4000C400_BASE_ADDRESS
#define CONFIG_USART_GECKO_1_CURRENT_SPEED SILABS_GECKO_USART_4000C400_CURRENT_SPEED
#define CONFIG_USART_GECKO_1_IRQ_RX SILABS_GECKO_USART_4000C400_IRQ_0
#define CONFIG_USART_GECKO_1_IRQ_RX_PRIORITY SILABS_GECKO_USART_4000C400_IRQ_0_PRIORITY
#define CONFIG_USART_GECKO_1_IRQ_TX SILABS_GECKO_USART_4000C400_IRQ_1
#define CONFIG_USART_GECKO_1_IRQ_TX_PRIORITY SILABS_GECKO_USART_4000C400_IRQ_1_PRIORITY
#define CONFIG_USART_GECKO_1_LABEL SILABS_GECKO_USART_4000C400_LABEL
#define CONFIG_USART_GECKO_1_LOCATION SILABS_GECKO_USART_4000C400_LOCATION
#define CONFIG_USART_GECKO_1_SIZE SILABS_GECKO_USART_4000C400_SIZE
#define CONFIG_GPIO_GECKO_COMMON_NAME SILABS_EFM32_GPIO_40006100_LABEL
#define CONFIG_GPIO_GECKO_COMMON_EVEN_IRQ SILABS_EFM32_GPIO_40006100_IRQ_GPIO_EVEN

View file

@ -18,17 +18,17 @@
#ifdef CONFIG_SOC_PART_NUMBER_EFM32HG322F64
#ifdef CONFIG_USART_GECKO_0
#if (CONFIG_USART_GECKO_0_GPIO_LOC == 0)
#if (CONFIG_USART_GECKO_0_LOCATION == 0)
#define PIN_USART0_TXD {gpioPortE, 10, gpioModePushPull, 1}
#define PIN_USART0_RXD {gpioPortE, 11, gpioModeInput, 1}
#elif (CONFIG_USART_GECKO_0_GPIO_LOC == 3)
#elif (CONFIG_USART_GECKO_0_LOCATION == 3)
#define PIN_USART0_TXD {gpioPortE, 13, gpioModePushPull, 1}
#define PIN_USART0_RXD {gpioPortE, 12, gpioModeInput, 1}
#elif (CONFIG_USART_GECKO_0_GPIO_LOC == 4)
#elif (CONFIG_USART_GECKO_0_LOCATION == 4)
#define PIN_USART0_TXD {gpioPortB, 7, gpioModePushPull, 1}
#define PIN_USART0_RXD {gpioPortB, 8, gpioModeInput, 1}
#elif (CONFIG_USART_GECKO_0_GPIO_LOC == 5) || \
(CONFIG_USART_GECKO_0_GPIO_LOC == 6)
#elif (CONFIG_USART_GECKO_0_LOCATION == 5) || \
(CONFIG_USART_GECKO_0_LOCATION == 6)
#define PIN_USART0_TXD {gpioPortC, 0, gpioModePushPull, 1}
#define PIN_USART0_RXD {gpioPortC, 1, gpioModeInput, 1}
#else
@ -37,17 +37,17 @@
#endif /* CONFIG_USART_GECKO_0 */
#ifdef CONFIG_USART_GECKO_1
#if (CONFIG_USART_GECKO_1_GPIO_LOC == 0)
#if (CONFIG_USART_GECKO_1_LOCATION == 0)
#define PIN_USART1_TXD {gpioPortC, 0, gpioModePushPull, 1}
#define PIN_USART1_RXD {gpioPortC, 1, gpioModeInput, 1}
#elif (CONFIG_USART_GECKO_1_GPIO_LOC == 2) || \
(CONFIG_USART_GECKO_1_GPIO_LOC == 3)
#elif (CONFIG_USART_GECKO_1_LOCATION == 2) || \
(CONFIG_USART_GECKO_1_LOCATION == 3)
#define PIN_USART1_TXD {gpioPortD, 7, gpioModePushPull, 1}
#define PIN_USART1_RXD {gpioPortD, 6, gpioModeInput, 1}
#elif (CONFIG_USART_GECKO_1_GPIO_LOC == 4)
#elif (CONFIG_USART_GECKO_1_LOCATION == 4)
#define PIN_USART1_TXD {gpioPortF, 2, gpioModePushPull, 1}
#define PIN_USART1_RXD {gpioPortA, 0, gpioModeInput, 1}
#elif (CONFIG_USART_GECKO_1_GPIO_LOC == 5)
#elif (CONFIG_USART_GECKO_1_LOCATION == 5)
#define PIN_USART1_TXD {gpioPortC, 1, gpioModePushPull, 1}
#define PIN_USART1_RXD {gpioPortC, 2, gpioModeInput, 1}
#else

View file

@ -7,10 +7,57 @@
/* SoC level DTS fixup file */
#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
#define CONFIG_UART_GECKO_0_NAME SILABS_EFM32_USART_4000C000_LABEL
#define CONFIG_UART_GECKO_0_BAUD_RATE SILABS_EFM32_USART_4000C000_CURRENT_SPEED
#define CONFIG_UART_GECKO_0_IRQ_PRI SILABS_EFM32_USART_4000C000_IRQ_0_PRIORITY
#define CONFIG_USART_GECKO_0_BASE_ADDRESS SILABS_GECKO_USART_4000C000_BASE_ADDRESS
#define CONFIG_USART_GECKO_0_CURRENT_SPEED SILABS_GECKO_USART_4000C000_CURRENT_SPEED
#define CONFIG_USART_GECKO_0_IRQ_RX SILABS_GECKO_USART_4000C000_IRQ_0
#define CONFIG_USART_GECKO_0_IRQ_RX_PRIORITY SILABS_GECKO_USART_4000C000_IRQ_0_PRIORITY
#define CONFIG_USART_GECKO_0_IRQ_TX SILABS_GECKO_USART_4000C000_IRQ_1
#define CONFIG_USART_GECKO_0_IRQ_TX_PRIORITY SILABS_GECKO_USART_4000C000_IRQ_1_PRIORITY
#define CONFIG_USART_GECKO_0_LABEL SILABS_GECKO_USART_4000C000_LABEL
#define CONFIG_USART_GECKO_0_LOCATION SILABS_GECKO_USART_4000C000_LOCATION
#define CONFIG_USART_GECKO_0_SIZE SILABS_GECKO_USART_4000C000_SIZE
#define CONFIG_USART_GECKO_1_BASE_ADDRESS SILABS_GECKO_USART_4000C400_BASE_ADDRESS
#define CONFIG_USART_GECKO_1_CURRENT_SPEED SILABS_GECKO_USART_4000C400_CURRENT_SPEED
#define CONFIG_USART_GECKO_1_IRQ_RX SILABS_GECKO_USART_4000C400_IRQ_0
#define CONFIG_USART_GECKO_1_IRQ_RX_PRIORITY SILABS_GECKO_USART_4000C400_IRQ_0_PRIORITY
#define CONFIG_USART_GECKO_1_IRQ_TX SILABS_GECKO_USART_4000C400_IRQ_1
#define CONFIG_USART_GECKO_1_IRQ_TX_PRIORITY SILABS_GECKO_USART_4000C400_IRQ_1_PRIORITY
#define CONFIG_USART_GECKO_1_LABEL SILABS_GECKO_USART_4000C400_LABEL
#define CONFIG_USART_GECKO_1_LOCATION SILABS_GECKO_USART_4000C400_LOCATION
#define CONFIG_USART_GECKO_1_SIZE SILABS_GECKO_USART_4000C400_SIZE
#define CONFIG_USART_GECKO_2_BASE_ADDRESS SILABS_GECKO_USART_4000C800_BASE_ADDRESS
#define CONFIG_USART_GECKO_2_CURRENT_SPEED SILABS_GECKO_USART_4000C800_CURRENT_SPEED
#define CONFIG_USART_GECKO_2_IRQ_RX SILABS_GECKO_USART_4000C800_IRQ_0
#define CONFIG_USART_GECKO_2_IRQ_RX_PRIORITY SILABS_GECKO_USART_4000C800_IRQ_0_PRIORITY
#define CONFIG_USART_GECKO_2_IRQ_TX SILABS_GECKO_USART_4000C800_IRQ_1
#define CONFIG_USART_GECKO_2_IRQ_TX_PRIORITY SILABS_GECKO_USART_4000C800_IRQ_1_PRIORITY
#define CONFIG_USART_GECKO_2_LABEL SILABS_GECKO_USART_4000C800_LABEL
#define CONFIG_USART_GECKO_2_LOCATION SILABS_GECKO_USART_4000C800_LOCATION
#define CONFIG_USART_GECKO_2_SIZE SILABS_GECKO_USART_4000C800_SIZE
#define CONFIG_UART_GECKO_0_BASE_ADDRESS SILABS_GECKO_UART_4000E000_BASE_ADDRESS
#define CONFIG_UART_GECKO_0_CURRENT_SPEED SILABS_GECKO_UART_4000E000_CURRENT_SPEED
#define CONFIG_UART_GECKO_0_IRQ_RX SILABS_GECKO_UART_4000E000_IRQ_0
#define CONFIG_UART_GECKO_0_IRQ_RX_PRIORITY SILABS_GECKO_UART_4000E000_IRQ_0_PRIORITY
#define CONFIG_UART_GECKO_0_IRQ_TX SILABS_GECKO_UART_4000E000_IRQ_1
#define CONFIG_UART_GECKO_0_IRQ_TX_PRIORITY SILABS_GECKO_UART_4000E000_IRQ_1_PRIORITY
#define CONFIG_UART_GECKO_0_LABEL SILABS_GECKO_UART_4000E000_LABEL
#define CONFIG_UART_GECKO_0_LOCATION SILABS_GECKO_UART_4000E000_LOCATION
#define CONFIG_UART_GECKO_0_SIZE SILABS_GECKO_UART_4000E000_SIZE
#define CONFIG_UART_GECKO_1_BASE_ADDRESS SILABS_GECKO_UART_4000E400_BASE_ADDRESS
#define CONFIG_UART_GECKO_1_CURRENT_SPEED SILABS_GECKO_UART_4000E400_CURRENT_SPEED
#define CONFIG_UART_GECKO_1_IRQ_RX SILABS_GECKO_UART_4000E400_IRQ_0
#define CONFIG_UART_GECKO_1_IRQ_RX_PRIORITY SILABS_GECKO_UART_4000E400_IRQ_0_PRIORITY
#define CONFIG_UART_GECKO_1_IRQ_TX SILABS_GECKO_UART_4000E400_IRQ_1
#define CONFIG_UART_GECKO_1_IRQ_TX_PRIORITY SILABS_GECKO_UART_4000E400_IRQ_1_PRIORITY
#define CONFIG_UART_GECKO_1_LABEL SILABS_GECKO_UART_4000E400_LABEL
#define CONFIG_UART_GECKO_1_LOCATION SILABS_GECKO_UART_4000E400_LOCATION
#define CONFIG_UART_GECKO_1_SIZE SILABS_GECKO_UART_4000E400_SIZE
#define CONFIG_GPIO_GECKO_COMMON_NAME SILABS_EFM32_GPIO_40006100_LABEL
#define CONFIG_GPIO_GECKO_COMMON_EVEN_IRQ SILABS_EFM32_GPIO_40006100_IRQ_GPIO_EVEN

View file

@ -18,13 +18,13 @@
#ifdef CONFIG_SOC_PART_NUMBER_EFM32WG990F256
#ifdef CONFIG_UART_GECKO_0
#if (CONFIG_UART_GECKO_0_GPIO_LOC == 0)
#if (CONFIG_UART_GECKO_0_LOCATION == 0)
#define PIN_UART0_TXD {gpioPortF, 6, gpioModePushPull, 1}
#define PIN_UART0_RXD {gpioPortF, 7, gpioModeInput, 1}
#elif (CONFIG_UART_GECKO_0_GPIO_LOC == 1)
#elif (CONFIG_UART_GECKO_0_LOCATION == 1)
#define PIN_UART0_TXD {gpioPortE, 0, gpioModePushPull, 1}
#define PIN_UART0_RXD {gpioPortE, 1, gpioModeInput, 1}
#elif (CONFIG_UART_GECKO_0_GPIO_LOC == 2)
#elif (CONFIG_UART_GECKO_0_LOCATION == 2)
#define PIN_UART0_TXD {gpioPortA, 3, gpioModePushPull, 1}
#define PIN_UART0_RXD {gpioPortA, 4, gpioModeInput, 1}
#else
@ -33,15 +33,15 @@
#endif /* CONFIG_UART_GECKO_0 */
#ifdef CONFIG_UART_GECKO_1
#if (CONFIG_UART_GECKO_1_GPIO_LOC == 0)
#if (CONFIG_UART_GECKO_1_LOCATION == 0)
#error ("Serial Driver for Gecko MCUs not implemented for this location index")
#elif (CONFIG_UART_GECKO_1_GPIO_LOC == 1)
#elif (CONFIG_UART_GECKO_1_LOCATION == 1)
#define PIN_UART1_TXD {gpioPortF, 10, gpioModePushPull, 1}
#define PIN_UART1_RXD {gpioPortF, 11, gpioModeInput, 1}
#elif (CONFIG_UART_GECKO_1_GPIO_LOC == 2)
#elif (CONFIG_UART_GECKO_1_LOCATION == 2)
#define PIN_UART1_TXD {gpioPortB, 9, gpioModePushPull, 1}
#define PIN_UART1_RXD {gpioPortB, 10, gpioModeInput, 1}
#elif (CONFIG_UART_GECKO_1_GPIO_LOC == 3)
#elif (CONFIG_UART_GECKO_1_LOCATION == 3)
#define PIN_UART1_TXD {gpioPortE, 2, gpioModePushPull, 1}
#define PIN_UART1_RXD {gpioPortE, 3, gpioModeInput, 1}
#else

View file

@ -7,10 +7,26 @@
/* SoC level DTS fixup file */
#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
#define CONFIG_USART_GECKO_0_NAME SILABS_EFM32_USART_40010000_LABEL
#define CONFIG_USART_GECKO_0_BAUD_RATE SILABS_EFM32_USART_40010000_CURRENT_SPEED
#define CONFIG_USART_GECKO_0_IRQ_PRI SILABS_EFM32_USART_40010000_IRQ_0_PRIORITY
#define CONFIG_USART_GECKO_0_BASE_ADDRESS SILABS_GECKO_USART_40010000_BASE_ADDRESS
#define CONFIG_USART_GECKO_0_CURRENT_SPEED SILABS_GECKO_USART_40010000_CURRENT_SPEED
#define CONFIG_USART_GECKO_0_IRQ_RX SILABS_GECKO_USART_40010000_IRQ_0
#define CONFIG_USART_GECKO_0_IRQ_RX_PRIORITY SILABS_GECKO_USART_40010000_IRQ_0_PRIORITY
#define CONFIG_USART_GECKO_0_IRQ_TX SILABS_GECKO_USART_40010000_IRQ_1
#define CONFIG_USART_GECKO_0_IRQ_TX_PRIORITY SILABS_GECKO_USART_40010000_IRQ_1_PRIORITY
#define CONFIG_USART_GECKO_0_LABEL SILABS_GECKO_USART_40010000_LABEL
#define CONFIG_USART_GECKO_0_LOCATION SILABS_GECKO_USART_40010000_LOCATION
#define CONFIG_USART_GECKO_0_SIZE SILABS_GECKO_USART_40010000_SIZE
#define CONFIG_USART_GECKO_1_BASE_ADDRESS SILABS_GECKO_USART_40010400_BASE_ADDRESS
#define CONFIG_USART_GECKO_1_CURRENT_SPEED SILABS_GECKO_USART_40010400_CURRENT_SPEED
#define CONFIG_USART_GECKO_1_IRQ_RX SILABS_GECKO_USART_40010400_IRQ_0
#define CONFIG_USART_GECKO_1_IRQ_RX_PRIORITY SILABS_GECKO_USART_40010400_IRQ_0_PRIORITY
#define CONFIG_USART_GECKO_1_IRQ_TX SILABS_GECKO_USART_40010400_IRQ_1
#define CONFIG_USART_GECKO_1_IRQ_TX_PRIORITY SILABS_GECKO_USART_40010400_IRQ_1_PRIORITY
#define CONFIG_USART_GECKO_1_LABEL SILABS_GECKO_USART_40010400_LABEL
#define CONFIG_USART_GECKO_1_LOCATION SILABS_GECKO_USART_40010400_LOCATION
#define CONFIG_USART_GECKO_1_SIZE SILABS_GECKO_USART_40010400_SIZE
#define CONFIG_GPIO_GECKO_COMMON_NAME SILABS_EFR32XG1_GPIO_4000A400_LABEL
#define CONFIG_GPIO_GECKO_COMMON_EVEN_IRQ SILABS_EFR32XG1_GPIO_4000A400_IRQ_GPIO_EVEN

View file

@ -18,13 +18,13 @@
#ifdef CONFIG_SOC_PART_NUMBER_EFR32FG1P133F256GM48
#ifdef CONFIG_USART_GECKO_0
#if (CONFIG_USART_GECKO_0_GPIO_LOC == 0)
#if (CONFIG_USART_GECKO_0_LOCATION == 0)
#define PIN_USART0_TXD {gpioPortA, 0, gpioModePushPull, 1}
#define PIN_USART0_RXD {gpioPortA, 1, gpioModeInput, 1}
#elif (CONFIG_USART_GECKO_0_GPIO_LOC == 1)
#elif (CONFIG_USART_GECKO_0_LOCATION == 1)
#define PIN_USART0_TXD {gpioPortA, 1, gpioModePushPull, 1}
#define PIN_USART0_RXD {gpioPortA, 2, gpioModeInput, 1}
#elif (CONFIG_USART_GECKO_0_GPIO_LOC == 2)
#elif (CONFIG_USART_GECKO_0_LOCATION == 2)
#define PIN_USART0_TXD {gpioPortA, 2, gpioModePushPull, 1}
#define PIN_USART0_RXD {gpioPortA, 3, gpioModeInput, 1}
#else
@ -33,15 +33,15 @@
#endif /* CONFIG_USART_GECKO_0 */
#ifdef CONFIG_USART_GECKO_1
#if (CONFIG_USART_GECKO_1_GPIO_LOC == 0)
#if (CONFIG_USART_GECKO_1_LOCATION == 0)
#error ("Serial Driver for Gecko MCUs not implemented for this location index")
#elif (CONFIG_USART_GECKO_1_GPIO_LOC == 1)
#elif (CONFIG_USART_GECKO_1_LOCATION == 1)
#define PIN_USART1_TXD {gpioPortF, 10, gpioModePushPull, 1}
#define PIN_USART1_RXD {gpioPortF, 11, gpioModeInput, 1}
#elif (CONFIG_USART_GECKO_1_GPIO_LOC == 2)
#elif (CONFIG_USART_GECKO_1_LOCATION == 2)
#define PIN_USART1_TXD {gpioPortB, 9, gpioModePushPull, 1}
#define PIN_USART1_RXD {gpioPortB, 10, gpioModeInput, 1}
#elif (CONFIG_USART_GECKO_1_GPIO_LOC == 3)
#elif (CONFIG_USART_GECKO_1_LOCATION == 3)
#define PIN_USART1_TXD {gpioPortE, 2, gpioModePushPull, 1}
#define PIN_USART1_RXD {gpioPortE, 3, gpioModeInput, 1}
#else