TX2 use i2c4 (dp1_aux_ch)

Hi,
I had used dp1_aux (pin:A34 A35) connecting an i2c device(bmi160) for HW configuration.
i reference https://devtalk.nvidia.com/default/topic/1025490/jetson-tx2/uses-i2c6-dp0_aux_ch-/1
to edit tegra186-quill-p3310-c03-00-base.dts

host1x {
		nvdisplay@15200000 {
			status = "okay";
		};

		nvdisplay@15210000 {
			status = "disabled";
		};

		sor1 {
			status = "disabled";

			hdmi-display {
				status = "disabled";
			};

			dp-display {
				status = "disabled";
			};
		};

		dsi {
			status = "okay";

			panel-t-wuxga-8-0 {
				status = "okay";
			};
		};

		dpaux@15040000 {
		compatible = "nvidia,tegra186-dpaux1-padctl";
		status = "okay";

		pinctrl-names = "default";
		pinctrl-0 = <&dpaux_default1>;
		dpaux_default1: pinmux@0 {
				dpaux1_pins {
					pins = "dpaux1-1";
					function = "i2c";
				};
			};
		};

		dpaux@155c0000 {
			compatible = "nvidia,tegra186-dpaux-padctl";
			status = "okay";

			pinctrl-names = "default";
			pinctrl-0 = <&dpaux_default>;
			dpaux_default: pinmux@0 {
				dpaux0_pins {
					pins = "dpaux-0";
					function = "i2c";
				};
			};
		};
	};

	dpaux0 {
		status = "okay";
	};

	dpaux1 {
		status = "okay";
	};

and edit tegra186-soc-base.dtsi

dpaux@15040000 {
			///compatible = "nvidia,tegra186-dpaux1";
			compatible = "nvidia,tegra186-dpaux1-padctl";
			reg = <0x0 0x15040000 0x0 0x00040000>;
			interrupts = <0 160 0x4>; /* INT_DPAUX_1 */
			clocks = <&clk32k_in>,
				 <&tegra_car TEGRA186_CLK_DPAUX1>,
				 <&tegra_car TEGRA186_CLK_PLLDP>;
			clock-names = "clk32k_in", "dpaux1", "plldp";
			resets = <&tegra_car TEGRA186_RESET_DPAUX1>;
			reset-names = "dpaux1";
			///power-domains = <&disa_pd>;
			///status = "disabled";
			status = "disabled";
		};

and add my sensor device in tegra186-super-module-e2614-p2597-1000-a00.dtsi

i2c@3190000 {
		  bmi160@69 {
			compatible = "bosch-sensortec,bmi160";
			reg = <0x69>;
			};
	};

but i get the error message when kernel boot, and can not enter to system.
how to setting the i2c4 can it work?

[ 6.437423] tegra-i2c 3190000.i2c: pio xfer timed out addr: 0x69
[ 6.447592] tegra-i2c 3190000.i2c: — register dump for debugging ----
[ 6.458375] tegra-i2c 3190000.i2c: I2C_CNFG - 0x22c00
[ 6.467604] tegra-i2c 3190000.i2c: I2C_PACKET_TRANSFER_STATUS - 0x10001
[ 6.478440] tegra-i2c 3190000.i2c: I2C_FIFO_CONTROL - 0xe0
[ 6.488157] tegra-i2c 3190000.i2c: I2C_FIFO_STATUS - 0x800040
[ 6.498270] tegra-i2c 3190000.i2c: I2C_INT_MASK - 0x7d
[ 6.507722] tegra-i2c 3190000.i2c: I2C_INT_STATUS - 0x0
[ 6.517265] tegra-i2c 3190000.i2c: i2c transfer timed out addr: 0x69
[ 8.529454] tegra-i2c 3190000.i2c: pio xfer timed out addr: 0x69
[ 8.538186] tegra-i2c 3190000.i2c: — register dump for debugging ----
[ 8.547434] tegra-i2c 3190000.i2c: I2C_CNFG - 0x22c00
[ 8.558035] tegra-i2c 3190000.i2c: I2C_PACKET_TRANSFER_STATUS - 0x10001
[ 8.567195] tegra-i2c 3190000.i2c: I2C_FIFO_CONTROL - 0xe0
[ 8.575217] tegra-i2c 3190000.i2c: I2C_FIFO_STATUS - 0x800040
[ 8.583472] tegra-i2c 3190000.i2c: I2C_INT_MASK - 0x7d
[ 8.591095] tegra-i2c 3190000.i2c: I2C_INT_STATUS - 0x0
[ 8.598795] tegra-i2c 3190000.i2c: i2c transfer timed out addr: 0x69
[ 10.605495] tegra-i2c 3190000.i2c: pio xfer timed out addr: 0x69

Modify below to disable

dpaux0 {
		status = "okay";
	};

	dpaux1 {
		status = "okay";
	};

And below to okay

///power-domains = <&disa_pd>;
			///status = "disabled";
			status = "disabled";
		};

Also read the 0x15040124 to check the mode is set as i2c.

15040124: DPAUX_HYBRID_PADCTL_1                                   = 0x00002462 //
          I2C_SDA_INPUT_RCV                                       = 0x00000000 // [15:15] DISABLE [DISABLE=0,ENABLE=1]
          I2C_SCL_INPUT_RCV                                       = 0x00000000 // [14:14] DISABLE [DISABLE=0,ENABLE=1]
          AUX_CMH                                                 = 0x00000002 // [13:12] V1_10 [V0_10=0,V0_55=1,V1_10=2,V1_60=3]
          AUX_DRVZ                                                = 0x00000004 // [10:08] OHM_56_49 [OHM_38_10=7,OHM_43_91=6,OHM_47_15=5,OHM_51_53=3,OHM_56_49=4,OHM_62_94=2,OHM_70_12=1,OHM_93_37=0]
          AUX_DRVI                                                = 0x00000018 // [07:02] I12_00 [I00_00=0,I07_17=1,I07_81=4,I08_02=5,I08_23=6,I08_44=7,I08_65=8,I08_86=9,I09_07=10,I09_28=11,I09_49=12,I09_70=13,I09_91=14,I10_12=15,I10_33=16,I10_54=17,I10_75=18,I10_96=19,I11_17=20,I11_37=21,I11_58=22,I11_79=23,I12_00=24,I12_20=25,I12_41=26,I12_62=27,I12_82=28,I13_03=29,I13_23=30,I13_44=31,I13_64=32,I13_84=33,I14_04=34,I14_25=35,I14_45=36,I14_65=37,I14_85=38,I15_05=39,I15_24=40,I15_44=41,I15_63=42,I15_83=43,I16_02=44,I16_21=45,I16_40=46,I16_59=47,I16_78=48,I16_96=49,I17_14=50,I17_32=51,I17_49=52,I17_66=53,I17_82=54,I17_98=55,I18_13=56,I18_28=57,I18_43=58,I18_56=59,I18_69=60,I18_82=61,I18_94=62,I19_05=63,V07_38=2,V07_59=3]
          AUX_INPUT_RCV                                           = 0x00000001 // [01:01] ENABLE [DISABLE=0,ENABLE=1]
          MODE                                                    = 0x00000000 // [00:00] AUX [AUX=0,I2C=1]
          I2C_SDA_INPUT_RCV                                       = 0x00000000 // [15:15] DISABLE [DISABLE=0,ENABLE=1]
          I2C_SCL_INPUT_RCV                                       = 0x00000000 // [14:14] DISABLE [DISABLE=0,ENABLE=1]
          AUX_CMH                                                 = 0x00000002 // [13:12] V1_10 [V0_10=0,V0_55=1,V1_10=2,V1_60=3]
          AUX_DRVZ                                                = 0x00000004 // [10:08] OHM_56_49 [OHM_38_10=7,OHM_43_91=6,OHM_47_15=5,OHM_51_53=3,OHM_56_49=4,OHM_62_94=2,OHM_70_12=1,OHM_93_37=0]
          AUX_DRVI                                                = 0x00000018 // [07:02] I12_00 [I00_00=0,I07_17=1,I07_81=4,I08_02=5,I08_23=6,I08_44=7,I08_65=8,I08_86=9,I09_07=10,I09_28=11,I09_49=12,I09_70=13,I09_91=14,I10_12=15,I10_33=16,I10_54=17,I10_75=18,I10_96=19,I11_17=20,I11_37=21,I11_58=22,I11_79=23,I12_00=24,I12_20=25,I12_41=26,I12_62=27,I12_82=28,I13_03=29,I13_23=30,I13_44=31,I13_64=32,I13_84=33,I14_04=34,I14_25=35,I14_45=36,I14_65=37,I14_85=38,I15_05=39,I15_24=40,I15_44=41,I15_63=42,I15_83=43,I16_02=44,I16_21=45,I16_40=46,I16_59=47,I16_78=48,I16_96=49,I17_14=50,I17_32=51,I17_49=52,I17_66=53,I17_82=54,I17_98=55,I18_13=56,I18_28=57,I18_43=58,I18_56=59,I18_69=60,I18_82=61,I18_94=62,I19_05=63,V07_38=2,V07_59=3]
          AUX_INPUT_RCV                                           = 0x00000001 // [01:01] ENABLE [DISABLE=0,ENABLE=1]
          MODE                                                    = 0x00000000 // [00:00] AUX [AUX=0,I2C=1]

Hi Shane,
1. I try to edit the setting with your suggest,but it is not work.
I get the same error message when kernel boot, and can not enter to system.
2. how to read the 0x15040124 to see the mode, have any commend or API can read it?
thanks.

@mars
Try to boot to OS to access the REG by devmem2.

Below step was been verified by partner to enable I2C4 and I2C6 to be used as I2C busses

/ { 
host1x { 
/* 1) Disable anything that would activate HDMI or DisplayPort drivers */ 
nvdisplay@15200000 { 
status = "disabled"; 
}; 
nvdisplay@15210000 { 
status = "disabled"; 
}; 
nvdisplay@15220000 { 
status = "disabled"; 
}; 
sor { 
status = "disabled"; 
}; 
sor1 { 
status = "disabled"; 
hdmi-display { 
status = "disabled"; 
}; 
dp-display { 
status = "disabled"; 
}; 
}; 
dsi { 
status = "disabled"; 
}; 

/* 2) Explicitly mux these pins as I2C. These four pins are _not_ GPIOs and do 
not fall under control of pinmux block; rather they are muxed using 
dedicated registers within DPAUX block (eg. DPAUX_HYBRID_PADCTL_0). 
Conveniently Nvidia provided a driver specifically for this purpose, 
tegra186-dpaux-padctl, and documented it thoroughly at: 
t18x/Documentation/devicetree/bindings/pinctrl/nvidia,tegra186-dpaux-pinctl.txt 
*/ 
dpaux@15040000 { /* DPAUX1 (I2C4) */ 
compatible = "nvidia,tegra186-dpaux1-padctl"; 
status = "okay"; 
/* pinctrl-names = "default"; */ 
/* pinctrl-0 = &dpaux1_default; */ 
/delete-property/ power-domains; 
dpaux1_default: pinmux@0 { 
dpaux_pins { 
pins = "dpaux-0"; 
function = "i2c"; 
}; 
}; 
}; 
dpaux@155c0000 { /* DPAUX (I2C6) */ 
compatible = "nvidia,tegra186-dpaux-padctl"; 
status = "okay"; 
/* pinctrl-names = "default"; */ 
/* pinctrl-0 = &dpaux0_default; */ 
/delete-property/ power-domains; 
dpaux0_default: pinmux@0 { 
dpaux_pins { 
pins = "dpaux1-1"; 
function = "i2c"; 
}; 
}; 
}; 
}; 
i2c@3190000 { /* I2C4 */ 
pinctrl-names = "default"; 
pinctrl-0 = &dpaux1_default; 
}; 
i2c@31b0000 { /* I2C6 */ 
pinctrl-names = "default"; 
pinctrl-0 = &dpaux0_default; 
}; 
dpaux0 { 
status = "okay"; 
}; 
};

Hello!
I tried enabling I2C4 and I2C6 using these device tree changes but with no luck. Neither I2C bus works.
Also, I was wondering that under node dpaux@15040000 (DPAUX1) pinmux property ‘pins’ is set to “dpaux-0” and similarly under dpaux@155c0000 (DPAUX) ‘pins’ is set to “dpaux1-1”. Should these ‘pins’ values be other way around? If yes, then is it possible there are other errors in that devtree snippet as well?
Anyway, at least simply switching those ‘pins’ values did not make a difference.

I also noticed that adding this part:

i2c@3190000 { /* I2C4 */ 
pinctrl-names = "default"; 
pinctrl-0 = &dpaux1_default; 
}; 
i2c@31b0000 { /* I2C6 */ 
pinctrl-names = "default"; 
pinctrl-0 = &dpaux0_default; 
};

causes the following errors:
[ 0.245421] tegra-i2c 3190000.i2c: prop pinctrl-0 index 0 invalid phandle
[ 0.254235] tegra-i2c 31b0000.i2c: prop pinctrl-0 index 0 invalid phandle

Anyone got any more tips on how to enable these I2C buses?

I’m digging up this old thread because I haven’t been able to get i2c4 to work using this solution or any others I’ve found on the forum, maybe they’re out of date? First of all, when I follow the instructions in t18x/Documentation/devicetree/bindings/pinctrl/nvidia,tegra186-dpaux-pinctl.txt, and set these properties:

	# DPAUX1 muxed to I2C mode
	i2c@3190000 {
		pinctrl-names = "default";
		pinctrl-0 = <&dpaux_default>;
	};

When I run i2cdetect -l, that bus (usually enumerated as i2c-3) doesn’t even show up, but it will if I comment out those lines. What am I missing?

Hi mah6786,

Please help to open a new topic for your issue. Thanks