diff mbox

[U-Boot,v2,1/2] omap3+: Add OMAP support for cmd_gpio

Message ID 1313533071-2372-1-git-send-email-joe.hershberger@ni.com
State Not Applicable
Headers show

Commit Message

Joe Hershberger Aug. 16, 2011, 10:17 p.m. UTC
Add a shim driver to drivers/gpio that maps the standard GPIO API to the OMAP GPIO API
Empty gpio.h is needed in the asm/arch dirs for omap3 and omap4 due to include in asm/gpio.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Cc: Joe Hershberger <joe.hershberger@gmail.com>
Cc: Sandeep Paulraj <s-paulraj@ti.com>
---
Changes for v2:
 - Changed API to match common gpio API (http://patchwork.ozlabs.org/patch/109904/)

 arch/arm/include/asm/arch-omap3/gpio.h |    1 +
 arch/arm/include/asm/arch-omap4/gpio.h |    1 +
 drivers/gpio/Makefile                  |    1 +
 drivers/gpio/omap_gpio.c               |   64 ++++++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-omap3/gpio.h
 create mode 100644 arch/arm/include/asm/arch-omap4/gpio.h
 create mode 100644 drivers/gpio/omap_gpio.c

Comments

Joe Hershberger Sept. 14, 2011, 3:13 p.m. UTC | #1
On Tue, Aug 16, 2011 at 5:17 PM, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Add a shim driver to drivers/gpio that maps the standard GPIO API to the OMAP GPIO API
> Empty gpio.h is needed in the asm/arch dirs for omap3 and omap4 due to include in asm/gpio.h
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> Cc: Joe Hershberger <joe.hershberger@gmail.com>
> Cc: Sandeep Paulraj <s-paulraj@ti.com>
> ---
> Changes for v2:
>  - Changed API to match common gpio API (http://patchwork.ozlabs.org/patch/109904/)
>
>  arch/arm/include/asm/arch-omap3/gpio.h |    1 +
>  arch/arm/include/asm/arch-omap4/gpio.h |    1 +
>  drivers/gpio/Makefile                  |    1 +
>  drivers/gpio/omap_gpio.c               |   64 ++++++++++++++++++++++++++++++++
>  4 files changed, 67 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/include/asm/arch-omap3/gpio.h
>  create mode 100644 arch/arm/include/asm/arch-omap4/gpio.h
>  create mode 100644 drivers/gpio/omap_gpio.c

Any word on this patch?

Thanks,
-Joe
Sandeep Paulraj Sept. 14, 2011, 7:52 p.m. UTC | #2
> On Tue, Aug 16, 2011 at 5:17 PM, Joe Hershberger <joe.hershberger@ni.com>
> wrote:
> > Add a shim driver to drivers/gpio that maps the standard GPIO API to the
> OMAP GPIO API
> > Empty gpio.h is needed in the asm/arch dirs for omap3 and omap4 due to
> include in asm/gpio.h
> >
> > Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> > Cc: Joe Hershberger <joe.hershberger@gmail.com>
> > Cc: Sandeep Paulraj <s-paulraj@ti.com>
> > ---
> > Changes for v2:
> >  - Changed API to match common gpio API
> (http://patchwork.ozlabs.org/patch/109904/)
> >
> >  arch/arm/include/asm/arch-omap3/gpio.h |    1 +
> >  arch/arm/include/asm/arch-omap4/gpio.h |    1 +
> >  drivers/gpio/Makefile                  |    1 +
> >  drivers/gpio/omap_gpio.c               |   64
> ++++++++++++++++++++++++++++++++
> >  4 files changed, 67 insertions(+), 0 deletions(-)
> >  create mode 100644 arch/arm/include/asm/arch-omap3/gpio.h
> >  create mode 100644 arch/arm/include/asm/arch-omap4/gpio.h
> >  create mode 100644 drivers/gpio/omap_gpio.c
> 
> Any word on this patch?


The OMAP GPIO driver was updated recently.

http://git.denx.de/?p=u-boot/u-boot-ti.git;a=commit;h=81bdc155c72ef9e093b388b90c58d8134d870976

http://git.denx.de/?p=u-boot/u-boot-ti.git;a=commit;h=3b690ebbbf21303a3bac1f62d967c36cd8655ce0

http://git.denx.de/?p=u-boot/u-boot-ti.git;a=commit;h=84c3b6312997de6f98114263159c8b9824f3d33d

--Sandeep
Joe Hershberger Sept. 14, 2011, 8:24 p.m. UTC | #3
On Wed, Sep 14, 2011 at 2:52 PM, Paulraj, Sandeep <s-paulraj@ti.com> wrote:
>
>
>> On Tue, Aug 16, 2011 at 5:17 PM, Joe Hershberger <joe.hershberger@ni.com>
>> wrote:
>> > Add a shim driver to drivers/gpio that maps the standard GPIO API to the
>> OMAP GPIO API
>> > Empty gpio.h is needed in the asm/arch dirs for omap3 and omap4 due to
>> include in asm/gpio.h
>> >
>> > Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> > Cc: Joe Hershberger <joe.hershberger@gmail.com>
>> > Cc: Sandeep Paulraj <s-paulraj@ti.com>
>> > ---
>> > Changes for v2:
>> >  - Changed API to match common gpio API
>> (http://patchwork.ozlabs.org/patch/109904/)
>> >
>> >  arch/arm/include/asm/arch-omap3/gpio.h |    1 +
>> >  arch/arm/include/asm/arch-omap4/gpio.h |    1 +
>> >  drivers/gpio/Makefile                  |    1 +
>> >  drivers/gpio/omap_gpio.c               |   64
>> ++++++++++++++++++++++++++++++++
>> >  4 files changed, 67 insertions(+), 0 deletions(-)
>> >  create mode 100644 arch/arm/include/asm/arch-omap3/gpio.h
>> >  create mode 100644 arch/arm/include/asm/arch-omap4/gpio.h
>> >  create mode 100644 drivers/gpio/omap_gpio.c
>>
>> Any word on this patch?
>
>
> The OMAP GPIO driver was updated recently.
>
> http://git.denx.de/?p=u-boot/u-boot-ti.git;a=commit;h=81bdc155c72ef9e093b388b90c58d8134d870976
>
> http://git.denx.de/?p=u-boot/u-boot-ti.git;a=commit;h=3b690ebbbf21303a3bac1f62d967c36cd8655ce0
>
> http://git.denx.de/?p=u-boot/u-boot-ti.git;a=commit;h=84c3b6312997de6f98114263159c8b9824f3d33d
>
> --Sandeep
>

Sounds good... I'll port my Panda Board support to use the common API.

-Joe
diff mbox

Patch

diff --git a/arch/arm/include/asm/arch-omap3/gpio.h b/arch/arm/include/asm/arch-omap3/gpio.h
new file mode 100644
index 0000000..fdeeadb
--- /dev/null
+++ b/arch/arm/include/asm/arch-omap3/gpio.h
@@ -0,0 +1 @@ 
+/* gpio.h */
diff --git a/arch/arm/include/asm/arch-omap4/gpio.h b/arch/arm/include/asm/arch-omap4/gpio.h
new file mode 100644
index 0000000..fdeeadb
--- /dev/null
+++ b/arch/arm/include/asm/arch-omap4/gpio.h
@@ -0,0 +1 @@ 
+/* gpio.h */
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 62ec97d..f9bef58 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -31,6 +31,7 @@  COBJS-$(CONFIG_MARVELL_MFP)	+= mvmfp.o
 COBJS-$(CONFIG_MXC_GPIO)	+= mxc_gpio.o
 COBJS-$(CONFIG_PCA953X)		+= pca953x.o
 COBJS-$(CONFIG_S5P)		+= s5p_gpio.o
+COBJS-$(CONFIG_OMAP_GPIO)	+= omap_gpio.o
 COBJS-$(CONFIG_TEGRA2_GPIO)	+= tegra2_gpio.o
 COBJS-$(CONFIG_DA8XX_GPIO)	+= da8xx_gpio.o
 
diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
new file mode 100644
index 0000000..551e387
--- /dev/null
+++ b/drivers/gpio/omap_gpio.c
@@ -0,0 +1,64 @@ 
+/*
+ * Adapter to OMAP GPIO handling.
+ *
+ * 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
+ */
+
+#include <common.h>
+#include <asm/omap_gpio.h>
+
+/*
+ * Generic_GPIO primitives.
+ */
+
+int gpio_request(unsigned gpio, const char *label)
+{
+	return omap_request_gpio(gpio);
+}
+
+void gpio_free(unsigned gpio)
+{
+}
+
+/* set GPIO pin 'gpio' as an input */
+int gpio_direction_input(unsigned gpio)
+{
+	omap_set_gpio_direction(gpio, 1);
+	return 0;
+}
+
+/* set GPIO pin 'gpio' as an output, with polarity 'value' */
+int gpio_direction_output(unsigned gpio, int value)
+{
+	omap_set_gpio_dataout(gpio, value);
+	omap_set_gpio_direction(gpio, 0);
+	return 0;
+}
+
+/* read GPIO IN value of pin 'gpio' */
+int gpio_get_value(unsigned gpio)
+{
+	return omap_get_gpio_datain(gpio);
+}
+
+/* write GPIO OUT value to pin 'gpio' */
+void gpio_set_value(unsigned gpio, int value)
+{
+	omap_set_gpio_dataout(gpio, value);
+}