summaryrefslogtreecommitdiffstats
path: root/drivers/sbus/char/zs.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
commit78c388aed2b7184182c08428db1de6c872d815f5 (patch)
tree4b2003b1b4ceb241a17faa995da8dd1004bb8e45 /drivers/sbus/char/zs.c
parenteb7a5bf93aaa4be1d7c6181100ab7639e74d67f7 (diff)
Merge with Linux 2.1.131 and more MIPS goodies.
(Did I mention that CVS is buggy ...)
Diffstat (limited to 'drivers/sbus/char/zs.c')
-rw-r--r--drivers/sbus/char/zs.c51
1 files changed, 38 insertions, 13 deletions
diff --git a/drivers/sbus/char/zs.c b/drivers/sbus/char/zs.c
index 9bc0b2717..67aa3c574 100644
--- a/drivers/sbus/char/zs.c
+++ b/drivers/sbus/char/zs.c
@@ -1,9 +1,9 @@
-/* $Id: zs.c,v 1.26 1998/08/03 23:58:14 davem Exp $
+/* $Id: zs.c,v 1.32 1998/11/08 11:15:29 davem Exp $
* zs.c: Zilog serial port driver for the Sparc.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
* Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
- * Fixes by Pete A. Zaitcev <zaitcev@ipmce.su>.
+ * Fixes by Pete A. Zaitcev <zaitcev@metabyte.com>.
*/
#include <linux/errno.h>
@@ -36,10 +36,10 @@
#include <asm/sbus.h>
#ifdef __sparc_v9__
#include <asm/fhc.h>
+#endif
#ifdef CONFIG_PCI
#include <linux/pci.h>
#endif
-#endif
#include "sunserial.h"
#include "zs.h"
@@ -111,7 +111,7 @@ static unsigned char zscons_regs[16] = {
DECLARE_TASK_QUEUE(tq_serial);
-struct tty_driver serial_driver, callout_driver;
+static struct tty_driver serial_driver, callout_driver;
static int serial_refcount;
/* serial subtype definitions */
@@ -1354,10 +1354,9 @@ static void send_break( struct sun_serial * info, int duration)
if (!info->port)
return;
current->state = TASK_INTERRUPTIBLE;
- current->timeout = jiffies + duration;
cli();
write_zsreg(info->zs_channel, 5, (info->curregs[5] | SND_BRK));
- schedule();
+ schedule_timeout(duration);
write_zsreg(info->zs_channel, 5, info->curregs[5]);
sti();
}
@@ -1543,8 +1542,7 @@ static void zs_close(struct tty_struct *tty, struct file * filp)
if (info->blocked_open) {
if (info->close_delay) {
current->state = TASK_INTERRUPTIBLE;
- current->timeout = jiffies + info->close_delay;
- schedule();
+ schedule_timeout(info->close_delay);
}
wake_up_interruptible(&info->open_wait);
}
@@ -1808,7 +1806,7 @@ int zs_open(struct tty_struct *tty, struct file * filp)
static void show_serial_version(void)
{
- char *revision = "$Revision: 1.26 $";
+ char *revision = "$Revision: 1.32 $";
char *version, *p;
version = strchr(revision, ' ');
@@ -1830,6 +1828,7 @@ __initfunc(static struct sun_zslayout *
get_zs(int chip))
{
unsigned int vaddr[2] = { 0, 0 };
+ unsigned long mapped_addr = 0;
int busnode, seen, zsnode, sun4u_ino;
static int irq = 0;
@@ -1854,7 +1853,30 @@ get_zs(int chip))
int len = prom_getproperty(zsnode, "address",
(void *) vaddr, sizeof(vaddr));
- if(len % sizeof(unsigned int)) {
+ if(len == -1) {
+ struct linux_sbus *sbus;
+ struct linux_sbus_device *sdev = NULL;
+
+ /* "address" property is not guarenteed,
+ * everything in I/O is implicitly mapped
+ * anyways by our clever TLB miss handling
+ * scheme, so don't fail here. -DaveM
+ */
+ for_each_sbus(sbus) {
+ for_each_sbusdev(sdev, sbus) {
+ if (sdev->prom_node == zsnode)
+ goto found;
+ }
+ }
+ found:
+ if (sdev == NULL)
+ prom_halt();
+ prom_apply_sbus_ranges(sbus, sdev->reg_addrs, 1, sdev);
+ mapped_addr = (unsigned long)
+ sparc_alloc_io(sdev->reg_addrs[0].phys_addr, 0,
+ PAGE_SIZE, "Zilog Registers",
+ sdev->reg_addrs[0].which_io, 0x0);
+ } else if(len % sizeof(unsigned int)) {
prom_printf("WHOOPS: proplen for %s "
"was %d, need multiple of "
"%d\n", "address", len,
@@ -1883,9 +1905,12 @@ get_zs(int chip))
}
if(!zsnode)
panic("get_zs: whee chip not found");
- if(!vaddr[0])
+ if(!vaddr[0] && !mapped_addr)
panic("get_zs: whee no serial chip mappable");
- return (struct sun_zslayout *)(unsigned long) vaddr[0];
+ if (mapped_addr != 0)
+ return (struct sun_zslayout *) mapped_addr;
+ else
+ return (struct sun_zslayout *) (unsigned long) vaddr[0];
}
#else /* !(__sparc_v9__) */
__initfunc(static struct sun_zslayout *
@@ -2119,7 +2144,7 @@ no_probe:
kbd_ops.getledstate = sun_getledstate;
kbd_ops.setkeycode = sun_setkeycode;
kbd_ops.getkeycode = sun_getkeycode;
-#ifdef CONFIG_PCI
+#if defined(__sparc_v9__) && defined(CONFIG_PCI)
sunkbd_install_keymaps(memory_start, sun_key_maps, sun_keymap_count,
sun_func_buf, sun_func_table,
sun_funcbufsize, sun_funcbufleft,