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

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

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

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

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

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

236 for (i = 0; i < sc->gpio_npins; i++) {
237 if (sc->gpio_pins[i].gp_pin == pin)
238 break;
239 }
240
241 if (i >= sc->gpio_npins)
242 return (EINVAL);
243
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/bus.h>
39
40#include <sys/kernel.h>
41#include <sys/module.h>
42#include <sys/rman.h>

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

236 for (i = 0; i < sc->gpio_npins; i++) {
237 if (sc->gpio_pins[i].gp_pin == pin)
238 break;
239 }
240
241 if (i >= sc->gpio_npins)
242 return (EINVAL);
243
244 /* Check for unwanted flags. */
245 if ((flags & sc->gpio_pins[i].gp_caps) != flags)
246 return (EINVAL);
247
248 /* Can't mix input/output together */
249 if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) ==
250 (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT))
251 return (EINVAL);
252
253 ar71xx_gpio_pin_configure(sc, &sc->gpio_pins[i], flags);
244 ar71xx_gpio_pin_configure(sc, &sc->gpio_pins[i], flags);
245
254 return (0);
255}
256
257static int
258ar71xx_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
259{
260 struct ar71xx_gpio_softc *sc = device_get_softc(dev);
261 int i;

--- 232 unchanged lines hidden ---
246 return (0);
247}
248
249static int
250ar71xx_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
251{
252 struct ar71xx_gpio_softc *sc = device_get_softc(dev);
253 int i;

--- 232 unchanged lines hidden ---