Skip to content

Commit d7513fb

Browse files
erwangocarlescufi
authored andcommitted
driver: serial: stm32u5: DMAT Errata behavior valid only on some SoCs
Workaround for DMAT errata was applied on all SoCs declaring STM32U5 DMA compatible. This errata has been fixed in later SoCs revisions and should not be applied anymore as this can cause compatibility issues with power mgmt (can not enter STOP1 in some cases). Declare a specific Kconfig symbol to restrict the workaround only to the set of SoCs impacted by the issue and requiring workaround. Note that I preferred using Kconfig over device tree since it doesn't feel right to declare a compatible on a silicon bug base. Signed-off-by: Erwan Gouriou <[email protected]>
1 parent c47880a commit d7513fb

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

drivers/serial/Kconfig.stm32

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,18 @@ config UART_STM32
2121
This option enables the UART driver for STM32 family of
2222
processors.
2323
Say y if you wish to use serial port on STM32 MCU.
24+
25+
if UART_STM32
26+
27+
config UART_STM32U5_ERRATA_DMAT
28+
bool
29+
default y
30+
depends on SOC_STM32U575XX || SOC_STM32U585XX || \
31+
SOC_STM32H562XX || SOC_STM32H563XX || SOC_STM32H573XX
32+
help
33+
Handles erratum "USART does not generate DMA requests after
34+
setting/clearing DMAT bit".
35+
Seen in Errata Sheet 0499 § 2.19.2 and §2.20.1 for stm32u57x/u58x,
36+
Errata Sheet 0565 § 2.14.1 and §2.15.1 for stm32h56x/h57x
37+
38+
endif

drivers/serial/uart_stm32.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ static inline void uart_stm32_dma_tx_enable(const struct device *dev)
13211321

13221322
static inline void uart_stm32_dma_tx_disable(const struct device *dev)
13231323
{
1324-
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32u5_dma)
1324+
#ifdef CONFIG_UART_STM32U5_ERRATA_DMAT
13251325
ARG_UNUSED(dev);
13261326

13271327
/*
@@ -1333,7 +1333,7 @@ static inline void uart_stm32_dma_tx_disable(const struct device *dev)
13331333
const struct uart_stm32_config *config = dev->config;
13341334

13351335
LL_USART_DisableDMAReq_TX(config->usart);
1336-
#endif /* ! st_stm32u5_dma */
1336+
#endif
13371337
}
13381338

13391339
static inline void uart_stm32_dma_rx_enable(const struct device *dev)
@@ -1633,9 +1633,9 @@ static int uart_stm32_async_tx_abort(const struct device *dev)
16331633
data->dma_tx.counter = tx_buffer_length - stat.pending_length;
16341634
}
16351635

1636-
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32u5_dma)
1636+
#ifdef CONFIG_UART_STM32U5_ERRATA_DMAT
16371637
dma_suspend(data->dma_tx.dma_dev, data->dma_tx.dma_channel);
1638-
#endif /* st_stm32u5_dma */
1638+
#endif
16391639
dma_stop(data->dma_tx.dma_dev, data->dma_tx.dma_channel);
16401640
async_evt_tx_abort(data);
16411641

0 commit comments

Comments
 (0)