2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Serial Device Initialisation for Lasi/Asp/Wax/Dino
|
|
|
|
*
|
|
|
|
* (c) Copyright Matthew Wilcox <willy@debian.org> 2001-2002
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/ioport.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/serial_core.h>
|
|
|
|
#include <linux/signal.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
#include <asm/hardware.h>
|
|
|
|
#include <asm/parisc-device.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
|
|
|
|
#include "8250.h"
|
|
|
|
|
2008-02-08 20:18:50 +08:00
|
|
|
static int __init serial_init_chip(struct parisc_device *dev)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2012-07-12 19:59:50 +08:00
|
|
|
struct uart_8250_port uart;
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned long address;
|
|
|
|
int err;
|
|
|
|
|
2013-06-10 05:00:21 +08:00
|
|
|
#ifdef CONFIG_64BIT
|
|
|
|
if (!dev->irq && (dev->id.sversion == 0xad))
|
2013-07-30 08:02:16 +08:00
|
|
|
dev->irq = iosapic_serial_irq(dev);
|
2013-06-10 05:00:21 +08:00
|
|
|
#endif
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!dev->irq) {
|
|
|
|
/* We find some unattached serial ports by walking native
|
|
|
|
* busses. These should be silently ignored. Otherwise,
|
|
|
|
* what we have here is a missing parent device, so tell
|
|
|
|
* the user what they're missing.
|
|
|
|
*/
|
2008-02-08 20:18:50 +08:00
|
|
|
if (parisc_parent(dev)->id.hw_type != HPHW_IOA)
|
|
|
|
printk(KERN_INFO
|
2009-05-29 05:34:34 +08:00
|
|
|
"Serial: device 0x%llx not configured.\n"
|
2005-10-22 10:36:40 +08:00
|
|
|
"Enable support for Wax, Lasi, Asp or Dino.\n",
|
2009-05-29 05:34:34 +08:00
|
|
|
(unsigned long long)dev->hpa.start);
|
2005-04-17 06:20:36 +08:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2005-10-22 10:36:40 +08:00
|
|
|
address = dev->hpa.start;
|
2008-02-08 20:18:50 +08:00
|
|
|
if (dev->id.sversion != 0x8d)
|
2005-04-17 06:20:36 +08:00
|
|
|
address += 0x800;
|
|
|
|
|
2012-07-12 19:59:50 +08:00
|
|
|
memset(&uart, 0, sizeof(uart));
|
|
|
|
uart.port.iotype = UPIO_MEM;
|
2006-08-29 01:53:30 +08:00
|
|
|
/* 7.272727MHz on Lasi. Assumed the same for Dino, Wax and Timi. */
|
2013-06-10 05:00:21 +08:00
|
|
|
uart.port.uartclk = (dev->id.sversion != 0xad) ?
|
|
|
|
7272727 : 1843200;
|
2012-07-12 19:59:50 +08:00
|
|
|
uart.port.mapbase = address;
|
|
|
|
uart.port.membase = ioremap_nocache(address, 16);
|
|
|
|
uart.port.irq = dev->irq;
|
|
|
|
uart.port.flags = UPF_BOOT_AUTOCONF;
|
|
|
|
uart.port.dev = &dev->dev;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-07-12 19:59:50 +08:00
|
|
|
err = serial8250_register_8250_port(&uart);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (err < 0) {
|
2008-02-08 20:18:50 +08:00
|
|
|
printk(KERN_WARNING
|
2012-07-12 19:59:50 +08:00
|
|
|
"serial8250_register_8250_port returned error %d\n", err);
|
|
|
|
iounmap(uart.port.membase);
|
2005-04-17 06:20:36 +08:00
|
|
|
return err;
|
|
|
|
}
|
2008-02-08 20:18:50 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct parisc_device_id serial_tbl[] = {
|
|
|
|
{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00075 },
|
|
|
|
{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008c },
|
|
|
|
{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008d },
|
2013-06-10 05:00:21 +08:00
|
|
|
{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x000ad },
|
2005-04-17 06:20:36 +08:00
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Hack. Some machines have SERIAL_0 attached to Lasi and SERIAL_1
|
|
|
|
* attached to Dino. Unfortunately, Dino appears before Lasi in the device
|
|
|
|
* tree. To ensure that ttyS0 == SERIAL_0, we register two drivers; one
|
|
|
|
* which only knows about Lasi and then a second which will find all the
|
|
|
|
* other serial ports. HPUX ignores this problem.
|
|
|
|
*/
|
|
|
|
static struct parisc_device_id lasi_tbl[] = {
|
|
|
|
{ HPHW_FIO, HVERSION_REV_ANY_ID, 0x03B, 0x0008C }, /* C1xx/C1xxL */
|
|
|
|
{ HPHW_FIO, HVERSION_REV_ANY_ID, 0x03C, 0x0008C }, /* B132L */
|
|
|
|
{ HPHW_FIO, HVERSION_REV_ANY_ID, 0x03D, 0x0008C }, /* B160L */
|
|
|
|
{ HPHW_FIO, HVERSION_REV_ANY_ID, 0x03E, 0x0008C }, /* B132L+ */
|
|
|
|
{ HPHW_FIO, HVERSION_REV_ANY_ID, 0x03F, 0x0008C }, /* B180L+ */
|
|
|
|
{ HPHW_FIO, HVERSION_REV_ANY_ID, 0x046, 0x0008C }, /* Rocky2 120 */
|
|
|
|
{ HPHW_FIO, HVERSION_REV_ANY_ID, 0x047, 0x0008C }, /* Rocky2 150 */
|
|
|
|
{ HPHW_FIO, HVERSION_REV_ANY_ID, 0x04E, 0x0008C }, /* Kiji L2 132 */
|
|
|
|
{ HPHW_FIO, HVERSION_REV_ANY_ID, 0x056, 0x0008C }, /* Raven+ */
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(parisc, serial_tbl);
|
|
|
|
|
|
|
|
static struct parisc_driver lasi_driver = {
|
|
|
|
.name = "serial_1",
|
|
|
|
.id_table = lasi_tbl,
|
|
|
|
.probe = serial_init_chip,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct parisc_driver serial_driver = {
|
|
|
|
.name = "serial",
|
|
|
|
.id_table = serial_tbl,
|
|
|
|
.probe = serial_init_chip,
|
|
|
|
};
|
|
|
|
|
2008-10-19 11:27:45 +08:00
|
|
|
static int __init probe_serial_gsc(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
register_parisc_driver(&lasi_driver);
|
|
|
|
register_parisc_driver(&serial_driver);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
module_init(probe_serial_gsc);
|
2008-07-24 12:29:44 +08:00
|
|
|
|
|
|
|
MODULE_LICENSE("GPL");
|