diff options
author | Daniel Hellstrom <daniel@gaisler.com> | 2013-06-03 14:12:08 +0200 |
---|---|---|
committer | Daniel Hellstrom <daniel@gaisler.com> | 2013-06-03 17:22:56 +0200 |
commit | febe4b464dac53080fdf4d42f7541237f180e70f (patch) | |
tree | 802f01d0c4c8dbd30bfe22fd36a74cdfb26b0054 | |
parent | 8bbca82bf5f895ae097e1cb0c32443ec094bd612 (diff) |
APBUART: debug bit was cleared incorrectly
-rw-r--r-- | c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c b/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c index 4e1304b227..fae8f3d3cb 100644 --- a/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c +++ b/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c @@ -200,29 +200,29 @@ int apbuart_init1(struct drvmgr_dev *dev) /* Clear HW regs, leave baudrate register as it is */ priv->regs->status = 0; - /* leave debug bit, and Transmitter/receiver if this is the debug UART. - * With old APBUARTs debug is enabled by setting LB and FL, since LB is - * not reset we can not trust is, however since FL is reset we guess - * that we are debugging old UART if both FL and LB is already set. + + /* leave Transmitter/receiver if this is the RTEMS debug UART (assume + * it has been setup by boot loader). */ + db = 0; #ifdef LEON3 if (priv->regs == dbg_uart) { - db = priv->regs->ctrl & (LEON_REG_UART_CTRL_DB | - LEON_REG_UART_CTRL_RE | + db = priv->regs->ctrl & (LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE | - LEON_REG_UART_CTRL_FL | - LEON_REG_UART_CTRL_LB | LEON_REG_UART_CTRL_PE | LEON_REG_UART_CTRL_PS); - } else + } #endif - { - if (priv->regs->ctrl & (LEON_REG_UART_CTRL_FL | - LEON_REG_UART_CTRL_LB)) - db = priv->regs->ctrl & (LEON_REG_UART_CTRL_FL | - LEON_REG_UART_CTRL_LB); - else - db = priv->regs->ctrl & LEON_REG_UART_CTRL_DB; + /* Let UART debug tunnelling be untouched if Flow-control is set. + * + * With old APBUARTs debug is enabled by setting LB and FL, since LB or + * DB are not reset we can not trust them. However since FL is reset we + * guess that we are debugging if FL is already set, the debugger set + * either LB or DB depending on UART capabilities. + */ + if (priv->regs->ctrl & LEON_REG_UART_CTRL_FL) { + db |= priv->regs->ctrl & (LEON_REG_UART_CTRL_DB | + LEON_REG_UART_CTRL_LB | LEON_REG_UART_CTRL_FL); } priv->regs->ctrl = db; |