Home | History | Annotate | Line # | Download | only in include
      1 /* $NetBSD: adm5120_mainbusvar.h,v 1.2 2011/02/20 07:48:35 matt Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or
      8  * without modification, are permitted provided that the following
      9  * conditions are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above
     13  *    copyright notice, this list of conditions and the following
     14  *    disclaimer in the documentation and/or other materials provided
     15  *    with the distribution.
     16  * 3. The names of the authors may not be used to endorse or promote
     17  *    products derived from this software without specific prior
     18  *    written permission.
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY
     21  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     23  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS
     24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
     25  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
     27  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
     29  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     30  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
     31  * OF SUCH DAMAGE.
     32  */
     33 
     34 #ifndef _ADM5120_MAINBUSVAR_H_
     35 #define _ADM5120_MAINBUSVAR_H_
     36 
     37 #include <sys/types.h>
     38 #include <sys/gpio.h>
     39 #include <sys/ioctl.h>
     40 #include <dev/gpio/gpiovar.h>
     41 
     42 struct mainbus_attach_args {
     43 	const char		*ma_name;	/* name of device */
     44 	bus_dma_tag_t		ma_dmat;
     45 	bus_space_tag_t		ma_obiot;
     46 	bus_space_handle_t	ma_gpioh;
     47 	void			*ma_gpio;
     48 	int			ma_gpio_offset;
     49 	uint32_t		ma_gpio_mask;
     50 };
     51 
     52 struct mainbus_softc {
     53 	device_t		sc_dev;
     54 	bus_space_tag_t		sc_obiot;
     55 	bus_space_handle_t	sc_gpioh;
     56 	struct gpio_chipset_tag	sc_gp;
     57 	gpio_pin_t		sc_pins[8];
     58 	device_t		sc_gpio;
     59 };
     60 
     61 device_t admgpio_attach(struct mainbus_softc *);
     62 
     63 #endif /* _ADM5120_MAINBUSVAR_H_ */
     64