Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/acorn32/podulebus On ARCIN v6 cards, clear the EPRO...



details:   https://anonhg.NetBSD.org/src/rev/4ba6e8b4a4d1
branches:  trunk
changeset: 536393:4ba6e8b4a4d1
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Sat Sep 14 18:12:16 2002 +0000

description:
On ARCIN v6 cards, clear the EPROM page latch on shutdown.  This seems to be
necessary to allow the card to be detected afterwards.  In theory, this
shouldn't be necessary, since we don't touch the page latch yet, but I'm not
going to argue.

diffstat:

 sys/arch/acorn32/podulebus/icside.c    |  50 +++++++++++++++++++++++++++++----
 sys/arch/acorn32/podulebus/icsidereg.h |   6 +++-
 2 files changed, 48 insertions(+), 8 deletions(-)

diffs (132 lines):

diff -r 138db7f1d0e8 -r 4ba6e8b4a4d1 sys/arch/acorn32/podulebus/icside.c
--- a/sys/arch/acorn32/podulebus/icside.c       Sat Sep 14 18:07:31 2002 +0000
+++ b/sys/arch/acorn32/podulebus/icside.c       Sat Sep 14 18:12:16 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: icside.c,v 1.3 2002/05/22 22:43:18 bjh21 Exp $ */
+/*     $NetBSD: icside.c,v 1.4 2002/09/14 18:12:16 bjh21 Exp $ */
 
 /*
  * Copyright (c) 1997-1998 Mark Brinicombe
@@ -40,6 +40,13 @@
  * information
  */
 
+/*
+ * BUGS:
+ * Cold boot (hard reset or power-on) booting straight to NetBSD:
+ * panic: wdcstart: channel waiting for irq
+ * Booting via desktop avoinds this.
+ */
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/conf.h>
@@ -76,6 +83,9 @@
        int                     sc_podule_number;       /* Our podule number */
        struct bus_space        sc_tag;                 /* custom tag */
        struct podule_attach_args *sc_pa;               /* podule info */
+       bus_space_tag_t         sc_latchiot;    /* EEPROM page latch etc */
+       bus_space_handle_t      sc_latchioh;
+       void                    *sc_shutdownhook;
        struct icside_channel {
                struct channel_softc    wdc_channel;    /* generic part */
                void                    *ic_ih;         /* interrupt handler */
@@ -90,6 +100,7 @@
 int    icside_probe    __P((struct device *, struct cfdata *, void *));
 void   icside_attach   __P((struct device *, struct device *, void *));
 int    icside_intr     __P((void *));
+void   icside_v6_shutdown(void *);
 
 struct cfattach icside_ca = {
        sizeof(struct icside_softc), icside_probe, icside_attach
@@ -112,6 +123,7 @@
        int             modspace;       /* Type of podule space */
        int             channels;       /* Number of channels */
        const char      *name;          /* name */
+       int             latchreg;       /* EEPROM latch register */
        int             ideregs[MAX_CHANNELS];  /* IDE registers */
        int             auxregs[MAX_CHANNELS];  /* AUXSTAT register */
        int             irqregs[MAX_CHANNELS];  /* IRQ register */
@@ -122,18 +134,18 @@
        /* A3USER - Unsupported */
 /*     { 1,  0, 0, NULL, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },*/
        /* ARCIN V6 - Supported */
-       { 3,  0, 2, "ARCIN V6", 
+       { 3,  0, 2, "ARCIN V6", V6_ADDRLATCH,
          { V6_P_IDE_BASE, V6_S_IDE_BASE },
          { V6_P_AUX_BASE, V6_S_AUX_BASE },
          { V6_P_IRQ_BASE, V6_S_IRQ_BASE },
          { V6_P_IRQSTAT_BASE, V6_S_IRQSTAT_BASE }
        },
        /* ARCIN V5 - Supported (ID reg not supported so reads as 15) */
-       { 15,  1, 1, "ARCIN V5", 
-         { V5_IDE_BASE, 0 },
-         { V5_AUX_BASE, 0 },
-         { V5_IRQ_BASE, 0 },
-         { V5_IRQSTAT_BASE, 0 }
+       { 15,  1, 1, "ARCIN V5", -1,
+         { V5_IDE_BASE, -1 },
+         { V5_AUX_BASE, -1 },
+         { V5_IRQ_BASE, -1 },
+         { V5_IRQSTAT_BASE, -1 }
        }
 };
 
@@ -212,6 +224,18 @@
        } else
                printf(": %s\n", ide->name);
 
+       if (ide->latchreg != -1) {
+               sc->sc_latchiot = pa->pa_iot;
+               if (bus_space_map(iot, pa->pa_podule->fast_base +
+                       ide->latchreg, 1, 0, &sc->sc_latchioh)) {
+                       printf("%s: cannot map latch register\n",
+                           self->dv_xname);
+                       return;
+               }
+               sc->sc_shutdownhook =
+                   shutdownhook_establish(icside_v6_shutdown, sc);
+       }
+
        /*
         * Ok we need our own bus tag as the register spacing
         * is not the default.
@@ -305,6 +329,18 @@
 }
 
 /*
+ * Shutdown handler -- try to restore the card to a state where
+ * RISC OS will see it.
+ */
+void
+icside_v6_shutdown(void *arg)
+{
+       struct icside_softc *sc = arg;
+
+       bus_space_write_1(sc->sc_latchiot, sc->sc_latchioh, 0, 0);
+}
+
+/*
  * Podule interrupt handler
  *
  * If the interrupt was from our card pass it on to the wdc interrupt handler
diff -r 138db7f1d0e8 -r 4ba6e8b4a4d1 sys/arch/acorn32/podulebus/icsidereg.h
--- a/sys/arch/acorn32/podulebus/icsidereg.h    Sat Sep 14 18:07:31 2002 +0000
+++ b/sys/arch/acorn32/podulebus/icsidereg.h    Sat Sep 14 18:12:16 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: icsidereg.h,v 1.1 2001/10/05 22:27:56 reinoud Exp $    */
+/*     $NetBSD: icsidereg.h,v 1.2 2002/09/14 18:12:16 bjh21 Exp $      */
 
 /*
  * Copyright (c) 1997 Mark Brinicombe
@@ -54,6 +54,10 @@
 #define V5_IRQSTAT_BASE                        0x0000  /* byte offset from base */
 
 /* ARCIN V6 registers */
+#define V6_ADDRLATCH                   0x0000
+#define V6_ADDRLATCH_DMACHAN           0x01 /* XXX doc is unclear, poss 0x02*/
+#define V6_ADDRLATCH_EASI              0x20 /* EASI space enable */
+
 #define V6_P_IDE_BASE                  0x2000  /* byte offset from base */
 #define V6_P_AUX_BASE                  0x2380  /* byte offset from base */
 #define V6_P_IRQ_BASE                  0x2200  /* byte offset from base */



Home | Main Index | Thread Index | Old Index