xref: /netbsd-src/sys/arch/hpcmips/vr/vr4102ip.c (revision cbab9cadce21ae72fac13910001079fff214cc29)
1*cbab9cadSchs /*	$NetBSD: vr4102ip.c,v 1.9 2012/10/27 17:17:55 chs Exp $	*/
29f66659cStakemura 
39f66659cStakemura /*-
49f66659cStakemura  * Copyright (c) 2002 TAKEMURA Shin
59f66659cStakemura  * All rights reserved.
69f66659cStakemura  *
79f66659cStakemura  * Redistribution and use in source and binary forms, with or without
89f66659cStakemura  * modification, are permitted provided that the following conditions
99f66659cStakemura  * are met:
109f66659cStakemura  * 1. Redistributions of source code must retain the above copyright
119f66659cStakemura  *    notice, this list of conditions and the following disclaimer.
129f66659cStakemura  * 2. Redistributions in binary form must reproduce the above copyright
139f66659cStakemura  *    notice, this list of conditions and the following disclaimer in the
149f66659cStakemura  *    documentation and/or other materials provided with the distribution.
159f66659cStakemura  * 3. Neither the name of the project nor the names of its contributors
169f66659cStakemura  *    may be used to endorse or promote products derived from this software
179f66659cStakemura  *    without specific prior written permission.
189f66659cStakemura  *
199f66659cStakemura  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
209f66659cStakemura  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
219f66659cStakemura  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
229f66659cStakemura  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
239f66659cStakemura  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
249f66659cStakemura  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
259f66659cStakemura  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
269f66659cStakemura  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
279f66659cStakemura  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
289f66659cStakemura  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
299f66659cStakemura  * SUCH DAMAGE.
309f66659cStakemura  *
319f66659cStakemura  */
329f66659cStakemura 
330c82163cSlukem #include <sys/cdefs.h>
34*cbab9cadSchs __KERNEL_RCSID(0, "$NetBSD: vr4102ip.c,v 1.9 2012/10/27 17:17:55 chs Exp $");
350c82163cSlukem 
369f66659cStakemura #include <sys/param.h>
379f66659cStakemura #include <sys/systm.h>
38fb1e16b4Sad #include <sys/device.h>
39fb1e16b4Sad #include <sys/bus.h>
409f66659cStakemura 
4138e50940Stakemura #include "opt_vr41xx.h"
429f66659cStakemura #include <hpcmips/vr/vrcpudef.h>
439f66659cStakemura #include <hpcmips/vr/vripunit.h>
449f66659cStakemura #include <hpcmips/vr/vripreg.h>
459f66659cStakemura #include <hpcmips/vr/vripvar.h>
469f66659cStakemura #include <hpcmips/vr/icureg.h>
479f66659cStakemura #include <hpcmips/vr/cmureg.h>
489f66659cStakemura 
49*cbab9cadSchs void	vr4102ipattach(device_t, device_t, void *);
509f66659cStakemura 
51*cbab9cadSchs CFATTACH_DECL_NEW(vr4102ip, sizeof(struct vrip_softc),
52c5e91d44Sthorpej     vripmatch, vr4102ipattach, NULL, NULL);
539f66659cStakemura 
549f66659cStakemura static const struct vrip_unit vr4102ip_units[] = {
559f66659cStakemura 	[VRIP_UNIT_PMU] = { "pmu",
569f66659cStakemura 			    { VRIP_INTR_POWER,	VRIP_INTR_BAT,	},	},
579f66659cStakemura 	[VRIP_UNIT_RTC] = { "rtc",
589f66659cStakemura 			    { VRIP_INTR_RTCL1,	},		},
599f66659cStakemura 	[VRIP_UNIT_PIU] = { "piu",
609f66659cStakemura 			    { VRIP_INTR_PIU, },
619f66659cStakemura 			    VR4102_CMUMSKPIU,
629f66659cStakemura 			    ICUPIUINT_REG_W,	MPIUINT_REG_W	},
639f66659cStakemura 	[VRIP_UNIT_KIU] = { "kiu",
649f66659cStakemura 			    { VRIP_INTR_KIU,	},
659f66659cStakemura 			    VR4102_CMUMSKKIU,
669f66659cStakemura 			    VR4102_KIUINT_REG_W,VR4102_MKIUINT_REG_W	},
679f66659cStakemura 	[VRIP_UNIT_SIU] = { "siu",
689f66659cStakemura 			    { VRIP_INTR_SIU,	},		},
699f66659cStakemura 	[VRIP_UNIT_GIU] = { "giu",
709f66659cStakemura 			    { VRIP_INTR_GIU,	},
719f66659cStakemura 			    0,
729f66659cStakemura 			    VR4102_GIUINT_L_REG_W,VR4102_MGIUINT_L_REG_W,
739f66659cStakemura 			    VR4102_GIUINT_H_REG_W,VR4102_MGIUINT_H_REG_W},
749f66659cStakemura 	[VRIP_UNIT_LED] = { "led",
759f66659cStakemura 			    { VRIP_INTR_LED,	},		},
769f66659cStakemura 	[VRIP_UNIT_AIU] = { "aiu",
779f66659cStakemura 			    { VRIP_INTR_AIU,	},
789f66659cStakemura 			    VR4102_CMUMSKAIU,
799f66659cStakemura 			    VR4102_AIUINT_REG_W,VR4102_MAIUINT_REG_W	},
809f66659cStakemura 	[VRIP_UNIT_FIR] = { "fir",
819f66659cStakemura 			    { VRIP_INTR_FIR,	},
829f66659cStakemura 			    VR4102_CMUMSKFIR,
839f66659cStakemura 			    VR4102_FIRINT_REG_W,VR4102_MFIRINT_REG_W	},
849f66659cStakemura 	[VRIP_UNIT_DSIU]= { "dsiu",
859f66659cStakemura 			    { VRIP_INTR_DSIU,	},
869f66659cStakemura 			    VR4102_CMUMSKDSIU,
879f66659cStakemura 			    VR4102_DSIUINT_REG_W,VR4102_MDSIUINT_REG_W	},
889f66659cStakemura 	[VRIP_UNIT_BCU] = { "bcu",
899f66659cStakemura 			    { VRIP_INTR_BCU,	},
909f66659cStakemura 			    0,
919f66659cStakemura 			    VR4102_BCUINT_REG_W,VR4102_MBCUINT_REG_W	}
929f66659cStakemura };
939f66659cStakemura 
949f66659cStakemura void
vr4102ipattach(device_t parent,device_t self,void * aux)95*cbab9cadSchs vr4102ipattach(device_t parent, device_t self, void *aux)
969f66659cStakemura {
97*cbab9cadSchs 	struct vrip_softc *sc = device_private(self);
989f66659cStakemura 
999f66659cStakemura 	printf("\n");
1009f66659cStakemura 
1019f66659cStakemura 	sc->sc_units = vr4102ip_units;
1029f66659cStakemura 	sc->sc_nunits = sizeof(vr4102ip_units)/sizeof(struct vrip_unit);
1039f66659cStakemura 	sc->sc_icu_addr = VR4102_ICU_ADDR;
1049f66659cStakemura 	sc->sc_sysint2 = VR4102_SYSINT2_REG_W;
1059f66659cStakemura 	sc->sc_msysint2 = VR4102_MSYSINT2_REG_W;
1069f66659cStakemura 
1079f66659cStakemura 	vripattach_common(parent, self, aux);
1089f66659cStakemura }
109