summaryrefslogtreecommitdiffstats
path: root/drivers/serial/atmel_serial.c
diff options
context:
space:
mode:
authorAndrew Victor <andrew@sanpeople.com>2007-05-03 13:26:24 +0200
committerRussell King <rmk+kernel@arm.linux.org.uk>2007-05-03 15:12:45 +0200
commit03abeac0a222060ae8f02e8359c285df0971437e (patch)
tree96fd9e6f11740a098ffa0958d218ff1f41e4b216 /drivers/serial/atmel_serial.c
parent[ARM] 4354/1: AT91: Support ADS7846 touchsceen on SAM9263-EK board (diff)
downloadlinux-03abeac0a222060ae8f02e8359c285df0971437e.tar.xz
linux-03abeac0a222060ae8f02e8359c285df0971437e.zip
[ARM] 4357/1: AT91: Support slower serial baud-rates
Allow slower serial baud-rates by switching the UART clock from MCK to MCK/8. Based on patches by Mike Wolfram and Russell King. Signed-off-by: Andrew Victor <andrew@sanpeople.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial/atmel_serial.c')
-rw-r--r--drivers/serial/atmel_serial.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 935f48fa501d..3320bcd92c0a 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -484,11 +484,16 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios * termios,
unsigned long flags;
unsigned int mode, imr, quot, baud;
+ /* Get current mode register */
+ mode = UART_GET_MR(port) & ~(ATMEL_US_USCLKS | ATMEL_US_CHRL | ATMEL_US_NBSTOP | ATMEL_US_PAR);
+
baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
quot = uart_get_divisor(port, baud);
- /* Get current mode register */
- mode = UART_GET_MR(port) & ~(ATMEL_US_CHRL | ATMEL_US_NBSTOP | ATMEL_US_PAR);
+ if (quot > 65535) { /* BRGR is 16-bit, so switch to slower clock */
+ quot /= 8;
+ mode |= ATMEL_US_USCLKS_MCK_DIV8;
+ }
/* byte size */
switch (termios->c_cflag & CSIZE) {