1. 分析arch/arm64/boot/dts/freescale/imx8mm-evk.dts中的i2c3相关的pinctrl_i2c3节点
pinctrl_i2c3: i2c3grp {
fsl,pins = <
MX8MM_IOMUXC_I2C3_SCL_I2C3_SCL 0x400001c3
MX8MM_IOMUXC_I2C3_SDA_I2C3_SDA 0x400001c3
>;
};
MX8MM_IOMUXC_I2C3_SCL_I2C3_SC和MX8MM_IOMUXC_I2C3_SDA_I2C3_SDA是什么?
其定义在arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h中
/*
* The pin function ID is a tuple of
* <mux_reg conf_reg input_reg mux_mode input_val>
*/
#define MX8MM_IOMUXC_I2C3_SCL_I2C3_SCL 0x224 0x48C 0x000 0x0 0x0
#define MX8MM_IOMUXC_I2C3_SDA_I2C3_SDA 0x228 0x490 0x000 0x0 0x0
那么pinctrl_i2c3展开后为:
pinctrl_i2c3: i2c3grp {
fsl,pins = <
0x224 0x48C 0x000 0x0 0x0 0x400001c3 (设置引脚I2C3_SCL的功能为i2c中的时钟输出信号线)
0x228 0x490 0x000 0x0 0x0 0x400001c3 (设置引脚I2C3_SDA的功能为i2c中的数据线)
>;
};
0x224 是Pad Mux Register的寄存器地址偏移量
0x48c 是Pad Control Register的寄存器地址偏移量
0x000 是Select Input Register的寄存器地址偏移量
0x0 是设置到Pad Mux Register的值
0x0 是设置到Select Input Register的值
0x400001c3 是将要设置到Pad Control Register的值
关于fsl,pins属性可以参考Documentation/devicetree/bindings/pinctrl/fsl,imx8mm-pinctrl.txt