Entering KSLEEP=0 after triggering OTG Host is broken

Hi, sorry for the late response, the company was on break.
I took a step back and reassessed if the bug was caused by the manual hsusb-otg-otg-control, so I asked my colleagues for a OTG cable with a switch on the ID pin, so that I could control the OTG status without unplugging cables. I’ve tested this both on R16.3 and R17, and as expected, nothing changes on R17, locking up on sleep after plugging ID to host mode and unplugging it back, while on R16.3 it works, after going to sleep mode the device is perfectly able to wake up again without a hitch. As for the modem datasheet specs, VBUS needs to be cut or applied every time the ID pin is acted upon. This happens by using a NOT gate on the USB_ID pin, as shown. So, if an OTG adapter is present, it will be detected and the VBUS voltage will be applied, otherwise, it will be removed.


To recap what the bug on R17 entails:

  1. I plug my cable, with OTG ID on low state. The device is happy on sleep and resume.
  2. I unpower VBUS and put ID on high, then I power VBUS back on. This makes the OTG device appear alongside the USB 2.0 root hub.
  3. I unpower VBUS, switch ID back on low (and optionally put VBUS back on). When I tell the device to go in KSLEEP=0, the CPU will halt, the serial will still send local echo, and when I wake it up via GPIO the CPU won’t wake up anymore, needing a hard poweroff.
    I have also tried plugging the WP7607 back to a PC before KSLEEPing, but nothing changes.
    In regards to the HSIC port, I unfortunately can’t use without a whole board redesign, our device microUSB port is the same as the MangOH Red’s CF3 microUSB port.
    I wish I could use R16.3, but I need to use the newer device drivers and kernel support that R17 comes with.