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.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>
25 #include <asm/serial.h>
27 static void setup_parisc_serial(struct serial_struct
*serial
,
28 unsigned long address
, int irq
, int line
)
30 memset(serial
, 0, sizeof(struct serial_struct
));
32 /* autoconfig() sets state->type. This sets info->type */
33 serial
->type
= PORT_16550A
;
36 serial
->iomap_base
= address
;
37 serial
->iomem_base
= ioremap(address
, 0x8);
40 serial
->io_type
= SERIAL_IO_MEM
; /* define access method */
42 serial
->xmit_fifo_size
= 16;
43 serial
->custom_divisor
= 0;
44 serial
->baud_base
= LASI_BASE_BAUD
;
48 serial_init_chip(struct parisc_device
*dev
)
50 static int serial_line_nr
;
51 unsigned long address
;
54 struct serial_struct
*serial
;
57 /* We find some unattached serial ports by walking native
58 * busses. These should be silently ignored. Otherwise,
59 * what we have here is a missing parent device, so tell
60 * the user what they're missing.
62 if (dev
->parent
->id
.hw_type
!= HPHW_IOA
) {
63 printk(KERN_INFO
"Serial: device 0x%lx not configured.\n"
64 "Enable support for Wax, Lasi, Asp or Dino.\n", dev
->hpa
);
69 serial
= kmalloc(sizeof(*serial
), GFP_KERNEL
);
74 if (dev
->id
.sversion
!= 0x8d) {
78 setup_parisc_serial(serial
, address
, dev
->irq
, serial_line_nr
++);
79 err
= register_serial(serial
);
81 printk(KERN_WARNING
"register_serial returned error %d\n", err
);
89 static struct parisc_device_id serial_tbl
[] = {
90 { HPHW_FIO
, HVERSION_REV_ANY_ID
, HVERSION_ANY_ID
, 0x00075 },
91 { HPHW_FIO
, HVERSION_REV_ANY_ID
, HVERSION_ANY_ID
, 0x0008c },
92 { HPHW_FIO
, HVERSION_REV_ANY_ID
, HVERSION_ANY_ID
, 0x0008d },
96 /* Hack. Some machines have SERIAL_0 attached to Lasi and SERIAL_1
97 * attached to Dino. Unfortunately, Dino appears before Lasi in the device
98 * tree. To ensure that ttyS0 == SERIAL_0, we register two drivers; one
99 * which only knows about Lasi and then a second which will find all the
100 * other serial ports. HPUX ignores this problem.
102 static struct parisc_device_id lasi_tbl
[] = {
103 { HPHW_FIO
, HVERSION_REV_ANY_ID
, 0x03B, 0x0008C }, /* C1xx/C1xxL */
104 { HPHW_FIO
, HVERSION_REV_ANY_ID
, 0x03C, 0x0008C }, /* B132L */
105 { HPHW_FIO
, HVERSION_REV_ANY_ID
, 0x03D, 0x0008C }, /* B160L */
106 { HPHW_FIO
, HVERSION_REV_ANY_ID
, 0x03E, 0x0008C }, /* B132L+ */
107 { HPHW_FIO
, HVERSION_REV_ANY_ID
, 0x03F, 0x0008C }, /* B180L+ */
108 { HPHW_FIO
, HVERSION_REV_ANY_ID
, 0x046, 0x0008C }, /* Rocky2 120 */
109 { HPHW_FIO
, HVERSION_REV_ANY_ID
, 0x047, 0x0008C }, /* Rocky2 150 */
110 { HPHW_FIO
, HVERSION_REV_ANY_ID
, 0x04E, 0x0008C }, /* Kiji L2 132 */
111 { HPHW_FIO
, HVERSION_REV_ANY_ID
, 0x056, 0x0008C }, /* Raven+ */
116 MODULE_DEVICE_TABLE(parisc
, serial_tbl
);
118 static struct parisc_driver lasi_driver
= {
119 .name
= "Lasi RS232",
120 .id_table
= lasi_tbl
,
121 .probe
= serial_init_chip
,
124 static struct parisc_driver serial_driver
= {
125 .name
= "Serial RS232",
126 .id_table
= serial_tbl
,
127 .probe
= serial_init_chip
,
130 int __init
probe_serial_gsc(void)
132 register_parisc_driver(&lasi_driver
);
133 register_parisc_driver(&serial_driver
);
137 module_init(probe_serial_gsc
);