mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 21:21:37 +00:00
mx6q: define GPIO macros for translating between ordinals and port:index
The interface to the mxc_gpio driver uses integer (ordinal) values to refer to all GPIOs on the i.MX processors. The registers themselves and much of the i.MX documentation are banked in groups of 32, and these macros allow the use of the port:index numbering for clarity. GPIO_NUMBER() converts to ordinal value from port:index GPIO_PORT() returns the port of an ordinal value GPIO_INDEX() returns the index or offset of the ordinal. Discussion on the mailing list at http://lists.denx.de/pipermail/u-boot/2012-January/116927.html Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com> Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
This commit is contained in:
parent
63b1e004f5
commit
4b3a30e9ae
1 changed files with 4 additions and 0 deletions
|
@ -164,6 +164,10 @@
|
||||||
#define IRAM_SIZE 0x00040000
|
#define IRAM_SIZE 0x00040000
|
||||||
#define IMX_IIM_BASE OCOTP_BASE_ADDR
|
#define IMX_IIM_BASE OCOTP_BASE_ADDR
|
||||||
|
|
||||||
|
#define GPIO_NUMBER(port, index) ((((port)-1)*32)+((index)&31))
|
||||||
|
#define GPIO_TO_PORT(number) (((number)/32)+1)
|
||||||
|
#define GPIO_TO_INDEX(number) ((number)&31)
|
||||||
|
|
||||||
#if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
|
#if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
|
||||||
#include <asm/types.h>
|
#include <asm/types.h>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue