[PATCH 2/4] target uart: fix preservation of LCR

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/baseband-devel@lists.osmocom.org/.

Alex Badea vamposdecampos at gmail.com
Wed Nov 17 21:35:16 UTC 2010


Store old_lcr only when switching to LCR == 0xBF.  We don't want
to clobber old_lcr when switching back, otherwise we can't restore
the previous LCR value.

Signed-off-by: Alex Badea <vamposdecampos at gmail.com>
---
 src/target/firmware/calypso/uart.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/target/firmware/calypso/uart.c b/src/target/firmware/calypso/uart.c
index a46fff9..4d7df09 100644
--- a/src/target/firmware/calypso/uart.c
+++ b/src/target/firmware/calypso/uart.c
@@ -127,12 +127,12 @@ static void uart_set_lcr7bit(int uart, int on)
 static uint8_t old_lcr;
 static void uart_set_lcr_bf(int uart, int on)
 {
-	old_lcr = readb(UART_REG(uart, LCR));
-
-	if (on)
+	if (on) {
+		old_lcr = readb(UART_REG(uart, LCR));
 		writeb(0xBF, UART_REG(uart, LCR));
-	else
+	} else {
 		writeb(old_lcr, UART_REG(uart, LCR));
+	}
 }
 
 /* Enable or disable the TCR_TLR latch bit in MCR[6] */
-- 
1.7.0.4





More information about the baseband-devel mailing list