Skip to content

Commit 504eb7d

Browse files
Martinhoff-makerjhedberg
authored andcommitted
drivers: serial: silabs: fix eusart driver when parity param is nok
When running uart_elementary on the xg22 SoC, some tests are failing due to the lack of checks inside the configuration function. This patch adds a check for the parity parameter. I've also noticed an error in the ISR function where we check all the ISR flags and not only the enabled ones. It has no impact but needs to be changed in order to be accurate. Signed-off-by: Martin Hoff <[email protected]>
1 parent e0fcca5 commit 504eb7d

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

drivers/serial/uart_silabs_eusart.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ static void eusart_isr(const struct device *dev)
765765
#ifdef CONFIG_UART_SILABS_EUSART_ASYNC
766766
const struct eusart_config *config = dev->config;
767767
EUSART_TypeDef *eusart = config->eusart;
768-
uint32_t flags = EUSART_IntGet(eusart);
768+
uint32_t flags = EUSART_IntGetEnabled(eusart);
769769
struct dma_status stat;
770770
#endif
771771
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
@@ -983,6 +983,10 @@ static int eusart_configure(const struct device *dev, const struct uart_config *
983983
return -ENOSYS;
984984
}
985985

986+
if (cfg->parity > UART_CFG_PARITY_SPACE) {
987+
return -EINVAL;
988+
}
989+
986990
if (cfg->flow_ctrl == UART_CFG_FLOW_CTRL_DTR_DSR ||
987991
cfg->flow_ctrl == UART_CFG_FLOW_CTRL_RS485) {
988992
return -ENOSYS;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2025, Silicon Laboratories Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/*
8+
* Need to connect PB1 (L7) and PB2(L8) of the MikroE connector
9+
*/
10+
11+
dut: &euart0 {
12+
compatible = "silabs,eusart-uart";
13+
pinctrl-0 = <&euart0_default>;
14+
pinctrl-names = "default";
15+
current-speed = <115200>;
16+
status = "okay";
17+
};

tests/drivers/uart/uart_elementary/testcase.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ tests:
2525
- esp32h2_devkitm
2626
- esp32s2_saola
2727
- esp32s3_devkitm/esp32s3/procpu
28+
- bgm220_ek4314a
2829
- xg24_rb4187c
2930
- bg29_rb4420a
3031
- xg29_rb4412a

0 commit comments

Comments
 (0)