diff options
author | Valentin Caron <valentin.caron@foss.st.com> | 2024-01-12 10:52:57 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-01-27 19:04:11 -0800 |
commit | ec240f88934f6ecda5cd21514cc6f30e0ec5d955 (patch) | |
tree | fc6719cd907a799b581d89794ad9da565d34e1f5 /drivers/tty/serial/stm32-usart.h | |
parent | 5c49b6a4a4bcf368f85cfe7a0e5ac3a7016f30fd (diff) | |
download | linux-stable-ec240f88934f6ecda5cd21514cc6f30e0ec5d955.tar.gz linux-stable-ec240f88934f6ecda5cd21514cc6f30e0ec5d955.tar.bz2 linux-stable-ec240f88934f6ecda5cd21514cc6f30e0ec5d955.zip |
serial: stm32: implement prescaler tuning to compute low baudrate
In the case of high USART input clock and low baud rate, BRR value
is not enough to get correct baud rate. So here we use USART prescaler to
divide USART input clock to get the correct baud rate.
PRESC register is only available since stm32h7.
Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
Link: https://lore.kernel.org/r/20240112095300.2004878-2-valentin.caron@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/stm32-usart.h')
-rw-r--r-- | drivers/tty/serial/stm32-usart.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/tty/serial/stm32-usart.h b/drivers/tty/serial/stm32-usart.h index f59f831b2a10..8cecfdce9386 100644 --- a/drivers/tty/serial/stm32-usart.h +++ b/drivers/tty/serial/stm32-usart.h @@ -20,6 +20,7 @@ struct stm32_usart_offsets { u8 icr; u8 rdr; u8 tdr; + u8 presc; }; struct stm32_usart_config { @@ -71,6 +72,7 @@ struct stm32_usart_info { #define USART_BRR_DIV_M_MASK GENMASK(15, 4) #define USART_BRR_DIV_M_SHIFT 4 #define USART_BRR_04_R_SHIFT 1 +#define USART_BRR_MASK (USART_BRR_DIV_M_MASK | USART_BRR_DIV_F_MASK) /* USART_CR1 */ #define USART_CR1_SBK BIT(0) @@ -176,6 +178,10 @@ struct stm32_usart_info { #define USART_ICR_CMCF BIT(17) /* F7 */ #define USART_ICR_WUCF BIT(20) /* H7 */ +/* USART_PRESC */ +#define USART_PRESC GENMASK(3, 0) /* H7 */ +#define USART_PRESC_MAX 0b1011 + #define STM32_SERIAL_NAME "ttySTM" #define STM32_MAX_PORTS 8 |