We are having a custom board based on I.MX 8M mini. We want to have the usb charger detection functionality to limit the current drawn from a max charger IC.
We are facing some issues during the detection. We are testing the detection in various scenarios and the details are as mentioned below.
1. USB is connected before booting the kernel:
The detection of the host charger connected is happening fine when the cable is connected to the charger before kernel boots up.
2. USB is not connected before booting the kernel and then hotplugged:
The detection is also happening fine when the cable is not connected to the charger and on ,kernel bootup the cable is hotplugged. We observe that in this case the BSVIS[USBx_nOTGSC[19]] interrupt which indicates that "VBus has either risen above or fallen below the B session valid threshold" is set and hence it is enabling the vbus comparator, entering the "usb_gadget_vbus_connect" function in kernel/drivers/usb/gadget/udc/core.c and also completing the detection process.
3. USB is connected before booting the kernel and then again hotplugged:
In this case the "BSVIS"[USBx_nOTGSC[19] register bit] is not getting set and hence not indicating that there is a change in vbus connected and its not entering the detection process.
We are stuck with this issue and require your help in understanding the reason for the interrupt not getting generated and also how can we reinitiate the detection process on hotplug.
Thanks and Regards,
Bhavani S