2 * Serial Device Initialisation for LASI/ASP/WAX/DINO
4 * (c) Copyright 2000 The Puffin Group Inc.
5 * (c) Copyright 2000-2001 Helge Deller <deller@gmx.de>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
14 #include <linux/config.h>
15 #include <linux/errno.h>
16 #include <linux/init.h>
17 #include <linux/signal.h>
18 #include <linux/types.h>
19 #include <linux/sched.h>
20 #include <linux/interrupt.h>
21 #include <linux/kernel_stat.h>
22 #include <linux/ioport.h>
23 #include <linux/timex.h>
24 #include <linux/module.h>
25 #include <linux/serial.h>
26 #include <linux/slab.h>
28 #include <asm/serial.h>
30 #include <asm/hardware.h>
33 #include "busdevice.h"
35 static void setup_parisc_serial(struct serial_struct *serial,
36 unsigned long address, int irq, int line)
38 memset(serial, 0, sizeof(struct serial_struct));
40 /* autoconfig() sets state->type. This sets info->type */
41 serial->type = PORT_16550A;
44 serial->iomem_base = ioremap(address, 0x8);
47 serial->io_type = SERIAL_IO_MEM; /* define access method */
49 serial->xmit_fifo_size = 16;
50 serial->custom_divisor = 0;
51 serial->baud_base = LASI_BASE_BAUD;
55 serial_init_chip(struct parisc_device *dev)
57 static int serial_line_nr;
58 unsigned long address;
60 struct serial_struct *serial;
63 if (dev->parent->id.hw_type != HPHW_IOA) {
64 printk(KERN_INFO "Serial: device 0x%lx not configured.\n"
65 "Enable support for Wax, Lasi, Asp or Dino.\n", dev->hpa);
70 serial = kmalloc(sizeof(*serial), GFP_KERNEL);
75 if (dev->id.sversion != 0x8d) {
79 setup_parisc_serial(serial, address, dev->irq, serial_line_nr++);
81 if (register_serial(serial) < 0) {
82 printk(KERN_WARNING "register_serial returned error\n");
90 static struct parisc_device_id serial_tbl[] = {
91 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00075 },
92 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008c },
93 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008d },
97 /* Hack. Dino's serial port will get listed first on some machines.
98 * So we register this driver first which knows about Lasi's serial port.
99 * This needs to get fixed properly somehow.
101 static struct parisc_device_id serial1_tbl[] = {
102 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03B, 0x0008C }, /* C1xx/C1xxL */
103 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03C, 0x0008C }, /* B132L */
104 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03D, 0x0008C }, /* B160L */
105 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03E, 0x0008C }, /* B132L+ */
106 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03F, 0x0008C }, /* B180L+ */
107 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x046, 0x0008C }, /* Rocky2 120 */
108 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x047, 0x0008C }, /* Rocky2 150 */
109 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x04E, 0x0008C }, /* Kiji L2 132 */
110 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x056, 0x0008C }, /* Raven+ */
115 MODULE_DEVICE_TABLE(parisc, serial_tbl);
117 static struct parisc_driver serial1_driver = {
118 name: "Serial RS232",
119 id_table: serial1_tbl,
120 probe: serial_init_chip,
123 static struct parisc_driver serial_driver = {
124 name: "Serial RS232",
125 id_table: serial_tbl,
126 probe: serial_init_chip,
129 void __init probe_serial_gsc(void)
131 register_parisc_driver(&serial1_driver);
132 register_parisc_driver(&serial_driver);