Hi,
I've started looking at keyboard support for the DS5000/200, and
I'm getting nowhere fast but what the hell :-), the enclosed patch fixes a
few bugs in the dz.c driver I've spotted that don't become apparant until
two or more ports are in use,
* dz_stop may be called with a NULL tty, it shouldn't be but I've seen it
happen, so I now check for a null tty in dz_stop
* the init function was not working the for loop was constructed wrong,
I re-wrote it a bit cleaner
* long flags instead of unsigned long
* spinning wheels checking wrong register on serial port
* remove prom printing of everything on serial port
* remove duplicate section in serial console init
Please read my next post about some problems I'm currently having,
Please apply to tree, is against 2.2.10,
Dave.
------------ David Airlie, David.Airlie@ul.ie,airlied@skynet --------
Telecommunications Research Centre, ECE Dept, University of Limerick \
http://www.csn.ul.ie/~airlied -- Telecommunications Researcher \
--- TEL: +353-61-202695 -----------------------------------------------
--- /home/airlied/works/dz.c Tue Sep 7 18:19:25 1999
+++ drivers/char/dz.c Mon Sep 13 14:32:39 1999
@@ -14,6 +14,9 @@
* after patches by harald to irq code.
* [09-JAN-99] triemer minor fix for schedule - due to removal of timeout
* field from "current" - somewhere between 2.1.121 and 2.1.131
+ *
+ * Parts (C) 1999 David Airlie, airlied@linux.ie
+ * [07-SEP-99] Bugfixes
*/
#ifdef MODULE
@@ -131,10 +134,14 @@
static void dz_stop (struct tty_struct *tty)
{
- struct dz_serial *info = (struct dz_serial *)tty->driver_data;
+ struct dz_serial *info;
unsigned short mask, tmp;
-
+ if (tty==0)
+ return;
+
+ info = (struct dz_serial *)tty->driver_data;
+
mask = 1 << info->line;
tmp = dz_in (info, DZ_TCR); /* read the TX flag */
@@ -1040,7 +1047,7 @@
}
if (--info->count < 0) {
- printk("rs_close: bad serial port count for ttys%d: %d\n",
+ printk("dz_close: bad serial port count for ttys%d: %d\n",
info->line, info->count);
info->count = 0;
}
@@ -1339,9 +1346,9 @@
panic("Couldn't register callout driver\n");
save_flags(flags); cli();
- i = 0;
- for (info = &multi[i]; i < DZ_NB_PORT; i++)
+ for (i=0; i < DZ_NB_PORT; i++)
{
+ info = &multi[i];
lines[i] = info;
info->magic = SERIAL_MAGIC;
@@ -1400,7 +1407,7 @@
#ifdef CONFIG_SERIAL_CONSOLE
static void dz_console_put_char (unsigned char ch)
{
- long flags;
+ unsigned long flags;
int loops = 2500;
unsigned short tmp = ch;
/* this code sends stuff out to serial device - spinning its
@@ -1414,7 +1421,7 @@
/* spin our wheels */
- while (((dz_in(dz_console,DZ_TCR) & DZ_TRDY) != DZ_TRDY) && loops--)
+ while (((dz_in(dz_console,DZ_CSR) & DZ_TRDY) != DZ_TRDY) && loops--)
;
/* Actually transmit the character. */
@@ -1433,9 +1440,11 @@
const char *str,
unsigned int count)
{
+/*
#ifdef DEBUG_DZ
prom_printf((char *)str);
#endif
+*/
while (count--)
{
if (*str == '\n')
@@ -1510,37 +1519,6 @@
break;
}
co->cflag = cflag;
-
- /* TOFIX: force to console line */
- dz_console = &multi[CONSOLE_LINE];
- if ((mips_machtype == MACH_DS23100) || (mips_machtype == MACH_DS5100))
- dz_console->port = KN01_DZ11_BASE;
- else
- dz_console->port = KN02_DZ11_BASE;
- dz_console->line = CONSOLE_LINE;
-
- dz_out(dz_console, DZ_CSR, DZ_CLR);
- while ((tmp = dz_in(dz_console,DZ_CSR)) & DZ_CLR)
- ;
-
- /* enable scanning */
- dz_out(dz_console, DZ_CSR, DZ_MSE);
-
- /* Set up flags... */
- dz_console->cflags = 0;
- dz_console->cflags |= DZ_B9600;
- dz_console->cflags |= DZ_CS8;
- dz_console->cflags |= DZ_PARENB;
- dz_out (dz_console, DZ_LPR, dz_console->cflags);
-
-
- mask = 1 << dz_console->line;
- tmp = dz_in (dz_console, DZ_TCR); /* read the TX flag */
- if (!(tmp & mask)) {
- tmp |= mask; /* set the TX flag */
- dz_out (dz_console, DZ_TCR, tmp);
- }
-
/* TOFIX: force to console line */
dz_console = &multi[CONSOLE_LINE];
|