Deleted Added
full compact
rt305x_gpio.c (273799) rt305x_gpio.c (274670)
1/*-
2 * Copyright (c) 2010-2011, Aleksandr Rybalko <ray@ddteam.net>
3 * Copyright (c) 2009, Oleksandr Tymoshenko <gonzo@FreeBSD.org>
4 * Copyright (c) 2009, Luiz Otavio O Souza.
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 RT305X SoC.
32 */
33
34#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2010-2011, Aleksandr Rybalko <ray@ddteam.net>
3 * Copyright (c) 2009, Oleksandr Tymoshenko <gonzo@FreeBSD.org>
4 * Copyright (c) 2009, Luiz Otavio O Souza.
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 RT305X SoC.
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/mips/rt305x/rt305x_gpio.c 273799 2014-10-28 18:33:59Z loos $");
35__FBSDID("$FreeBSD: head/sys/mips/rt305x/rt305x_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>

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

237 for (i = 0; i < sc->gpio_npins; i++) {
238 if (sc->gpio_pins[i].gp_pin == pin)
239 break;
240 }
241
242 if (i >= sc->gpio_npins)
243 return (EINVAL);
244
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>

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

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

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

--- 353 unchanged lines hidden ---