TX2 USB on my custom board

Hi
now ,usb suddenly started working , but I don’t know the reason,I‘m changed “tegra186-quill-p3310-1000-a00-00-base.dts”

#if TEGRA_XUSB_PADCONTROL_VERSION >= DT_VERSION_2
	xusb_padctl@3520000 {
		status = "okay";
		pinctrl-0 = <&vbus_en0_default_state>;
		pinctrl-1 = <&vbus_en1_default_state>;
		pinctrl-2 = <&vbus_en0_sfio_tristate_state>;
		pinctrl-3 = <&vbus_en1_sfio_tristate_state>;
		pinctrl-4 = <&vbus_en0_sfio_passthrough_state>;
		pinctrl-5 = <&vbus_en1_sfio_passthrough_state>;
		pinctrl-names = "vbus_en0_default", "vbus_en1_default",
			"vbus_en0_sfio_tristate", "vbus_en1_sfio_tristate",
			"vbus_en0_sfio_passthrough", "vbus_en1_sfio_passthrough";

		pads {
			usb2 {
				lanes {
					usb2-0 {
						nvidia,function = "xusb";
						status = "okay";
					};
					usb2-1 {
						nvidia,function = "xusb";
						status = "okay";
					};
					usb2-2 {
						nvidia,function = "xusb";
						status = "okay";
					};
				};
			};
			usb3 {
				lanes {
					usb3-0 {
						nvidia,function = "xusb";
						status = "okay";
					};
					usb3-1 {
						nvidia,function = "xusb";
						status = "okay";
					};
					usb3-2 {
						nvidia,function = "xusb";
						status = "okay";
					};
				};
			};
		};

		ports {
			usb2-0 {
				status = "okay";
				mode = "otg";
				vbus-supply = <&vdd_usb0_5v>;
				nvidia,oc-pin = <0>;
			};
			usb2-1 {
				status = "okay";
				mode = "host";
				vbus-supply = <&vdd_usb1_5v>;
				nvidia,oc-pin = <1>;
			};
			usb2-2 {
				status = "okay";
				mode = "host";
				-**vbus-supply = <&vdd_usb2_5v>;** 
**  +  vbus-supply = <&battery-reg>**;
			};
			usb3-0 {
				nvidia,usb2-companion = <2>;
			};
			usb3-1 {
				nvidia,usb2-companion = <1>;
				status = "okay";
			};
		};
	};
#endif

Changed the above sentence ,Please help me to see how it works ,Should there still be a problem ,on L4T32.3.1

Sorry ,There seems to be a problem with the paste format,Changed vbus-supply = <&vdd_usb2_5v> to vbus-supply = <&battery-reg> ,then It worked, And,use vbus-supply = <&vdd_usb0_5v>、vbus-supply = <&vdd_usb1_5v>Also works ,Only use vbus-supply = <&vdd_usb2_5v>usb not working

What do you mean usb suddenly start to work?

What was the board design? Any schematic to share? Any kernel log to share?

You cannot just threw me a code snippet and asked me why. I am not your co-worker so I won’t know any detail about your board.

dmesg(all).docx (41.3 KB)

Ok,So Sorry,About board design I don’t have too, Wait for me to find out the details

This is the definition of vdd_usb2_5v. And it is using a gpio from a i2c expander to control.

If your board design does not have such i2c expander, you shouldn’t use such regulator.

Actually, you shouldn’t use vdd_usb0_5v, vdd_usb1_5v either. Unless you already review them and sure they are matching your board design.

vdd_usb2_5v: regulator@17 {
 			compatible = "regulator-fixed-sync";
 			reg = <17>;
 			regulator-name = "vdd-usb2-5v";
 			regulator-min-microvolt = <5000000>;
 			regulator-max-microvolt = <5000000>;
 			gpio = <&gpio_i2c_0_74 0 0>;
 		};

ok,thanks,but If not have such i2c expander, Can i use <&battery-reg>?,and i want to ask In which document is the definition of vdd_usb2_5v etc,I’m not very familiar

and Which documents are related to register definitions ,thanks

It is not a “register”. It is a regulator framework from linux kernel.

You can refer to the usb porting guide in our developer guide. But first you need to have some basic knowledge about the linux kernel device tree.

Also, the regulator is in the device tree of our public source. You need to download that too.

Ok thanks , Where is the public source download link,I don’t seem to see ,so sorry

And the document to build it.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/kernel_custom.html#

Actually, they are still dts and dtsi files. So in the end it will also form tegra186-quill-p3310-1000-a00-00-base.dts.