imx6 Device Tree Pinctrl parsing

Source: Internet
Author: User
Tags int size imx6

imx6 Device Tree Pinctrl parsing

Transferred from: http://zzjlzx.blog.chinaunix.net/uid-9688646-id-5680705.html

Recently in the porting of Linux, with the kernel version of 3.14.28, in the high version of the kernel source used in the device tree (device-tree), the device tree with the Pinctrl configuration, recorded.

1. General Settings

When configuring the serial port, the configuration information for the Pinctrl is as follows:


[CPP] view plain copy &uart2 {pinctrl-names = "default";      pinctrl-0 = <&pinctrl_uart2>;  Status = "Okay";    };  。。。。。。。。                  pinctrl_uart2:uart2grp {fsl,pins = < Mx6qdl_pad_sd4_dat7__uart2_tx_data 0x1b0b1  Mx6qdl_pad_sd4_dat4__uart2_rx_data 0x1b0b1 >; };
The mx6qdl_pad_sd4_dat7__uart2_tx_data here is defined in the Imx6dl-pinfunc.h file as follows:


[CPP] view plain copy mx6qdl_pad_sd4_dat7__uart2_tx_data 0x35c 0x744 0x000 0x2 0x0


Expand the configuration of the pin as follows: 0x35c 0x744 0x000 0x2 0x00x1b0b1

Want to know what these six values are, you can start from two ways: ① to find the interpretation of DTS files, that is, to see the kernel source, ② on the Internet to find relevant knowledge.


1.1 View the source code to the device tree file interpretation

First, there is an explanation of the first 5 variables in the Imx6dl-pinfunc.h file, as shown in the following figure:


To verify the 5 variables and find the meaning of the 6th variable, we open the code that reads the device tree file.

The file that reads the DTS file is: DRIVERS/PINCTRL/FREESCALE/PINCTRL-IMX.C, the implementation function is named: static int imx_pinctrl_parse_groups (... ), as follows:


[CPP] View plain copy static int imx_pinctrl_parse_groups (struct device_node *np,                       struct Imx_pin_group *grp,                       struct Imx_pinctrl_soc_info *info,                       u32 index)   {      int size, pin_size;       const __BE32 *list;      int i;      u32 config;        dev_dbg (Info->dev, "Group (%d):%s\n", index, Np->name);         if (Info->flags & Share_mux_conf_reg)           pin_size = share_ fsl_pin_size;      else  &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBsp;  pin_size = fsl_pin_size;     /* initialise Group */      Grp->name = np->name;       /*      * The binding format is Fsl,pins =,  &nbs p;   * Do sanity check and calculate pins number      */      list = Of_ Get_property (NP, "Fsl,pins", &size);      if (!list) {           Dev_err (Info->dev, "no Fsl,pins property in Node%s\n", Np->full_name);           return-einval;     }       /* We do not check RET Urn since it's safe node passed down */      if (!size | | size% pin_size) {     & nbsp;    Dev_err (Info->dev, "Invalid Fsl,pins Property in Node%s\n", Np->full_name);           return-einval; 

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.