serial: mvebu-uart: correctly calculate minimal possible baudrate
authorPali Rohár <pali@kernel.org>
Thu, 24 Jun 2021 22:49:02 +0000 (00:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:56:50 +0000 (16:56 +0200)
commit347af865b6a20d2f498644f612c0e09d2eeba199
treed904142c2fe330928dfc0f5651325cb22f26abcd
parent9ad82f0412c04f7cf8a8522a5dca633a0c40135a
serial: mvebu-uart: correctly calculate minimal possible baudrate

[ Upstream commit deeaf963569a0d9d1b08babb771f61bb501a5704 ]

For default (x16) scheme which is currently used by mvebu-uart.c driver,
maximal divisor of UART base clock is 1023*16. Therefore there is limit for
minimal supported baudrate. This change calculate it correctly and prevents
setting invalid divisor 0 into hardware registers.

Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: 68a0db1d7da2 ("serial: mvebu-uart: add function to change baudrate")
Link: https://lore.kernel.org/r/20210624224909.6350-4-pali@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/serial/mvebu-uart.c