Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0dd25df1 authored by Sonic Zhang's avatar Sonic Zhang Committed by Greg Kroah-Hartman
Browse files

serial: bfin_sport_uart: speed up sport RX sample rate to be 3% faster



The actual uart baud rate of devices vary between +/-2% of what is
asked.  The SPORT RX sample rate should be faster than double of the
worst case.  Otherwise, wrong data may be received.  So set SPORT RX
clock to be 3% faster in general.

Reported-by: default avatarOlivier STOCK <ostockemer@ereca.fr>
Signed-off-by: default avatarSonic Zhang <sonic.zhang@analog.com>
Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent af7f3743
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -131,7 +131,12 @@ static int sport_uart_setup(struct sport_uart_port *up, int size, int baud_rate)
	pr_debug("%s RCR1:%x, RCR2:%x\n", __func__, SPORT_GET_RCR1(up), SPORT_GET_RCR2(up));

	tclkdiv = sclk / (2 * baud_rate) - 1;
	rclkdiv = sclk / (2 * baud_rate * 2) - 1;
	/* The actual uart baud rate of devices vary between +/-2%. The sport
	 * RX sample rate should be faster than the double of the worst case,
	 * otherwise, wrong data are received. So, set sport RX clock to be
	 * 3% faster.
	 */
	rclkdiv = sclk / (2 * baud_rate * 2 * 97 / 100) - 1;
	SPORT_PUT_TCLKDIV(up, tclkdiv);
	SPORT_PUT_RCLKDIV(up, rclkdiv);
	SSYNC();