[U-Boot] [PATCH 2/5] mx5: add helper function to retrieve the GPIO number

Wolfgang Grandegger wg at denx.de
Fri Nov 11 14:03:35 CET 2011


Signed-off-by: Wolfgang Grandegger <wg at denx.de>
CC: Stefano Babic <sbabic at denx.de>
---
 arch/arm/include/asm/arch-mx5/mx5x_pins.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx5/mx5x_pins.h b/arch/arm/include/asm/arch-mx5/mx5x_pins.h
index 4e3a31b..3978bd5 100644
--- a/arch/arm/include/asm/arch-mx5/mx5x_pins.h
+++ b/arch/arm/include/asm/arch-mx5/mx5x_pins.h
@@ -25,6 +25,10 @@
 
 #ifndef __ASSEMBLY__
 
+/* 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))
+
 /*
  * In order to identify pins more effectively, each mux-controlled pin's
  * enumerated value is constructed in the following way:
-- 
1.7.4.1



More information about the U-Boot mailing list