TX2 USB2.0 cannot create /dev/video1

Hello , everybody,
I designed a board.My usb 2.0 used pin A38 A39.I changed the vbus-2-supply,the usb port can use the mouse,When I insert camera,it can know this is a camera.But it cannot creat /dev/video0.My Tx1 is ok.

Hi MMMA,
Can you check if the voltage of VBUS is as expected? Looks to be an issue in unstable power supply.

Hi DaneLLL,
The voltage of VBUS is ok.
TX1 and TX2 log is not same,TX1 create /dev/video1 is ok.I think the device tree of tx2 should change something.

TX2:
[ 66.927868] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work mailbox command 6
[ 67.064814] xhci-tegra 3530000.xhci: entering ELPG
[ 67.073749] xhci-tegra 3530000.xhci: entering ELPG done
[ 70.056816] xhci-tegra 3530000.xhci: exiting ELPG
[ 70.084866] xhci-tegra 3530000.xhci: Firmware timestamp: 2017-12-07 10:50:08 UTC, Version: 55.09 release
[ 70.098221] xhci-tegra 3530000.xhci: exiting ELPG done
[ 70.316504] usb 1-2: new high-speed USB device number 3 using xhci-tegra
[ 70.927322] usb 1-2: feature bit otg_vbus_off set
[ 70.932244] usb 1-2: New USB device found, idVendor=1e4e, idProduct=0110
[ 70.939687] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 70.947175] usb 1-2: Product: USB2.0 Camera
[ 70.951610] usb 1-2: Manufacturer: Etron Technology, Inc.
[ 70.959066] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work mailbox command 6
[ 71.743739] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work mailbox command 5
[ 71.751007] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work ignore firmware MBOX_CMD_DEC_SSPI_CLOCK request

TX1:
nvidia@tegra-ubuntu:~$ [ 50.197960] usb 1-3: USB disconnect, device number 2
[ 52.442096] usb 1-3: new high-speed USB device number 3 using xhci-tegra
[ 52.940243] usb 1-3: feature bit otg_vbus_off set
[ 52.945236] usb 1-3: New USB device found, idVendor=1e4e, idProduct=0110
[ 52.952350] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 52.959813] usb 1-3: Product: USB2.0 Camera
[ 52.964296] usb 1-3: Manufacturer: Etron Technology, Inc.
[ 52.977395] uvcvideo: Found UVC 1.00 device USB2.0 Camera (1e4e:0110)
[ 52.990288] input: USB2.0 Camera as /devices/70090000.xusb/usb1/1-3/1-3:1.0/input/input4

I changed tegra186-quill-p3310-1000-c03-00-base.dts as follows.The usb camera should be video1.Dose it matter?
i2c@3160000 {
status = “okay”;

	#address-cells = <1>;
	#size-cells = <0>;

	/* HDMI IN A (4K) */
	tc358840@0f {
		compatible = "toshiba,tc358840";
		reg = <0x0f>;
		status = "okay";
		devnode = "video0";

		/* Power Supply */
		vdig-supply = <&en_vdd_cam_1v2>;
		vif-supply = <&en_vdd_cam>;

		/* Reset */
		reset-gpios = <&tegra_aon_gpio TEGRA_AON_GPIO(S, 3) GPIO_ACTIVE_LOW>;

		/* Interrupt */
		interrupt-parent = <&tegra_main_gpio>;
		interrupts = <TEGRA_MAIN_GPIO(R, 0) IRQ_TYPE_LEVEL_HIGH>;

		refclk_hz = <48000000>; /* 40 - 50 MHz */

		ddc5v_delay = <1>;		/* 50 ms */

		/* HDCP */
		/* TODO: Not yet implemented */
		enable_hdcp = <0>;

		/* CSI Output */
		/* Enable TX0 (4 lanes) & TX1 (4 lanes) */
		csi_port = <1>;

		lineinitcnt = <0x00000FA0>;
		lptxtimecnt = <0x00000004>;
		tclk_headercnt = <0x00180203>;
		tclk_trailcnt = <0x00040005>;
		ths_headercnt = <0x000D0004>;
		twakeup = <0x00003E80>;
		tclk_postcnt = <0x0000000A>;
		ths_trailcnt = <0x00080006>;
		hstxvregcnt = <0x00000020>;

		/* PLL */
		/* Bps per lane is (refclk_hz / pll_prd) * pll_fbd */
		pll_prd = <10>;
		pll_fbd = <125>;

		port@0 {
			ret = <0>;
			hdmi2csi_tc358840_out0: endpoint {
				csi-port = <0>;
				bus-width = <2>;
				remote-endpoint = <&hdmi2csi_csi_in0>;
			};
		};
	};
};

host1x {
	vi@15700000 {
		num-channels = <2>;
		ports {
			#address-cells = <1>;
			#size-cells = <0>;
			port@0 {
				status = "okay";
				reg = <0>;
				hdmi2csi_vi_in0: endpoint {
					status = "okay";
					csi-port = <0>;
					bus-width = <2>;
					remote-endpoint = <&hdmi2csi_csi_out0>;
				};
			};
		};
	};

	nvcsi@150c0000 {
		num-channels = <2>;
		#address-cells = <1>;
		#size-cells = <0>;
		channel@0 {
			status = "okay";
			reg = <0>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					status = "okay";
					reg = <0>;
					hdmi2csi_csi_in0: endpoint@0 {
						status = "okay";
						csi-port = <0>;
						bus-width = <2>;
						remote-endpoint = <&hdmi2csi_tc358840_out0>;
					};
				};
				port@1 {
					status = "okay";
					reg = <1>;
					hdmi2csi_csi_out0: endpoint@1 {
						status = "okay";
						remote-endpoint = <&hdmi2csi_vi_in0>;
					};
				};
			};
		};

	};
};

Hi MMMA,
Can you try to remove the change for tc358840? It seems not right to hard code it into video0

[ 70.316504] usb 1-2: new high-speed USB device number 3 using xhci-tegra

This means that the USB bus sees the device.

The fact that /dev/video0 doesn’t show up, seems to indicate that that the UVC class driver or the camera-specific modules in the Linux Kernel aren’t enabled.

By default, the earlier JetPacks didn’t do this – I don’t know if 3.3 does it; I haven’t tested that.
To fix this, if it’s the case, you need to download the kernel source, re-configure it to enable USB UVC devices and camera modules, re-compile the kernel, and re-flash the TX2 to get it to create /dev/video0 out of a USB video camera.

Hi DaneLLL,
Thank you.Tc358840 is one of the video inputs.Can you tell me the problem of the device tree?

Hi snarky,
Thank you.The config file enabled USB UVC devices and camera module.
tegra18_defconfig.txt (15.2 KB)

Hi MMMA,
The device tree should be fine if you can fetch HDMI input via /dev/video0.

Can you try the one-line change and re-flash tegra186-quill-p3310-1000-c03-00-base.dtb?
[url]https://devtalk.nvidia.com/default/topic/1028223/jetson-tx2/tx2-usb-not-work/post/5280501/#5280501[/url]

The one-line change dtb should work if your custom board is not with much deviation comparing to default carrier board.

Hi DaneLLL,
Thank you.It seems to be not work,my change is no right?
I change tegra186-quill-power-tree-p3310-1000-a00-00.dtsi
pinctrl@3520000 {
vbus-0-supply = <&vdd_usb0_5v>;
vbus-1-supply = <&vdd_usb1_5v>;
//vbus-2-supply = <&vdd_usb2_5v>;
//vbus-2-supply = <&battery_reg>;
vbus-3-supply = <&battery_reg>;
vddio-hsic-supply = <&battery_reg>;
avdd_usb-supply = <&spmic_sd3>;
vclamp_usb-supply = <&spmic_sd2>;
avdd_pll_erefeut-supply = <&spmic_sd2>;
};
change tegra186-quill-p3310-1000-c03-00-base.dts
pinctrl@3520000 {
vbus-2-supply = <0x0000001a>;
pinmux {
usb3-std-A-port2 {
nvidia,lanes = “usb3-0”;
};
};
};

Hi MMMA,
I mean you convert default dtb to dts, do one-line change, convert back to dtb and re-flash.
[url]https://devtalk.nvidia.com/default/topic/1028223/jetson-tx2/tx2-usb-not-work/post/5280140/#5280140[/url]
[url]https://devtalk.nvidia.com/default/topic/1028223/jetson-tx2/tx2-usb-not-work/post/5280501/#5280501[/url]

It works for custom boards which are almost same as default board but don’t have gpio expander tca9539

Hi DaneLLL,
Thank you.I think this way is same to mine. Now I find the device tree is ok.The problem is my kernel changed something.When I used the official kernel the usb camera is ok.I’m looking into the kernel problem.

Hi snarky,DaneLLL,
When I use the original kernel of Linux_for_Tegra/ the USB camera is ok.I download the 28.2.1 kernel source,the config is tegra18_defconfig I changed nothing.
USB Video Class,
<*>UVC input events device support.
Am I missing something?Can you give me some guidance?Thank you.

This is the original kernel:
[ 29.148929] xhci-tegra 3530000.xhci: Firmware timestamp: 2017-12-07 10:50:08 UTC, Version: 55.09 release
[ 29.162264] xhci-tegra 3530000.xhci: exiting ELPG done
[ 29.380594] usb 1-2: new high-speed USB device number 2 using xhci-tegra
[ 29.598280] usb 1-2: New USB device found, idVendor=0ac8, idProduct=3313
[ 29.605122] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 29.612663] usb 1-2: Product: Sirius USB2.0 Camera
[ 29.617629] usb 1-2: Manufacturer: Vimicro Corp.
[ 29.624759] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work mailbox command 6
[ 29.656986] tegra-snd-t186ref-mobile-rt565x sound: ASoC: CODEC DAI tlv320aic3x-hifi not registered
[ 29.666099] tegra-snd-t186ref-mobile-rt565x sound: snd_soc_register_card failed (-517)
[ 29.736993] uvcvideo: Found UVC 1.00 device Sirius USB2.0 Camera (0ac8:3313)
[ 29.748904] tegra-snd-t186ref-mobile-rt565x sound: ASoC: CODEC DAI tlv320aic3x-hifi not registered
[ 29.749334] input: Sirius USB2.0 Camera as /devices/3530000.xhci/usb1/1-2/1-2:1.0/input/input3
[ 29.749605] usbcore: registered new interface driver uvcvideo
[ 29.749606] USB Video Class driver (1.1.1)
[ 29.776453] tegra-snd-t186ref-mobile-rt565x sound: snd_soc_register_card failed (-517)
[ 29.788747] tegra-snd-t186ref-mobile-rt565x sound: ASoC: CODEC DAI tlv320aic3x-hifi not registered
[ 29.797712] tegra-snd-t186ref-mobile-rt565x sound: snd_soc_register_card failed (-517)
[ 30.807830] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work mailbox command 5
[ 30.815022] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work ignore firmware MBOX_CMD_DEC_SSPI_CLOCK request
[ 32.800869] xhci-tegra 3530000.xhci: entering ELPG
[ 32.810019] xhci-tegra 3530000.xhci: entering ELPG done

The compiled kernel:
[ 39.450298] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work mailbox command 6
[ 39.584406] xhci-tegra 3530000.xhci: entering ELPG
[ 39.592933] xhci-tegra 3530000.xhci: entering ELPG done
[ 40.654613] xhci-tegra 3530000.xhci: exiting ELPG
[ 40.684421] xhci-tegra 3530000.xhci: Firmware timestamp: 2017-12-07 10:50:08 UTC, Version: 55.09 release
[ 40.697795] xhci-tegra 3530000.xhci: exiting ELPG done
[ 40.916118] usb 1-2: new high-speed USB device number 3 using xhci-tegra
[ 41.133624] usb 1-2: New USB device found, idVendor=0ac8, idProduct=3313
[ 41.140482] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 41.147780] usb 1-2: Product: Sirius USB2.0 Camera
[ 41.152874] usb 1-2: Manufacturer: Vimicro Corp.
[ 41.159874] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work mailbox command 6
[ 41.188736] tegra-snd-t186ref-mobile-rt565x sound: ASoC: CODEC DAI tlv320aic3x-hifi not registered
[ 41.197791] tegra-snd-t186ref-mobile-rt565x sound: snd_soc_register_card failed (-517)
[ 42.343344] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work mailbox command 5
[ 42.350569] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work ignore firmware MBOX_CMD_DEC_SSPI_CLOCK request

Hi MMMA,
Please check if you have

/lib/modules/4.4.38-tegra/kernel/drivers/media/usb/uvc/uvcvideo.ko

And if it is loaded:

nvidia@tegra-ubuntu:/lib/modules$ lsmod | grep uvc
uvcvideo               76326  0
videobuf2_vmalloc       5496  1 uvcvideo

uvcvideo.ko is in sample rootfs https://developer.nvidia.com/embedded/dlc/sample-root-filesystem-r2821

Hi DaneLLL,
Thank you.
1.It has /lib/modules/4.4.38-tegra/kernel/drivers/media/usb/uvc/uvcvideo.ko.

The original kernel has loaded,but the compiled not loaded.I insmod uvcvideo.ko printed insmod: ERROR: could not insert module uvcvideo.ko: Invalid module format.

I couldn’t open the link https://developer.nvidia.com/embedded/dlc/sample-root-filesystem-r2821

There was some server trouble not long ago, you might try that URL again (I just went there and the file was available).

Also, I think you must first login before you can get that file. You might want to go here first and login:
https://developer.nvidia.com/embedded/linux-tegra-r2821
…and then reload the page. After that you can try the download link again:

Unfortunately some of the URLs require login before you can see the content, and after you log in, it won’t redirect to your original destination (thus you have to visit the URL twice).

An exec format error means the module was built for a different architecture. Jetsons require arm64, but I am guessing you probably had a module compiled for x86_64 instead (desktop PCs). Did you compile the module? Jetsons should already have uvcvideo.ko, and it should be for arm64.

Some of the content of the Jetson’s direct hardware access drivers can be verified via this showing as all “ok”:

sha1sum -c /etc/nv_tegra_release

Hi MMMA,
Please check if you have correct path.
The default path is:

/lib/modules/4.4.38-tegra/kernel/drivers/media/usb/uvc/uvcvideo.ko

Self-built-kernel path is:

/lib/modules/4.4.38/kernel/drivers/media/usb/uvc/uvcvideo.ko

Hi linuxdev,
Thank you.I have download the file.

I didn’t compile the module.The /lib/modules/4.4.38-tegra/kernel/drivers/media/usb/uvc/uvcvideo.ko
can be insmoded when use the original kernel.My compiled kernel report Invalid module format.

Compile command:
$ export ARCH=arm64
$ export CROSS_COMPILE=aarch64-linux-gnu-
$ make tegra18_defconfig
$ make -j6

Hi DaneLLL,
Thank you.I use the /lib/modules/4.4.38-tegra/kernel/drivers/media/usb/uvc/uvcvideo.ko.I didn’t compile the module.My kernel uname -r back is 4.4.38.The original kernel is 4.4.38-tegra.What should I do next?

Hi DaneLLL,
Thank you.
I have solved the problem.I changed the name 4.4.38-tegra to 4.4.38 and replace the nvhost-vi-tpg.ko uvcvideo.ko videobuf2-vmalloc.ko by my compiled .ko.It works now.