APBUART: debug bit was cleared incorrectly

This commit is contained in:
Daniel Hellstrom
2013-06-03 14:12:08 +02:00
parent ab907e8eab
commit d936c1a781

View File

@@ -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;