1
2
3
4
5
6
7
8
9
10
11
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/types.h>
20
21#include <asm/hardware.h>
22#include <asm/parisc-device.h>
23#include <asm/io.h>
24
25#include "8250.h"
26
27static int __init serial_init_chip(struct parisc_device *dev)
28{
29 struct uart_8250_port uart;
30 unsigned long address;
31 int err;
32
33#ifdef CONFIG_64BIT
34 if (!dev->irq && (dev->id.sversion == 0xad))
35 dev->irq = iosapic_serial_irq(dev);
36#endif
37
38 if (!dev->irq) {
39
40
41
42
43
44 if (parisc_parent(dev)->id.hw_type != HPHW_IOA)
45 printk(KERN_INFO
46 "Serial: device 0x%llx not configured.\n"
47 "Enable support for Wax, Lasi, Asp or Dino.\n",
48 (unsigned long long)dev->hpa.start);
49 return -ENODEV;
50 }
51
52 address = dev->hpa.start;
53 if (dev->id.sversion != 0x8d)
54 address += 0x800;
55
56 memset(&uart, 0, sizeof(uart));
57 uart.port.iotype = UPIO_MEM;
58
59 uart.port.uartclk = (dev->id.sversion != 0xad) ?
60 7272727 : 1843200;
61 uart.port.mapbase = address;
62 uart.port.membase = ioremap_nocache(address, 16);
63 uart.port.irq = dev->irq;
64 uart.port.flags = UPF_BOOT_AUTOCONF;
65 uart.port.dev = &dev->dev;
66
67 err = serial8250_register_8250_port(&uart);
68 if (err < 0) {
69 printk(KERN_WARNING
70 "serial8250_register_8250_port returned error %d\n", err);
71 iounmap(uart.port.membase);
72 return err;
73 }
74
75 return 0;
76}
77
78static struct parisc_device_id serial_tbl[] = {
79 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00075 },
80 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008c },
81 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008d },
82 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x000ad },
83 { 0 }
84};
85
86
87
88
89
90
91
92static struct parisc_device_id lasi_tbl[] = {
93 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03B, 0x0008C },
94 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03C, 0x0008C },
95 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03D, 0x0008C },
96 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03E, 0x0008C },
97 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03F, 0x0008C },
98 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x046, 0x0008C },
99 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x047, 0x0008C },
100 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x04E, 0x0008C },
101 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x056, 0x0008C },
102 { 0 }
103};
104
105
106MODULE_DEVICE_TABLE(parisc, serial_tbl);
107
108static struct parisc_driver lasi_driver = {
109 .name = "serial_1",
110 .id_table = lasi_tbl,
111 .probe = serial_init_chip,
112};
113
114static struct parisc_driver serial_driver = {
115 .name = "serial",
116 .id_table = serial_tbl,
117 .probe = serial_init_chip,
118};
119
120static int __init probe_serial_gsc(void)
121{
122 register_parisc_driver(&lasi_driver);
123 register_parisc_driver(&serial_driver);
124 return 0;
125}
126
127module_init(probe_serial_gsc);
128
129MODULE_LICENSE("GPL");
130