167754Smsmith/*-
267754Smsmith * Copyright (c) 2011
367754Smsmith *	Ben Gray <ben.r.gray@gmail.com>.
467754Smsmith * All rights reserved.
571867Smsmith *
667754Smsmith * Redistribution and use in source and binary forms, with or without
767754Smsmith * modification, are permitted provided that the following conditions
867754Smsmith * are met:
967754Smsmith * 1. Redistributions of source code must retain the above copyright
1067754Smsmith *    notice, this list of conditions and the following disclaimer.
1167754Smsmith * 2. Redistributions in binary form must reproduce the above copyright
1267754Smsmith *    notice, this list of conditions and the following disclaimer in the
1371867Smsmith *    documentation and/or other materials provided with the distribution.
1470243Smsmith *
1567754Smsmith * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1667754Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1767754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1867754Smsmith * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
1967754Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2067754Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2167754Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2267754Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2367754Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2467754Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2567754Smsmith * SUCH DAMAGE.
2667754Smsmith */
2767754Smsmith
2867754Smsmith#ifndef TI_GPIO_H
2967754Smsmith#define	TI_GPIO_H
3067754Smsmith
3167754Smsmith/* The maximum number of banks for any SoC */
3267754Smsmith#define	MAX_GPIO_BANKS			6
3367754Smsmith
3467754Smsmith/*
3567754Smsmith * Maximum GPIOS possible, max of *_MAX_GPIO_BANKS * *_INTR_PER_BANK.
3667754Smsmith * These are defined in ti_gpio.c
3767754Smsmith */
3867754Smsmith#define	MAX_GPIO_INTRS			8
3967754Smsmith
4067754Smsmithstruct ti_gpio_irqsrc {
4167754Smsmith	struct intr_irqsrc	tgi_isrc;
4267754Smsmith	u_int			tgi_irq;
4367754Smsmith	uint32_t		tgi_mask;
4467754Smsmith	uint32_t		tgi_mode;
4567754Smsmith};
4667754Smsmith
4767754Smsmith/**
4867754Smsmith *	Structure that stores the driver context.
4967754Smsmith *
5067754Smsmith *	This structure is allocated during driver attach.
5167754Smsmith */
5267754Smsmithstruct ti_gpio_softc {
5367754Smsmith	device_t		sc_dev;
5467754Smsmith	device_t		sc_busdev;
5567754Smsmith	int			sc_bank;
5667754Smsmith	int			sc_maxpin;
5767754Smsmith	struct mtx		sc_mtx;
5867754Smsmith
5967754Smsmith	int			sc_mem_rid;
6067754Smsmith	struct resource		*sc_mem_res;
6167754Smsmith	int			sc_irq_rid;
6267754Smsmith	struct resource		*sc_irq_res;
6367754Smsmith	struct ti_gpio_irqsrc	*sc_isrcs;
6467754Smsmith	/* The handle for the register IRQ handlers. */
6567754Smsmith	void			*sc_irq_hdl;
6667754Smsmith};
6767754Smsmith
6867754Smsmith#endif /* TI_GPIO_H */
6967754Smsmith