Commit d10ee1d1 authored by Vabhav Sharma's avatar Vabhav Sharma Committed by Greg Kroah-Hartman
Browse files

tty: serial: fsl_lpuart: minimum baud rate support



The formula for the baud rate is
baud rate = "baud clock / ((OSR+1) × SBR)

Algorithm used in function lpuart32_serial_setbrg() only changes
the SBR. Even with maxmum value put in, OSR stays at 0x7 and the
lowest baud rate would be ~ 2600 bps

Update the algorithm to allow driver operation at 1200,2400 or 600 bps

Signed-off-by: default avatarVabhav Sharma <vabhav.sharma@nxp.com>
Link: https://lore.kernel.org/r/1593170434-13524-1-git-send-email-vabhav.sharma@oss.nxp.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3550f897
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1925,6 +1925,9 @@ static void __lpuart32_serial_setbrg(struct uart_port *port,
			tmp_sbr++;
		}

		if (tmp_sbr > UARTBAUD_SBR_MASK)
			continue;

		if (tmp_diff <= baud_diff) {
			baud_diff = tmp_diff;
			osr = tmp_osr;