]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/asm-generic/gpio.h
merged tx6dl-devel into denx master branch
[karo-tx-uboot.git] / include / asm-generic / gpio.h
index bfedbe44596aa31fb2266f7e052a63401f06d181..0106d0af65f58868c94fb983add4d819189feee8 100644 (file)
@@ -1,23 +1,7 @@
 /*
  * Copyright (c) 2011 The Chromium OS Authors.
  * Copyright (c) 2011, NVIDIA Corp. All rights reserved.
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #ifndef _ASM_GENERIC_GPIO_H_
  * an error value of -1.
  */
 
+enum gpio_flags {
+       GPIOF_INPUT,
+       GPIOF_OUTPUT_INIT_LOW,
+       GPIOF_OUTPUT_INIT_HIGH,
+};
+
+struct gpio {
+       unsigned int gpio;
+       enum gpio_flags flags;
+       const char *label;
+};
+
 /**
  * Request a gpio. This should be called before any of the other functions
  * are used on this gpio.
@@ -94,4 +90,26 @@ int gpio_get_value(unsigned gpio);
  * @return 0 if ok, -1 on error
  */
 int gpio_set_value(unsigned gpio, int value);
+
+/**
+ * Request a GPIO and configure it
+ * @param gpios        pointer to array of gpio defs
+ * @param count        number of GPIOs to set up
+ */
+int gpio_request_one(unsigned gpio, enum gpio_flags flags, const char *label);
+
+/**
+ * Request a set of GPIOs and configure them
+ * @param gpios        pointer to array of gpio defs
+ * @param count        number of GPIOs to set up
+ */
+int gpio_request_array(const struct gpio *gpios, int count);
+
+/**
+ * Release a set of GPIOs
+ * @param gpios        pointer to array of gpio defs
+ * @param count        number of GPIOs to set up
+ */
+int gpio_free_array(const struct gpio *gpios, int count);
+
 #endif /* _ASM_GENERIC_GPIO_H_ */