VBUS_DETECT on K20

We have got the USB device mode work on our K20 based board, but we don't want the USB module to be initialized and clocked until it is plugged into a host - in order to save power. Our device is self-powered.

To do that we need an interrupt to be triggered on being plugged into a host, so that we can then enable the USB clock, etc.

In K20's reference manual, it states "VBUS_detect: This interrupt pin connected to the USB VBUS signal detects when the device has been plugged into or unplugged from the USB bus. If the system requires waking up from a low power mode on being plugged into the USB port, this interrupt should also be a low power wake up source. If this pin multiplexes other functions, such as GPIO, the pin can be configured as an interrupt so that the USB plug or unplug event can be detected."

Does it mean we have to connect VBUS to a GPIO? VBUS_DETECT doesn't seem to belong to either USB controller or USB DCD module according to the figure below (Figure 42-8). How should the signal be used then?

We have VBUS connected to VREGIN at moment, will that help in any way? If it has to be connected to a GPIO to get the interrupt, is there any workaround without having to change H/W?

Also, the usb driver in MQX4.0 doesn't seem to be dealing with the VBUS sensing, is there a usb driver update somewhere or should I deinitialize the usb on unplug interrupt and reinitialize it on plug in interrupt by myself?

I'm facing a similar issue and I'm trying to figure out why my device won't enumerate. At the moment I have a "self-powered" usb configuration and everywhere I read it states that we need to tie VBUS to a gpio but MQX's USB stack doesn't have anything like this anywhere in code. I would have assumed that there is a configuration file where we can configure the VBUS_detect pin but I see nothing in the MQX source code.