From: Peter Chen <peter.chen@freescale.com>
To: Mike Looijmans <mike.looijmans@topic.nl>
Cc: <lars@metafoo.de>, <linux-usb@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] usb: chipidea: Wait 50 ms before reading ID bit
Date: Tue, 30 Jun 2015 10:11:46 +0800 [thread overview]
Message-ID: <20150630021145.GB7586@shlinux2> (raw)
In-Reply-To: <1435326424-18748-2-git-send-email-mike.looijmans@topic.nl>
On Fri, Jun 26, 2015 at 03:47:04PM +0200, Mike Looijmans wrote:
> 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.
This 50mS delay is dedicated for this PHY, you may add it at the
PHY driver.
>
> 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
>
--
Best Regards,
Peter Chen
next prev parent reply other threads:[~2015-06-30 3:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-26 13:47 [PATCH 1/2] usb: chipidea: Reduce ULPI PHY reset pulse to datasheet spec of 1us Mike Looijmans
2015-06-26 13:47 ` [PATCH 2/2] usb: chipidea: Wait 50 ms before reading ID bit Mike Looijmans
2015-06-30 2:11 ` Peter Chen [this message]
2015-06-30 2:06 ` [PATCH 1/2] usb: chipidea: Reduce ULPI PHY reset pulse to datasheet spec of 1us Peter Chen
2015-07-02 9:39 ` David Laight
2015-07-06 12:54 ` Mike Looijmans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150630021145.GB7586@shlinux2 \
--to=peter.chen@freescale.com \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mike.looijmans@topic.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.