8 #include <linux/module.h>
10 #include <linux/string.h>
11 #include <linux/kernel.h>
12 #include <linux/serial.h>
13 #include <linux/serial_core.h>
18 #include <linux/slab.h>
23 #if !defined(CONFIG_HPDCA) && !defined(CONFIG_HPAPCI)
24 #warning CONFIG_8250 defined but neither CONFIG_HPDCA nor CONFIG_HPAPCI defined, are you sure?
30 struct hp300_port *
next;
34 static struct hp300_port *hp300_ports;
39 static int __devinit hpdca_init_one(
struct dio_dev *
d,
40 const struct dio_device_id *
ent);
41 static void __devexit hpdca_remove_one(
struct dio_dev *
d);
43 static struct dio_device_id hpdca_dio_tbl[] = {
51 static struct dio_driver hpdca_driver = {
53 .id_table = hpdca_dio_tbl,
54 .probe = hpdca_init_one,
65 #define UART_OFFSET 17
71 #define DCA_IC_IE 0x80
73 #define HPDCA_BAUD_BASE 153600
76 #define FRODO_BASE (0x41c000)
81 #define FRODO_APCIBASE 0x0
82 #define FRODO_APCISPACE 0x20
83 #define FRODO_APCI_OFFSET(x) (FRODO_APCIBASE + ((x) * FRODO_APCISPACE))
85 #define HPAPCI_BAUD_BASE 500400
87 #ifdef CONFIG_SERIAL_8250_CONSOLE
96 int __init hp300_setup_serial_console(
void)
101 memset(&port, 0,
sizeof(port));
103 if (hp300_uart_scode < 0 || hp300_uart_scode > DIO_SCMAX)
127 printk(
KERN_WARNING "Serial console is APCI but support is disabled (CONFIG_HPAPCI)!\n");
136 printk(
KERN_INFO "Serial console is HP DCA at select code %d\n", scode);
142 port.
irq = DIO_IPL(pa + DIO_VIRADDRBASE);
147 if (DIO_ID(pa + DIO_VIRADDRBASE) & 0x80)
150 printk(
KERN_WARNING "Serial console is DCA but support is disabled (CONFIG_HPDCA)!\n");
162 static int __devinit hpdca_init_one(
struct dio_dev *
d,
163 const struct dio_device_id *
ent)
168 #ifdef CONFIG_SERIAL_8250_CONSOLE
179 uart.port.irq = d->ipl;
182 uart.port.membase = (
char *)(
uart.port.mapbase + DIO_VIRADDRBASE);
183 uart.port.regshift = 1;
184 uart.port.dev = &d->dev;
189 " irq %d failed\n", d->scode,
uart.port.irq);
195 dio_set_drvdata(d, (
void *)line);
198 out_8(d->resource.start + DIO_VIRADDRBASE +
DCA_ID, 0xff);
207 static int __init hp300_8250_init(
void)
214 struct hp300_port *
port;
237 for (i = 1; i < 4; i++) {
241 #ifdef CONFIG_SERIAL_8250_CONSOLE
262 uart.port.mapbase = base;
263 uart.port.membase = (
char *)(base + DIO_VIRADDRBASE);
264 uart.port.regshift = 2;
270 " %d irq %d failed\n", i,
uart.port.irq);
276 port->next = hp300_ports;
291 static void __devexit hpdca_remove_one(
struct dio_dev *d)
295 line = (
int) dio_get_drvdata(d);
296 if (d->resource.start) {
298 out_8(d->resource.start + DIO_VIRADDRBASE +
DCA_IC, 0);
304 static void __exit hp300_8250_exit(
void)
307 struct hp300_port *
port, *to_free;
309 for (port = hp300_ports;
port; ) {