xref: /netbsd-src/sys/arch/mips/adm5120/include/adm5120_extiovar.h (revision c8da0e5fefd3800856b306200a18b2315c7fbb9f)
1 /* $NetBSD: adm5120_extiovar.h,v 1.2 2008/01/15 22:22:37 dyoung Exp $ */
2 
3 /*-
4  * Copyright (c) 2007 David Young.  All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or
7  * without modification, are permitted provided that the following
8  * conditions are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above
12  *    copyright notice, this list of conditions and the following
13  *    disclaimer in the documentation and/or other materials provided
14  *    with the distribution.
15  * 3. The name of the author may not be used to endorse or promote
16  *    products derived from this software without specific prior
17  *    written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
20  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
26  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
28  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
30  * OF SUCH DAMAGE.
31  */
32 #ifndef _ADM5120_EXTIOVAR_H_
33 #define _ADM5120_EXTIOVAR_H_
34 
35 #include <sys/device.h>
36 #include <sys/types.h>
37 #include <sys/gpio.h>
38 #include <sys/ioctl.h>
39 #include <dev/gpio/gpiovar.h>
40 
41 struct extio_attach_args {
42 	const char	*ea_name;	/* name of device */
43 	bus_space_tag_t	ea_st;
44 	bus_addr_t	ea_addr;	/* address of device */
45 	int		ea_irq;		/* interrupt bit # */
46 	void		*ea_gpio;
47 	int		ea_gpio_offset;
48 	uint32_t	ea_gpio_mask;
49 	int		ea_cfio;
50 };
51 
52 struct extio_softc {
53 	struct device		sc_dev;
54 	bus_space_tag_t		sc_obiot;
55 	bus_space_handle_t	sc_gpioh;
56 	bus_space_handle_t	sc_mpmch;
57 	device_t		sc_gpio;
58 	int			sc_map[5];
59 	struct gpio_pinmap	sc_pm;
60 	struct mips_bus_space	sc_cfio;
61 };
62 
63 void cfio_bus_mem_init(bus_space_tag_t, bus_space_tag_t);
64 void extio_bus_mem_init(bus_space_tag_t, void *);
65 
66 #endif /* _ADM5120_EXTIOVAR_H_ */
67