lkml.org 
[lkml]   [2015]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] usb: chipidea: Wait 50 ms before reading ID bit
Date
The datasheet for the USB343x PHY mentions a 50ms wait time before
reading back the ID bit after enabling the internal pull-up or a
reset:
"To monitor the status of the ID pin, the Link activates the IdPullup
bit in the OTG Control register, waits 50mS and then reads the status
of the IdGnd bit in the USB Interrupt Status register."
Implement this by adding a 50ms sleep at the only point in the code
where the ID status is being read without IRQ trigger.

When starting the board with a USB cable connected to a PC, the
system would activate host mode, then in ~20ms get an ID IRQ and
attempt to switch to gadget mode. This then failed because the
VBUS will not drop to zero (because the host is supplying it).

After this patch, the system starts up correctly and selects
gadget mode immediately, and the USB link works. It also fixes
the issue that the VBUS supply was being activated while already
being supplied from the host PC.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
---
drivers/usb/chipidea/core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index c865abe..4c6cf48 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -801,6 +801,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)

if (ci->roles[CI_ROLE_HOST] && ci->roles[CI_ROLE_GADGET]) {
if (ci->is_otg) {
+ msleep(50); /* Datasheet: Wait 50ms to read ID */
ci->role = ci_otg_role(ci);
/* Enable ID change irq */
hw_write_otgsc(ci, OTGSC_IDIE, OTGSC_IDIE);
--
1.9.1


\
 
 \ /
  Last update: 2015-06-26 16:21    [W:0.281 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site