Deleted Added
full compact
bcm2835_gpio.c (274669) bcm2835_gpio.c (274670)
1/*-
2 * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
3 * Copyright (c) 2012 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:

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

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
3 * Copyright (c) 2012 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:

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

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 */
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c 274669 2014-11-18 17:07:02Z imp $");
29__FBSDID("$FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c 274670 2014-11-18 17:22:08Z loos $");
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/bus.h>
34
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/rman.h>

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

392
393 if (i >= sc->sc_gpio_npins)
394 return (EINVAL);
395
396 /* We never touch on read-only/reserved pins. */
397 if (bcm_gpio_pin_is_ro(sc, pin))
398 return (EINVAL);
399
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/bus.h>
34
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/rman.h>

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

392
393 if (i >= sc->sc_gpio_npins)
394 return (EINVAL);
395
396 /* We never touch on read-only/reserved pins. */
397 if (bcm_gpio_pin_is_ro(sc, pin))
398 return (EINVAL);
399
400 /* Check for unwanted flags. */
401 if ((flags & sc->sc_gpio_pins[i].gp_caps) != flags)
402 return (EINVAL);
403
404 /* Can't mix input/output together. */
405 if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) ==
406 (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT))
407 return (EINVAL);
408
409 /* Can't mix pull-up/pull-down together. */
410 if ((flags & (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN)) ==
411 (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN))
412 return (EINVAL);
413
414 bcm_gpio_pin_configure(sc, &sc->sc_gpio_pins[i], flags);
415
416 return (0);
417}
418
419static int
420bcm_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
421{

--- 385 unchanged lines hidden ---
400 bcm_gpio_pin_configure(sc, &sc->sc_gpio_pins[i], flags);
401
402 return (0);
403}
404
405static int
406bcm_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
407{

--- 385 unchanged lines hidden ---