#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/module.h>
-#include <linux/serial.h>
+#include <linux/serial_core.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>
-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;
-}
+#include "8250.h"
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,
* what we have here is a missing parent device, so tell
* the user what they're missing.
*/
- if (dev->parent->id.hw_type != HPHW_IOA) {
+ if (parisc_parent(dev)->id.hw_type != HPHW_IOA) {
printk(KERN_INFO "Serial: device 0x%lx not configured.\n"
- "Enable support for Wax, Lasi, Asp or Dino.\n", dev->hpa);
+ "Enable support for Wax, Lasi, Asp or Dino.\n",
+ dev->hpa.start);
}
return -ENODEV;
}
- serial = kmalloc(sizeof(*serial), GFP_KERNEL);
- if (!serial)
- return -ENOMEM;
-
- address = dev->hpa;
+ address = dev->hpa.start;
if (dev->id.sversion != 0x8d) {
address += 0x800;
}
- setup_parisc_serial(serial, address, dev->irq, serial_line_nr++);
- err = register_serial(serial);
+ memset(&port, 0, sizeof(port));
+ port.iotype = UPIO_MEM;
+ /* 7.272727MHz on Lasi. Assumed the same for Dino, Wax and Timi. */
+ port.uartclk = 7272727;
+ port.mapbase = address;
+ port.membase = ioremap_nocache(address, 16);
+ port.irq = dev->irq;
+ port.flags = UPF_BOOT_AUTOCONF;
+ port.dev = &dev->dev;
+
+ err = serial8250_register_port(&port);
if (err < 0) {
- printk(KERN_WARNING "register_serial returned error %d\n", err);
- kfree(serial);
- return -ENODEV;
+ printk(KERN_WARNING "serial8250_register_port returned error %d\n", err);
+ iounmap(port.membase);
+ return err;
}
-
+
return 0;
}
MODULE_DEVICE_TABLE(parisc, serial_tbl);
static struct parisc_driver lasi_driver = {
- .name = "Lasi RS232",
+ .name = "serial_1",
.id_table = lasi_tbl,
.probe = serial_init_chip,
};
static struct parisc_driver serial_driver = {
- .name = "Serial RS232",
+ .name = "serial",
.id_table = serial_tbl,
.probe = serial_init_chip,
};