serial: stm32: get FIFO size from hwcfg register
authorValentin Caron <valentin.caron@foss.st.com>
Fri, 12 Jan 2024 09:53:00 +0000 (10:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 28 Jan 2024 03:04:11 +0000 (19:04 -0800)
commit5d207f62cec8d6e6f0fb6f35495723bf3960daf7
treea54f0ffbc51476eb8150ae086d46d61e05f1bddc
parent7be985bd7cd5c6c605ec710e691620b8afb983fd
serial: stm32: get FIFO size from hwcfg register

Since STM32MP25, FIFO size could vary regarding the STM32MPxx version.
So we get this size from "hwcfgr1" register and compute threshold values
corresponding to the ratio given by reference manual.

As STM32MP1x, STM32MP25 and STM32H7 share the same compatible and STM32H7
doesn't have a register to get FIFO size, we force FIFO size to 16 in case
of zero read from hwcfgr1 register.

Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
Link: https://lore.kernel.org/r/20240112095300.2004878-5-valentin.caron@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/stm32-usart.c
drivers/tty/serial/stm32-usart.h