According to "i.MX 6SoloLite Applications Processor Reference Manual, Rev. 3, 09/2017" it is possible to detect when i.MX6 is connected to USB host. I am referring to section "184.108.40.206 USB Plugged-In Detector" and "220.127.116.11 Data pin contact detector.
On my i.MX6 I have enabled "Data pin contact detector" mode in register USB_ANALOG_USB1_CHRG_DETECTn by setting:
EN_B = 0
CHK_CHRG_B = 1
CHK_CONTACT = 1
But I do not observe any difference while my board is plugged to power bank or USB host. USB_ANALOG_USB1_CHRG_DETECT_STAT value is the same for both cases. Moreover, when connected to PC only PLUG_CONTACT bit is set to 1, but I would expect that DP_STATE and DM_STATE are also set.
Please see log below when i.MX6 is connected either to PC or power bank:
root@imx6:~# ./app 0x20C81B0 <-- USB1_CHRG_DETECT register.
:0x020c81b0 =0x000c0000 <-- EN_B = 0, CHK_CHRG_B = 1, CHK_CONTACT = 1
root@imx6:~# ./app 0x20C81D0 <-- USB1_CHRG_DETECT_STAT register
:0x020c81d0 =0x00000001 <-- DP_STATE = 0, DM_STATE = 0, CHRG_DETECTED = 0, PLUG_CONTACT = 1