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.

AM335x USB register USBxUTMI and VBUS detection

Hi,

Can the bits VBUSVLDEXTSEL / VBUSVLDEXT in register USB0UTMI / USB1UTMI  be used to prevent the USB PHY (and thereby the controller) from sensing VBUS and setting VBUS to be "detected" as high/low from software ?

The documentation in SPRUH73F is very sparse and tests seems to show that the bits are simply ignored.

I hope that someone can help with more info.

Many thanks,

David Marqvar 

  • The AM335x internal USB PHY does not provide the optional ExternalVBUSIndicator pin as defined in the ULPI specification.  Therefore, I suspect your observations are correct and these register bits do not provide any function.    I will try to find more details related to these bits.

    Meanwhile, I would like to understand why you are trying to do this so I can determine if there is another option.

    Regards,
    Paul

  • Hi Paul,

    Thank you for your response.

    I am trying to mitigate a problem in hardware where VBUS is always high/on. Do you think that is possible to do in another way (from software)? The system is supposed to always be usb host.

    BR, David

  • I assume you want to always apply a 5 volt power source to the USB host connector which also applies power to the AM335x VBUS input.

    I also assume you understand the USB OTG controller will not begin a host session if it detects VBUS present when a session is started, and you are hoping to use a software workaround to avoid using a VBUS power switch.

    I confirmed the bits you originally asked about are not implemented in AM335x, but the design team proposed another option when I ask your question.  There is an undocumented USB2PHY register that can be used to disable the AVALID and VBUSVALID comparators which forces these UTMI output signals form the PHY to be low.

    If bits 17 and 22 of the USBOTG register located at offset 0x40 are set high, this will disable the AVALID and VBUSVALID comparators.  Bit 17 enables an override for several OTG PHY functions controlled by bits 16 to 23.  This override feature was implemented to support USB PHY factory testing.  Once bit 17 is set high, setting bit 22 high disables the AVALID and VBUSVALID comparators. 

    After the USB OTG controller begins a host session the DRVVBUS output is driven high to enable a VBUS power switch.  The OTG controller is monitoring the VBUS voltage after a host session is started to determine if there is an over-current condition on VBUS.  I'm not sure if you will be able use this software approach to block the VBUS status before the session is started and turn off it off before the OTG controller checks for a valid VBUS.

    Please let me know if this works for you.

    Regards,
    Paul 

  • Hi Paul,

    You hit it spot on what I'm trying to do. Thank you!

    Unfortunately it does not seem to work - there's no difference to be seen. I'm simply trying just to block the VBUS detection and it is still being detected as high.

    I've added my hack in the function dsps_musb_init() just after:

    /* Reset the musb */
    dsps_writel(reg_base, wrp->control, (1 << wrp->reset));
    /* Start the on-chip PHY and its PLL. */
    musb_dsps_phy_control(glue, pdev->id, 1);
    /* HACK: FORCE VBUS TO BE UNDETECTED */
    void __iomem *reg = musb->ctrl_base + 0x300 + 0x40;
    u32 t;
    dev_warn(musb->controller, "***** FORCING VBUS TO BE UNDETECTED: %s\n", __func__);
    dev_warn(musb->controller, "***** %p is 0x%08x\n", reg - 12, dsps_readl(reg - 12, 0));
    t = dsps_readl(reg, 0);
    dev_warn(musb->controller, "***** %p is 0x%08x\n", reg, t);
    t = ((1 << 17) | (1 << 22));
    dev_warn(musb->controller, "***** writing 0x%08x\n", t);
    dsps_writel(reg, 0, t);
    dev_warn(musb->controller, "***** wait 2 ms\n");
    udelay(2000);
    dev_warn(musb->controller, "***** %p is 0x%08x\n", reg, dsps_readl(reg, 0));
    dev_warn(musb->controller, "***** %p is 0x%02x (DEVCTL)\n", reg, __raw_readb(musb->mregs + MUSB_DEVCTL));
    
    

    Besides I've added it to another place with no success.

    Trace:

    [ 3.185768] musb-hdrc musb-hdrc.1.auto: ***** FORCING VBUS TO BE UNDETECTED: dsps_musb_init
    [ 3.194446] musb-hdrc musb-hdrc.1.auto: ***** d087eb34 is 0x17008000
    [ 3.201051] musb-hdrc musb-hdrc.1.auto: ***** d087eb40 is 0x000000c0
    [ 3.207653] musb-hdrc musb-hdrc.1.auto: ***** writing 0x00420000
    [ 3.214255] musb-hdrc musb-hdrc.1.auto: ***** wait 2 ms
    [ 3.221687] musb-hdrc musb-hdrc.1.auto: ***** d087eb40 is 0x004200c0
    [ 3.228291] musb-hdrc musb-hdrc.1.auto: ***** d087eb40 is 0x98 (DEVCTL)
    .......
    [ 3.455065] musb-hdrc musb-hdrc.1.auto: ***** FORCING VBUS TO BE UNDETECTED: musb_start
    [ 3.463360] musb-hdrc musb-hdrc.1.auto: ***** d087eb34 is 0x17008000
    [ 3.469943] musb-hdrc musb-hdrc.1.auto: ***** d087eb40 is 0x004200c0
    [ 3.476524] musb-hdrc musb-hdrc.1.auto: ***** writing 0x00420000
    [ 3.483104] musb-hdrc musb-hdrc.1.auto: ***** wait 2 ms
    [ 3.490500] musb-hdrc musb-hdrc.1.auto: ***** d087eb40 is 0x004200c0
    [ 3.497082] musb-hdrc musb-hdrc.1.auto: ***** d087eb40 is 0x98 (DEVCTL)

    Do you have any idea what I could do differently?

    BR,

    David

  • Hi Paul,

    i have a similar request, in my board VBUS is float because USB Bus is connected only to onboard USB-Serial chip and 5v is not generated.

    How can i disable VBUS control to start SESSION in host mode ?

    How can i force Host mode and ignore VBUS status ?

    I tested David patch but doesn't works.

    Thanks Paolo

  • Hey,

    I have a same problem.

    I want to remove OTG from AM335x.

    But USB driver can't work. How can i force at HOST Mode and ignore VBUS status?

    HSIN WEI

  • I have the same problem because I don't have 5V on board. Does any one have a solution to disable VBUS detection in host only mode?

    Regards,

    Colman