Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=03abeac0a222060ae8f02e8359c285df0971437e
Commit:     03abeac0a222060ae8f02e8359c285df0971437e
Parent:     7c73628f24ea73479232d1b608359aa7d8d2c95d
Author:     Andrew Victor <[EMAIL PROTECTED]>
AuthorDate: Thu May 3 12:26:24 2007 +0100
Committer:  Russell King <[EMAIL PROTECTED]>
CommitDate: Thu May 3 14:12:45 2007 +0100

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Russell King <[EMAIL PROTECTED]>
---
 drivers/serial/atmel_serial.c |    9 +++++++--
 drivers/serial/atmel_serial.h |    3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 935f48f..3320bcd 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) {
diff --git a/drivers/serial/atmel_serial.h b/drivers/serial/atmel_serial.h
index 11b4436..e014177 100644
--- a/drivers/serial/atmel_serial.h
+++ b/drivers/serial/atmel_serial.h
@@ -46,6 +46,9 @@
 #define                        ATMEL_US_USMODE_ISO7816_T1      6
 #define                        ATMEL_US_USMODE_IRDA            8
 #define                ATMEL_US_USCLKS         (3   <<  4)             /* 
Clock Selection */
+#define                        ATMEL_US_USCLKS_MCK             (0 <<  4)
+#define                        ATMEL_US_USCLKS_MCK_DIV8        (1 <<  4)
+#define                        ATMEL_US_USCLKS_SCK             (3 <<  4)
 #define                ATMEL_US_CHRL           (3   <<  6)             /* 
Character Length */
 #define                        ATMEL_US_CHRL_5                 (0 <<  6)
 #define                        ATMEL_US_CHRL_6                 (1 <<  6)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to