Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Don't reprogram SCC registers unless the values h...



details:   https://anonhg.NetBSD.org/src/rev/cb6d69f6d7b3
branches:  trunk
changeset: 511705:cb6d69f6d7b3
user:      wdk <wdk%NetBSD.org@localhost>
date:      Mon Jun 25 08:30:11 2001 +0000

description:
Don't reprogram SCC registers unless the values have changed.

Some CMOS Z85C30 SCC's (as used in the SGI Indy and Mips Magnum 3000's)
reset the baud rate generator when a new prescaler is loaded - despite
what is documented in the datasheet.

Avoids "character glitch" problems when line discipline characteristics
are changed at the start of the login process, or during a ftp session
on the /dev/console device.

Tested on -sgimips, -mipsco and -alpha platforms

diffstat:

 sys/dev/ic/z8530sc.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (36 lines):

diff -r f39652bd7914 -r cb6d69f6d7b3 sys/dev/ic/z8530sc.c
--- a/sys/dev/ic/z8530sc.c      Mon Jun 25 06:44:41 2001 +0000
+++ b/sys/dev/ic/z8530sc.c      Mon Jun 25 08:30:11 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: z8530sc.c,v 1.12 2000/03/30 12:45:32 augustss Exp $    */
+/*     $NetBSD: z8530sc.c,v 1.13 2001/06/25 08:30:11 wdk Exp $ */
 
 /*
  * Copyright (c) 1994 Gordon W. Ross
@@ -131,11 +131,7 @@
 {
        u_char *reg;
 
-       /* Copy "pending" regs to "current" */
-       bcopy((caddr_t)cs->cs_preg, (caddr_t)cs->cs_creg, 16);
-       reg = cs->cs_creg;      /* current regs */
-
-       zs_write_csr(cs, ZSM_RESET_ERR);        /* XXX: reset error condition */
+       zs_write_csr(cs, ZSM_RESET_ERR); /* XXX: reset error condition */
 
 #if 1
        /*
@@ -145,6 +141,13 @@
        zs_iflush(cs);  /* XXX */
 #endif
 
+       if (bcmp((caddr_t)cs->cs_preg, (caddr_t)cs->cs_creg, 16) == 0)
+           return;     /* only change if values are different */
+
+       /* Copy "pending" regs to "current" */
+       bcopy((caddr_t)cs->cs_preg, (caddr_t)cs->cs_creg, 16);
+       reg = cs->cs_creg;      /* current regs */
+
        /* disable interrupts */
        zs_write_reg(cs, 1, reg[1] & ~ZSWR1_IMASK);
 



Home | Main Index | Thread Index | Old Index