serial: clps711x: Fix TERMIOS-flags handling

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Alexander Shiyan 2012-10-14 11:05:33 +04:00 коммит произвёл Greg Kroah-Hartman
Родитель f52ede2ac1
Коммит 7ae75e94ec
1 изменённых файлов: 12 добавлений и 24 удалений

Просмотреть файл

@ -273,10 +273,9 @@ clps711xuart_set_termios(struct uart_port *port, struct ktermios *termios,
unsigned int ubrlcr, baud, quot; unsigned int ubrlcr, baud, quot;
unsigned long flags; unsigned long flags;
/* /* Mask termios capabilities we don't support */
* We don't implement CREAD. termios->c_cflag &= ~CMSPAR;
*/ termios->c_iflag &= ~(BRKINT | IGNBRK);
termios->c_cflag |= CREAD;
/* Ask the core to calculate the divisor for us */ /* Ask the core to calculate the divisor for us */
baud = uart_get_baud_rate(port, termios, old, port->uartclk / 4096, baud = uart_get_baud_rate(port, termios, old, port->uartclk / 4096,
@ -297,8 +296,10 @@ clps711xuart_set_termios(struct uart_port *port, struct ktermios *termios,
ubrlcr = UBRLCR_WRDLEN8; ubrlcr = UBRLCR_WRDLEN8;
break; break;
} }
if (termios->c_cflag & CSTOPB) if (termios->c_cflag & CSTOPB)
ubrlcr |= UBRLCR_XSTOP; ubrlcr |= UBRLCR_XSTOP;
if (termios->c_cflag & PARENB) { if (termios->c_cflag & PARENB) {
ubrlcr |= UBRLCR_PRTEN; ubrlcr |= UBRLCR_PRTEN;
if (!(termios->c_cflag & PARODD)) if (!(termios->c_cflag & PARODD))
@ -310,33 +311,20 @@ clps711xuart_set_termios(struct uart_port *port, struct ktermios *termios,
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
/* /* Set read status mask */
* Update the per-port timeout.
*/
uart_update_timeout(port, termios->c_cflag, baud);
port->read_status_mask = UARTDR_OVERR; port->read_status_mask = UARTDR_OVERR;
if (termios->c_iflag & INPCK) if (termios->c_iflag & INPCK)
port->read_status_mask |= UARTDR_PARERR | UARTDR_FRMERR; port->read_status_mask |= UARTDR_PARERR | UARTDR_FRMERR;
/* /* Set status ignore mask */
* Characters to ignore
*/
port->ignore_status_mask = 0; port->ignore_status_mask = 0;
if (termios->c_iflag & IGNPAR) if (!(termios->c_cflag & CREAD))
port->ignore_status_mask |= UARTDR_FRMERR | UARTDR_PARERR; port->ignore_status_mask |= UARTDR_OVERR | UARTDR_PARERR |
if (termios->c_iflag & IGNBRK) { UARTDR_FRMERR;
/*
* If we're ignoring parity and break indicators,
* ignore overruns to (for real raw support).
*/
if (termios->c_iflag & IGNPAR)
port->ignore_status_mask |= UARTDR_OVERR;
}
quot -= 1; uart_update_timeout(port, termios->c_cflag, baud);
clps_writel(ubrlcr | quot, UBRLCR(port)); clps_writel(ubrlcr | (quot - 1), UBRLCR(port));
spin_unlock_irqrestore(&port->lock, flags); spin_unlock_irqrestore(&port->lock, flags);
} }