This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM4376: am437x usb remote wake up

Part Number: AM4376

Tool/software: Linux

Hello everyone

i have a am437x board,when system suspend,i want to wake up system through network by usb 4g modem.

but i think am437x usb controller is power down when i  exec "echo mem > /sys/power/state",some log like this:

root@am437x-evm:/# echo mem > /sys/power/state 
[ 941.006300] PM: Syncing filesystems ... done.
[ 941.019368] Freezing user space processes ... (elapsed 0.001 seconds) done.
[ 941.035127] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 941.044099] Suspending console(s) (use no_console_suspend to debug)
[ 941.057618] PM: suspend of devices complete after 6.185 msecs
[ 941.060357] PM: late suspend of devices complete after 2.708 msecs
[ 941.063676] PM: noirq suspend of devices complete after 3.290 msecs
[ 941.063686] PM: Successfully put all powerdomains to target state
[ 941.067026] PM: noirq resume of devices complete after 3.227 msecs
[ 941.069164] PM: early resume of devices complete after 1.718 msecs
[ 941.177354] usb usb1: root hub lost power or was reset
[ 941.177372] usb usb2: root hub lost power or was reset
[ 941.180330] usb usb3: root hub lost power or was reset
[ 941.180348] usb usb4: root hub lost power or was reset
[ 941.294983] PM: resume of devices complete after 225.783 msecs
[ 941.361580] Restarting tasks ... 
[ 941.365052] usb 1-1: USB disconnect, device number 2
[ 941.370425] cdc_ether 1-1:2.0 usb0: unregister 'cdc_ether' usb-xhci-hcd.0.auto-1, CDC Ethernet Device
[ 941.393051] done.
root@am437x-evm:/# [ 941.466452] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[ 941.521233] option 1-1:2.2: device disconnected
[ 941.549256] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[ 941.588786] option 1-1:2.3: device disconnected
[ 941.605284] option1 ttyUSB3: GSM modem (1-port) converter now disconnected from ttyUSB3
[ 941.635840] option 1-1:2.4: device disconnected
[ 941.650996] option1 ttyUSB4: GSM modem (1-port) converter now disconnected from ttyUSB4
[ 941.676776] option 1-1:2.5: device disconnected
[ 941.691900] option1 ttyUSB5: GSM modem (1-port) converter now disconnected from ttyUSB5
[ 941.717909] option 1-1:2.6: device disconnected
[ 945.492586] usb 1-1: new high-speed USB device number 3 using xhci-hcd
[ 945.699092] cdc_ether 1-1:2.0 usb0: register 'cdc_ether' at usb-xhci-hcd.0.auto-1, CDC Ethernet Device, 02:1e:10:1f:00:00
[ 945.720774] option 1-1:2.2: GSM modem (1-port) converter detected
[ 945.729806] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 945.747506] option 1-1:2.3: GSM modem (1-port) converter detected
[ 945.771812] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[ 945.810413] option 1-1:2.4: GSM modem (1-port) converter detected
[ 945.831348] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
[ 945.841605] option 1-1:2.5: GSM modem (1-port) converter detected
[ 945.854758] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB3
[ 945.869764] option 1-1:2.6: GSM modem (1-port) converter detected
[ 945.877664] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB4

usb 4g modem have independent power supply, when system suspend it was going well,but my server application check tcp link is disconnect.this will led to pppd re-dial,the ip address will change.

i found a usb persist.txt in linux kernel documentation,if open usb remote wake up the usb device will not change,i think if this working

pppd will still working when system suspend,the tcp link will not down.

i use the usb 4g mode support usb remote wake up,so

i try to set  /sys/devices/platform/44000000.ocp/48380000.omap_dwc3/48390000.usb/xhci-hcd.0.auto/usb1/1-1/power/persist

and 

/sys/devices/platform/44000000.ocp/48380000.omap_dwc3/48390000.usb/xhci-hcd.0.auto/usb1/1-1/power/wakeup

buf not work.

so,i want to ask how to make usb 4g modem recv data from my server when system suspend and when system wake up the tcp link is still working good.

  • Hi,

    I've notified the usb experts. Their feedback will be posted here.

    NOTE that responses may be delayed, because of the Christmas holidays.

    Best Regards,
    Yordan
  • I am not sure about persist, never used it, but it seems usb remote wakeup will not help in this case. USB remote wakeup is to allow the connected usb device to wake up the suspended host, and you have to enable '.../power/wakeup' for the whole chain between the usb host and the device: the host controller, the usb phy, any hub in the middle, and the usb device.

    To me it more sounds like network configuration problem: the usb device (4G modem) is disconnected during the system suspend, and re-enumerated after system resumed, but got a different IP address, which causes issues in application, is it right?

    If the modem got the same IP address after resumed, your application will work correct? If so, you will have to look for how to assign the same IP address to the modem, this more to udev rules and network configuration.
  • Thank you for your reply
    i think if turn on the usb remote usb wake up the usb phy will not power off,then pppd will working well.
    i try to modify the dwc3 drivers,cancel dwc3 suspend and resume function,when system suspend 4g modem working well,when 4g modem recv data from server,it can wake up system through gpio0
    but have an another problem,if usb 4g modem connect to am437x usb0 interface,sometimes when system suspend and resume it will disconnt and re-connect,this will make pppd re-dial.
    buf if usb 4g modem connect to am437x usb1 interface,this problem will disappear,am437x usb0 and usb1 interface working in the same mode. we want to use usb boot from u disk,am437x only usb1 to be usb boot.
    so could not use usb1 to connect usb 4g modem,if usb1 connect to usb 4g modem,it will not boot from u disk.
    i don't kown why usb0 have this problem.
  • hclydao said:
    buf if usb 4g modem connect to am437x usb1 interface,this problem will disappear,am437x usb0 and usb1 interface working in the same mode. we want to use usb boot from u disk,am437x only usb1 to be usb boot.
    so could not use usb1 to connect usb 4g modem,if usb1 connect to usb 4g modem,it will not boot from u disk.
    i don't kown why usb0 have this problem.

    Are you using your custom board or TI EVM?

    The TI EVM sets usb0 to otg mode and usb1 to host mode, please check dr_mode property in am437x-gp-evm.dts.

  • we design a custom board refer to AM437X_SK_EVM_3K0009_REV1_2A.pdf,the part of core are the same,only peripheral different
    i set usb0 dr_mode to otg or host in am437x-sk-evm.dts have the same problem,but usb1 have not this problem.
    i don't know why