Skip to contentSkip to conversation

imx: add IMX_GPIO_NR macro.

PATCH New Marc Reilly 1 participant 1 message Dec 11, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imx: add IMX_GPIO_NR macro.

Simplifies specifying gpio numbers from bank/number info. From linux kernel.

---
 arch/arm/mach-imx/include/mach/imx-regs.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/mach-imx/include/mach/imx-regs.h +4 -0
index 605d320..a234621 100644
@@ -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
Signature · 7 lines
1.7.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox