2 * Serial Device Initialisation for Lasi/Asp/Wax/Dino
4 * (c) Copyright Matthew Wilcox <willy@debian.org> 2001-2002
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
12 #include <linux/errno.h>
13 #include <linux/init.h>
14 #include <linux/interrupt.h>
15 #include <linux/ioport.h>
16 #include <linux/module.h>
17 #include <linux/serial_core.h>
18 #include <linux/signal.h>
19 #include <linux/slab.h>
20 #include <linux/types.h>
22 #include <asm/hardware.h>
23 #include <asm/parisc-device.h>
29 serial_init_chip(struct parisc_device *dev)
31 struct uart_port port;
32 unsigned long address;
36 /* We find some unattached serial ports by walking native
37 * busses. These should be silently ignored. Otherwise,
38 * what we have here is a missing parent device, so tell
39 * the user what they're missing.
41 if (parisc_parent(dev)->id.hw_type != HPHW_IOA) {
42 printk(KERN_INFO "Serial: device 0x%lx not configured.\n"
43 "Enable support for Wax, Lasi, Asp or Dino.\n",
49 address = dev->hpa.start;
50 if (dev->id.sversion != 0x8d) {
54 memset(&port, 0, sizeof(port));
55 port.iotype = UPIO_MEM;
56 /* 7.272727MHz on Lasi. Assumed the same for Dino, Wax and Timi. */
57 port.uartclk = 7272727;
58 port.mapbase = address;
59 port.membase = ioremap_nocache(address, 16);
61 port.flags = UPF_BOOT_AUTOCONF;
64 err = serial8250_register_port(&port);
66 printk(KERN_WARNING "serial8250_register_port returned error %d\n", err);
67 iounmap(port.membase);
74 static struct parisc_device_id serial_tbl[] = {
75 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00075 },
76 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008c },
77 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008d },
81 /* Hack. Some machines have SERIAL_0 attached to Lasi and SERIAL_1
82 * attached to Dino. Unfortunately, Dino appears before Lasi in the device
83 * tree. To ensure that ttyS0 == SERIAL_0, we register two drivers; one
84 * which only knows about Lasi and then a second which will find all the
85 * other serial ports. HPUX ignores this problem.
87 static struct parisc_device_id lasi_tbl[] = {
88 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03B, 0x0008C }, /* C1xx/C1xxL */
89 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03C, 0x0008C }, /* B132L */
90 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03D, 0x0008C }, /* B160L */
91 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03E, 0x0008C }, /* B132L+ */
92 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03F, 0x0008C }, /* B180L+ */
93 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x046, 0x0008C }, /* Rocky2 120 */
94 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x047, 0x0008C }, /* Rocky2 150 */
95 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x04E, 0x0008C }, /* Kiji L2 132 */
96 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x056, 0x0008C }, /* Raven+ */
101 MODULE_DEVICE_TABLE(parisc, serial_tbl);
103 static struct parisc_driver lasi_driver = {
105 .id_table = lasi_tbl,
106 .probe = serial_init_chip,
109 static struct parisc_driver serial_driver = {
111 .id_table = serial_tbl,
112 .probe = serial_init_chip,
115 int __init probe_serial_gsc(void)
117 register_parisc_driver(&lasi_driver);
118 register_parisc_driver(&serial_driver);
122 module_init(probe_serial_gsc);