1228925Sgonzo/*- 2228925Sgonzo * Copyright (c) 2011, Oleksandr Tymoshenko <gonzo@FreeBSD.org> 3228925Sgonzo * All rights reserved. 4228925Sgonzo * 5228925Sgonzo * Redistribution and use in source and binary forms, with or without 6228925Sgonzo * modification, are permitted provided that the following conditions 7228925Sgonzo * are met: 8228925Sgonzo * 1. Redistributions of source code must retain the above copyright 9228925Sgonzo * notice unmodified, this list of conditions, and the following 10228925Sgonzo * disclaimer. 11228925Sgonzo * 2. Redistributions in binary form must reproduce the above copyright 12228925Sgonzo * notice, this list of conditions and the following disclaimer in the 13228925Sgonzo * documentation and/or other materials provided with the distribution. 14228925Sgonzo * 15228925Sgonzo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16228925Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17228925Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18228925Sgonzo * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19228925Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20228925Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21228925Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22228925Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23228925Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24228925Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25228925Sgonzo * SUCH DAMAGE. 26228925Sgonzo * 27228925Sgonzo * $FreeBSD: releng/10.3/sys/mips/cavium/octeon_gpiovar.h 228925 2011-12-28 05:57:03Z gonzo $ 28228925Sgonzo * 29228925Sgonzo */ 30228925Sgonzo 31228925Sgonzo#ifndef __OCTEON_GPIOVAR_H__ 32228925Sgonzo#define __OCTEON_GPIOVAR_H__ 33228925Sgonzo 34228925Sgonzo#define GPIO_LOCK(_sc) mtx_lock(&(_sc)->gpio_mtx) 35228925Sgonzo#define GPIO_UNLOCK(_sc) mtx_unlock(&(_sc)->gpio_mtx) 36228925Sgonzo#define GPIO_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->gpio_mtx, MA_OWNED) 37228925Sgonzo 38228925Sgonzo#define OCTEON_GPIO_IRQ_LEVEL 0 39228925Sgonzo#define OCTEON_GPIO_IRQ_EDGE 1 40228925Sgonzo 41228925Sgonzo#define OCTEON_GPIO_PINS 24 42228925Sgonzo#define OCTEON_GPIO_IRQS 16 43228925Sgonzo 44228925Sgonzostruct octeon_gpio_softc { 45228925Sgonzo device_t dev; 46228925Sgonzo struct mtx gpio_mtx; 47228925Sgonzo struct resource *gpio_irq_res[OCTEON_GPIO_IRQS]; 48228925Sgonzo int gpio_irq_rid[OCTEON_GPIO_IRQS]; 49228925Sgonzo void *gpio_ih[OCTEON_GPIO_IRQS]; 50228925Sgonzo void *gpio_intr_cookies[OCTEON_GPIO_IRQS]; 51228925Sgonzo int gpio_npins; 52228925Sgonzo struct gpio_pin gpio_pins[OCTEON_GPIO_PINS]; 53228925Sgonzo}; 54228925Sgonzo 55228925Sgonzo#endif /* __OCTEON_GPIOVAR_H__ */ 56