Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1550145 > unrolled thread

[PATCH 0/5 v2] Fixes and workarounds for dwc2 on HiKey board

Started byJohn Stultz <john.stultz@linaro.org>
First post2017-01-03 21:00 +0100
Last post2017-01-12 00:20 +0100
Articles 10 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/5 v2] Fixes and workarounds for dwc2 on HiKey board John Stultz <john.stultz@linaro.org> - 2017-01-03 21:00 +0100
    [PATCH 2/5 v2] usb: dwc2: Workaround case where GOTGCTL state is wrong John Stultz <john.stultz@linaro.org> - 2017-01-03 21:00 +0100
    Re: [PATCH 0/5 v2] Fixes and workarounds for dwc2 on HiKey board John Stultz <john.stultz@linaro.org> - 2017-01-03 21:10 +0100
      Re: [PATCH 0/5 v2] Fixes and workarounds for dwc2 on HiKey board John Youn <John.Youn@synopsys.com> - 2017-01-04 01:40 +0100
        Re: [PATCH 0/5 v2] Fixes and workarounds for dwc2 on HiKey board John Stultz <john.stultz@linaro.org> - 2017-01-04 01:50 +0100
    Re: [PATCH 0/5 v2] Fixes and workarounds for dwc2 on HiKey board John Youn <John.Youn@synopsys.com> - 2017-01-11 23:10 +0100
      Re: [PATCH 0/5 v2] Fixes and workarounds for dwc2 on HiKey board John Stultz <john.stultz@linaro.org> - 2017-01-11 23:40 +0100
        Re: [PATCH 0/5 v2] Fixes and workarounds for dwc2 on HiKey board John Youn <John.Youn@synopsys.com> - 2017-01-12 00:00 +0100
          Re: [PATCH 0/5 v2] Fixes and workarounds for dwc2 on HiKey board John Youn <John.Youn@synopsys.com> - 2017-01-12 00:20 +0100
          Re: [PATCH 0/5 v2] Fixes and workarounds for dwc2 on HiKey board John Stultz <john.stultz@linaro.org> - 2017-01-12 00:20 +0100

#1550145 — [PATCH 0/5 v2] Fixes and workarounds for dwc2 on HiKey board

FromJohn Stultz <john.stultz@linaro.org>
Date2017-01-03 21:00 +0100
Subject[PATCH 0/5 v2] Fixes and workarounds for dwc2 on HiKey board
Message-ID<sVDpv-2Bs-15@gated-at.bofh.it>
Hope everyone had a happy new years!

I just wanted to send out my current queue of patches for dwc2
controller on the HiKey board for consideration for the 4.11
merge window.

This does exclude my patchset[1] to add extcon support to dwc2,
which John Youn suspects a pending rework of the dwc2 fifo init
logic might make unnecssary.

Any feedback would be greatly appreciated!

thanks
-john

[1] https://lkml.org/lkml/2016/12/6/69


New in v2:
* Reworked goto logic in patch #2, as suggested by Vardan

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: Vardan Mikayelyan <Vardan.Mikayelyan@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


Chen Yu (2):
  usb: dwc2: Force port resume on switching to device mode
  usb: dwc2: Add a quirk to allow speed negotiation for Hisilicon Hi6220

John Stultz (3):
  usb: dwc2: Avoid sleeping while holding hsotg->lock
  usb: dwc2: Workaround case where GOTGCTL state is wrong
  usb: dwc2: Avoid suspending if we're in gadget mode

 drivers/usb/dwc2/core.c   |  6 ++--
 drivers/usb/dwc2/core.h   |  9 +++++-
 drivers/usb/dwc2/gadget.c |  2 +-
 drivers/usb/dwc2/hcd.c    | 79 +++++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/dwc2/params.c | 19 ++++++++++++
 5 files changed, 110 insertions(+), 5 deletions(-)

-- 
2.7.4

[toc] | [next] | [standalone]


#1550146 — [PATCH 2/5 v2] usb: dwc2: Workaround case where GOTGCTL state is wrong

FromJohn Stultz <john.stultz@linaro.org>
Date2017-01-03 21:00 +0100
Subject[PATCH 2/5 v2] usb: dwc2: Workaround case where GOTGCTL state is wrong
Message-ID<sVDpw-2Bs-43@gated-at.bofh.it>
In reply to#1550145
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: Vardan Mikayelyan <mvardan@synopsys.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>
Reviewed-by: Vardan Mikayelyan <mvardan@synopsys.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
v2: Rework goto logic suggested by Vardan, and add a comment

 drivers/usb/dwc2/hcd.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 911c3b3..b60307a 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -3241,6 +3241,14 @@ static void dwc2_conn_id_status_change(struct work_struct *work)
 				 dwc2_is_host_mode(hsotg) ? "Host" :
 				 "Peripheral");
 			usleep_range(20000, 40000);
+			/*
+			 * Sometimes the initial GOTGCTRL read is wrong, so
+			 * check it again and jump to host mode if that was
+			 * the case.
+			 */
+			gotgctl = dwc2_readl(hsotg->regs + GOTGCTL);
+			if (!(gotgctl & GOTGCTL_CONID_B))
+				goto host;
 			if (++count > 250)
 				break;
 		}
@@ -3255,6 +3263,7 @@ static void dwc2_conn_id_status_change(struct work_struct *work)
 		spin_unlock_irqrestore(&hsotg->lock, flags);
 		dwc2_hsotg_core_connect(hsotg);
 	} else {
+host:
 		/* A-Device connector (Host Mode) */
 		dev_dbg(hsotg->dev, "connId A\n");
 		while (!dwc2_is_host_mode(hsotg)) {
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1550147

FromJohn Stultz <john.stultz@linaro.org>
Date2017-01-03 21:10 +0100
Message-ID<sVDzc-2TT-11@gated-at.bofh.it>
In reply to#1550145
On Tue, Jan 3, 2017 at 11:52 AM, John Stultz <john.stultz@linaro.org> wrote:
> Hope everyone had a happy new years!
>
> I just wanted to send out my current queue of patches for dwc2
> controller on the HiKey board for consideration for the 4.11
> merge window.
>
> This does exclude my patchset[1] to add extcon support to dwc2,
> which John Youn suspects a pending rework of the dwc2 fifo init
> logic might make unnecssary.

John/Vardan: Just as a heads up, along with these patches, I'm also
still using the "fix flags for DMA descriptor allocation in
dwc2_hsotg_ep_enable" from Marek Szyprowski, as its not landed
upstream, and I'm also still seeing the matching warning on
dwc2_hsotg_ep_disable() on the free side, as I've not seen a fix for
that yet.

thanks
-john

[toc] | [prev] | [next] | [standalone]


#1550325

FromJohn Youn <John.Youn@synopsys.com>
Date2017-01-04 01:40 +0100
Message-ID<sVHMt-5wN-11@gated-at.bofh.it>
In reply to#1550147
On 1/3/2017 12:05 PM, John Stultz wrote:
> On Tue, Jan 3, 2017 at 11:52 AM, John Stultz <john.stultz@linaro.org> wrote:
>> Hope everyone had a happy new years!
>>
>> I just wanted to send out my current queue of patches for dwc2
>> controller on the HiKey board for consideration for the 4.11
>> merge window.
>>
>> This does exclude my patchset[1] to add extcon support to dwc2,
>> which John Youn suspects a pending rework of the dwc2 fifo init
>> logic might make unnecssary.
> 
> John/Vardan: Just as a heads up, along with these patches, I'm also
> still using the "fix flags for DMA descriptor allocation in
> dwc2_hsotg_ep_enable" from Marek Szyprowski, as its not landed

This just hit Greg's tree and should be in -rc3.

> upstream, and I'm also still seeing the matching warning on
> dwc2_hsotg_ep_disable() on the free side, as I've not seen a fix for
> that yet.

Most of the team is out this week, so it might not be ready until next
week. Unfortunately we had some infrastructure issues which prevented
us from getting this out before the holidays.

Regards,
John

[toc] | [prev] | [next] | [standalone]


#1550329

FromJohn Stultz <john.stultz@linaro.org>
Date2017-01-04 01:50 +0100
Message-ID<sVHW9-5Ar-9@gated-at.bofh.it>
In reply to#1550325
On Tue, Jan 3, 2017 at 4:31 PM, John Youn <John.Youn@synopsys.com> wrote:
> On 1/3/2017 12:05 PM, John Stultz wrote:
>> On Tue, Jan 3, 2017 at 11:52 AM, John Stultz <john.stultz@linaro.org> wrote:
>>> Hope everyone had a happy new years!
>>>
>>> I just wanted to send out my current queue of patches for dwc2
>>> controller on the HiKey board for consideration for the 4.11
>>> merge window.
>>>
>>> This does exclude my patchset[1] to add extcon support to dwc2,
>>> which John Youn suspects a pending rework of the dwc2 fifo init
>>> logic might make unnecssary.
>>
>> John/Vardan: Just as a heads up, along with these patches, I'm also
>> still using the "fix flags for DMA descriptor allocation in
>> dwc2_hsotg_ep_enable" from Marek Szyprowski, as its not landed
>
> This just hit Greg's tree and should be in -rc3.
>
>> upstream, and I'm also still seeing the matching warning on
>> dwc2_hsotg_ep_disable() on the free side, as I've not seen a fix for
>> that yet.
>
> Most of the team is out this week, so it might not be ready until next
> week. Unfortunately we had some infrastructure issues which prevented
> us from getting this out before the holidays.

No worries. I don't mean to stress folks after vacations. Just wanted
to make sure it wasn't forgotten.

thanks
-john

[toc] | [prev] | [next] | [standalone]


#1556977

FromJohn Youn <John.Youn@synopsys.com>
Date2017-01-11 23:10 +0100
Message-ID<sYzfI-42A-23@gated-at.bofh.it>
In reply to#1550145
On 1/3/2017 11:52 AM, John Stultz wrote:
> Hope everyone had a happy new years!
> 
> I just wanted to send out my current queue of patches for dwc2
> controller on the HiKey board for consideration for the 4.11
> merge window.
> 
> This does exclude my patchset[1] to add extcon support to dwc2,
> which John Youn suspects a pending rework of the dwc2 fifo init
> logic might make unnecssary.
> 
> Any feedback would be greatly appreciated!
> 

Hi John,

Do you need these in 4.10-rc or is 4.11 ok?

John

[toc] | [prev] | [next] | [standalone]


#1556992

FromJohn Stultz <john.stultz@linaro.org>
Date2017-01-11 23:40 +0100
Message-ID<sYzIK-4eb-37@gated-at.bofh.it>
In reply to#1556977
On Wed, Jan 11, 2017 at 2:08 PM, John Youn <John.Youn@synopsys.com> wrote:
> On 1/3/2017 11:52 AM, John Stultz wrote:
>> Hope everyone had a happy new years!
>>
>> I just wanted to send out my current queue of patches for dwc2
>> controller on the HiKey board for consideration for the 4.11
>> merge window.
>>
>> This does exclude my patchset[1] to add extcon support to dwc2,
>> which John Youn suspects a pending rework of the dwc2 fifo init
>> logic might make unnecssary.
>>
>> Any feedback would be greatly appreciated!
>>
>
> Hi John,
>
> Do you need these in 4.10-rc or is 4.11 ok?

So I was submitting these for 4.11.

The only one which was sort of a regression fix (though introduced in
4.9 rather then 4.10) was the "Avoid suspending if we're in gadget
mode" one, which you seemed to submit for 4.10-rc already.

Let me know if there is anything you need prior to queuing the rest for 4.11.

thanks
-john

[toc] | [prev] | [next] | [standalone]


#1556997

FromJohn Youn <John.Youn@synopsys.com>
Date2017-01-12 00:00 +0100
Message-ID<sYA25-4n7-7@gated-at.bofh.it>
In reply to#1556992
On 1/11/2017 2:39 PM, John Stultz wrote:
> On Wed, Jan 11, 2017 at 2:08 PM, John Youn <John.Youn@synopsys.com> wrote:
>> On 1/3/2017 11:52 AM, John Stultz wrote:
>>> Hope everyone had a happy new years!
>>>
>>> I just wanted to send out my current queue of patches for dwc2
>>> controller on the HiKey board for consideration for the 4.11
>>> merge window.
>>>
>>> This does exclude my patchset[1] to add extcon support to dwc2,
>>> which John Youn suspects a pending rework of the dwc2 fifo init
>>> logic might make unnecssary.
>>>
>>> Any feedback would be greatly appreciated!
>>>
>>
>> Hi John,
>>
>> Do you need these in 4.10-rc or is 4.11 ok?
> 
> So I was submitting these for 4.11.
> 
> The only one which was sort of a regression fix (though introduced in
> 4.9 rather then 4.10) was the "Avoid suspending if we're in gadget
> mode" one, which you seemed to submit for 4.10-rc already.
> 
> Let me know if there is anything you need prior to queuing the rest for 4.11.
> 

Ok. The only one that will have a problem will be patch 5 due to my
recent series [1].

Can you rebase against that?

Patch 1-4 of this series:
Acked-by: John Youn <johnyoun@synopsys.com>

I'll also add these to our 4.11 branch locally as there are a lot of
interdependent changes. I'll send everything at once to Felipe to make
it easier for him.

Regards,
John

[1] https://www.spinics.net/lists/linux-usb/msg151693.html

[toc] | [prev] | [next] | [standalone]


#1557005

FromJohn Youn <John.Youn@synopsys.com>
Date2017-01-12 00:20 +0100
Message-ID<sYAlr-4Mp-9@gated-at.bofh.it>
In reply to#1556997
On 1/11/2017 3:10 PM, John Stultz wrote:
> On Wed, Jan 11, 2017 at 2:58 PM, John Youn <John.Youn@synopsys.com> wrote:
>> On 1/11/2017 2:39 PM, John Stultz wrote:
>>> On Wed, Jan 11, 2017 at 2:08 PM, John Youn <John.Youn@synopsys.com> wrote:
>>>> On 1/3/2017 11:52 AM, John Stultz wrote:
>>>>> Hope everyone had a happy new years!
>>>>>
>>>>> I just wanted to send out my current queue of patches for dwc2
>>>>> controller on the HiKey board for consideration for the 4.11
>>>>> merge window.
>>>>>
>>>>> This does exclude my patchset[1] to add extcon support to dwc2,
>>>>> which John Youn suspects a pending rework of the dwc2 fifo init
>>>>> logic might make unnecssary.
>>>>>
>>>>> Any feedback would be greatly appreciated!
>>>>>
>>>>
>>>> Hi John,
>>>>
>>>> Do you need these in 4.10-rc or is 4.11 ok?
>>>
>>> So I was submitting these for 4.11.
>>>
>>> The only one which was sort of a regression fix (though introduced in
>>> 4.9 rather then 4.10) was the "Avoid suspending if we're in gadget
>>> mode" one, which you seemed to submit for 4.10-rc already.
>>>
>>> Let me know if there is anything you need prior to queuing the rest for 4.11.
>>>
>>
>> Ok. The only one that will have a problem will be patch 5 due to my
>> recent series [1].
>>
>> Can you rebase against that?
> 
> Do you have a git branch for that series to rebase against?
> 

https://github.com/synopsys-usb/linux.git

branch 'next'

Regards,
John

[toc] | [prev] | [next] | [standalone]


#1557009

FromJohn Stultz <john.stultz@linaro.org>
Date2017-01-12 00:20 +0100
Message-ID<sYAlr-4Mp-11@gated-at.bofh.it>
In reply to#1556997
On Wed, Jan 11, 2017 at 2:58 PM, John Youn <John.Youn@synopsys.com> wrote:
> On 1/11/2017 2:39 PM, John Stultz wrote:
>> On Wed, Jan 11, 2017 at 2:08 PM, John Youn <John.Youn@synopsys.com> wrote:
>>> On 1/3/2017 11:52 AM, John Stultz wrote:
>>>> Hope everyone had a happy new years!
>>>>
>>>> I just wanted to send out my current queue of patches for dwc2
>>>> controller on the HiKey board for consideration for the 4.11
>>>> merge window.
>>>>
>>>> This does exclude my patchset[1] to add extcon support to dwc2,
>>>> which John Youn suspects a pending rework of the dwc2 fifo init
>>>> logic might make unnecssary.
>>>>
>>>> Any feedback would be greatly appreciated!
>>>>
>>>
>>> Hi John,
>>>
>>> Do you need these in 4.10-rc or is 4.11 ok?
>>
>> So I was submitting these for 4.11.
>>
>> The only one which was sort of a regression fix (though introduced in
>> 4.9 rather then 4.10) was the "Avoid suspending if we're in gadget
>> mode" one, which you seemed to submit for 4.10-rc already.
>>
>> Let me know if there is anything you need prior to queuing the rest for 4.11.
>>
>
> Ok. The only one that will have a problem will be patch 5 due to my
> recent series [1].
>
> Can you rebase against that?

Do you have a git branch for that series to rebase against?

thanks
-john

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web