public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] at91: add new gpio pin definitions
Date: Fri, 29 Nov 2013 12:13:43 +0100	[thread overview]
Message-ID: <1385723626-1586-2-git-send-email-andreas.devel@googlemail.com> (raw)
In-Reply-To: <1385723626-1586-1-git-send-email-andreas.devel@googlemail.com>

This patch define new names for GPIO pins on at91 devices. Follow up patches
will convert the whole infrastructure to use these new definitions.

Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
---
 arch/arm/include/asm/arch-at91/gpio.h |   24 +++++++++++++++++++++++-
 drivers/gpio/at91_gpio.c              |    4 +---
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/arch/arm/include/asm/arch-at91/gpio.h b/arch/arm/include/asm/arch-at91/gpio.h
index 0700427..b340afe 100644
--- a/arch/arm/include/asm/arch-at91/gpio.h
+++ b/arch/arm/include/asm/arch-at91/gpio.h
@@ -231,4 +231,26 @@ static inline unsigned pin_to_mask(unsigned pin)
 #define at91_set_gpio_value(x, y)	at91_set_pio_value(x, y)
 #define at91_get_gpio_value(x)		at91_get_pio_value(x)
 #endif
-#endif
+
+#define GPIO_PIOA_BASE  (0)
+#define GPIO_PIOB_BASE  (GPIO_PIOA_BASE + 32)
+#define GPIO_PIOC_BASE  (GPIO_PIOB_BASE + 32)
+#define GPIO_PIOD_BASE  (GPIO_PIOC_BASE + 32)
+#define GPIO_PIOE_BASE  (GPIO_PIOD_BASE + 32)
+#define GPIO_PIN_PA(x)  (GPIO_PIOA_BASE + (x))
+#define GPIO_PIN_PB(x)  (GPIO_PIOB_BASE + (x))
+#define GPIO_PIN_PC(x)  (GPIO_PIOC_BASE + (x))
+#define GPIO_PIN_PD(x)  (GPIO_PIOD_BASE + (x))
+#define GPIO_PIN_PE(x)  (GPIO_PIOE_BASE + (x))
+
+static inline unsigned at91_gpio_to_port(unsigned gpio)
+{
+	return gpio / 32;
+}
+
+static inline unsigned at91_gpio_to_pin(unsigned gpio)
+{
+	return gpio % 32;
+}
+
+#endif /* __ASM_ARCH_AT91_GPIO_H */
diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c
index af09786..8b76666 100644
--- a/drivers/gpio/at91_gpio.c
+++ b/drivers/gpio/at91_gpio.c
@@ -14,6 +14,7 @@
 #include <asm/sizes.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_pio.h>
+#include <asm/arch/gpio.h>
 
 static struct at91_port *at91_pio_get_port(unsigned port)
 {
@@ -356,9 +357,6 @@ int at91_get_pio_value(unsigned port, unsigned pin)
 
 /* Common GPIO API */
 
-#define at91_gpio_to_port(gpio)		(gpio / 32)
-#define at91_gpio_to_pin(gpio)		(gpio % 32)
-
 int gpio_request(unsigned gpio, const char *label)
 {
 	return 0;
-- 
1.7.10.4

  reply	other threads:[~2013-11-29 11:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29 12:53 [U-Boot] [RFC PATCH 0/3] at91: remove legacy gpio API Andreas Bießmann
2013-10-29 12:53 ` [U-Boot] [RFC PATCH 1/3] at91: add new gpio pin macros Andreas Bießmann
2013-10-30  9:56   ` Bo Shen
2013-10-30 10:39     ` Andreas Bießmann
2013-10-30 17:19       ` Jens Scharsig
2013-10-30 18:59         ` Andreas Bießmann
2013-10-31  5:04           ` Heiko Schocher
2013-10-29 12:53 ` [U-Boot] [RFC PATCH 2/3] at91sam9263ek: remove ATMEL_LEGACY Andreas Bießmann
2013-10-29 12:53 ` [U-Boot] [RFC PATCH 3/3] at91: use generic gpio API for AT91_LED Andreas Bießmann
2013-11-29 11:13 ` [U-Boot] [PATCH 0/4] at91: remove legacy GPIO API (part 1) Andreas Bießmann
2013-11-29 11:13   ` Andreas Bießmann [this message]
2013-12-02  5:27     ` [U-Boot] [PATCH 1/4] at91: add new gpio pin definitions Bo Shen
2013-12-09 12:35     ` [U-Boot] [U-Boot,1/4] " Andreas Bießmann
2013-11-29 11:13   ` [U-Boot] [PATCH 2/4] at91: redefine legacy GPIO PIN_BASE Andreas Bießmann
2013-12-09 12:36     ` [U-Boot] [U-Boot,2/4] " Andreas Bießmann
2013-11-29 11:13   ` [U-Boot] [PATCH 3/4] at91: nand: switch atmel_nand to generic GPIO API Andreas Bießmann
2013-12-02  7:01     ` esw at bus-elektronik.de
2013-12-06 19:16     ` Scott Wood
2013-12-09 12:38     ` [U-Boot] [U-Boot,3/4] " Andreas Bießmann
2013-11-29 11:13   ` [U-Boot] [PATCH 4/4] at91: switch coloured LED to gpio API Andreas Bießmann
2013-12-09 12:38     ` [U-Boot] [U-Boot,4/4] " Andreas Bießmann

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=1385723626-1586-2-git-send-email-andreas.devel@googlemail.com \
    --to=andreas.devel@googlemail.com \
    --cc=u-boot@lists.denx.de \
    /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