Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1541531
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | John Stultz <john.stultz@linaro.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [RFC][PATCH 2/5] usb: dwc2: Workaround case where GOTGCTL state is wrong |
| Date | Tue, 13 Dec 2016 22:20:01 +0100 |
| Message-ID | <sO2Ep-6bg-19@gated-at.bofh.it> (permalink) |
| References | <sNPxv-6Ga-3@gated-at.bofh.it> <sNPxw-6Ga-19@gated-at.bofh.it> <sNUnw-18c-29@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=49tJ3HIcJd6mF7cikmq10EVtABGpCSxJAWzwZUhFua0=; b=exf8pPYurifDhmfRmsgxqZQop5qoKzRJ1CWI1lWW647EK3maDMvtU4MqYqtQUj0YcJ TyOgSJFFL26SC7KdzQoXMoc75Pi5hZQ2iPqsC3WSSY7ECyvoI3Y99BSp6ukNnL/dI7Pj DwRc8wutrgUEsWoW6ZRw+V0yCT2Qz0YUo8Qjs= |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=49tJ3HIcJd6mF7cikmq10EVtABGpCSxJAWzwZUhFua0=; b=hx/UzzPoQ2M5XuRsqAyeCSGaddJuBCvs7ME7P6jY9RC1yRDwXoZMNfC58qmPbgeIJA QNbd9FWg6klkJOja1ss2LKl09ypXiOniSCZtb0wilYIsrmPkznjVRhB7TZYGlhkgbIzs XDgmgyc3KbGOGzR0VsDHLEAyS7G9kL6df+Y4j6gvbnbLJTrdu0M9DNUSySe8eGSC5NWq UXRcxo9QXMYb9oH7MiJjEe743LjCz45c4ERpggoNoc8+sknUXL8qGUQR4zMW9gRkPcEB JyKM4dpnH9f7AlJRWsO5Zsv9td49T6iM3gRN1FS/8h+XHAfFE6X8oIH69Of/i8/Fnwnk bGug== |
| X-Gm-Message-State | AKaTC00aT9iB4kQ+EHH9B7boYaVaPaYZ6/0S+UYGPjo6eRaXnCwcZ+ZrpbGsl2PB6v9omysgoZu1lJn4pXYjgKQJ |
| X-Received | by 10.157.42.199 with SMTP id e65mr54535267otb.269.1481661615627; Tue, 13 Dec 2016 12:40:15 -0800 (PST) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 71 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | lkml <linux-kernel@vger.kernel.org>, Wei Xu <xuwei5@hisilicon.com>, Guodong Xu <guodong.xu@linaro.org>, Amit Pundir <amit.pundir@linaro.org>, Rob Herring <robh+dt@kernel.org>, John Youn <John.Youn@synopsys.com>, Douglas Anderson <dianders@chromium.org>, Chen Yu <chenyu56@huawei.com>, Kishon Vijay Abraham I <kishon@ti.com>, Felipe Balbi <felipe.balbi@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org> |
| X-Original-Date | Tue, 13 Dec 2016 12:40:15 -0800 |
| X-Original-Message-ID | <CALAqxLV3uEzjM1Ljwv+=_NRL5XVb5syQ7Ehbq7u5ecPObBsqhQ@mail.gmail.com> |
| X-Original-References | <1481612990-23409-1-git-send-email-john.stultz@linaro.org> <1481612990-23409-3-git-send-email-john.stultz@linaro.org> <A62D4564EAF812438095D5571C2BF7D7FCC24529@am04wembxa.internal.synopsys.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1541531 |
Show key headers only | View raw
On Tue, Dec 13, 2016 at 4:28 AM, Vardan Mikayelyan
<Vardan.Mikayelyan@synopsys.com> wrote:
> On 12/13/2016 11:12 AM, John Stultz wrote:
>> When removing a USB-A to USB-otg adapter cable, we get a change
>> status irq, and then in dwc2_conn_id_status_change, we
>> erroniously see the GOTGCTL_CONID_B flag set. This causes us to
>> get stuck in the "while (!dwc2_is_device_mode(hsotg))" loop,
>> spitting out "Waiting for Peripheral Mode, Mode=Host" warnings
>> until it fails out many seconds later.
>>
>> This patch works around the issue by re-reading the GOTGCTL
>> state to check if the GOTGCTL_CONID_B is still set and if not
>> restarting the change status logic.
>>
>> I suspect this isn't the best solution, but it seems to work
>> well for me.
>>
>> Feedback would be greatly appreciated!
>>
>> Cc: Wei Xu <xuwei5@hisilicon.com>
>> Cc: Guodong Xu <guodong.xu@linaro.org>
>> Cc: Amit Pundir <amit.pundir@linaro.org>
>> Cc: Rob Herring <robh+dt@kernel.org>
>> Cc: John Youn <johnyoun@synopsys.com>
>> Cc: Douglas Anderson <dianders@chromium.org>
>> Cc: Chen Yu <chenyu56@huawei.com>
>> Cc: Kishon Vijay Abraham I <kishon@ti.com>
>> Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Cc: linux-usb@vger.kernel.org
>> Acked-by: John Youn <johnyoun@synopsys.com>
>> Signed-off-by: John Stultz <john.stultz@linaro.org>
>> ---
>> drivers/usb/dwc2/hcd.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
>> index df5a065..a3f34dd 100644
>> --- a/drivers/usb/dwc2/hcd.c
>> +++ b/drivers/usb/dwc2/hcd.c
>> @@ -3199,7 +3199,7 @@ static void dwc2_conn_id_status_change(struct work_struct *work)
>> dev_dbg(hsotg->dev, "gotgctl=%0x\n", gotgctl);
>> dev_dbg(hsotg->dev, "gotgctl.b.conidsts=%d\n",
>> !!(gotgctl & GOTGCTL_CONID_B));
>> -
>> +again:
>> /* B-Device connector (Device Mode) */
>> if (gotgctl & GOTGCTL_CONID_B) {
>> /* Wait for switch to device mode */
>> @@ -3210,6 +3210,9 @@ static void dwc2_conn_id_status_change(struct work_struct *work)
>> dwc2_is_host_mode(hsotg) ? "Host" :
>> "Peripheral");
>> usleep_range(20000, 40000);
>> + gotgctl = dwc2_readl(hsotg->regs + GOTGCTL);
>> + if (!(gotgctl & GOTGCTL_CONID_B))
>> + goto again;
>> if (++count > 250)
>> break;
>> }
>>
> Hi John Stultz,
>
> When it goes to ":again", it will go to else anyways. I'll suggest
> alternative way to do this. Please see below.
Sounds good. I've made the change.
> Also you can add "Reviewed-by: Vardan Mikayelyan <mvardan@synopsys.com>"
Thanks so much for your review!
-john
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[RFC][PATCH 0/5] Fixes and workarounds for dwc2 on HiKey board John Stultz <john.stultz@linaro.org> - 2016-12-13 08:20 +0100
[RFC][PATCH 2/5] usb: dwc2: Workaround case where GOTGCTL state is wrong John Stultz <john.stultz@linaro.org> - 2016-12-13 08:20 +0100
Re: [RFC][PATCH 2/5] usb: dwc2: Workaround case where GOTGCTL state is wrong Vardan Mikayelyan <Vardan.Mikayelyan@synopsys.com> - 2016-12-13 13:30 +0100
Re: [RFC][PATCH 2/5] usb: dwc2: Workaround case where GOTGCTL state is wrong John Stultz <john.stultz@linaro.org> - 2016-12-13 22:20 +0100
csiph-web