Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Machine independent GPIO interface.
details: https://anonhg.NetBSD.org/src/rev/5eb14412403d
branches: trunk
changeset: 509260:5eb14412403d
user: takemura <takemura%NetBSD.org@localhost>
date: Mon Apr 30 11:42:17 2001 +0000
description:
Machine independent GPIO interface.
diffstat:
sys/arch/hpcmips/conf/files.hpcmips | 19 +--
sys/arch/hpcmips/isa/isa_machdep.c | 75 ++++++------
sys/arch/hpcmips/vr/button_vrgiu.c | 188 ------------------------------
sys/arch/hpcmips/vr/com_vrip.c | 16 +-
sys/arch/hpcmips/vr/gpbus.c | 157 -------------------------
sys/arch/hpcmips/vr/pwctl_vrgiu.c | 221 ------------------------------------
sys/arch/hpcmips/vr/vrgiu.c | 202 +++++++++++++++++++-------------
sys/arch/hpcmips/vr/vrgiuvar.h | 43 +------
sys/arch/hpcmips/vr/vrip.c | 17 +-
sys/arch/hpcmips/vr/vripvar.h | 21 ++-
sys/dev/hpc/button.c | 62 ++++++---
sys/dev/hpc/files.hpcio | 44 +++++++
sys/dev/hpc/hpcin.c | 114 ++++++++++++++++++
sys/dev/hpc/hpcioman.c | 175 ++++++++++++++++++++++++++++
sys/dev/hpc/hpciomanvar.h | 62 ++++++++++
sys/dev/hpc/hpciovar.h | 96 +++++++++++++++
sys/dev/hpc/hpcout.c | 109 +++++++++++++++++
sys/dev/hpc/pwctl.c | 58 ++++-----
18 files changed, 860 insertions(+), 819 deletions(-)
diffs (truncated from 2330 to 300 lines):
diff -r 01f9b761d645 -r 5eb14412403d sys/arch/hpcmips/conf/files.hpcmips
--- a/sys/arch/hpcmips/conf/files.hpcmips Mon Apr 30 11:10:23 2001 +0000
+++ b/sys/arch/hpcmips/conf/files.hpcmips Mon Apr 30 11:42:17 2001 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.hpcmips,v 1.54 2001/04/11 08:23:26 sato Exp $
+# $NetBSD: files.hpcmips,v 1.55 2001/04/30 11:42:18 takemura Exp $
# maxpartitions must be first item in files.${ARCH}.
maxpartitions 8
@@ -102,30 +102,17 @@
attach vrcmu at vrip
file arch/hpcmips/vr/cmu.c vrcmu needs-flag
+include "dev/hpc/files.hpcio"
device vrisabif {[platform = -1], [isaportoffset=0], [isamemoffset=0]} # GIU attachment
-device gpbusif {[platform = -1], [comctrl = -1], [button0 = -1], [button1 = -1], [button2 = -1], [button3 = -1], [button4 = -1], [button5 = -1], [button6 = -1], [button7 = -1], [button8 = -1],
[button9 = -1], [button10 = -1], [button11 = -1]}
-device newgpbusif { [platform = -1], [id = -1], [port = -1], [active = 1], [level = -1], [initvalue = -1] }
-device vrgiu: vrisabif, gpbusif, newgpbusif
+device vrgiu: vrisabif, hpcioif
attach vrgiu at vrip
file arch/hpcmips/vr/vrgiu.c vrgiu
-device gpbus
-attach gpbus at gpbusif
-file arch/hpcmips/vr/gpbus.c gpbus
-
device vrisab: isabus
attach vrisab at vrisabif
file arch/hpcmips/isa/isa_machdep.c vrisab
-device pwctl
-attach pwctl at newgpbusif with pwctl_vrgiu
-file arch/hpcmips/vr/pwctl_vrgiu.c pwctl_vrgiu
-
-device button
-attach button at newgpbusif with button_vrgiu
-file arch/hpcmips/vr/button_vrgiu.c button_vrgiu
-
device vrkiu: hpckbdif
attach vrkiu at vrip
file arch/hpcmips/vr/vrkiu.c vrkiu needs-flag
diff -r 01f9b761d645 -r 5eb14412403d sys/arch/hpcmips/isa/isa_machdep.c
--- a/sys/arch/hpcmips/isa/isa_machdep.c Mon Apr 30 11:10:23 2001 +0000
+++ b/sys/arch/hpcmips/isa/isa_machdep.c Mon Apr 30 11:42:17 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isa_machdep.c,v 1.12 2001/04/18 11:07:26 sato Exp $ */
+/* $NetBSD: isa_machdep.c,v 1.13 2001/04/30 11:42:18 takemura Exp $ */
/*
* Copyright (c) 1999, by UCHIYAMA Yasushi
@@ -38,12 +38,13 @@
#include <machine/platid.h>
#include <machine/platid_mask.h>
+#include <dev/hpc/hpciovar.h>
+
#include <hpcmips/hpcmips/machdep.h>
#include "opt_vr41xx.h"
#include <hpcmips/vr/vrcpudef.h>
#include <hpcmips/vr/vripreg.h>
#include <hpcmips/vr/vripvar.h>
-#include <hpcmips/vr/vrgiureg.h>
#include "locators.h"
@@ -63,15 +64,28 @@
#define VPRINTF(arg) if (bootverbose) printf arg;
#endif /* VRISADEBUG */
+/*
+ * intrrupt no. encoding:
+ *
+ * 0x0000000f ISA IRQ#
+ * 0x00ff0000 GPIO port#
+ * 0x01000000 interrupt signal hold/through (1:hold/0:though)
+ * 0x02000000 interrupt detection level (1:low /0:high )
+ * 0x04000000 interrupt detection trigger (1:edge/0:level )
+ */
+#define INTR_IRQ(i) (((i)>> 0) & 0x0f)
+#define INTR_PORT(i) (((i)>>16) & 0xff)
+#define INTR_MODE(i) (((i)>>24) & 0x07)
+#define INTR_NIRQS 16
+
int vrisabprint __P((void*, const char*));
int vrisabmatch __P((struct device*, struct cfdata*, void*));
void vrisabattach __P((struct device*, struct device*, void*));
struct vrisab_softc {
struct device sc_dev;
- vrgiu_chipset_tag_t sc_gc;
- vrgiu_function_tag_t sc_gf;
- int sc_intr_map[MAX_GPIO_INOUT]; /* ISA <-> GIU inerrupt line mapping */
+ hpcio_chip_t sc_hc;
+ int sc_intr_map[INTR_NIRQS]; /* ISA <-> GIU inerrupt line mapping */
struct hpcmips_isa_chipset sc_isa_ic;
};
@@ -100,14 +114,14 @@
struct cfdata *match;
void *aux;
{
- struct gpbus_attach_args *gpa = aux;
+ struct hpcio_attach_args *haa = aux;
platid_mask_t mask;
- if (strcmp(gpa->gpa_busname, match->cf_driver->cd_name))
+ if (strcmp(haa->haa_busname, match->cf_driver->cd_name))
return 0;
- if (match->cf_loc[VRISABIFCF_PLATFORM] == VRISABIFCF_PLATFORM_DEFAULT)
+ if (match->cf_loc[HPCIOIFCF_PLATFORM] == HPCIOIFCF_PLATFORM_DEFAULT)
return 1;
- mask = PLATID_DEREF(match->cf_loc[VRISABIFCF_PLATFORM]);
+ mask = PLATID_DEREF(match->cf_loc[HPCIOIFCF_PLATFORM]);
if (platid_match(&platid, &mask))
return 2;
return 0;
@@ -119,15 +133,13 @@
struct device *self;
void *aux;
{
- struct gpbus_attach_args *gpa = aux;
- struct vrgiu_softc *chipset;
+ struct hpcio_attach_args *haa = aux;
struct vrisab_softc *sc = (void*)self;
struct isabus_attach_args iba;
bus_addr_t offset;
int i;
- sc->sc_gc = chipset = gpa->gpa_gc;
- sc->sc_gf = gpa->gpa_gf;
+ sc->sc_hc = (*haa->haa_getchip)(haa->haa_sc, VRIP_IOCHIP_VRGIU);
sc->sc_isa_ic.ic_sc = sc;
iba.iba_busname = "isa";
@@ -157,7 +169,7 @@
__find_pcic();
#else
/* Initialize ISA IRQ <-> GPIO mapping */
- for (i = 0; i < MAX_GPIO_INOUT; i++)
+ for (i = 0; i < INTR_NIRQS; i++)
sc->sc_intr_map[i] = -1;
printf (":ISA port %#x-%#x mem %#x-%#x\n",
iba.iba_iot->t_base, iba.iba_iot->t_base + iba.iba_iot->t_size,
@@ -208,27 +220,15 @@
struct vrisab_softc *sc = ic->ic_sc;
int port, irq, mode;
- /*
- * 'intr' encoding:
- *
- * 0x0000000f ISA IRQ#
- * 0x00ff0000 GPIO port#
- * 0x01000000 interrupt signal hold/through (1:hold/0:though)
- * 0x02000000 interrupt detection level (1:low /0:high )
- * 0x04000000 interrupt detection trigger (1:edge/0:level )
- */
-#define INTR_IRQ(i) (((i)>> 0) & 0x0f)
-#define INTR_PORT(i) (((i)>>16) & 0xff)
-#define INTR_MODE(i) (((i)>>24) & 0x07)
static int intr_modes[8] = {
- VRGIU_INTR_LEVEL_HIGH_THROUGH,
- VRGIU_INTR_LEVEL_HIGH_HOLD,
- VRGIU_INTR_LEVEL_LOW_THROUGH,
- VRGIU_INTR_LEVEL_LOW_HOLD,
- VRGIU_INTR_EDGE_THROUGH,
- VRGIU_INTR_EDGE_HOLD,
- VRGIU_INTR_EDGE_THROUGH,
- VRGIU_INTR_EDGE_HOLD,
+ HPCIO_INTR_LEVEL_HIGH_THROUGH,
+ HPCIO_INTR_LEVEL_HIGH_HOLD,
+ HPCIO_INTR_LEVEL_LOW_THROUGH,
+ HPCIO_INTR_LEVEL_LOW_HOLD,
+ HPCIO_INTR_EDGE_THROUGH,
+ HPCIO_INTR_EDGE_HOLD,
+ HPCIO_INTR_EDGE_THROUGH,
+ HPCIO_INTR_EDGE_HOLD,
};
#ifdef VRISADEBUG
static char* intr_mode_names[8] = {
@@ -260,9 +260,8 @@
irq, port, intr_mode_names[mode]));
/* Call Vr routine */
- return sc->sc_gf->gf_intr_establish(sc->sc_gc, port,
- intr_modes[mode],
- level, ih_fun, ih_arg);
+ return hpcio_intr_establish(sc->sc_hc, port, intr_modes[mode],
+ ih_fun, ih_arg);
}
void
@@ -272,7 +271,7 @@
{
struct vrisab_softc *sc = ic->ic_sc;
/* Call Vr routine */
- sc->sc_gf->gf_intr_disestablish(sc->sc_gc, arg);
+ hpcio_intr_disestablish(sc->sc_hc, arg);
}
int
diff -r 01f9b761d645 -r 5eb14412403d sys/arch/hpcmips/vr/button_vrgiu.c
--- a/sys/arch/hpcmips/vr/button_vrgiu.c Mon Apr 30 11:10:23 2001 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/* $NetBSD: button_vrgiu.c,v 1.4 2001/04/18 11:07:26 sato Exp $ */
-
-/*-
- * Copyright (c) 1999
- * Shin Takemura and PocketBSD Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the PocketBSD project
- * and its contributors.
- * 4. Neither the name of the project nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-
-#include <machine/config_hook.h>
-#include <machine/platid.h>
-#include <machine/platid_mask.h>
-
-#include "opt_vr41xx.h"
-#include <hpcmips/vr/vrcpudef.h>
-#include <hpcmips/vr/vripreg.h>
-#include <hpcmips/vr/vripvar.h>
-#include <hpcmips/vr/vrgiureg.h>
-
-#include "locators.h"
-
-struct button_vrgiu_softc {
- struct device sc_dev;
- vrgiu_chipset_tag_t sc_gc;
- vrgiu_function_tag_t sc_gf;
- int sc_port;
- long sc_id;
- int sc_active;
- config_hook_tag sc_hook_tag;
- config_hook_tag sc_ghook_tag;
-};
-
-static int button_vrgiu_match __P((struct device *, struct cfdata *,
- void *));
-static void button_vrgiu_attach __P((struct device *, struct device *,
- void *));
-static int button_vrgiu_intr __P((void*));
-static int button_vrgiu_state __P((void *ctx, int type, long id,
- void *msg));
-
-struct cfattach button_vrgiu_ca = {
- sizeof(struct button_vrgiu_softc), button_vrgiu_match, button_vrgiu_attach
-};
-
-int
-button_vrgiu_match(parent, match, aux)
- struct device *parent;
- struct cfdata *match;
- void *aux;
-{
- platid_mask_t mask;
- struct gpbus_attach_args *gpa = aux;
-
- if (strcmp(gpa->gpa_busname, "gpbus"))
- return 0;
- if (match->cf_loc[NEWGPBUSIFCF_PLATFORM] == 0)
- return 0;
- mask = PLATID_DEREF(match->cf_loc[NEWGPBUSIFCF_PLATFORM]);
- return platid_match(&platid, &mask);
-}
-
-void
Home |
Main Index |
Thread Index |
Old Index