]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/gpio/tegra_gpio.c
config: introduce a generic $bootcmd
[karo-tx-uboot.git] / drivers / gpio / tegra_gpio.c
index 747f4cf921213ffbdbbfe913de960b7f9d5319f2..fea9d17f8e628b1a98fdbd2c921396ba78f3d644 100644 (file)
@@ -3,23 +3,7 @@
  *  (C) Copyright 2010-2012
  *  NVIDIA Corporation <www.nvidia.com>
  *
- * 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+
  */
 
 /*
@@ -30,7 +14,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/bitops.h>
-#include <asm/arch/tegra20.h>
+#include <asm/arch/tegra.h>
 #include <asm/gpio.h>
 
 enum {
@@ -237,6 +221,26 @@ int gpio_set_value(unsigned gpio, int value)
        return 0;
 }
 
+void gpio_config_table(const struct tegra_gpio_config *config, int len)
+{
+       int i;
+
+       for (i = 0; i < len; i++) {
+               switch (config[i].init) {
+               case TEGRA_GPIO_INIT_IN:
+                       gpio_direction_input(config[i].gpio);
+                       break;
+               case TEGRA_GPIO_INIT_OUT0:
+                       gpio_direction_output(config[i].gpio, 0);
+                       break;
+               case TEGRA_GPIO_INIT_OUT1:
+                       gpio_direction_output(config[i].gpio, 1);
+                       break;
+               }
+               set_config(config[i].gpio, 1);
+       }
+}
+
 /*
  * Display Tegra GPIO information
  */