Deleted Added
full compact
vf_gpio.c (273799) vf_gpio.c (274670)
1/*-
2 * Copyright (c) 2013 Ruslan Bukin <br@bsdpad.com>
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 */
26
27/*
28 * Vybrid Family General-Purpose Input/Output (GPIO)
29 * Chapter 7, Vybrid Reference Manual, Rev. 5, 07/2013
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2013 Ruslan Bukin <br@bsdpad.com>
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 */
26
27/*
28 * Vybrid Family General-Purpose Input/Output (GPIO)
29 * Chapter 7, Vybrid Reference Manual, Rev. 5, 07/2013
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/arm/freescale/vybrid/vf_gpio.c 273799 2014-10-28 18:33:59Z loos $");
33__FBSDID("$FreeBSD: head/sys/arm/freescale/vybrid/vf_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#include <sys/kernel.h>
39#include <sys/module.h>
40#include <sys/malloc.h>
41#include <sys/rman.h>

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

307 for (i = 0; i < sc->gpio_npins; i++) {
308 if (sc->gpio_pins[i].gp_pin == pin)
309 break;
310 }
311
312 if (i >= sc->gpio_npins)
313 return (EINVAL);
314
34
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/bus.h>
38#include <sys/kernel.h>
39#include <sys/module.h>
40#include <sys/malloc.h>
41#include <sys/rman.h>

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

307 for (i = 0; i < sc->gpio_npins; i++) {
308 if (sc->gpio_pins[i].gp_pin == pin)
309 break;
310 }
311
312 if (i >= sc->gpio_npins)
313 return (EINVAL);
314
315 /* Check for unwanted flags. */
316 if ((flags & sc->gpio_pins[i].gp_caps) != flags)
317 return (EINVAL);
318
319 /* Can't mix input/output together */
320 if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) ==
321 (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT))
322 return (EINVAL);
323
324 vf_gpio_pin_configure(sc, &sc->gpio_pins[i], flags);
325
326 return (0);
327}
328
329static int
330vf_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
331{

--- 47 unchanged lines hidden ---
315 vf_gpio_pin_configure(sc, &sc->gpio_pins[i], flags);
316
317 return (0);
318}
319
320static int
321vf_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
322{

--- 47 unchanged lines hidden ---