xref: /netbsd-src/sys/arch/hpcmips/vr/vripif.h (revision f8bc0014843c7e103917bd575c67f4c090eb9077)
1*f8bc0014Sigy /*	$NetBSD: vripif.h,v 1.4 2003/05/01 07:02:06 igy Exp $	*/
2a0584b29Stakemura 
3a0584b29Stakemura /*-
4a0584b29Stakemura  * Copyright (c) 1999, 2002
5a0584b29Stakemura  *         Shin Takemura and PocketBSD Project. All rights reserved.
6a0584b29Stakemura  *
7a0584b29Stakemura  * Redistribution and use in source and binary forms, with or without
8a0584b29Stakemura  * modification, are permitted provided that the following conditions
9a0584b29Stakemura  * are met:
10a0584b29Stakemura  * 1. Redistributions of source code must retain the above copyright
11a0584b29Stakemura  *    notice, this list of conditions and the following disclaimer.
12a0584b29Stakemura  * 2. Redistributions in binary form must reproduce the above copyright
13a0584b29Stakemura  *    notice, this list of conditions and the following disclaimer in the
14a0584b29Stakemura  *    documentation and/or other materials provided with the distribution.
15a0584b29Stakemura  * 3. Neither the name of the project nor the names of its contributors
16a0584b29Stakemura  *    may be used to endorse or promote products derived from this software
17a0584b29Stakemura  *    without specific prior written permission.
18a0584b29Stakemura  *
19a0584b29Stakemura  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20a0584b29Stakemura  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21a0584b29Stakemura  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22a0584b29Stakemura  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23a0584b29Stakemura  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24a0584b29Stakemura  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25a0584b29Stakemura  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26a0584b29Stakemura  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27a0584b29Stakemura  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28a0584b29Stakemura  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29a0584b29Stakemura  * SUCH DAMAGE.
30a0584b29Stakemura  *
31a0584b29Stakemura  */
32a0584b29Stakemura 
33a0584b29Stakemura #ifndef _VRIPIF_H_
34a0584b29Stakemura #define _VRIPIF_H_
35a0584b29Stakemura 
36a0584b29Stakemura #include <hpcmips/vr/cmuvar.h>
379f231495Stakemura #include <hpcmips/vr/vrdmaauvar.h>
389f231495Stakemura #include <hpcmips/vr/vrdcuvar.h>
39a0584b29Stakemura #include <dev/hpc/hpciovar.h>
40a0584b29Stakemura 
41a0584b29Stakemura /* Vrip GPIO chip IDs */
42a0584b29Stakemura enum vrip_iochip {
43a0584b29Stakemura 	VRIP_IOCHIP_VRGIU = 0,
44a0584b29Stakemura 	VRIP_IOCHIP_VRC4172GPIO,
45*f8bc0014Sigy 	VRIP_IOCHIP_VR4181GIU,
46a0584b29Stakemura 	VRIP_NIOCHIPS
47a0584b29Stakemura };
48a0584b29Stakemura 
49a0584b29Stakemura /*
50a0584b29Stakemura  * Vrip chipset
51a0584b29Stakemura  */
52a0584b29Stakemura typedef struct vrip_chipset_tag *vrip_chipset_tag_t;
53a0584b29Stakemura typedef void *vrip_intr_handle_t;
54a0584b29Stakemura struct vrip_chipset_tag {
55a0584b29Stakemura 	void *vc_sc;
56a0584b29Stakemura 	vrcmu_chipset_tag_t vc_cc;
579f231495Stakemura 	vrdmaau_chipset_tag_t vc_ac;
589f231495Stakemura 	vrdcu_chipset_tag_t vc_dc;
59a0584b29Stakemura 	int (*vc_power)(vrip_chipset_tag_t, int, int);
60a0584b29Stakemura 	vrip_intr_handle_t (*vc_intr_establish)(vrip_chipset_tag_t, int, int,
61a0584b29Stakemura 	    int, int(*)(void*), void*);
62a0584b29Stakemura 	void (*vc_intr_disestablish)(vrip_chipset_tag_t, vrip_intr_handle_t);
63a0584b29Stakemura 	void (*vc_intr_setmask1)(vrip_chipset_tag_t, vrip_intr_handle_t, int);
64a0584b29Stakemura 	void (*vc_intr_setmask2)(vrip_chipset_tag_t, vrip_intr_handle_t,
65a0584b29Stakemura 	    u_int32_t, int);
66a0584b29Stakemura 	void (*vc_intr_getstatus2)(vrip_chipset_tag_t, vrip_intr_handle_t,
67a0584b29Stakemura 	    u_int32_t*);
68a0584b29Stakemura 	void (*vc_register_cmu)(vrip_chipset_tag_t, vrcmu_chipset_tag_t);
69a0584b29Stakemura 	void (*vc_register_gpio)(vrip_chipset_tag_t, hpcio_chip_t);
709f231495Stakemura 	void (*vc_register_dmaau)(vrip_chipset_tag_t, vrdmaau_chipset_tag_t);
719f231495Stakemura 	void (*vc_register_dcu)(vrip_chipset_tag_t, vrdcu_chipset_tag_t);
72a0584b29Stakemura };
73a0584b29Stakemura 
74a0584b29Stakemura /*
75a0584b29Stakemura  * Vrip driver attach arguments.
76a0584b29Stakemura  */
77a0584b29Stakemura struct vrip_attach_args {
78a0584b29Stakemura 	vrip_chipset_tag_t	va_vc;		/* Chipset tag		*/
79a0584b29Stakemura 	int			va_unit;	/* unit id		*/
80a0584b29Stakemura 	bus_space_tag_t		va_iot;		/* i/o space tag	*/
81794600ceStakemura 	bus_space_handle_t	va_parent_ioh;	/* parent i/o space	*/
82a0584b29Stakemura 	bus_addr_t		va_addr;	/* i/o address		*/
83a0584b29Stakemura 	bus_size_t		va_size;
84a0584b29Stakemura 	bus_addr_t		va_addr2;	/* i/o address 2	*/
85a0584b29Stakemura 	bus_size_t		va_size2;
86a0584b29Stakemura 	hpcio_chip_t*		va_gpio_chips;
879f231495Stakemura 	vrcmu_chipset_tag_t	va_cc;
889f231495Stakemura 	vrdmaau_chipset_tag_t	va_ac;
899f231495Stakemura 	vrdcu_chipset_tag_t	va_dc;
90a0584b29Stakemura #ifdef HPCMIPS_NOT_YET
91a0584b29Stakemura 	bus_dma_tag_t va_dmat;	/* DMA tag */
92a0584b29Stakemura #endif
93a0584b29Stakemura };
94a0584b29Stakemura 
95a0584b29Stakemura /*
96a0584b29Stakemura  * Vrip methods
97a0584b29Stakemura  */
98a0584b29Stakemura #define vrip_power(vc, unit, onoff)					\
99a0584b29Stakemura 		((*(vc)->vc_power)((vc), (unit), (onoff)))
100a0584b29Stakemura #define vrip_intr_establish(vc, u, l, lv, fn, arg)			\
101a0584b29Stakemura 		((*(vc)->vc_intr_establish)((vc), (u), (l), (lv), (fn), (arg)))
102a0584b29Stakemura #define vrip_intr_disestablish(vc, handle)				\
103a0584b29Stakemura 		((*(vc)->vc_intr_disestablish)((vc), (handle)))
104a0584b29Stakemura #define vrip_intr_setmask1(vc, handle, enable)				\
105a0584b29Stakemura 		((*(vc)->vc_intr_setmask1)((vc), (handle), (enable)))
106a0584b29Stakemura #define vrip_intr_setmask2(vc, handle, mask, onoff)			\
107a0584b29Stakemura 		((*(vc)->vc_intr_setmask2)((vc), (handle), (mask), (onoff)))
108a0584b29Stakemura #define vrip_intr_getstatus2(vc, handle, status)			\
109a0584b29Stakemura 		((*(vc)->vc_intr_getstatus2)((vc), (handle), (status)))
110a0584b29Stakemura #define vrip_register_cmu(vc, cmu)					\
111a0584b29Stakemura 		((*(vc)->vc_register_cmu)((vc), (cmu)))
112a0584b29Stakemura #define vrip_register_gpio(vc, gpio)				\
113a0584b29Stakemura 		((*(vc)->vc_register_gpio)((vc), (gpio)))
1149f231495Stakemura #define vrip_register_dmaau(vc, dmaau)					\
1159f231495Stakemura 		((*(vc)->vc_register_dmaau)((vc), (dmaau)))
1169f231495Stakemura #define vrip_register_dcu(vc, dcu)					\
1179f231495Stakemura 		((*(vc)->vc_register_dcu)((vc), (dcu)))
118a0584b29Stakemura 
119a0584b29Stakemura #endif /* !_VRIPIF_H_ */
120