Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752466AbbFZNrj (ORCPT ); Fri, 26 Jun 2015 09:47:39 -0400 Received: from atl4mhob14.myregisteredsite.com ([209.17.115.52]:52987 "EHLO atl4mhob14.myregisteredsite.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752146AbbFZNrP (ORCPT ); Fri, 26 Jun 2015 09:47:15 -0400 X-TCPREMOTEIP: 88.159.208.100 X-Authenticated-UID: mike@milosoftware.com From: Mike Looijmans To: lars@metafoo.de Cc: Peter.Chen@freescale.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Looijmans Subject: [PATCH 2/2] usb: chipidea: Wait 50 ms before reading ID bit Date: Fri, 26 Jun 2015 15:47:04 +0200 Message-Id: <1435326424-18748-2-git-send-email-mike.looijmans@topic.nl> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435326424-18748-1-git-send-email-mike.looijmans@topic.nl> References: <1435326424-18748-1-git-send-email-mike.looijmans@topic.nl> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1816 Lines: 44 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/