1/*- 2 * Copyright (c) 2011 3 * Ben Gray <ben.r.gray@gmail.com>. 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: --- 26 unchanged lines hidden (view full) --- 35 * 36 * Beware the OMA datasheet(s) lists GPIO banks 1-6, whereas I've used 0-5 here 37 * in the code. 38 * 39 * 40 */ 41 42#include <sys/cdefs.h> |
43__FBSDID("$FreeBSD: head/sys/arm/ti/ti_gpio.c 274670 2014-11-18 17:22:08Z loos $"); |
44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/bus.h> 48 49#include <sys/kernel.h> 50#include <sys/module.h> 51#include <sys/rman.h> --- 405 unchanged lines hidden (view full) --- 457static int 458ti_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) 459{ 460 struct ti_gpio_softc *sc = device_get_softc(dev); 461 uint32_t bank = (pin / PINS_PER_BANK); 462 uint32_t mask = (1UL << (pin % PINS_PER_BANK)); 463 uint32_t reg_val; 464 |
465 TI_GPIO_LOCK(sc); 466 467 /* Sanity check the pin number is valid */ 468 if ((bank >= ti_max_gpio_banks()) || (sc->sc_mem_res[bank] == NULL)) { 469 TI_GPIO_UNLOCK(sc); 470 return (EINVAL); 471 } 472 --- 398 unchanged lines hidden --- |