GPIO Configuration for IMX6 processors

Source: Internet
Author: User
Tags imx6
How GPIO is configured for Freescale IMX6 processors

Turn from:

Http://zzjlzx.blog.chinaunix.net/uid-9688646-id-5206540.html

In Linux or Android, if we want to configure a Freescale IMX6 processor's Gpio pin, such as the gpio_19 pin, then this: [CPP] view plain copy #define Mx6q_pad_ Gpio_19__gpio_4_5 \ (_mx6q_pad_gpio_19__gpio_4_5 | Mux_pad_ctrl (No_pad_ctrl))

Where _mx6q_pad_gpio_19__gpio_4_5 is defined as: [CPP] view plain copy #define _MX6Q_PAD_GPIO_19__GPIO_4_5 \ IO Mux_pad (0x0624, 0x0254, 5, 0x0000, 0, 0)

This IOMUX_PAD macro is a key macro that defines Gpio, and is prototyped as: [CPP] view plain copy #define IOMUX_PAD (_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode , _sel_input_ofs, _sel_input, _pad_ctrl)

The IOMUX_PAD macro has 6 parameters, and each parameter means:

Parameters

meaning

_pad_ctrl_ofs

Offset address of the control register (16 binary)

_mux_ctrl_ofs

Offset address (16 binary) of the MUX Control register for selecting the PIN function

_mux_mode

MUX mode, bit0~3, range 0~7

_select_input_ofs

Select_input Register offset address (16 binary)

_select_input

Daisy chain mode, bit0~1, range 0~3

_pad_ctrl

Bits to BES set in register _pad_ctrl_ofs for configuration selection

The specific meaning should be combined with the contents of the IMX6 data sheet "Chapter Imoux Controller (IOMUXC)".


The following is a description of gpio_19 this PIN configuration:


1, _pad_ctrl_ofs

Find the Data sheet page 2433:



From the image above: _pad_ctrl_ofs = 0x624

2, _mux_ctrl_ofs, _mux_mode

Find the contents of page 2055 of the data sheet:


As shown above, the _mux_ctrl_ofs value is 0x254,_mux_mode range of 000~110

Only _mux_mode = 0 o'clock, _select_input_ofs and _select_input are valid, while the remaining _select_input_ofs and _select_input are 0. 3, _select_input_of, _select_input


When _mux_mode = 0 o'clock, the value of _select_input_ofs should be referenced in the Data sheet page 2654:


At this time _select_input_ofs=0x8e8,_select_input=0x1

4, _pad_ctrl

_pad_ctrl General value is 0


In summary, the GPIO_19 configuration macro is defined as follows:[CPP] View Plain copy #define _mx6q_pad_gpio_19__kpp_col_5             \          Iomux_pad (0x0624, 0x0254, 0, 0x08e8, 1, 0)   #define _mx6q _pad_gpio_19__enet_1588_event0_out     \          Iomux_pad (0x0624, 0x0254, 1, 0x0000, 0, 0)   #define _mx6q_pad_gpio_19__spdif_out1     & nbsp;     \          iomux_pad (0x0624, 0x0254, 2, 0x0000 , 0, 0)   #define _mx6q_pad_gpio_19__ccm_clko         \           Iomux_pad (0x0624, 0x0254, 3, 0x0000, 0, 0)   #define _MX6Q_PAD_GPIO_19__ ecspi1_rdy           \           Iomux_pad (0x0624, 0x0254, 4, 0x0000, 0, 0)   #define _mx6q_pad_gpio_19__gpio_4_5         \          iomux_ PAD (0x0624, 0x0254, 5, 0x0000, 0, 0)   #define _mx6q_pad_gpio_19__enet_tx_er      & nbsp;    \          iomux_pad (0x0624, 0x0254, 6, 0x0000, 0, 0) & nbsp #define _mx6q_pad_gpio_19__src_int_boot         \           Iomux_pad (0x0624, 0x0254, 7, 0x0000, 0, 0)  

The above macros define the Linux source code from imx6 arm/arch/palt-mxc/include/mach/iomux-mx6q.h

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.