diff mbox

[U-Boot,v5,1/3] gpio: Move common gpio.h to include/asm-generic

Message ID 1313136684-4204-1-git-send-email-joe.hershberger@ni.com
State Superseded
Delegated to: Kim Phillips
Headers show

Commit Message

Joe Hershberger Aug. 12, 2011, 8:11 a.m. UTC
Common GPIO API used by cmd_gpio should be available to any arch

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Cc: Joe Hershberger <joe.hershberger@gmail.com>
Cc: Kim Phillips <kim.phillips@freescale.com>
Cc: Mike Frysinger <vapier@gentoo.org>
---
Changes for v4:
  - Split out of patch 1/2
Changes for v5:
  - Moved asm/arch/gpio.h include to asm/gpio.h

 arch/arm/include/asm/gpio.h     |   38 +-------------------------------------
 arch/powerpc/include/asm/gpio.h |    2 ++
 include/asm-generic/gpio.h      |   37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 37 deletions(-)
 create mode 100644 arch/powerpc/include/asm/gpio.h
 create mode 100644 include/asm-generic/gpio.h

Comments

Mike Frysinger Aug. 12, 2011, 6:42 p.m. UTC | #1
On Friday, August 12, 2011 04:11:22 Joe Hershberger wrote:
> +int gpio_request(int gp, const char *label);
> +void gpio_free(int gp);
> +int gpio_direction_input(int gp);
> +int gpio_direction_output(int gp, int value);
> +int gpio_get_value(int gp);
> +void gpio_set_value(int gp, int value);

please use "unsigned gpio".  this is what linux does and what most 
implementations should be doing (since sane people will pull from linux).

> +void gpio_toggle_value(int gp);

this is not currently part of the generic gpio api.  this should stay in arm's 
asm/gpio.h for now, or not implement it at all.
-mike
diff mbox

Patch

diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
index eb071d1..d49ad08 100644
--- a/arch/arm/include/asm/gpio.h
+++ b/arch/arm/include/asm/gpio.h
@@ -1,38 +1,2 @@ 
-/*
- * 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
- */
-
-#ifndef _GPIO_H_
-#define _GPIO_H_
-
 #include <asm/arch/gpio.h>
-/*
- * Generic GPIO API
- */
-
-int gpio_request(int gp, const char *label);
-void gpio_free(int gp);
-void gpio_toggle_value(int gp);
-int gpio_direction_input(int gp);
-int gpio_direction_output(int gp, int value);
-int gpio_get_value(int gp);
-void gpio_set_value(int gp, int value);
-
-#endif	/* _GPIO_H_ */
+#include <asm-generic/gpio.h>
diff --git a/arch/powerpc/include/asm/gpio.h b/arch/powerpc/include/asm/gpio.h
new file mode 100644
index 0000000..d49ad08
--- /dev/null
+++ b/arch/powerpc/include/asm/gpio.h
@@ -0,0 +1,2 @@ 
+#include <asm/arch/gpio.h>
+#include <asm-generic/gpio.h>
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
new file mode 100644
index 0000000..57542ad
--- /dev/null
+++ b/include/asm-generic/gpio.h
@@ -0,0 +1,37 @@ 
+/*
+ * 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
+ */
+
+#ifndef _GPIO_H_
+#define _GPIO_H_
+
+/*
+ * Generic GPIO API
+ */
+
+int gpio_request(int gp, const char *label);
+void gpio_free(int gp);
+void gpio_toggle_value(int gp);
+int gpio_direction_input(int gp);
+int gpio_direction_output(int gp, int value);
+int gpio_get_value(int gp);
+void gpio_set_value(int gp, int value);
+
+#endif	/* _GPIO_H_ */