Deleted Added
full compact
cambria_gpio.c (273799) cambria_gpio.c (274670)
1/*-
2 * Copyright (c) 2010, Andrew Thompson <thompsa@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

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

34 * times out and not write our latch. To get around this we grab the iicbus and
35 * then do our own bit banging. This is a comprimise to changing all the iicbb
36 * device methods to allow a flag to be passed down and is similir to how Linux
37 * does it.
38 *
39 */
40
41#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2010, Andrew Thompson <thompsa@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

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

34 * times out and not write our latch. To get around this we grab the iicbus and
35 * then do our own bit banging. This is a comprimise to changing all the iicbb
36 * device methods to allow a flag to be passed down and is similir to how Linux
37 * does it.
38 *
39 */
40
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: head/sys/arm/xscale/ixp425/cambria_gpio.c 273799 2014-10-28 18:33:59Z loos $");
42__FBSDID("$FreeBSD: head/sys/arm/xscale/ixp425/cambria_gpio.c 274670 2014-11-18 17:22:08Z loos $");
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/bus.h>
47
48#include <sys/kernel.h>
49#include <sys/module.h>
50#include <sys/rman.h>

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

312 int error;
313 uint8_t mask;
314
315 mask = 1 << pin;
316
317 if (pin >= GPIO_PINS)
318 return (EINVAL);
319
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/bus.h>
47
48#include <sys/kernel.h>
49#include <sys/module.h>
50#include <sys/rman.h>

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

312 int error;
313 uint8_t mask;
314
315 mask = 1 << pin;
316
317 if (pin >= GPIO_PINS)
318 return (EINVAL);
319
320 /* Check for unwanted flags. */
321 if ((flags & sc->sc_pins[pin].gp_caps) != flags)
322 return (EINVAL);
323
324 /* Can't mix input/output together */
325 if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) ==
326 (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT))
327 return (EINVAL);
328
329 GPIO_LOCK(sc);
330 sc->sc_pins[pin].gp_flags = flags;
331
332 /*
333 * Writing a logical one sets the signal high and writing a logical
334 * zero sets the signal low. To configure a digital I/O signal as an
335 * input, a logical one must first be written to the data bit to
336 * three-state the associated output.

--- 164 unchanged lines hidden ---
320 GPIO_LOCK(sc);
321 sc->sc_pins[pin].gp_flags = flags;
322
323 /*
324 * Writing a logical one sets the signal high and writing a logical
325 * zero sets the signal low. To configure a digital I/O signal as an
326 * input, a logical one must first be written to the data bit to
327 * three-state the associated output.

--- 164 unchanged lines hidden ---