drivers: uart_gecko: use DT_<COMPAT>_<INSTANCE>_<PROP> defines
Use the new DT_<COMPAT>_<INSTANCE>_<PROP> defines to instantiate devices. This commit adds also ability to define individual pin locations on SoC series that support the feature. Definitions of GPIO pins assigned to a given location have been moved from soc_pinmap.h file to board DTS file. Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
This commit is contained in:
parent
93d0f8c58d
commit
a148e11e2a
29 changed files with 247 additions and 338 deletions
|
@ -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
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
|
||||
&usart1 {
|
||||
current-speed = <115200>;
|
||||
location = <4>;
|
||||
location-rx = <GECKO_LOCATION(4) GECKO_PORT_A GECKO_PIN(0)>;
|
||||
location-tx = <GECKO_LOCATION(4) GECKO_PORT_F GECKO_PIN(2)>;
|
||||
status = "ok";
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -55,7 +55,8 @@
|
|||
|
||||
&usart0 {
|
||||
current-speed = <115200>;
|
||||
location = <0>;
|
||||
location-rx = <GECKO_LOCATION(0) GECKO_PORT_A GECKO_PIN(1)>;
|
||||
location-tx = <GECKO_LOCATION(0) GECKO_PORT_A GECKO_PIN(0)>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
|
||||
&uart0 {
|
||||
current-speed = <115200>;
|
||||
location = <1>;
|
||||
location-rx = <GECKO_LOCATION(1) GECKO_PORT_E GECKO_PIN(1)>;
|
||||
location-tx = <GECKO_LOCATION(1) GECKO_PORT_E GECKO_PIN(0)>;
|
||||
status = "ok";
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -56,7 +56,8 @@
|
|||
|
||||
&usart0 {
|
||||
current-speed = <115200>;
|
||||
location = <0>;
|
||||
location-rx = <GECKO_LOCATION(0) GECKO_PORT_A GECKO_PIN(1)>;
|
||||
location-tx = <GECKO_LOCATION(0) GECKO_PORT_A GECKO_PIN(0)>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -54,7 +54,8 @@
|
|||
|
||||
&usart0 {
|
||||
current-speed = <115200>;
|
||||
location = <0>;
|
||||
location-rx = <GECKO_LOCATION(0) GECKO_PORT_A GECKO_PIN(1)>;
|
||||
location-tx = <GECKO_LOCATION(0) GECKO_PORT_A GECKO_PIN(0)>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <arm/armv6-m.dtsi>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#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";
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <arm/armv7-m.dtsi>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/i2c/i2c.h>
|
||||
#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;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <arm/armv7-m.dtsi>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#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";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <arm/armv7-m.dtsi>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#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";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <arm/armv7-m.dtsi>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/i2c/i2c.h>
|
||||
#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;
|
||||
|
|
24
dts/arm/silabs/gpio_gecko.h
Normal file
24
dts/arm/silabs/gpio_gecko.h
Normal file
|
@ -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_ */
|
|
@ -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 <location port pin>
|
||||
generation: define
|
||||
|
||||
location-tx:
|
||||
type: array
|
||||
category: required
|
||||
description: TX pin configuration defined as <location port pin>
|
||||
generation: define
|
||||
...
|
||||
|
|
|
@ -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 <location port pin>
|
||||
generation: define
|
||||
|
||||
location-tx:
|
||||
type: array
|
||||
category: required
|
||||
description: TX pin configuration defined as <location port pin>
|
||||
generation: define
|
||||
...
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -16,42 +16,4 @@
|
|||
#include <soc.h>
|
||||
#include <em_gpio.h>
|
||||
|
||||
#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_ */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -16,36 +16,4 @@
|
|||
#include <soc.h>
|
||||
#include <em_gpio.h>
|
||||
|
||||
#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_ */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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_ */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue