From 65367623beb1bb8b3452fa1512be7e0e108ca8cb Mon Sep 17 00:00:00 2001 From: Daniel Hellstrom Date: Tue, 19 Jun 2012 14:49:40 +0200 Subject: APBUART: fix GRMON -u support for older UARTs --- c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 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 3a1c070b45..4e1304b227 100644 --- a/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c +++ b/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c @@ -200,18 +200,30 @@ 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 */ + /* 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. + */ #ifdef LEON3 if (priv->regs == dbg_uart) { db = priv->regs->ctrl & (LEON_REG_UART_CTRL_DB | 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 - db = priv->regs->ctrl & LEON_REG_UART_CTRL_DB; + { + 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; + } priv->regs->ctrl = db; -- cgit v1.2.3