diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2012-10-14 03:05:33 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-24 14:39:48 -0400 |
commit | 7ae75e94ec1128598f91dc56ca2919c45701ec32 (patch) | |
tree | 8bb139e4920430fe91c5305ef894fc2511e7c413 /drivers/tty/serial/clps711x.c | |
parent | f52ede2ac1159f844994519ae0386def308a296b (diff) |
serial: clps711x: Fix TERMIOS-flags handling
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/clps711x.c')
-rw-r--r-- | drivers/tty/serial/clps711x.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c index e71508767e1e..90efe0595718 100644 --- a/drivers/tty/serial/clps711x.c +++ b/drivers/tty/serial/clps711x.c | |||
@@ -273,10 +273,9 @@ clps711xuart_set_termios(struct uart_port *port, struct ktermios *termios, | |||
273 | unsigned int ubrlcr, baud, quot; | 273 | unsigned int ubrlcr, baud, quot; |
274 | unsigned long flags; | 274 | unsigned long flags; |
275 | 275 | ||
276 | /* | 276 | /* Mask termios capabilities we don't support */ |
277 | * We don't implement CREAD. | 277 | termios->c_cflag &= ~CMSPAR; |
278 | */ | 278 | termios->c_iflag &= ~(BRKINT | IGNBRK); |
279 | termios->c_cflag |= CREAD; | ||
280 | 279 | ||
281 | /* Ask the core to calculate the divisor for us */ | 280 | /* Ask the core to calculate the divisor for us */ |
282 | baud = uart_get_baud_rate(port, termios, old, port->uartclk / 4096, | 281 | 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, | |||
297 | ubrlcr = UBRLCR_WRDLEN8; | 296 | ubrlcr = UBRLCR_WRDLEN8; |
298 | break; | 297 | break; |
299 | } | 298 | } |
299 | |||
300 | if (termios->c_cflag & CSTOPB) | 300 | if (termios->c_cflag & CSTOPB) |
301 | ubrlcr |= UBRLCR_XSTOP; | 301 | ubrlcr |= UBRLCR_XSTOP; |
302 | |||
302 | if (termios->c_cflag & PARENB) { | 303 | if (termios->c_cflag & PARENB) { |
303 | ubrlcr |= UBRLCR_PRTEN; | 304 | ubrlcr |= UBRLCR_PRTEN; |
304 | if (!(termios->c_cflag & PARODD)) | 305 | if (!(termios->c_cflag & PARODD)) |
@@ -310,33 +311,20 @@ clps711xuart_set_termios(struct uart_port *port, struct ktermios *termios, | |||
310 | 311 | ||
311 | spin_lock_irqsave(&port->lock, flags); | 312 | spin_lock_irqsave(&port->lock, flags); |
312 | 313 | ||
313 | /* | 314 | /* Set read status mask */ |
314 | * Update the per-port timeout. | ||
315 | */ | ||
316 | uart_update_timeout(port, termios->c_cflag, baud); | ||
317 | |||
318 | port->read_status_mask = UARTDR_OVERR; | 315 | port->read_status_mask = UARTDR_OVERR; |
319 | if (termios->c_iflag & INPCK) | 316 | if (termios->c_iflag & INPCK) |
320 | port->read_status_mask |= UARTDR_PARERR | UARTDR_FRMERR; | 317 | port->read_status_mask |= UARTDR_PARERR | UARTDR_FRMERR; |
321 | 318 | ||
322 | /* | 319 | /* Set status ignore mask */ |
323 | * Characters to ignore | ||
324 | */ | ||
325 | port->ignore_status_mask = 0; | 320 | port->ignore_status_mask = 0; |
326 | if (termios->c_iflag & IGNPAR) | 321 | if (!(termios->c_cflag & CREAD)) |
327 | port->ignore_status_mask |= UARTDR_FRMERR | UARTDR_PARERR; | 322 | port->ignore_status_mask |= UARTDR_OVERR | UARTDR_PARERR | |
328 | if (termios->c_iflag & IGNBRK) { | 323 | UARTDR_FRMERR; |
329 | /* | ||
330 | * If we're ignoring parity and break indicators, | ||
331 | * ignore overruns to (for real raw support). | ||
332 | */ | ||
333 | if (termios->c_iflag & IGNPAR) | ||
334 | port->ignore_status_mask |= UARTDR_OVERR; | ||
335 | } | ||
336 | 324 | ||
337 | quot -= 1; | 325 | uart_update_timeout(port, termios->c_cflag, baud); |
338 | 326 | ||
339 | clps_writel(ubrlcr | quot, UBRLCR(port)); | 327 | clps_writel(ubrlcr | (quot - 1), UBRLCR(port)); |
340 | 328 | ||
341 | spin_unlock_irqrestore(&port->lock, flags); | 329 | spin_unlock_irqrestore(&port->lock, flags); |
342 | } | 330 | } |