Deleted Added
full compact
avila_gpio.c (273799) avila_gpio.c (274670)
1/*-
2 * Copyright (c) 2009, Oleksandr Tymoshenko <gonzo@FreeBSD.org>
3 * Copyright (c) 2009, Luiz Otavio O Souza.
4 * Copyright (c) 2010, Andrew Thompson <thompsa@FreeBSD.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 18 unchanged lines hidden (view full) ---

27 * SUCH DAMAGE.
28 */
29
30/*
31 * GPIO driver for Gateworks Avilia
32 */
33
34#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2009, Oleksandr Tymoshenko <gonzo@FreeBSD.org>
3 * Copyright (c) 2009, Luiz Otavio O Souza.
4 * Copyright (c) 2010, Andrew Thompson <thompsa@FreeBSD.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 18 unchanged lines hidden (view full) ---

27 * SUCH DAMAGE.
28 */
29
30/*
31 * GPIO driver for Gateworks Avilia
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/arm/xscale/ixp425/avila_gpio.c 273799 2014-10-28 18:33:59Z loos $");
35__FBSDID("$FreeBSD: head/sys/arm/xscale/ixp425/avila_gpio.c 274670 2014-11-18 17:22:08Z loos $");
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/bus.h>
40
41#include <sys/kernel.h>
42#include <sys/module.h>
43#include <sys/rman.h>

--- 171 unchanged lines hidden (view full) ---

215avila_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
216{
217 struct avila_gpio_softc *sc = device_get_softc(dev);
218 uint32_t mask = 1 << pin;
219
220 if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & mask))
221 return (EINVAL);
222
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/bus.h>
40
41#include <sys/kernel.h>
42#include <sys/module.h>
43#include <sys/rman.h>

--- 171 unchanged lines hidden (view full) ---

215avila_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
216{
217 struct avila_gpio_softc *sc = device_get_softc(dev);
218 uint32_t mask = 1 << pin;
219
220 if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & mask))
221 return (EINVAL);
222
223 /* Check for unwanted flags. */
224 if ((flags & sc->sc_pins[pin].gp_caps) != flags)
225 return (EINVAL);
226
227 /* Can't mix input/output together */
228 if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) ==
229 (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT))
230 return (EINVAL);
231
232 avila_gpio_pin_configure(sc, &sc->sc_pins[pin], flags);
223 avila_gpio_pin_configure(sc, &sc->sc_pins[pin], flags);
224
233 return (0);
234}
235
236static int
237avila_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
238{
239 struct avila_gpio_softc *sc = device_get_softc(dev);
240 uint32_t mask = 1 << pin;

--- 126 unchanged lines hidden ---
225 return (0);
226}
227
228static int
229avila_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
230{
231 struct avila_gpio_softc *sc = device_get_softc(dev);
232 uint32_t mask = 1 << pin;

--- 126 unchanged lines hidden ---