1*cbab9cadSchs /* $NetBSD: vr4122ip.c,v 1.8 2012/10/27 17:17:55 chs Exp $ */
238e50940Stakemura
338e50940Stakemura /*-
438e50940Stakemura * Copyright (c) 2002 TAKEMURA Shin
538e50940Stakemura * All rights reserved.
638e50940Stakemura *
738e50940Stakemura * Redistribution and use in source and binary forms, with or without
838e50940Stakemura * modification, are permitted provided that the following conditions
938e50940Stakemura * are met:
1038e50940Stakemura * 1. Redistributions of source code must retain the above copyright
1138e50940Stakemura * notice, this list of conditions and the following disclaimer.
1238e50940Stakemura * 2. Redistributions in binary form must reproduce the above copyright
1338e50940Stakemura * notice, this list of conditions and the following disclaimer in the
1438e50940Stakemura * documentation and/or other materials provided with the distribution.
1538e50940Stakemura * 3. Neither the name of the project nor the names of its contributors
1638e50940Stakemura * may be used to endorse or promote products derived from this software
1738e50940Stakemura * without specific prior written permission.
1838e50940Stakemura *
1938e50940Stakemura * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2038e50940Stakemura * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2138e50940Stakemura * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2238e50940Stakemura * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2338e50940Stakemura * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2438e50940Stakemura * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2538e50940Stakemura * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2638e50940Stakemura * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2738e50940Stakemura * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2838e50940Stakemura * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2938e50940Stakemura * SUCH DAMAGE.
3038e50940Stakemura *
3138e50940Stakemura */
3238e50940Stakemura
330c82163cSlukem #include <sys/cdefs.h>
34*cbab9cadSchs __KERNEL_RCSID(0, "$NetBSD: vr4122ip.c,v 1.8 2012/10/27 17:17:55 chs Exp $");
350c82163cSlukem
3638e50940Stakemura #include <sys/param.h>
3738e50940Stakemura #include <sys/systm.h>
38fb1e16b4Sad #include <sys/device.h>
39fb1e16b4Sad #include <sys/bus.h>
4038e50940Stakemura
4138e50940Stakemura #include "opt_vr41xx.h"
4238e50940Stakemura #include <hpcmips/vr/vrcpudef.h>
4338e50940Stakemura #include <hpcmips/vr/vripunit.h>
4438e50940Stakemura #include <hpcmips/vr/vripreg.h>
4538e50940Stakemura #include <hpcmips/vr/vripvar.h>
4638e50940Stakemura #include <hpcmips/vr/icureg.h>
4738e50940Stakemura #include <hpcmips/vr/cmureg.h>
4838e50940Stakemura
49*cbab9cadSchs void vr4122ipattach(device_t, device_t, void *);
5038e50940Stakemura
51*cbab9cadSchs CFATTACH_DECL_NEW(vr4122ip, sizeof(struct vrip_softc),
52c5e91d44Sthorpej vripmatch, vr4122ipattach, NULL, NULL);
5338e50940Stakemura
5438e50940Stakemura static const struct vrip_unit vr4122ip_units[] = {
5538e50940Stakemura [VRIP_UNIT_PMU] = { "pmu",
5638e50940Stakemura { VRIP_INTR_POWER, VRIP_INTR_BAT, }, },
5738e50940Stakemura [VRIP_UNIT_RTC] = { "rtc",
5838e50940Stakemura { VRIP_INTR_RTCL1, }, },
5938e50940Stakemura [VRIP_UNIT_SIU] = { "siu",
6038e50940Stakemura { VRIP_INTR_SIU, }, },
6138e50940Stakemura [VRIP_UNIT_GIU] = { "giu",
6238e50940Stakemura { VRIP_INTR_GIU, },
6338e50940Stakemura 0,
6438e50940Stakemura VR4122_GIUINT_L_REG_W,VR4122_MGIUINT_L_REG_W,
6538e50940Stakemura VR4122_GIUINT_H_REG_W,VR4122_MGIUINT_H_REG_W},
6638e50940Stakemura [VRIP_UNIT_LED] = { "led",
6738e50940Stakemura { VRIP_INTR_LED, }, },
6838e50940Stakemura [VRIP_UNIT_FIR] = { "fir",
6938e50940Stakemura { VRIP_INTR_FIR, },
7038e50940Stakemura VR4122_CMUMSKFIR,
7138e50940Stakemura VR4122_FIRINT_REG_W,VR4122_MFIRINT_REG_W },
7238e50940Stakemura [VRIP_UNIT_DSIU]= { "dsiu",
7338e50940Stakemura { VRIP_INTR_DSIU, },
7438e50940Stakemura VR4122_CMUMSKDSIU,
7538e50940Stakemura VR4122_DSIUINT_REG_W,VR4122_MDSIUINT_REG_W },
7638e50940Stakemura [VRIP_UNIT_PCIU]= { "pciu",
7738e50940Stakemura { VRIP_INTR_PCI, },
7847c249a1Stakemura VR4122_CMUMSKPCIU,
7947c249a1Stakemura VR4122_PCIINT_REG_W,VR4122_MPCIINT_REG_W },
8038e50940Stakemura [VRIP_UNIT_SCU] = { "scu",
8138e50940Stakemura { VRIP_INTR_SCU, },
8238e50940Stakemura 0,
8347c249a1Stakemura VR4122_SCUINT_REG_W,VR4122_MSCUINT_REG_W },
8438e50940Stakemura [VRIP_UNIT_CSI] = { "csi",
8538e50940Stakemura { VRIP_INTR_CSI, },
8647c249a1Stakemura VR4122_CMUMSKCSI,
8747c249a1Stakemura VR4122_CSIINT_REG_W,VR4122_MCSIINT_REG_W },
8838e50940Stakemura [VRIP_UNIT_BCU] = { "bcu",
8938e50940Stakemura { VRIP_INTR_BCU, },
9038e50940Stakemura 0,
9138e50940Stakemura VR4122_BCUINT_REG_W,VR4122_MBCUINT_REG_W }
9238e50940Stakemura };
9338e50940Stakemura
9438e50940Stakemura void
vr4122ipattach(device_t parent,device_t self,void * aux)95*cbab9cadSchs vr4122ipattach(device_t parent, device_t self, void *aux)
9638e50940Stakemura {
97*cbab9cadSchs struct vrip_softc *sc = device_private(self);
9838e50940Stakemura
9938e50940Stakemura printf("\n");
10038e50940Stakemura
10138e50940Stakemura sc->sc_units = vr4122ip_units;
10238e50940Stakemura sc->sc_nunits = sizeof(vr4122ip_units)/sizeof(struct vrip_unit);
10338e50940Stakemura sc->sc_icu_addr = VR4122_ICU_ADDR;
10438e50940Stakemura sc->sc_sysint2 = VR4122_SYSINT2_REG_W;
10538e50940Stakemura sc->sc_msysint2 = VR4122_MSYSINT2_REG_W;
10638e50940Stakemura
10738e50940Stakemura vripattach_common(parent, self, aux);
10838e50940Stakemura }
109