From d936c1a7818b7e9d7e3fce6c566d18c75a328534 Mon Sep 17 00:00:00 2001 From: Daniel Hellstrom Date: Mon, 3 Jun 2013 14:12:08 +0200 Subject: APBUART: debug bit was cleared incorrectly --- c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c | 32 +++++++++++------------ 1 file 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 64d1b15045..e0fa64e178 100644 --- a/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c +++ b/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c @@ -197,29 +197,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; -- cgit v1.2.3