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/PROCESSOR-SDK-AM335X: am3358 usb otg host problem: not work when first plugged the otg's host role, device role are ok, but we have a problem.

Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: AM3358

Tool/software: Linux

am3358 usb otg host problem: not work when first plugged

  the otg's host role, device role are ok, but we have a problem.
  
  The 3 operations below, are performed just after reboot the linux system,
1. pc's usb cable connected to am3358, am3358 plays as an usb device well,
   and then, disconnect the usb cable,
   plug a usb disk to am3358, it is ok: am3358 can find the usb disk

2. but reverse the steps above:
   plug a usb disk to am3358 first, it is not ok, am3358 can't find the usb disk;
   and then, disconnect the usb cable, and connect to PC, it ok;
   finally, re-connect usb disk to am3358, it is ok: 3358 can find the usb disk.
   
3.  plug a usb disk to am3358, it is not ok, am3358 can't find the usb disk;
    and then, set the DEVCTL[SESSION] bit as 1, 
 am3358 can find the usb disk;
 
 remove, plug, remove , plug, it is all ok, and not need to set the DEVCTL[SESSION] bit again.
 

4. set the DEVCTL[SESSION] bit as 1 first,    
   plug usb disk to am3358,
   it is not work.   
   I must plug the usb disk first, and then set the DEVCTL[SESSION] bit, and it works.
   
 
 it seems to be : 
 If i want the host role to work, i must connect it to pc first, or set the DEVCTL[SESSION] bit manually.
 
 I wan to get that : plug the usb disk to am3358, and it works immediately.
 how can i do ?
 
 

  • Please post what Linux version you are using.
  • sdk version: am335x-evm-02.00.02.11
    kernel version: linux kernel 4.1.18
  • Hi Edward,

    Which am3358 usb port do you test? Is this on your custom board? If so, please post the usb portion of the schematics.
  • hello Liu Bin !
    We modified the kernel source to solve this problem.
    The patch is as follows:
    --- drivers/usb/musb/musb_core_origin.c 2019-04-04 11:54:43.778963944 +0800
    +++ drivers/usb/musb/musb_core.c.ok 2019-04-04 11:54:29.713733178 +0800
    @@ -798,6 +798,7 @@
    del_timer(&musb->otg_timer);
    break;
    default:
    + musb_writeb(musb->mregs, MUSB_DEVCTL, MUSB_DEVCTL_SESSION); /* 100ask */
    if ((devctl & MUSB_DEVCTL_VBUS)
    == (3 << MUSB_DEVCTL_VBUS_SHIFT)) {
    musb->xceiv->otg->state = OTG_STATE_A_HOST;
    @@ -2351,6 +2352,9 @@
    power |= musb->context.power;
    musb_writeb(musb_base, MUSB_POWER, power);

    + if (musb->xceiv->otg->state == OTG_STATE_A_HOST) /* www.100ask.org */
    + musb->context.devctl |= MUSB_DEVCTL_SESSION;
    +
    musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe);
    musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe);
    musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe);