Merge branches 'depends/rmk/io', 'depends/rmk/l2x0' and 'depends/rmk/gpio' into highb...
[linux-2.6.git] / drivers / tty / serial / atmel_serial.c
index 2a1d52f..caba673 100644 (file)
@@ -1,6 +1,4 @@
 /*
- *  linux/drivers/char/atmel_serial.c
- *
  *  Driver for Atmel AT91 / AT32 Serial ports
  *  Copyright (C) 2003 Rick Bronson
  *
@@ -48,7 +46,7 @@
 
 #ifdef CONFIG_ARM
 #include <mach/cpu.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #endif
 
 #define PDC_BUFFER_SIZE                512
@@ -1240,6 +1238,21 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
        spin_unlock_irqrestore(&port->lock, flags);
 }
 
+static void atmel_set_ldisc(struct uart_port *port, int new)
+{
+       int line = port->line;
+
+       if (line >= port->state->port.tty->driver->num)
+               return;
+
+       if (port->state->port.tty->ldisc->ops->num == N_PPS) {
+               port->flags |= UPF_HARDPPS_CD;
+               atmel_enable_ms(port);
+       } else {
+               port->flags &= ~UPF_HARDPPS_CD;
+       }
+}
+
 /*
  * Return string describing the specified port
  */
@@ -1380,6 +1393,7 @@ static struct uart_ops atmel_pops = {
        .shutdown       = atmel_shutdown,
        .flush_buffer   = atmel_flush_buffer,
        .set_termios    = atmel_set_termios,
+       .set_ldisc      = atmel_set_ldisc,
        .type           = atmel_type,
        .release_port   = atmel_release_port,
        .request_port   = atmel_request_port,
@@ -1406,7 +1420,7 @@ static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port,
        port->flags             = UPF_BOOT_AUTOCONF;
        port->ops               = &atmel_pops;
        port->fifosize          = 1;
-       port->line              = pdev->id;
+       port->line              = data->num;
        port->dev               = &pdev->dev;
        port->mapbase   = pdev->resource[0].start;
        port->irq       = pdev->resource[1].start;
@@ -1595,9 +1609,11 @@ static struct console atmel_console = {
 static int __init atmel_console_init(void)
 {
        if (atmel_default_console_device) {
-               add_preferred_console(ATMEL_DEVICENAME,
-                                     atmel_default_console_device->id, NULL);
-               atmel_init_port(&atmel_ports[atmel_default_console_device->id],
+               struct atmel_uart_data *pdata =
+                       atmel_default_console_device->dev.platform_data;
+
+               add_preferred_console(ATMEL_DEVICENAME, pdata->num, NULL);
+               atmel_init_port(&atmel_ports[pdata->num],
                                atmel_default_console_device);
                register_console(&atmel_console);
        }
@@ -1695,12 +1711,13 @@ static int atmel_serial_resume(struct platform_device *pdev)
 static int __devinit atmel_serial_probe(struct platform_device *pdev)
 {
        struct atmel_uart_port *port;
+       struct atmel_uart_data *pdata = pdev->dev.platform_data;
        void *data;
        int ret;
 
        BUILD_BUG_ON(ATMEL_SERIAL_RINGSIZE & (ATMEL_SERIAL_RINGSIZE - 1));
 
-       port = &atmel_ports[pdev->id];
+       port = &atmel_ports[pdata->num];
        port->backup_imr = 0;
 
        atmel_init_port(port, pdev);