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/AM3359: USB remote wakeup

Part Number: AM3359

Tool/software: Linux

Dear all,

I have a problem trying to remote wakeup the AM335x processor using a USB keyboard. Let explain me first the setup. So we have the following topology

  AM335x usb1 <----> USB HUB (USB2512B)*  <---> USB PORT0 <----> USB KEYBOARD

  * Note that  usb1_drvvbus is connected to the reset of the USB HUB.

For USB Remote Wakeup, I ran the commands below before entering into standby mode.

  echo enabled > /sys/bus/platform/devices/47401b00.usb-phy/power/wakeup
  echo enabled > /sys/bus/usb/devices/usb2/power/wakeup
  echo enabled > /sys/bus/usb/devices/2-1/power/wakeup

After entering into standby mode and pressing a key nothing happened. I observed that when the system goes to standby mode, usb1_drvvbus goes low so it resets the hub and disconnects the VBUS on port0, so I configured usb1_drvvbus as gpio instead. With this change the HUB and VBUS is available on port0 after entering into standby mode. but the problem now is that it  resumes without pressing any key. Any idea on what is happening ?

# echo mem > /sys/power/state                                                                                             
[  441.867362] PM: Syncing filesystems ... done.
[  441.900944] Freezing user space processes ... (elapsed 0.001 seconds) done.
[  441.911242] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[  441.921784] Suspending console(s) (use no_console_suspend to debug)
[  441.948555] PM: suspend of devices complete after 18.079 msecs
[  441.950500] PM: late suspend of devices complete after 1.919 msecs
[  441.952822] PM: noirq suspend of devices complete after 2.301 msecs
[  441.952830] Disabling non-boot CPUs ...
[  441.952838] PM: Successfully put all powerdomains to target state
[  441.952838] PM: Wakeup source USB1_PHY
[  441.979931] PM: noirq resume of devices complete after 26.956 msecs
[  441.981693] PM: early resume of devices complete after 1.548 msecs
[  441.982756] net eth0: initializing cpsw version 1.12 (0)
[  441.982766] net eth0: initialized cpsw ale version 1.4
[  441.982772] net eth0: ALE Table size 1024
[  442.057419] SMSC LAN8710/LAN8720 4a101000.mdio:02: attached PHY driver [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=4a101000.mdio:02, irq=-1)
[  442.057547] libphy: PHY 4a101000.mdio:01 not found
[  442.057556] net eth0: phy "4a101000.mdio:01" not found on slave 1, err -19
[  444.107287] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[  447.646615] PM: resume of devices complete after 5665.396 msecs
[  447.768192] Restarting tasks ... [  447.786823] usb 2-1: USB disconnect, device number 15
[  447.799181] done.
[  447.813631] usb 2-1.2: USB disconnect, device number 16
root@sl50:/home/tcl# [  448.111295] usb 2-1: new high-speed USB device number 17 using musb-hdrc
[  448.267170] usb 2-1: New USB device found, idVendor=0424, idProduct=2514
[  448.274254] usb 2-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[  448.302024] hub 2-1:1.0: USB hub found
[  448.316394] hub 2-1:1.0: 4 ports detected

  • Hi,

    Please see section 8.1.4.3.7 from the AM335x TRM Rev. O.
  • Hi,

    Thanks for answer but I'm not sure I get you, sorry, I already read this. According to 'Table 8-14 USB Wakeup Use Cases Supported in System Sleep States' what I'm trying to do is case number 7, DS1/Standby-Clock gated-Host-Yes-PHY WKUP. So I expect the system to resume when I press a key to the keyboard connected to the port, but this doesn't happen, it resumes without pressing any key. I'm also wondering if the HUB that we have between the AM335x port and the keyboard is the problem.

    Best regards,
    Enric
  • I think so, however I'm notifying the USB experts, who can help better. They will respond directly here.
  • Biser,

    I think I found where the confusion comes from and I understand now why you answered with see the TRM. Just to be clear what I'm trying to do is 'echo standby > /sys/power/state ' and wakeup pressing from a usb keyboard connected to the hub, I'm not trying to do a suspend-to-ram like I posted in the steps of my first message.

    Waiting for the usb experts then. Thanks for your quick reply.
  • Adding more information:

    Same behavior with the TI kernel on BeagleBone black with a keyboard connected to the usb host.

    uname -a

    Linux am335x-evm 4.4.32-gadde2ca9f8 #1 PREEMPT Wed Dec 14 18:52:13 EST 2016 armv7l GNU/Linux

    echo standby > /sys/mem/state

    [ 1237.653346] PM: Syncing filesystems ... done.
    [ 1237.693446] Freezing user space processes ... (elapsed 0.002 seconds) done.
    [ 1237.694813] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
    [ 1237.694874] Suspending console(s) (use no_console_suspend to debug)
    [ 1237.767728] PM: suspend of devices complete after 40.749 msecs
    [ 1237.772027] PM: late suspend of devices complete after 4.253 msecs
    [ 1237.776681] PM: noirq suspend of devices complete after 4.605 msecs
    [ 1237.776699] PM: Successfully put all powerdomains to target state
    [ 1237.796140] PM: noirq resume of devices complete after 19.248 msecs
    [ 1237.799992] PM: early resume of devices complete after 3.494 msecs
    [ 1237.801905] net eth0: initializing cpsw version 1.12 (0)
    [ 1237.801929] net eth0: initialized cpsw ale version 1.4
    [ 1237.801943] net eth0: ALE Table size 1024
    [ 1237.805059] net eth0: phy found : id is : 0x7c0f1
    [ 1237.805177] libphy: PHY 4a101000.mdio:01 not found
    [ 1237.805197] net eth0: phy "4a101000.mdio:01" not found on slave 1, err -19
    [ 1238.416885] PM: resume of devices complete after 616.829 msecs
    [ 1238.495298] Restarting tasks ... 
    [ 1238.498990] usb 1-1: USB disconnect, device number 13
    [ 1238.539591] done.
    [ 1239.006492] usb 1-1: new low-speed USB device number 14 using musb-hdrc
    [ 1239.174387] input: SEM USB Keyboard as /devices/platform/ocp/47400000.usb/47401c00.usb/musb-hdrc.2.auto/usb1/1-1/1-1:1.0/0003:1A2C:0E24.000B/input/input11
    [ 1239.281766] hid-generic 0003:1A2C:0E24.000B: input: USB HID v1.10 Keyboard [SEM USB Keyboard] on usb-musb-hdrc.2.auto-1/input0
    [ 1239.328495] input: SEM USB Keyboard as /devices/platform/ocp/47400000.usb/47401c00.usb/musb-hdrc.2.auto/usb1/1-1/1-1:1.1/0003:1A2C:0E24.000C/input/input12
    [ 1239.407006] hid-generic 0003:1A2C:0E24.000C: input: USB HID v1.10 Device [SEM USB Keyboard] on usb-musb-hdrc.2.auto-1/input1
    [ 1239.797265] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx

  • Enric,

    This is an known issue. We don't have an solution yet.
  • Dear Bin Liu,

    Many thanks for your answer, if this is a known issue could I ask you for more information? Is this a software issue or there is any SoC errata involved ? Could you provide more info about this?

    Also maybe you could modify documentation to avoid confusions.

    Many thanks,

     Enric

  • Enric,

    The issue only exists in kernel v4.4, but remote wakeup works in v4.1, so I believe this is a purely software issue.
    I have updated the wiki document you pointed to note this feature is broken in kernel v4.4. Thanks for pointing it out.
  • The issue is also reproducible with v4.9, so looks like none of the recent kernels support it. Is that right?
    I see that there is usb_ctrl_mod for that purpose but doesn't seem to work.
  • That doesn't explains why the wakeup occurs, see the full thread
  • Hi Bin,

    I tested latest ti-linux-4.1.y branch and was not able to make it work. Could you provide me the link to the 4.1 kernel that this works?

    Based on the known issues of the Release Notes of latest 4.1 based SDK [1] doesn't seem to be solved.

    Many thanks,

     Enric

    [1] http://processors.wiki.ti.com/index.php?title=Processor_SDK_Linux_Kernel_Release_Notes&oldid=216574

  • Enric,

    Enric Balletbo i Serra said:
    I tested latest ti-linux-4.1.y branch and was not able to make it work. Could you provide me the link to the 4.1 kernel that this works?

    Please checkout the release tag "ti2015.03" instead of the ti-linux-4.1,y branch. I validated the feature works on ti2015.03.

    Enric Balletbo i Serra said:
    Based on the known issues of the Release Notes of latest 4.1 based SDK [1] doesn't seem to be solved.

    Not yet.