Home | History | Annotate | Line # | Download | only in include
      1 /* $NetBSD: adm5120_extiovar.h,v 1.4 2012/10/27 17:18:01 chs 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  *
     16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
     17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     18  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     19  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR
     20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
     21  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     22  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
     23  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
     25  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     26  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
     27  * OF SUCH DAMAGE.
     28  */
     29 #ifndef _ADM5120_EXTIOVAR_H_
     30 #define _ADM5120_EXTIOVAR_H_
     31 
     32 #include <sys/device.h>
     33 #include <sys/types.h>
     34 #include <sys/gpio.h>
     35 #include <sys/ioctl.h>
     36 #include <dev/gpio/gpiovar.h>
     37 
     38 struct extio_attach_args {
     39 	const char	*ea_name;	/* name of device */
     40 	bus_space_tag_t	ea_st;
     41 	bus_addr_t	ea_addr;	/* address of device */
     42 	int		ea_irq;		/* interrupt bit # */
     43 	void		*ea_gpio;
     44 	int		ea_gpio_offset;
     45 	uint32_t	ea_gpio_mask;
     46 	int		ea_cfio;
     47 };
     48 
     49 struct extio_softc {
     50 	device_t		sc_dev;
     51 	bus_space_tag_t		sc_obiot;
     52 	bus_space_handle_t	sc_gpioh;
     53 	bus_space_handle_t	sc_mpmch;
     54 	device_t		sc_gpio;
     55 	int			sc_map[5];
     56 	struct gpio_pinmap	sc_pm;
     57 	struct mips_bus_space	sc_cfio;
     58 };
     59 
     60 void cfio_bus_mem_init(bus_space_tag_t, bus_space_tag_t);
     61 void extio_bus_mem_init(bus_space_tag_t, void *);
     62 
     63 #endif /* _ADM5120_EXTIOVAR_H_ */
     64