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