summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/calypso
diff options
context:
space:
mode:
authorAlex Badea <vamposdecampos@gmail.com>2010-11-17 23:35:16 +0200
committerHarald Welte <laforge@gnumonks.org>2010-11-17 23:39:46 +0100
commit4ad8b730a0f09fae020e2cf13fdbf301c1e2aec9 (patch)
treedfa889ef840084b128112bfad5bc153d8fb540e8 /src/target/firmware/calypso
parenta69d67ec732ca35b2c71c261af04456ed64b9c9b (diff)
target uart: fix preservation of LCR
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@gmail.com>
Diffstat (limited to 'src/target/firmware/calypso')
-rw-r--r--src/target/firmware/calypso/uart.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/target/firmware/calypso/uart.c b/src/target/firmware/calypso/uart.c
index a46fff91..4d7df092 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] */