linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: fsl: check vbus presence on probe
@ 2014-04-24  8:54 Paul Fertser
  2014-04-30 16:06 ` Felipe Balbi
  0 siblings, 1 reply; 11+ messages in thread
From: Paul Fertser @ 2014-04-24  8:54 UTC (permalink / raw)
  To: Li Yang, Felipe Balbi; +Cc: linux-usb, linux-kernel, Paul Fertser

If VBUS is already present during the driver initialisation, the
corresponding IRQ never fires, so there is no way the gadget can get
enumerated.

This patch is real-life tested on an i.MX25 board with VBUS constantly
hooked up.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
---
 drivers/usb/gadget/fsl_udc_core.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index a2f26cd..b4b1516 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2501,6 +2501,11 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_del_udc;
 
+	/* Now let it settle a bit and sense VBUS */
+	msleep_interruptible(1);
+	if (fsl_readl(&dr_regs->otgsc) & OTGSC_STS_B_SESSION_VALID)
+		udc_controller->vbus_active = 1;
+
 	create_proc_file();
 	return 0;
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-05-09 11:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-24  8:54 [PATCH] usb: gadget: fsl: check vbus presence on probe Paul Fertser
2014-04-30 16:06 ` Felipe Balbi
2014-04-30 19:27   ` Paul Fertser
2014-04-30 20:12     ` Felipe Balbi
2014-05-01 14:27       ` suresh.gupta
2014-05-08 14:30         ` suresh.gupta
2014-05-08 15:38           ` Paul Fertser
2014-05-08 18:42             ` suresh.gupta
2014-05-08 20:14               ` Paul Fertser
2014-05-09  9:07                 ` suresh.gupta
2014-05-09 11:18                   ` Paul Fertser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).