* [PATCH] imx: add IMX_GPIO_NR macro.
@ 2010-12-11 7:39 Marc Reilly
0 siblings, 0 replies; only message in thread
From: Marc Reilly @ 2010-12-11 7:39 UTC (permalink / raw)
To: barebox
Simplifies specifying gpio numbers from bank/number info.
From linux kernel.
Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
---
arch/arm/mach-imx/include/mach/imx-regs.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-imx/include/mach/imx-regs.h b/arch/arm/mach-imx/include/mach/imx-regs.h
index 605d320..a234621 100644
--- a/arch/arm/mach-imx/include/mach/imx-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx-regs.h
@@ -57,6 +57,10 @@
# error "unknown i.MX soc type"
#endif
+/* There's a off-by-one betweem the gpio bank number and the gpiochip */
+/* range e.g. GPIO_1_5 is gpio 5 under linux */
+#define IMX_GPIO_NR(bank, nr) (((bank) - 1) * 32 + (nr))
+
#define GPIO_PIN_MASK 0x1f
#define GPIO_PORT_SHIFT 5
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-12-11 7:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-11 7:39 [PATCH] imx: add IMX_GPIO_NR macro Marc Reilly
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox