aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-06-11 09:27:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-11 11:51:06 -0400
commit7d55deaf50182c47c1e805dc8cc85f2769f0673e (patch)
tree6f8c262d6606be33b7023ff8f06f2a010d721366 /drivers/serial
parent34aec591847c696339189b070cce2a11f901cfea (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')
-rw-r--r--drivers/serial/timbuart.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/serial/timbuart.c b/drivers/serial/timbuart.c
index 30ba3c4cc180..ac9e5d5f742e 100644
--- a/drivers/serial/timbuart.c
+++ b/drivers/serial/timbuart.c
@@ -278,7 +278,7 @@ static int get_bindex(int baud)
278 int i; 278 int i;
279 279
280 for (i = 0; i < ARRAY_SIZE(baudrates); i++) 280 for (i = 0; i < ARRAY_SIZE(baudrates); i++)
281 if (baud == baudrates[i]) 281 if (baud <= baudrates[i])
282 return i; 282 return i;
283 283
284 return -1; 284 return -1;
@@ -296,14 +296,20 @@ static void timbuart_set_termios(struct uart_port *port,
296 bindex = get_bindex(baud); 296 bindex = get_bindex(baud);
297 dev_dbg(port->dev, "%s - bindex %d\n", __func__, bindex); 297 dev_dbg(port->dev, "%s - bindex %d\n", __func__, bindex);
298 298
299 if (bindex < 0) { 299 if (bindex < 0)
300 printk(KERN_ALERT "timbuart: Unsupported baud rate\n"); 300 bindex = 0;
301 } else { 301 baud = baudrates[bindex];
302 spin_lock_irqsave(&port->lock, flags); 302
303 iowrite8((u8)bindex, port->membase + TIMBUART_BAUDRATE); 303 /* The serial layer calls into this once with old = NULL when setting
304 uart_update_timeout(port, termios->c_cflag, baud); 304 up initially */
305 spin_unlock_irqrestore(&port->lock, flags); 305 if (old)
306 } 306 tty_termios_copy_hw(termios, old);
307 tty_termios_encode_baud_rate(termios, baud, baud);
308
309 spin_lock_irqsave(&port->lock, flags);
310 iowrite8((u8)bindex, port->membase + TIMBUART_BAUDRATE);
311 uart_update_timeout(port, termios->c_cflag, baud);
312 spin_unlock_irqrestore(&port->lock, flags);
307} 313}
308 314
309static const char *timbuart_type(struct uart_port *port) 315static const char *timbuart_type(struct uart_port *port)