mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: barebox@lists.infradead.org
Cc: Robert Jarzmik <robert.jarzmik@atosorigin.com>
Subject: [PATCH 7/9] arm/mach-pxa: add gpio direction functions
Date: Thu, 24 Nov 2011 04:02:42 +0100	[thread overview]
Message-ID: <1322103764-6265-8-git-send-email-robert.jarzmik@free.fr> (raw)
In-Reply-To: <1322103764-6265-1-git-send-email-robert.jarzmik@free.fr>

From: Robert Jarzmik <robert.jarzmik@atosorigin.com>

Add missing function for generic GPIO support.
Both gpio_direction_input() and gpio_direction_output() were
added.

Add also generic GPIO support as a PXA native configuration
option.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 arch/arm/Kconfig                      |    1 +
 arch/arm/mach-pxa/include/mach/gpio.h |    1 -
 arch/arm/mach-pxa/include/plat/gpio.h |   19 +++++++++++++++++++
 3 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4487484..40677a3 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -64,6 +64,7 @@ config ARCH_OMAP
 
 config ARCH_PXA
 	bool "Intel/Marvell PXA based"
+	select GENERIC_GPIO
 
 config ARCH_S3C24xx
 	bool "Samsung S3C2410, S3C2412, S3C2413, S3C2440, S3C2442, S3C2443"
diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
index 16fccd1..8f00677 100644
--- a/arch/arm/mach-pxa/include/mach/gpio.h
+++ b/arch/arm/mach-pxa/include/mach/gpio.h
@@ -132,6 +132,5 @@ static inline int __gpio_is_occupied(unsigned gpio)
 	} else
 		return GPDR(gpio) & GPIO_bit(gpio);
 }
-
 #include <plat/gpio.h>
 #endif
diff --git a/arch/arm/mach-pxa/include/plat/gpio.h b/arch/arm/mach-pxa/include/plat/gpio.h
index 0eb38d1..4c7b526 100644
--- a/arch/arm/mach-pxa/include/plat/gpio.h
+++ b/arch/arm/mach-pxa/include/plat/gpio.h
@@ -44,6 +44,25 @@ static inline void gpio_set_value(unsigned gpio, int value)
 		GPCR(gpio) = GPIO_bit(gpio);
 }
 
+static inline int gpio_direction_input(unsigned gpio)
+{
+	if (__gpio_is_inverted(gpio))
+		GPDR(gpio) |= GPIO_bit(gpio);
+	else
+		GPDR(gpio) &= ~GPIO_bit(gpio);
+	return 0;
+}
+
+static inline int gpio_direction_output(unsigned gpio, int value)
+{
+	gpio_set_value(gpio, value);
+	if (__gpio_is_inverted(gpio))
+		GPDR(gpio) &= ~GPIO_bit(gpio);
+	else
+		GPDR(gpio) |= GPIO_bit(gpio);
+	return 0;
+}
+
 /* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
  * Those cases currently cause holes in the GPIO number space, the
  * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2011-11-24  3:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-24  3:02 [PATCH 0/9] Initial PXA support and Mitac MIOA701 board Robert Jarzmik
2011-11-24  3:02 ` [PATCH 1/9] initial Intel/Marvell PXA support Robert Jarzmik
2011-11-24  9:29   ` Sascha Hauer
2011-11-25 21:26     ` Robert Jarzmik
2011-11-24  3:02 ` [PATCH 2/9] fix association of cache handling code for PXA Robert Jarzmik
2011-11-24  3:02 ` [PATCH 3/9] fix core version selection Robert Jarzmik
2011-11-24  3:02 ` [PATCH 4/9] add PXA framebuffer support Robert Jarzmik
2011-11-24  3:02 ` [PATCH 5/9] drivers: pxafb: Fix IOMEM API evolution Robert Jarzmik
2011-11-24  3:02 ` [PATCH 6/9] drivers: pxafb: add include ifdefery Robert Jarzmik
2011-11-24  3:02 ` Robert Jarzmik [this message]
2011-11-24  3:02 ` [PATCH 8/9] arm/mach-pxa: add basic devices hooks Robert Jarzmik
2011-11-24  3:02 ` [PATCH 9/9] arm/mach-pxa: add mioa701 board Robert Jarzmik
2011-11-24  9:13   ` Marc Kleine-Budde
2011-11-24 21:15     ` Robert Jarzmik
2011-11-24  9:45   ` Sascha Hauer
2011-11-24 21:22     ` Robert Jarzmik
2011-11-24 23:08       ` Sascha Hauer
2011-11-25 21:50         ` Robert Jarzmik
2011-11-24  9:10 ` [PATCH 0/9] Initial PXA support and Mitac MIOA701 board Marc Kleine-Budde
2011-11-24  9:28   ` Sascha Hauer
2011-11-24 21:32   ` Robert Jarzmik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322103764-6265-8-git-send-email-robert.jarzmik@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=barebox@lists.infradead.org \
    --cc=robert.jarzmik@atosorigin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox