This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / serial / 8250_gsc.c
index a95bde8..97482be 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
-#include <linux/serial_core.h>
+#include <linux/serial.h>
 #include <linux/signal.h>
 #include <linux/slab.h>
 #include <linux/types.h>
 #include <asm/hardware.h>
 #include <asm/parisc-device.h>
 #include <asm/io.h>
-#include <asm/serial.h> /* for LASI_BASE_BAUD */
+#include <asm/serial.h>
 
-#include "8250.h"
+static void setup_parisc_serial(struct serial_struct *serial,
+               unsigned long address, int irq, int line)
+{
+       memset(serial, 0, sizeof(struct serial_struct));
+
+       /* autoconfig() sets state->type.  This sets info->type */
+       serial->type = PORT_16550A;
+
+       serial->line = line;
+       serial->iomap_base = address;
+       serial->iomem_base = ioremap(address, 0x8);
+
+       serial->irq = irq;
+       serial->io_type = SERIAL_IO_MEM;        /* define access method */
+       serial->flags = 0;
+       serial->xmit_fifo_size = 16;
+       serial->custom_divisor = 0;
+       serial->baud_base = LASI_BASE_BAUD;
+}
 
 static int __init 
 serial_init_chip(struct parisc_device *dev)
 {
        static int serial_line_nr;
-       struct uart_port port;
        unsigned long address;
        int err;
 
+       struct serial_struct *serial;
+
        if (!dev->irq) {
                /* We find some unattached serial ports by walking native
                 * busses.  These should be silently ignored.  Otherwise,
@@ -47,23 +66,21 @@ serial_init_chip(struct parisc_device *dev)
                return -ENODEV;
        }
 
+       serial = kmalloc(sizeof(*serial), GFP_KERNEL);
+       if (!serial)
+               return -ENOMEM;
+
        address = dev->hpa;
        if (dev->id.sversion != 0x8d) {
                address += 0x800;
        }
 
-       memset(&port, 0, sizeof(struct uart_port));
-       port.mapbase = address;
-       port.irq = dev->irq;
-       port.iotype = UPIO_MEM;
-       port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
-       port.uartclk = LASI_BASE_BAUD * 16;
-       port.dev = &dev->dev;
-
-       err = serial8250_register_port(&port);
+       setup_parisc_serial(serial, address, dev->irq, serial_line_nr++);
+       err = register_serial(serial);
        if (err < 0) {
-               printk(KERN_WARNING "serial8250_register_port returned error %d\n", err);
-               return err;
+               printk(KERN_WARNING "register_serial returned error %d\n", err);
+               kfree(serial);
+               return -ENODEV;
        }
 
        return 0;