From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux@prisktech.co.nz" <linux@prisktech.co.nz>,
"robh+dt@kernel.org" <robh+dt@kernel.org>,
"mark.rutland@arm.com" <mark.rutland@arm.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-renesas-soc@vger.kernel.org"
<linux-renesas-soc@vger.kernel.org>
Subject: RE: [PATCH 2/2] usb: host: ehci-platform: add a quirk to avoid stuck
Date: Tue, 21 Jan 2020 01:37:25 +0000 [thread overview]
Message-ID: <TYAPR01MB4544F9647CD645BEB2DC99D8D80D0@TYAPR01MB4544.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.2001201009480.16814-100000@netrider.rowland.org>
Hi Alan,
> From: Alan Stern, Sent: Tuesday, January 21, 2020 12:12 AM
>
> On Mon, 20 Jan 2020, Yoshihiro Shimoda wrote:
>
> > > > +static void ehci_platform_quirk_poll_work(struct work_struct *work)
> > > > +{
> > > > + struct ehci_platform_priv *priv =
> > > > + container_of(work, struct ehci_platform_priv, poll_work);
> > > > + struct ehci_hcd *ehci = container_of((void *)priv, struct ehci_hcd,
> > > > + priv);
> > > > + int i;
> > > > +
> > > > + usleep_range(4000, 8000);
> > >
> > > You have just waited 1000 ms for the timer. Why will sleeping an
> > > additional 4 - 8 ms make any difference?
> >
> > This sleeping can avoid a misdetection between this work function and
> > reconnection. If user reconnects the usb within 4 ms, the PORTSC
> > condition is possible to be the same as the issue's condition.
> > I think I should have described this information into the code.
> >
> > However, if I used schedule_delayed_work() instead, we can remove
> > the usleep_range().
>
> Why not just make the timer delay be 1004 or 1008 ms instead of adding
> this extra delay here?
My concern is a race condition when the issue doesn't happen. If
the workaround code has an extra delay, we can detect misdetection like below.
This is related to the EHCI/OHCI controllers on R-Car Gen3 SoCs though,
updating the CCS status is possible to be delayed. To be clear of the reason,
I should have described this CCS status behavior too.
Timer routine workqueue EHCI PORTSC USB connection
disconnect
CCS=0 connect (within 4 ms)
condition = true (misdetection) CCS=0
usleep_range(4000,8000) CCS=1
condition = false
Best regards,
Yoshihiro Shimoda
> Alan Stern
next prev parent reply other threads:[~2020-01-21 1:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-17 10:54 [PATCH 0/2] usb: host: ehci-platform: add a quirk to avoid stuck Yoshihiro Shimoda
2020-01-17 10:54 ` [PATCH 1/2] dt-bindings: usb: generic-ehci: add a quirk property " Yoshihiro Shimoda
2020-01-17 16:03 ` Geert Uytterhoeven
2020-01-20 8:05 ` Yoshihiro Shimoda
2020-01-23 8:17 ` Yoshihiro Shimoda
2020-01-23 8:57 ` Geert Uytterhoeven
2020-01-23 12:06 ` Yoshihiro Shimoda
2020-01-17 10:54 ` [PATCH 2/2] usb: host: ehci-platform: add a quirk " Yoshihiro Shimoda
2020-01-17 16:26 ` Alan Stern
2020-01-20 9:33 ` Yoshihiro Shimoda
2020-01-20 15:12 ` Alan Stern
2020-01-21 1:37 ` Yoshihiro Shimoda [this message]
2020-01-21 15:09 ` Alan Stern
2020-01-22 11:05 ` Yoshihiro Shimoda
2020-01-22 14:58 ` Alan Stern
2020-01-23 12:05 ` Yoshihiro Shimoda
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=TYAPR01MB4544F9647CD645BEB2DC99D8D80D0@TYAPR01MB4544.jpnprd01.prod.outlook.com \
--to=yoshihiro.shimoda.uh@renesas.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@prisktech.co.nz \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=stern@rowland.harvard.edu \
/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 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).