usb: dwc3-msm: Read ID line state on bootup

On bootup driver needs to read the ID line state to detect
if micro-A cable is connected on bootup so that OTG driver
can program DWC3 in host mode. Otherwise, target fails to
enumerate USB devices connected to DWC3 USB port.

Change-Id: Idf58525018e3a4adb1550e242f4c1869a980cfda
CRs-fixed: 469177
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c
index 9fad90c..9d94b06 100644
--- a/drivers/usb/dwc3/dwc3-msm.c
+++ b/drivers/usb/dwc3/dwc3-msm.c
@@ -2218,6 +2218,7 @@
 	struct dwc3_msm *msm;
 	struct resource *res;
 	void __iomem *tcsr;
+	unsigned long flags;
 	int ret = 0;
 	int len = 0;
 	u32 tmp[3];
@@ -2430,6 +2431,11 @@
 					dev_err(&pdev->dev, "irqreq IDINT failed\n");
 					goto disable_hs_ldo;
 				}
+				local_irq_save(flags);
+				/* Update initial ID state */
+				msm->id_state = msm->ext_xceiv.id =
+					!!irq_read_line(msm->pmic_id_irq);
+				local_irq_restore(flags);
 				enable_irq_wake(msm->pmic_id_irq);
 			}
 		}