Deleted Added
full compact
octeon_gpio.c (273799) octeon_gpio.c (274670)
1/*-
2 * Copyright (c) 2011, Oleksandr Tymoshenko <gonzo@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

25 * SUCH DAMAGE.
26 */
27
28/*
29 * GPIO driver for Cavium Octeon
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2011, Oleksandr Tymoshenko <gonzo@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

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

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

214 for (i = 0; i < sc->gpio_npins; i++) {
215 if (sc->gpio_pins[i].gp_pin == pin)
216 break;
217 }
218
219 if (i >= sc->gpio_npins)
220 return (EINVAL);
221
34
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/bus.h>
38
39#include <sys/kernel.h>
40#include <sys/module.h>
41#include <sys/rman.h>

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

214 for (i = 0; i < sc->gpio_npins; i++) {
215 if (sc->gpio_pins[i].gp_pin == pin)
216 break;
217 }
218
219 if (i >= sc->gpio_npins)
220 return (EINVAL);
221
222 /* Check for unwanted flags. */
223 if ((flags & sc->gpio_pins[i].gp_caps) != flags)
224 return (EINVAL);
225
226 /* Can't mix input/output together */
227 if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) ==
228 (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT))
229 return (EINVAL);
230
231 octeon_gpio_pin_configure(sc, &sc->gpio_pins[i], flags);
222 octeon_gpio_pin_configure(sc, &sc->gpio_pins[i], flags);
223
232 return (0);
233}
234
235static int
236octeon_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
237{
238 struct octeon_gpio_softc *sc = device_get_softc(dev);
239 int i;

--- 255 unchanged lines hidden ---
224 return (0);
225}
226
227static int
228octeon_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
229{
230 struct octeon_gpio_softc *sc = device_get_softc(dev);
231 int i;

--- 255 unchanged lines hidden ---