aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2012-09-24 13:12:00 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-26 16:41:05 -0400
commit1685118f55209a518bb5efbbc91706f8b7fa7ffa (patch)
treec8a785e83f7beca993e008b920baff02cc3dd0cf /drivers/tty/serial
parent93b5c032d95e032691e627526b364cd463834347 (diff)
serial: sccnxp: Report actual baudrate back to core
Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/sccnxp.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c
index 05d767cf82a7..a7a6659b96ef 100644
--- a/drivers/tty/serial/sccnxp.c
+++ b/drivers/tty/serial/sccnxp.c
@@ -213,7 +213,7 @@ const struct baud_table baud_std[] = {
213 { 0, 0, 0, 0 } 213 { 0, 0, 0, 0 }
214}; 214};
215 215
216static void sccnxp_set_baud(struct uart_port *port, int baud) 216static int sccnxp_set_baud(struct uart_port *port, int baud)
217{ 217{
218 struct sccnxp_port *s = dev_get_drvdata(port->dev); 218 struct sccnxp_port *s = dev_get_drvdata(port->dev);
219 int div_std, tmp_baud, bestbaud = baud, besterr = -1; 219 int div_std, tmp_baud, bestbaud = baud, besterr = -1;
@@ -244,8 +244,11 @@ static void sccnxp_set_baud(struct uart_port *port, int baud)
244 sccnxp_port_write(port, SCCNXP_ACR_REG, acr | ACR_TIMER_MODE); 244 sccnxp_port_write(port, SCCNXP_ACR_REG, acr | ACR_TIMER_MODE);
245 sccnxp_port_write(port, SCCNXP_CSR_REG, (csr << 4) | csr); 245 sccnxp_port_write(port, SCCNXP_CSR_REG, (csr << 4) | csr);
246 246
247 dev_dbg(port->dev, "Baudrate desired: %i, calculated: %i\n", 247 if (baud != bestbaud)
248 baud, bestbaud); 248 dev_dbg(port->dev, "Baudrate desired: %i, calculated: %i\n",
249 baud, bestbaud);
250
251 return bestbaud;
249} 252}
250 253
251static void sccnxp_enable_irq(struct uart_port *port, int mask) 254static void sccnxp_enable_irq(struct uart_port *port, int mask)
@@ -587,11 +590,14 @@ static void sccnxp_set_termios(struct uart_port *port,
587 baud = uart_get_baud_rate(port, termios, old, 50, 590 baud = uart_get_baud_rate(port, termios, old, 50,
588 (s->flags & SCCNXP_HAVE_MR0) ? 591 (s->flags & SCCNXP_HAVE_MR0) ?
589 230400 : 38400); 592 230400 : 38400);
590 sccnxp_set_baud(port, baud); 593 baud = sccnxp_set_baud(port, baud);
591 594
592 /* Update timeout according to new baud rate */ 595 /* Update timeout according to new baud rate */
593 uart_update_timeout(port, termios->c_cflag, baud); 596 uart_update_timeout(port, termios->c_cflag, baud);
594 597
598 if (tty_termios_baud_rate(termios))
599 tty_termios_encode_baud_rate(termios, baud, baud);
600
595 /* Enable RX & TX */ 601 /* Enable RX & TX */
596 sccnxp_port_write(port, SCCNXP_CR_REG, CR_RX_ENABLE | CR_TX_ENABLE); 602 sccnxp_port_write(port, SCCNXP_CR_REG, CR_RX_ENABLE | CR_TX_ENABLE);
597 603