How to disable LPM for USB 3.0 in Apalis TK1

I think we’re on right way to solve the problem. I run command editenv defargs and add usbcore.autosuspend=-1 to end. Then command env save Reboot. Everything stay as was. Then i change parameter usb_port_owner_info=3 to usb_port_owner_info=2. Reboot. And everything become great. All cables works well. No timeout. Then i decide to change usb_port_owner_info to 3. Reboot. And nothing. Then return back to 3. Reboot. Nothing. Works as was, with timeout. Command cat /proc/cmdline return parameters as i changed.

defargs variable = defargs=lp0_vec=2064@0xf46ff000 core_edp_mv=1150 core_edp_ma=4000 usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0 pcie_aspm=off user_debug=30 usbcore.autosuspend=-1

Good, does it work now or not?

No, it doesn’t and i don’t know why.

You wrote that with setting usb_port_owner_info=2 everything worked fine without timeout. So what is the issue then?

Yes, when usb_port_owner_info=2, it worked, but after changing this parameter and then return back, it doesn’t work…

Look, there are steps, that i took to solve the problem:

1) First of all, i think that my problem in Link Power Management (LPM), because i saw from dmesg:

[ 1692.552323] usb 2-1: new SuperSpeed USB device number 7 using tegra-xhci                                                                                                         
[ 1692.577667] usb 2-1: Parent hub missing LPM exit latency info.  Power management will be impacted.                                                                               
[ 1692.591443] usb 2-1: New USB device found, idVendor=dcdc, idProduct=3102                                                                                                         
[ 1692.591456] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3                                                                                                    
[ 1692.591464] usb 2-1: Product: GEO-CMV Ver. 1.00                                                                                                                                  
[ 1692.591472] usb 2-1: Manufacturer: STT llc                                                                                                                                       
[ 1692.591479] usb 2-1: SerialNumber: 1700

But, as @dominik.tx wrote from Toradex - “Apalis TK1 is configured with LPM disabled…”. SOLVED. It’s not decision.

2) Then i think, that it’s enabled autosuspend mode impacts my camera. @jaski.tx wrote that i need to change defargs variable from u-boot and add usbcore.autosuspend=-1. Then i check it with cat /proc/cmdline and cat /sys/module/usbcore/parameters/autosuspend and it indicates, that autosuspend = -1. SOLVED. It’s not decision.

3) Another way to solve the task. I saw, that when i connect my camera to usb 3.0 port, from lsusb -t, field “Device” is empty. Then when i took from my program timeout error, i make command lsusb -t once more, and i see, that field “Device=usbfs”. So, is it possible to add my device to blacklist in linux by VendorID:ProductId? Maybe it help…

How frequent are those timeouts? Maybe you’re requesting more data then TK1 can handle, how much data are you trying to push over USB?

@dominik.tx On different cables different frequencies. How can i understand how much data tk1 can handle? And when i connect to usb 2.0 everything is ok.
In https://devtalk.nvidia.com/default/topic/1047173/jetson-tk1/disable-lpm-for-usb-3-0-in-tk1/2 give me advice to disable CONFIG_PM_RUNTIME, but as i understand in linux kernel 3.10.40 there is a bug, that it’s impossible to build kernel.
And from https://lwn.net/Articles/610986/ i understand that, this bug corrected in 3.10.54. How can i disable?
Another question, you say that “Apalis TK1 is configured with LPM disabled”, how can i enable LPM?

You can try disabling cpu hotplug and use performance cpu frequency governor.
To disable hotplug disable :

CONFIG_TEGRA_AUTO_HOTPLUG

CONFIG_CPUQUIET_FRAMEWORK

and set Default CPUFreq governor to performance

@dominik.tx There is no CONFIG_TEGRA_AUTO_HOTPLUG in apalis-tk1_defconfig. When i comment CONFIG_CPU_IDLE and CONFIG_CPUQUIET_FRAMEWORK, it give error, when i want to compile. ?
And how can i enable LPM support?

Those configs should be edited via menuconfig/nconfig or by editing .config file after make apalis-tk1_defconfig.

@dominik.tx Ok. I did it. As described there, i tried to copy uImage file, bus as i understand u-boot take zImage. Then i copied zImage file to sd card. But when i flashed the kernel, it give error: The disk drive for / is not ready yet or not present.keys:Continue to wait, or Press S to skip mounting or M for manual recovery. So, then i pressed ‘‘S’’, and it loaded in text mode without gui. I checked the parameters, that i changed, everything ok. But how to enable gui?

You’ll also need to deploy modules. https://developer.toradex.com/knowledge-base/build-u-boot-and-linux-kernel-from-source-code#kernel-module-deployment
since you’re no longer able to boot you may also use u-boot ums mode.

@dominik.tx I made it. Camera still not working. Always timeouts. How can i disable CONFIG_PM_RUNTIME parameter?

hi, why do you want to disable it?

@jaski.tx Because there->https://devtalk.nvidia.com/default/topic/1047173/jetson-tk1/disable-lpm-for-usb-3-0-in-tk1/2 give advice to turn off this parameter.

Thanks for this Information. As you know you can disable this configuration in the kernel, but this will lead to compilation errors which need to be corrected.

@jaski.tx Maybe you can give advice, how it can be corrected? I tried to patch the source (https://www.spinics.net/lists/stable/msg59816.html), but it doesn’t help, i have compilation errors.

Unfortunately not. We never did this on our side.

@jaski.tx Can you say, how can i enable LPM? I want to test communication with LPM.