Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Defer initialization of the ISAC chip until we enabl...



details:   https://anonhg.NetBSD.org/src/rev/5af5b91a13bf
branches:  trunk
changeset: 525579:5af5b91a13bf
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Apr 13 10:28:36 2002 +0000

description:
Defer initialization of the ISAC chip until we enable interrupts - it gets
into a strange failure mode if we do it with disabled interrupt. When
(re-)enabling interrupts reset transmitter and receiver and clear any
pending state.

diffstat:

 sys/dev/ic/isac.c            |  36 ++++++++++++++----------------------
 sys/dev/ic/isic_l1.c         |  35 ++++-------------------------------
 sys/dev/isa/isic_isa.c       |  10 ++++------
 sys/dev/isapnp/isic_isapnp.c |   8 +++-----
 sys/dev/pci/isic_pci.c       |  10 ++++------
 sys/dev/pcmcia/isic_pcmcia.c |   8 +++-----
 6 files changed, 32 insertions(+), 75 deletions(-)

diffs (274 lines):

diff -r bcd122f0c518 -r 5af5b91a13bf sys/dev/ic/isac.c
--- a/sys/dev/ic/isac.c Sat Apr 13 09:29:53 2002 +0000
+++ b/sys/dev/ic/isac.c Sat Apr 13 10:28:36 2002 +0000
@@ -27,14 +27,14 @@
  *     i4b_isac.c - i4b siemens isdn chipset driver ISAC handler
  *     ---------------------------------------------------------
  *
- *     $Id: isac.c,v 1.11 2002/04/10 23:51:06 martin Exp $ 
+ *     $Id: isac.c,v 1.12 2002/04/13 10:28:36 martin Exp $ 
  *
  *      last edit-date: [Fri Jan  5 11:36:10 2001]
  *
  *---------------------------------------------------------------------------*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isac.c,v 1.11 2002/04/10 23:51:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isac.c,v 1.12 2002/04/13 10:28:36 martin Exp $");
 
 #ifdef __FreeBSD__
 #include "opt_i4b.h"
@@ -551,7 +551,7 @@
 int
 isic_isac_init(struct isic_softc *sc)
 {
-       sc->sc_intr_valid = ISIC_INTR_DISABLED;
+       u_int8_t v;
 
        ISAC_IMASK = 0xff;              /* disable all irqs */
 
@@ -652,23 +652,6 @@
                 */
                ISAC_WRITE(I_MODE, ISAC_MODE_MDS2|ISAC_MODE_MDS1|ISAC_MODE_RAC|ISAC_MODE_DIM0);
        }
-
-#ifdef NOTDEF
-       /*
-        * XXX a transmitter reset causes an ISAC tx IRQ which will not
-        * be serviced at attach time under some circumstances leaving
-        * the associated IRQ line on the ISA bus active. This prevents
-        * any further interrupts to be serviced because no low -> high
-        * transition can take place anymore. (-hm)
-        */
-        
-       /* command register:
-        *      RRES - HDLC receiver reset
-        *      XRES - transmitter reset
-        */
-       ISAC_WRITE(I_CMDR, ISAC_CMDR_RRES|ISAC_CMDR_XRES);
-       ISACCMDRWRDELAY();
-#endif
        
        /* enabled interrupts:
         * ===================
@@ -683,10 +666,19 @@
                     ISAC_MASK_TIN |    /* timer irq            */
                     ISAC_MASK_SIN;     /* sync xfer irq        */
 
+       ISAC_WRITE(I_MASK, ISAC_IMASK);
+
        /*
-        * We don't want interrupts enabled attach time, so setup the
-        * mask, but don't write it to the chip yet 
+        * Even if interrupts are masked, the EXI bit may get set
+        * (but does not cause an interrupt).
+        * Clear the extended interrupts, and reset receiver and
+        * transmitter.
         */
+       v = ISAC_READ(I_ISTA);
+       if (v & ISAC_ISTA_EXI)
+               v = ISAC_READ(I_EXIR);
+       ISAC_WRITE(I_CMDR, ISAC_CMDR_RRES|ISAC_CMDR_XRES);
+       ISACCMDRWRDELAY();
 
        return(0);
 }
diff -r bcd122f0c518 -r 5af5b91a13bf sys/dev/ic/isic_l1.c
--- a/sys/dev/ic/isic_l1.c      Sat Apr 13 09:29:53 2002 +0000
+++ b/sys/dev/ic/isic_l1.c      Sat Apr 13 10:28:36 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isic_l1.c,v 1.9 2002/04/10 23:51:06 martin Exp $ */
+/* $NetBSD: isic_l1.c,v 1.10 2002/04/13 10:28:36 martin Exp $ */
 
 /*
  * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isic_l1.c,v 1.9 2002/04/10 23:51:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isic_l1.c,v 1.10 2002/04/13 10:28:36 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/ioctl.h>
@@ -267,42 +267,15 @@
 {
        if (sc->sc_ipac) {
                if (enabled) {
-                       IPAC_WRITE(IPAC_MASK, 0xc0);
+                       isic_isac_init(sc);
                } else {
                        IPAC_WRITE(IPAC_MASK, 0xff);
                }
        } else {
                if (enabled) {
-                       ISAC_WRITE(I_MASK, ISAC_IMASK);
+                       isic_isac_init(sc);
                } else {
                        ISAC_WRITE(I_MASK, 0xff);
                }
        }
-       if (enabled) {
-               /* try to clear any pending interrupts */
-               u_int8_t v;
-
-               if (sc->sc_ipac) {
-                       v = IPAC_READ(IPAC_ISTA);
-                       v = ISAC_READ(I_STAR);
-                       if (v & ISAC_ISTA_EXI)
-                               v = ISAC_READ(I_EXIR);
-                       v = ISAC_READ(I_MODE);
-                       v = ISAC_READ(I_ADF2);
-                       v = ISAC_READ(I_STAR);
-                       if (v & ISAC_ISTA_EXI)
-                               v = ISAC_READ(I_EXIR);
-               } else {
-                       v = ISAC_READ(I_STAR);
-                       if (v & ISAC_ISTA_EXI)
-                               v = ISAC_READ(I_EXIR);
-                       v = ISAC_READ(I_MODE);
-                       v = ISAC_READ(I_ADF2);
-                       v = ISAC_READ(I_STAR);
-                       if (v & ISAC_ISTA_EXI)
-                               v = ISAC_READ(I_EXIR);
-               }
-               if (sc->clearirq)
-                       sc->clearirq(sc);
-       }
 }
diff -r bcd122f0c518 -r 5af5b91a13bf sys/dev/isa/isic_isa.c
--- a/sys/dev/isa/isic_isa.c    Sat Apr 13 09:29:53 2002 +0000
+++ b/sys/dev/isa/isic_isa.c    Sat Apr 13 10:28:36 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: isic_isa.c,v 1.11 2002/04/10 23:51:08 martin Exp $     */
+/*     $NetBSD: isic_isa.c,v 1.12 2002/04/13 10:28:36 martin Exp $     */
 
 /*
  *   Copyright (c) 1997-1999 Martin Husemann. All rights reserved.
@@ -35,7 +35,7 @@
  *     isic_isa.c - ISA bus frontend for i4b_isic driver
  *     --------------------------------------------------
  *
- *     $Id: isic_isa.c,v 1.11 2002/04/10 23:51:08 martin Exp $ 
+ *     $Id: isic_isa.c,v 1.12 2002/04/13 10:28:36 martin Exp $ 
  *
  *      last edit-date: [Tue Jan  9 01:43:45 2001]
  *
@@ -45,7 +45,7 @@
  *---------------------------------------------------------------------------*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isic_isa.c,v 1.11 2002/04/10 23:51:08 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isic_isa.c,v 1.12 2002/04/13 10:28:36 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/errno.h>
@@ -619,9 +619,7 @@
                }
        }
 
-       /* ISAC setup */
-       
-       isic_isac_init(sc);
+        sc->sc_intr_valid = ISIC_INTR_DISABLED;
 
        /* HSCX setup */
 
diff -r bcd122f0c518 -r 5af5b91a13bf sys/dev/isapnp/isic_isapnp.c
--- a/sys/dev/isapnp/isic_isapnp.c      Sat Apr 13 09:29:53 2002 +0000
+++ b/sys/dev/isapnp/isic_isapnp.c      Sat Apr 13 10:28:36 2002 +0000
@@ -33,7 +33,7 @@
  *     isapnp_isic.c - ISA-P&P bus frontend for i4b_isic driver
  *     --------------------------------------------------------
  *
- *     $Id: isic_isapnp.c,v 1.10 2002/04/10 23:51:08 martin Exp $ 
+ *     $Id: isic_isapnp.c,v 1.11 2002/04/13 10:28:37 martin Exp $ 
  *
  *      last edit-date: [Fri Jan  5 11:38:29 2001]
  *
@@ -43,7 +43,7 @@
  *---------------------------------------------------------------------------*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isic_isapnp.c,v 1.10 2002/04/10 23:51:08 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isic_isapnp.c,v 1.11 2002/04/13 10:28:37 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/errno.h>
@@ -309,9 +309,7 @@
                        break;
        };
 
-       /* ISAC setup */
-
-       isic_isac_init(sc);
+        sc->sc_intr_valid = ISIC_INTR_DISABLED;
 
        /* HSCX setup */
 
diff -r bcd122f0c518 -r 5af5b91a13bf sys/dev/pci/isic_pci.c
--- a/sys/dev/pci/isic_pci.c    Sat Apr 13 09:29:53 2002 +0000
+++ b/sys/dev/pci/isic_pci.c    Sat Apr 13 10:28:36 2002 +0000
@@ -33,7 +33,7 @@
  *     isic_pci.c - pci bus frontend for i4b_isic driver
  *     ----------------------------------------------------
  *
- *     $Id: isic_pci.c,v 1.12 2002/04/10 23:51:08 martin Exp $ 
+ *     $Id: isic_pci.c,v 1.13 2002/04/13 10:28:37 martin Exp $ 
  *
  *      last edit-date: [Fri Jan  5 11:38:58 2001]
  *
@@ -43,7 +43,7 @@
  *---------------------------------------------------------------------------*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isic_pci.c,v 1.12 2002/04/10 23:51:08 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isic_pci.c,v 1.13 2002/04/13 10:28:37 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/errno.h>
@@ -296,10 +296,8 @@
        psc->sc_pc = pc;
        printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, intrstr);
 
-       /* ISAC setup */
-       
-       isic_isac_init(sc);
-
+       sc->sc_intr_valid = ISIC_INTR_DISABLED;
+ 
        /* HSCX setup */
 
        isic_bchannel_setup(sc, HSCX_CH_A, BPROT_NONE, 0);
diff -r bcd122f0c518 -r 5af5b91a13bf sys/dev/pcmcia/isic_pcmcia.c
--- a/sys/dev/pcmcia/isic_pcmcia.c      Sat Apr 13 09:29:53 2002 +0000
+++ b/sys/dev/pcmcia/isic_pcmcia.c      Sat Apr 13 10:28:36 2002 +0000
@@ -33,7 +33,7 @@
  *     isic_pcmcia.c - pcmcia bus frontend for i4b_isic driver
  *     -------------------------------------------------------
  *
- *     $Id: isic_pcmcia.c,v 1.13 2002/04/10 23:51:09 martin Exp $ 
+ *     $Id: isic_pcmcia.c,v 1.14 2002/04/13 10:28:37 martin Exp $ 
  *
  *      last edit-date: [Fri Jan  5 11:39:32 2001]
  *
@@ -42,7 +42,7 @@
  *---------------------------------------------------------------------------*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isic_pcmcia.c,v 1.13 2002/04/10 23:51:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isic_pcmcia.c,v 1.14 2002/04/13 10:28:37 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/errno.h>
@@ -366,9 +366,7 @@
                        return(EIO);
        };
 
-       /* ISAC setup */
-       
-       isic_isac_init(sc);
+        sc->sc_intr_valid = ISIC_INTR_DISABLED;
 
        /* HSCX setup */
 



Home | Main Index | Thread Index | Old Index