USB: dwc3: otg: Turn off VBUS before removing hcd

Currently turning off VBUS is done after removing hcd when
micro A cable is disconnected. Removing hcd might take time for
processing device disconnect and during this time, PMIC will
not notify VBUS valid event if micro B cable is connected. This
results in USB cable not getting detected. Hence turn off VBUS
before removing hcd so that PMIC will notify VBUS events.

CRs-Fixed: 473424
Change-Id: I3cc84c4fa403d93d9ea541ce6c9654a42841917c
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
diff --git a/drivers/usb/dwc3/dwc3_otg.c b/drivers/usb/dwc3/dwc3_otg.c
index 1d67cee..a3b2617 100644
--- a/drivers/usb/dwc3/dwc3_otg.c
+++ b/drivers/usb/dwc3/dwc3_otg.c
@@ -198,8 +198,6 @@
 	} else {
 		dev_dbg(otg->phy->dev, "%s: turn off host\n", __func__);
 
-		platform_device_del(dwc->xhci);
-
 		ret = regulator_disable(dotg->vbus_otg);
 		if (ret) {
 			dev_err(otg->phy->dev, "unable to disable vbus_otg\n");
@@ -207,6 +205,7 @@
 		}
 		dwc3_otg_notify_host_mode(otg, on);
 
+		platform_device_del(dwc->xhci);
 		/*
 		 * Perform USB hardware RESET (both core reset and DBM reset)
 		 * when moving from host to peripheral. This is required for