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/dra750: How to disable L1 function on usb2.0

Part Number: dra750

Tool/software: Linux

Hi, TI team,

we have a custom board using dra750 and GLSDK_7.04.00.03.

There is a usb to ethernet converter RTL8153vc connecting to USB2.0 port.

We can see a eth0 device when RTL8153vc is connected to USB2.0 port and it's driver is loaded.

The problem is that after "ifconfig eth0 up", the LAN link cannot establish automatically.

We have passed this issue to Realtek, they analyze this issue by usb logic analyzer as below.

They said that after leaving L1, bulk in should send to endpoint 1 and bulk out should send to endpoint 2,

but usb host still send bulk in/out to endpoint 0 which is used for control.

They suggest us to turn off L1.

Is there a way to turn off L1 for usb2.0 host?

Thanks for your time.

BR,

Shawn

  • Hi Shawn,

    I have forwarded your question to USB expert.

    Regards,
    Yordan
  • Shawn

    Based on the USB bus traces,  these are control transfers, the control transfers are targetted for ep0 only, device also responded the control request. 

    The host will start transaction on non-zero endpoint (EP1, EP2 etc) after after the SET_CONFIG or SET_INTERFACE is successful based on device endpoint pipes for particular interface.

    Regards

    Ravi

  • Hi Ravi,
    thanks for your reply.
    So, you don't agree that they said after leaving L1, the bluk in/out should go to non-zero endpoint.
    You think there can still be control transfers even after leaving L1.
    Do i understand correctly?

    By the way, any approach to turn off L1?

    Thank you very much.

  • Shawn

    I don't understand what is L1 here ?

    As per USB spec, the enumeration, following are different stages

    Upon device connect, the host will start enumerating the device through series of ep0 control transfers
    1) Set-address will be issued to set the new address to device (The device will entered addressed state).
    2) There will couple of control transaction on endpoint-0, to get the device descritpor, config descriptor & all config descritpor and string descritpor.
    3) Based on device connected, the respective class driver at host will further enable the configuration (SET_CONFIG , SET_INTERFACE),
    4) Once the device is configured and entered into configured state by enabling the non-zero endpoint or pipes for the device.

    After the device is in configured state, the host side class driver will issue NON-ZERO endpoint request to communicate with the device.

    Can you identify all of the steps from the bus traces.

    Please send the bus trace.

    Regards
    Ravi

  • Hi Ravi,

    we think they mean the LPM state,

    in data sheet 24.7.4.5.2 UTMI Power Management for LPM

    To the standard utmi_suspendm output used in "plain" USB, the current controller adds two non-standard

    outputs for the Link Power Management extension (see USB 2.0 Link Power Management (LPM)

    Addendum): utmi_l1_suspend_n and utmi_l1_sleep_n.

    LPM relabels the two USB power states of plain USB as L0 (active) and L2 (suspended), and introduces

    third, intermediate state L1 (sleep).

    Any chance to disable it?

    Thank you.

  • Shawn

    Ok, you meant LPM power management levels of XHCI controller (U0, U1,U2,U3). If there is no activity or request pending, the core put the controller in LPM state U1/2/3 as part of set port feature control request.

    But, i dont think there any issue related to LPM here.

    What is the real issue you are facing ? Can you share the complete enumeration traces. The non-zero endpoint transfer will be initiated after the device is entered into CONFIGURED state. Generally the SET_CONFIGURATION and enabling of non-zero endpoints are enabled by device specific class driver, it seems you are using custom/vendor specific RTL8153vc device. Have loaded the RTL8153vc class driver or whether it is enabled if it is supported in kernel?


    Regards
    Ravi
  • Hi Ravi,

    I'm sorry for my poor English.

    in my first post:

    There is a usb to ethernet converter RTL8153vc connecting to USB2.0 port.

    We can see a eth0 device when RTL8153vc is connected to USB2.0 port and it's driver is loaded.

    The problem is that after "ifconfig eth0 up", the LAN link cannot establish automatically.

    so we think the steps you mentioned above are done.

    We passed this issue to Realtek, they said there should be  non-zero endpoint transfer after leaving L1 state but they only see ep0 transfer.

    They also tried to connect a usb hub to CPU and then connect the RTL8153 to hub,

    then RTL8153 works fine, LAN link can establish automatically after "ifconfig eth0 up".

    Therefore they believe the problem is LPM, since that hub doesn't have LPM function.

    So they suggest us to turn of L1.

    I'm not sure if that is possible so please give us an answer.

    Thank you.

  • Shawn

    You have tried with and without HUB, connecting to which host ? J6 EVM or PC. What is CPU here ?   Can you share setup details ?

    Can you send the working USB bus trace with RTL8153 device. 

    From the bus traces image from initial thread, there is control request which is vendor specifc request with brequest type = 0x10. If you have RTL8153 driver, you can print debug prints and verify whether above control request are coming from RTL8153 driver? Also put debug prints in non-endpoint control request.

    I don't think the issue with LPM. You can check with connecting with standard device (USB disk, mouse  etc). it should work and you should see non-zero transaction.

    Regards

    Ravi

  • Hi Ravi,

    we use BEAGLE USB 480 and TOTAL PHASE data center to capture USB protocol.

    We captured three kinds of connections on our custom board (using dra750 and GLSDK_7.04.00.03)

    1. RTL8153 connecting to usb2.0 port without hub

    2. RTL8153 connecting to usb2.0 port with hub

    3. USB disk storage connecting to usb2.0 port without hub

    I have pictures of these connections in the attachment.

    I also put the debug port log of dra750 in attachment,

    you can see what command I sent.(ifconfig, ethtool, mount)

    Device are all connected to host after boot to the console prompt.

    usb_trace.zip(.tdc file is opened by TOTAL PHASE data center, .cvs is export from TOTAL PHASE data center and can be opened by Excel)

    In the log of RTL8153 connecting to usb2.0 port "without hub",

    after "ifconfig eth0 up", I have to use "ethtool eth0" many times to see "Link detected: yes".

    But in the log "with hub",

    I can see "Link detected: yes" at the first time I use "ethtool eth0" after "ifconfig eth0 up".

    Please help us to find out why.

    Thank you very much.

  • Shawn

    When the device connected directly to port (without HUB), since the device has remote wakeup capability, the core driver tries to suspend the bus, so that if the device can wakeup host when required to save the power. Thats why the in the trace after index 2078, you observe the suspend.
    This is expected behavior.
    When connected with HUB, the HUB does not support remote wakeup, hence the root port does not suspend the bus.

    Regards
    Ravi
  • Shawn

    Can you send dump of the register 0x48890424 and 0x488d0424 from linux kernel ?

    # devmem2 0x48890424

    #devmem2 0x488d0424

    Regards

    Ravi

  • Hi, Ravi,
    here is the dump

    root@dra7xx-evm:~# devmem2 0x48890424
    /dev/mem opened.
    Memory mapped at address 0xb6f44000.
    Read at address 0x48890424 (0xb6f44424): 0x00000000

    root@dra7xx-evm:~# devmem2 0x488d0424
    /dev/mem opened.
    Memory mapped at address 0xb6f3d000.
    Read at address 0x488D0424 (0xb6f3d424): 0x00010189


    USB1(3.0) works fine without the issue i ask in this thread.
    It only happened in USB2(2.0).

    I also tried to remove the CONFIG_PM and CONFIG_PM_RUNTIME in .config.
    The value of this register of USB2 becomes 0x00000000.
    This can solve our issue, but i think this is not a good solution since there are some kernel warning coming up.

    Is there any way to make core driver not to suspend the bus even the device has the remote wake up capability?

    Thanks for your support.
  • ShawLin

    On USB2.0 port, the PORTMSC.HLE bit is set (register 0x488d0424), which is Hardware LPM enable bit. Can you reset this bit and try.

    # devmem2 0x488d0424 w 0x00000189

    The HLE bit is set in xhci_set_usb2_hardware_lpm() in drivers/usb/host/xhci.c.

    Regards
    Ravi
  • Hi, Ravi,

    We tried and this resolved our problem,

    thanks for your great support!!

    BR,

    Shawn

  • Shawn

    Good to see the issue got resolved.

    Regards

    Ravi