设备树文件中的 i2c 引脚声明?

i2c pin declaration in device tree file?

任何人都可以帮助弄清楚以下代码的含义

特别是 0x80000000 这个值在下面的设备树节点中很重要

i2c-gpio-1 {
        pinctrl_smx6_i2c_gpio_1: i2c-gpio-1grp-smx6 {
            fsl,pins = <
                /* SCL GPIO */
                MX6QDL_PAD_GPIO_6__GPIO1_IO06   0x80000000
                /* SDA GPIO */
                MX6QDL_PAD_KEY_COL2__GPIO4_IO10 0x80000000
            >;
        };
    };

此设备树节点定义板上 imx6q 处理器的两个信号的 pinmux 配置,用作 GPIO(用于 bitbanged i2c 控制器)。

相关文档文件为:fsl,imx-pinctrl.txt

特别是,这部分在这里是相关的:

Required properties for pin configuration node:

  • fsl,pins: each entry consists of 6 integers and represents the mux and config setting for one pin. The first 5 integers are specified using a PIN_FUNC_ID macro, which can be found in imx*-pinfunc.h under device tree source folder. The last integer CONFIG is the pad setting value like pull-up on this pin. And that's why fsl,pins entry looks like in the example below.

Bits used for CONFIG: NO_PAD_CTL(1 << 31): indicate this pin does not need config.

两个PIN_FUNC_ID宏

MX6QDL_PAD_GPIO_6__GPIO1_IO06, MX6QDL_PAD_KEY_COL2__GPIO4_IO10

直接取自这个文件:imx6q-pinfunc.h

这些宏旁边的 0x80000000 值是上面的 NO_PAD_CTL(1 << 31) 宏。这意味着这些引脚没有配置那里详述的 pinmux 可能性:fsl,imx6q-pinctrl.txt