MN10300: fix debug polling in ttySM driver

The debug polling interface for the SoC serial ports did not work in the case
where the serial ports were not also used as a console. In that case, the
uart driver startup function will not be called so tx and rx would not be
enabled in the hardware control register. Also, vdma interrupts would not be
enabled which the poll_get_char function relied on. This patch makes sure that
the rx and tx enables are set as a consequence of the uart set_termios call
which is the only initialization done for the debug polling interface. Also,
the poll_get_char now handles the case where vdma interrupts are not enabled.

Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
Mark Salter 2012-12-12 15:36:39 +00:00 committed by David Howells
parent 97a70b1439
commit 0369c360e5
1 changed files with 23 additions and 12 deletions

View File

@ -1374,7 +1374,8 @@ timer_okay:
if ((new->c_cflag & CREAD) == 0) if ((new->c_cflag & CREAD) == 0)
port->uart.ignore_status_mask |= (1 << TTY_NORMAL); port->uart.ignore_status_mask |= (1 << TTY_NORMAL);
scxctr |= *port->_control & (SC01CTR_TXE | SC01CTR_RXE | SC01CTR_BKE); scxctr |= SC01CTR_TXE | SC01CTR_RXE;
scxctr |= *port->_control & SC01CTR_BKE;
*port->_control = scxctr; *port->_control = scxctr;
spin_unlock_irqrestore(&port->uart.lock, flags); spin_unlock_irqrestore(&port->uart.lock, flags);
@ -1720,19 +1721,29 @@ static int mn10300_serial_poll_get_char(struct uart_port *_port)
_enter("%s", port->name); _enter("%s", port->name);
do { if (mn10300_serial_int_tbl[port->rx_irq].port != NULL) {
/* pull chars out of the hat */ do {
ix = ACCESS_ONCE(port->rx_outp); /* pull chars out of the hat */
if (CIRC_CNT(port->rx_inp, ix, MNSC_BUFFER_SIZE) == 0) ix = ACCESS_ONCE(port->rx_outp);
return NO_POLL_CHAR; if (CIRC_CNT(port->rx_inp, ix, MNSC_BUFFER_SIZE) == 0)
return NO_POLL_CHAR;
smp_read_barrier_depends(); smp_read_barrier_depends();
ch = port->rx_buffer[ix++]; ch = port->rx_buffer[ix++];
st = port->rx_buffer[ix++]; st = port->rx_buffer[ix++];
smp_mb(); smp_mb();
port->rx_outp = ix & (MNSC_BUFFER_SIZE - 1); port->rx_outp = ix & (MNSC_BUFFER_SIZE - 1);
} while (st & (SC01STR_FEF | SC01STR_PEF | SC01STR_OEF)); } while (st & (SC01STR_FEF | SC01STR_PEF | SC01STR_OEF));
} else {
do {
st = *port->_status;
if (st & (SC01STR_FEF | SC01STR_PEF | SC01STR_OEF))
continue;
} while (!(st & SC01STR_RBF));
ch = *port->_rxb;
}
return ch; return ch;
} }