[PATCH 2/4] target uart: fix preservation of LCR
Alex Badea
vamposdecampos at gmail.com
Wed Nov 17 22:35:16 CET 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