]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/serial/atmel_serial.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6
[mv-sheeva.git] / drivers / serial / atmel_serial.c
index 34212df3980013c7013dcd33dcd78ddfefb8c336..391a1f4167a4f38819997c5a80cb12607e788fa6 100644 (file)
 #include <asm/arch/at91rm9200_pdc.h>
 #include <asm/mach/serial_at91.h>
 #include <asm/arch/board.h>
+#ifdef CONFIG_ARM
 #include <asm/arch/system.h>
 #include <asm/arch/gpio.h>
+#endif
 
 #include "atmel_serial.h"
 
@@ -135,6 +137,7 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl)
        unsigned int control = 0;
        unsigned int mode;
 
+#ifdef CONFIG_ARM
        if (arch_identify() == ARCH_ID_AT91RM9200) {
                /*
                 * AT91RM9200 Errata #39: RTS0 is not internally connected to PA21.
@@ -147,6 +150,7 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl)
                                at91_set_gpio_value(AT91_PIN_PA21, 1);
                }
        }
+#endif
 
        if (mctrl & TIOCM_RTS)
                control |= ATMEL_US_RTSEN;
@@ -245,7 +249,7 @@ static void atmel_break_ctl(struct uart_port *port, int break_state)
 /*
  * Characters received (called from interrupt handler)
  */
-static void atmel_rx_chars(struct uart_port *port, struct pt_regs *regs)
+static void atmel_rx_chars(struct uart_port *port)
 {
        struct tty_struct *tty = port->info->tty;
        unsigned int status, ch, flg;
@@ -287,7 +291,7 @@ static void atmel_rx_chars(struct uart_port *port, struct pt_regs *regs)
                                flg = TTY_FRAME;
                }
 
-               if (uart_handle_sysrq_char(port, ch, regs))
+               if (uart_handle_sysrq_char(port, ch))
                        goto ignore_char;
 
                uart_insert_char(port, status, ATMEL_US_OVRE, ch, flg);
@@ -335,7 +339,7 @@ static void atmel_tx_chars(struct uart_port *port)
 /*
  * Interrupt handler
  */
-static irqreturn_t atmel_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t atmel_interrupt(int irq, void *dev_id)
 {
        struct uart_port *port = dev_id;
        struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
@@ -346,7 +350,7 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        while (pending) {
                /* Interrupt receive */
                if (pending & ATMEL_US_RXRDY)
-                       atmel_rx_chars(port, regs);
+                       atmel_rx_chars(port);
 
                // TODO: All reads to CSR will clear these interrupts!
                if (pending & ATMEL_US_RIIC) port->icount.rng++;
@@ -789,8 +793,14 @@ static void __init atmel_console_get_options(struct uart_port *port, int *baud,
        else if (mr == ATMEL_US_PAR_ODD)
                *parity = 'o';
 
+       /*
+        * The serial core only rounds down when matching this to a
+        * supported baud rate. Make sure we don't end up slightly
+        * lower than one of those, as it would make us fall through
+        * to a much lower baud rate than we really want.
+        */
        quot = UART_GET_BRGR(port);
-       *baud = port->uartclk / (16 * (quot));
+       *baud = port->uartclk / (16 * (quot - 1));
 }
 
 static int __init atmel_console_setup(struct console *co, char *options)