From 38e509404e65757d968ce715b60af8e2736170c0 Mon Sep 17 00:00:00 2001 From: takemura Date: Mon, 11 Feb 2002 09:21:46 +0000 Subject: [PATCH] Added vr4122ip. --- sys/arch/hpcmips/conf/files.hpcmips | 12 ++-- sys/arch/hpcmips/dev/hpcapm.c | 12 ++-- sys/arch/hpcmips/hpcmips/mainbus.c | 5 +- sys/arch/hpcmips/vr/vr.c | 10 +-- sys/arch/hpcmips/vr/vr4102ip.c | 15 +--- sys/arch/hpcmips/vr/vr4122ip.c | 106 ++++++++++++++++++++++++++++ 6 files changed, 130 insertions(+), 30 deletions(-) create mode 100644 sys/arch/hpcmips/vr/vr4122ip.c diff --git a/sys/arch/hpcmips/conf/files.hpcmips b/sys/arch/hpcmips/conf/files.hpcmips index bff07972bb67..1eeb0115c3cf 100644 --- a/sys/arch/hpcmips/conf/files.hpcmips +++ b/sys/arch/hpcmips/conf/files.hpcmips @@ -1,4 +1,4 @@ -# $NetBSD: files.hpcmips,v 1.72 2002/02/11 07:55:50 takemura Exp $ +# $NetBSD: files.hpcmips,v 1.73 2002/02/11 09:21:46 takemura Exp $ # maxpartitions must be first item in files.${ARCH}. maxpartitions 8 @@ -109,12 +109,16 @@ include "dev/isa/files.isa" # Vr41xx integrated peripherals # device vripif { [addr=-1], [size=-1], [addr2=-1], [size2=-1], [unit=-1], [pwctl=-1], [platform = -1] } +define vrip_common +file arch/hpcmips/vr/vrip.c vrip_common needs-flag device vrip: vripif -attach vrip at mainbus +attach vrip at mainbus: vrip_common device vr4102ip: vripif -attach vr4102ip at mainbus -file arch/hpcmips/vr/vrip.c vrip|vr4102ip needs-flag +attach vr4102ip at mainbus: vrip_common file arch/hpcmips/vr/vr4102ip.c vr4102ip +device vr4122ip: vripif +attach vr4122ip at mainbus: vrip_common +file arch/hpcmips/vr/vr4122ip.c vr4122ip device vrbcu attach vrbcu at vripif diff --git a/sys/arch/hpcmips/dev/hpcapm.c b/sys/arch/hpcmips/dev/hpcapm.c index d5d4c1177efe..4a43951a09b8 100644 --- a/sys/arch/hpcmips/dev/hpcapm.c +++ b/sys/arch/hpcmips/dev/hpcapm.c @@ -1,4 +1,4 @@ -/* $NetBSD: hpcapm.c,v 1.10 2002/01/27 11:11:11 takemura Exp $ */ +/* $NetBSD: hpcapm.c,v 1.11 2002/02/11 09:21:47 takemura Exp $ */ /* * Copyright (c) 2000 Takemura Shin @@ -41,8 +41,8 @@ #include #include -#include "vrip.h" -#if NVRIP > 0 +#include "vrip_common.h" +#if NVRIP_COMMON > 0 #include #include #endif @@ -338,7 +338,7 @@ hpcapm_set_powstate(void *scx, u_int devid, u_int powstat) CONFIG_HOOK_PMEVENT_HARDPOWER, (void *)PWR_STANDBY); sc->power_state = APM_SYS_STANDBY; -#if NVRIP > 0 +#if NVRIP_COMMON > 0 if (platid_match(&platid, &platid_mask_CPU_MIPS_VR_41XX)) { /* * disable all interrupts except PIU interrupt @@ -378,7 +378,7 @@ hpcapm_set_powstate(void *scx, u_int devid, u_int powstat) CONFIG_HOOK_PMEVENT_HARDPOWER, (void *)PWR_SUSPEND); sc->power_state = APM_SYS_SUSPEND; -#if NVRIP > 0 +#if NVRIP_COMMON > 0 if (platid_match(&platid, &platid_mask_CPU_MIPS_VR_41XX)) { /* * disable all interrupts except PIU interrupt @@ -404,7 +404,7 @@ hpcapm_set_powstate(void *scx, u_int devid, u_int powstat) vrip_intr_resume(); delay(1000); /* 1msec */ } -#endif /* NVRIP > 0 */ +#endif /* NVRIP_COMMON > 0 */ #ifdef TX39XX if (platid_match(&platid, &platid_mask_CPU_MIPS_TX)) { tx39power_suspend_cpu(); diff --git a/sys/arch/hpcmips/hpcmips/mainbus.c b/sys/arch/hpcmips/hpcmips/mainbus.c index 89775527f9b6..2724af03fff5 100644 --- a/sys/arch/hpcmips/hpcmips/mainbus.c +++ b/sys/arch/hpcmips/hpcmips/mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.18 2002/02/11 07:55:50 takemura Exp $ */ +/* $NetBSD: mainbus.c,v 1.19 2002/02/11 09:21:47 takemura Exp $ */ /*- * Copyright (c) 1999 @@ -73,7 +73,8 @@ mainbus_attach(struct device *parent, struct device *self, void *aux) { static const char *devnames[] = { /* ATTACH ORDER */ "cpu", /* 1. CPU */ - "vrip", "vr4102ip", "txsim", /* 2. System BUS */ + "vrip", "vr4102ip", "vr4122ip", /* 2. System BUS */ + "txsim", "bivideo", "btnmgr", "hpcapm", /* 3. misc */ }; struct mainbus_attach_args ma; diff --git a/sys/arch/hpcmips/vr/vr.c b/sys/arch/hpcmips/vr/vr.c index 48f876da9302..e6a3422b0b8c 100644 --- a/sys/arch/hpcmips/vr/vr.c +++ b/sys/arch/hpcmips/vr/vr.c @@ -1,4 +1,4 @@ -/* $NetBSD: vr.c,v 1.37 2002/02/10 14:38:57 takemura Exp $ */ +/* $NetBSD: vr.c,v 1.38 2002/02/11 09:21:47 takemura Exp $ */ /*- * Copyright (c) 1999-2002 @@ -59,8 +59,8 @@ #include #include -#include "vrip.h" -#if NVRIP > 0 +#include "vrip_common.h" +#if NVRIP_COMMON > 0 #include #endif @@ -451,7 +451,7 @@ vr_reboot(int howto, char *bootstr) * halt */ if (howto & RB_HALT) { -#if NVRIP > 0 +#if NVRIP_COMMON > 0 _spllower(~MIPS_INT_MASK_0); vrip_intr_suspend(); #else @@ -465,7 +465,7 @@ vr_reboot(int howto, char *bootstr) __asm("nop"); __asm("nop"); __asm(".set reorder"); -#if NVRIP > 0 +#if NVRIP_COMMON > 0 vrip_intr_resume(); #endif } diff --git a/sys/arch/hpcmips/vr/vr4102ip.c b/sys/arch/hpcmips/vr/vr4102ip.c index 513a66e3da7c..0d21e3942c58 100644 --- a/sys/arch/hpcmips/vr/vr4102ip.c +++ b/sys/arch/hpcmips/vr/vr4102ip.c @@ -1,4 +1,4 @@ -/* $NetBSD: vr4102ip.c,v 1.2 2002/02/11 08:15:41 takemura Exp $ */ +/* $NetBSD: vr4102ip.c,v 1.3 2002/02/11 09:21:47 takemura Exp $ */ /*- * Copyright (c) 2002 TAKEMURA Shin @@ -29,31 +29,20 @@ * SUCH DAMAGE. * */ -#include "opt_vr41xx.h" -#include "opt_tx39xx.h" #include #include -#include -#include -#include #include -#include -#include -#include -#include +#include "opt_vr41xx.h" #include #include -#include #include #include #include #include -#include "locators.h" -int vr4102ipmatch(struct device *, struct cfdata *, void *); void vr4102ipattach(struct device *, struct device *, void *); struct cfattach vr4102ip_ca = { diff --git a/sys/arch/hpcmips/vr/vr4122ip.c b/sys/arch/hpcmips/vr/vr4122ip.c new file mode 100644 index 000000000000..cbe6d080e6e5 --- /dev/null +++ b/sys/arch/hpcmips/vr/vr4122ip.c @@ -0,0 +1,106 @@ +/* $NetBSD: vr4122ip.c,v 1.1 2002/02/11 09:21:47 takemura Exp $ */ + +/*- + * Copyright (c) 2002 TAKEMURA Shin + * 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. 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 +#include + +#include + +#include "opt_vr41xx.h" +#include +#include +#include +#include +#include +#include + +void vr4122ipattach(struct device *, struct device *, void *); + +struct cfattach vr4122ip_ca = { + sizeof(struct vrip_softc), vripmatch, vr4122ipattach +}; + +static const struct vrip_unit vr4122ip_units[] = { + [VRIP_UNIT_PMU] = { "pmu", + { VRIP_INTR_POWER, VRIP_INTR_BAT, }, }, + [VRIP_UNIT_RTC] = { "rtc", + { VRIP_INTR_RTCL1, }, }, + [VRIP_UNIT_SIU] = { "siu", + { VRIP_INTR_SIU, }, }, + [VRIP_UNIT_GIU] = { "giu", + { VRIP_INTR_GIU, }, + 0, + VR4122_GIUINT_L_REG_W,VR4122_MGIUINT_L_REG_W, + VR4122_GIUINT_H_REG_W,VR4122_MGIUINT_H_REG_W}, + [VRIP_UNIT_LED] = { "led", + { VRIP_INTR_LED, }, }, + [VRIP_UNIT_FIR] = { "fir", + { VRIP_INTR_FIR, }, + VR4122_CMUMSKFIR, + VR4122_FIRINT_REG_W,VR4122_MFIRINT_REG_W }, + [VRIP_UNIT_DSIU]= { "dsiu", + { VRIP_INTR_DSIU, }, + VR4122_CMUMSKDSIU, + VR4122_DSIUINT_REG_W,VR4122_MDSIUINT_REG_W }, + [VRIP_UNIT_PCIU]= { "pciu", + { VRIP_INTR_PCI, }, + CMUMASK_PCIU, + PCIINT_REG_W, MPCIINT_REG_W }, + [VRIP_UNIT_SCU] = { "scu", + { VRIP_INTR_SCU, }, + 0, + SCUINT_REG_W, MSCUINT_REG_W }, + [VRIP_UNIT_CSI] = { "csi", + { VRIP_INTR_CSI, }, + CMUMASK_CSI, + CSIINT_REG_W, MCSIINT_REG_W }, + [VRIP_UNIT_BCU] = { "bcu", + { VRIP_INTR_BCU, }, + 0, + VR4122_BCUINT_REG_W,VR4122_MBCUINT_REG_W } +}; + +void +vr4122ipattach(struct device *parent, struct device *self, void *aux) +{ + struct vrip_softc *sc = (struct vrip_softc*)self; + + printf("\n"); + + sc->sc_units = vr4122ip_units; + sc->sc_nunits = sizeof(vr4122ip_units)/sizeof(struct vrip_unit); + sc->sc_icu_addr = VR4122_ICU_ADDR; + sc->sc_sysint2 = VR4122_SYSINT2_REG_W; + sc->sc_msysint2 = VR4122_MSYSINT2_REG_W; + + vripattach_common(parent, self, aux); +}