diff options
author | Alan Cox <alan@linux.intel.com> | 2009-06-11 14:27:13 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-11 08:51:06 -0700 |
commit | 7d55deaf50182c47c1e805dc8cc85f2769f0673e (patch) | |
tree | 6f8c262d6606be33b7023ff8f06f2a010d721366 /drivers/serial/timbuart.c | |
parent | 34aec591847c696339189b070cce2a11f901cfea (diff) |
timbuart: Fix the termios logic
The driver only handles speeds but it fails to return the current values
for the hardware features it does not support.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/serial/timbuart.c')
-rw-r--r-- | drivers/serial/timbuart.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/serial/timbuart.c b/drivers/serial/timbuart.c index 30ba3c4cc18..ac9e5d5f742 100644 --- a/drivers/serial/timbuart.c +++ b/drivers/serial/timbuart.c @@ -278,7 +278,7 @@ static int get_bindex(int baud) int i; for (i = 0; i < ARRAY_SIZE(baudrates); i++) - if (baud == baudrates[i]) + if (baud <= baudrates[i]) return i; return -1; @@ -296,14 +296,20 @@ static void timbuart_set_termios(struct uart_port *port, bindex = get_bindex(baud); dev_dbg(port->dev, "%s - bindex %d\n", __func__, bindex); - if (bindex < 0) { - printk(KERN_ALERT "timbuart: Unsupported baud rate\n"); - } else { - spin_lock_irqsave(&port->lock, flags); - iowrite8((u8)bindex, port->membase + TIMBUART_BAUDRATE); - uart_update_timeout(port, termios->c_cflag, baud); - spin_unlock_irqrestore(&port->lock, flags); - } + if (bindex < 0) + bindex = 0; + baud = baudrates[bindex]; + + /* The serial layer calls into this once with old = NULL when setting + up initially */ + if (old) + tty_termios_copy_hw(termios, old); + tty_termios_encode_baud_rate(termios, baud, baud); + + spin_lock_irqsave(&port->lock, flags); + iowrite8((u8)bindex, port->membase + TIMBUART_BAUDRATE); + uart_update_timeout(port, termios->c_cflag, baud); + spin_unlock_irqrestore(&port->lock, flags); } static const char *timbuart_type(struct uart_port *port) |