i.mx6ul引脚复用

时间:2022-03-11 09:24:45

使用CAN1 RX引脚作为例子

arch\arm\boot\dts\imx6ul-14x14-evk.dts:

pinctrl_flexcan1: flexcan1grp{
	fsl,pins = <
		MX6UL_PAD_UART3_RTS_B__FLEXCAN1_RX	0x1b020
		MX6UL_PAD_UART3_CTS_B__FLEXCAN1_TX	0x1b020
	>;
};


而imx6ul-14x14-evk.dts包含imx6ul.dtsi(#include "imx6ul.dtsi"),而imx6ul.dtsi又包含imx6ul-pinfunc.h

arch\arm\boot\dts\imx6ul-pinfunc.h中对FLEXCAN1_RX有如下定义:

/*
 * The pin function ID is a tuple of
 * <mux_reg conf_reg input_reg mux_mode input_val>
 */

#define MX6UL_PAD_UART3_RTS_B__FLEXCAN1_RX                        0x00B0 0x033C 0x0584 0x2 0x0


mux_reg: IOMUXC_SW_MUX_CTL_PAD_UART3_RTS_B:   偏移地址00B0
conf_reg: IOMUXC_SW_PAD_CTL_PAD_UART3_RTS_B:   偏移地址033C
input_reg: IOMUXC_FLEXCAN1_RX_SELECT_INPUT:   偏移地址0584
mux_reg: IOMUXC_SW_MUX_CTL_PAD_UART3_RTS_B[3:0]: 0x2配置成ALT2(FLEXCAN1_RX)
input_reg: IOMUXC_FLEXCAN1_RX_SELECT_INPUT:   0x0  - 复用PAD_UART3_RTS_B(由PAD_UART3_RTS_B配置而来)


对于imx6ul-14x14-evk.dts中的MX6UL_PAD_UART3_RTS_B__FLEXCAN1_RX 0x1b020主要是对IOMUXC_SW_PAD_CTL_PAD_UART3_RTS_B进行设置。

即:

conf_reg: IOMUXC_SW_PAD_CTL_PAD_UART3_RTS_B的值为: 0x1b020