![Freescale Semiconductor i.MX 6DualLite Reference Manual Download Page 43](http://html1.mh-extra.com/html/freescale-semiconductor/i-mx-6duallite/i-mx-6duallite_reference-manual_2330523043.webp)
The GPIO utility functions should be called to configure a pin instead of directly
accessing the GPIO registers. The GPIO interrupt implementation contains functions,
such as the interrupt service routine (ISR) registration/un-registration and ISR
dispatching once an interrupt occurs. All driver-specific GPIO setup functions should be
made during device initialization at the MSL layer to provide better portability and
maintainability. This GPIO interrupt is initialized automatically during the system
startup.
If a pin is configured to GPIO by the IOMUX, the state of the pin should also be set
because it is not initialized by a dedicated hardware module. Setting the pad pull-up, pull-
down, slew rate and so on, with the pad control function may be required as well.
3.6.1.1 API for GPIO
API for GPIO lists the features supported by the GPIO implementation.
The GPIO implementation supports the following features:
• An API for registering an interrupt service routine to a GPIO interrupt. This is made
possible as the number of interrupts defined by NR_IRQS is expanded to
accommodate all the possible GPIO pins that are capable of generating interrupts.
• Functions to request and free an IOMUX pin. If a pin is used as GPIO, another set of
request/free function calls are provided. The user should check the return value of the
request calls to see if the pin has already been reserved before modifying the pin
state. The free function calls should be made when the pin is not needed. See the API
document for more details.
• Aligned parameter passing for both IOMUX and GPIO function calls. In this
implementation the same enumeration for iomux_pins is used for both IOMUX and
GPIO calls and the user does not have to figure out in which bit position a pin is
located in the GPIO module.
• Minimal changes required for the public drivers such as Ethernet and UART drivers
as no special GPIO function call is needed for registering an interrupt.
3.6.2 GPIO Features
This GPIO implementation supports the following features:
• Implementing the functions for accessing the GPIO hardware modules
• Provideing a way to control GPIO signal direction and GPIO interrupts
Chapter 3 Machine Specific Layer (MSL)
i.MX 6Solo/6DualLite Linux Reference Manual, Rev. L3.0.35_4.1.0, 09/2013
Freescale Semiconductor, Inc.
43