diff options
author | Alex Badea <vamposdecampos@gmail.com> | 2010-11-17 23:35:16 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-11-17 23:39:46 +0100 |
commit | 4ad8b730a0f09fae020e2cf13fdbf301c1e2aec9 (patch) | |
tree | dfa889ef840084b128112bfad5bc153d8fb540e8 /src/target/firmware/calypso/uart.c | |
parent | a69d67ec732ca35b2c71c261af04456ed64b9c9b (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/uart.c')
-rw-r--r-- | 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 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] */ |