Re: [PATCH] usb: dwc2: Fix HiKey regression caused by power_down feature

2018-09-27 Thread Artur Petrosyan
Hi John,

On 9/25/2018 21:59, John Stultz wrote:
> On Tue, Sep 25, 2018 at 3:04 AM, Artur Petrosyan
>  wrote:
>> Just a clarification by this commit "[PATCH] usb: dwc2: Fix HiKey
>> regression caused by power_down feature"
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__marc.info_-3Fl-3Dlinux-2Dusb-26m-3D152669095513248-26w-3D2&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=9hPBFKCJ_nBjJhGVrrlYOeOQjP_HlVzYqrC_D7niMJI&m=0lMkv7adFVwkzyaUzD6-pUG0iwg4fd6b1-aHQgbqvSI&s=m8SZvo3J_Za08sMbo-S9EkhoA06YnzEN-SRm-uTPnbg&e=
>>
>> the power_down is disabled setting "p->power_down = false;" in
>> "dwc2_set_his_params" function.
>>
>> Could you please clarify that the testes done for those 3 patches were
>> done enabling "p->power_down = true;" in "dwc2_set_his_params" function.
> 
> So if I remove the "power_down = true" initialization, USB does not
> seem to function.
> 
> If I boot w/ the gadget port removed, the USB host ports do work, but
> plugging in the gadget cable results in a bunch of:
> dwc2 f72c.usb: Waiting for Host Mode, Mode=Peripheral
> messages.
> 
> If I boot w/ the gadget port plugged in, USB gadget mode doesn't seem
> to function at all, and when I remove the gadget cable nothing
> happens, it doesn't switch to host mode.
> 
> thanks
> -john
> 

We would like to buy the HiKey board to perform testes.
We found this HiKey LeMaker to have USB 2.0 ports
https://www.ebay.com/itm/HiKey-LeMaker-version-2GB-Kirin-620-SoC-8-core-ARM-Cortex-A53-CPU-ARM-Mali-450/263958047308?hash=item3d75202a4c:g:aGsAAOSwOkxbqqot
on ebay.

Could you please confirm that it is the right board to test the issues 
you mention.

Regards,
Artur


Re: [PATCH] usb: dwc2: Fix HiKey regression caused by power_down feature

2018-09-25 Thread John Stultz
On Tue, Sep 25, 2018 at 3:04 AM, Artur Petrosyan
 wrote:
> Just a clarification by this commit "[PATCH] usb: dwc2: Fix HiKey
> regression caused by power_down feature"
> https://marc.info/?l=linux-usb&m=152669095513248&w=2
>
> the power_down is disabled setting "p->power_down = false;" in
> "dwc2_set_his_params" function.
>
> Could you please clarify that the testes done for those 3 patches were
> done enabling "p->power_down = true;" in "dwc2_set_his_params" function.

So if I remove the "power_down = true" initialization, USB does not
seem to function.

If I boot w/ the gadget port removed, the USB host ports do work, but
plugging in the gadget cable results in a bunch of:
   dwc2 f72c.usb: Waiting for Host Mode, Mode=Peripheral
messages.

If I boot w/ the gadget port plugged in, USB gadget mode doesn't seem
to function at all, and when I remove the gadget cable nothing
happens, it doesn't switch to host mode.

thanks
-john


Re: [PATCH] usb: dwc2: Fix HiKey regression caused by power_down feature

2018-09-24 Thread John Stultz
On Sun, Sep 23, 2018 at 10:57 PM, Artur Petrosyan
 wrote:
> Hi John,
>
> On 9/21/2018 05:05, John Stultz wrote:
>> On Thu, Sep 20, 2018 at 7:17 AM, Artur Petrosyan
>>  wrote:
>>> On 5/23/2018 01:57, John Stultz wrote:
 Its done automatically, when the OTG cable is detected it the host
 ports are disabled and when the OTG port is empty the host ports are
 enabled.

 Let me know if you need anything else!

>>>
>>> Please apply the patch set with this cover letter "[PATCH 0/3] usb:
>>> dwc2: Fix hibernation for switching between host and device modes."
>>
>> Sorry, can you send the patches to me, or point me to a git tree? I'm
>> not seeing that thread in my mailbox or on google.
>>
>>> Enable the power down on his devices. Let me know if you still see any
>>> issue. If there is no issue, please provide Tested-by tag.
>>
>> Would be happy to test it, thought I'm traveling tomorrow, so I may
>> not be able to validate till monday.
>>
>> thanks
>> -john
>>
>
> You can find the patch set following to this link.
>
> https://marc.info/?l=linux-usb&m=153745139408236&w=2

I applied those three patches, and it seems to work ok.

Just to be clear, was there anything else I was needing to do while testing it?

Otherwise,
Tested-by: John Stultz#On HiKey

thanks
-john


Re: [PATCH] usb: dwc2: Fix HiKey regression caused by power_down feature

2018-05-22 Thread John Stultz
On Tue, May 22, 2018 at 7:24 AM, Minas Harutyunyan
 wrote:
> Hi John,
>
> Please provide log with debug enabled configuration.

Ok. Attached.
For dmesg-broken.log:  OTG removed at 77, and OTG plugged in at 82
For dmesg-with-patch.log: OTG removed at 31, OTG plugged in at 38.

Note with the dmesg-with-patch (using my patch), things seem to be
working ok. Though in the example above it may look odd, as usually it
switches to to host mode, then when it detects a low speed device (a
mouse which I had plugged in), it will reset to switch to low-speed,
but I didn't wait long enough for the reset to complete and the mouse
to be detected before re-plugging in the OTG port.

> On 5/21/2018 11:41 PM, John Stultz wrote:
>> On Mon, May 21, 2018 at 1:45 AM, Minas Harutyunyan
>>  wrote:
>>> Hi John,
>>>
>>> On 5/19/2018 4:49 AM, John Stultz wrote:
 In 4.17-rc, commit 03ea6d6e9e1f ("usb: dwc2: Enable power down")
 caused the HiKey board to not correctly handle switching between
 usb-gadget and usb-host mode.

 Unplugging the OTG port would result in:
> OTG port you mean MicroAB, Correct?

Correct.

> dwc2 driver loaded when some device connected to OTG port?

Yes, I normally boot with the board plugged in to OTG as a
peripheral/gadget for adb.

> And below message printed after disconnect the device from OTG port?
>
 [   42.240973] dwc2 f72c.usb: dwc2_restore_host_registers: no host 
 registers to restore
 [   42.249066] dwc2 f72c.usb: dwc2_host_exit_hibernation: failed to 
 restore host registers

Correct.

 And the USB-host ports would not function.
> USB-host ports - you mean 2 USB A-ports, connected to TS3USB221 HUB?

Correct.

> Switching ports between OTG and Host ports via TS3USB221 Switch
> performing automatically or by some SW tool?

Its done automatically, when the OTG cable is detected it the host
ports are disabled and when the OTG port is empty the host ports are
enabled.

Let me know if you need anything else!

thanks
-john


dmesg-broken.log.xz
Description: Binary data


dmesg-with-patch.log.xz
Description: Binary data


Re: [PATCH] usb: dwc2: Fix HiKey regression caused by power_down feature

2018-05-22 Thread Minas Harutyunyan
Hi John,

Please provide log with debug enabled configuration.

On 5/21/2018 11:41 PM, John Stultz wrote:
> On Mon, May 21, 2018 at 1:45 AM, Minas Harutyunyan
>  wrote:
>> Hi John,
>>
>> On 5/19/2018 4:49 AM, John Stultz wrote:
>>> In 4.17-rc, commit 03ea6d6e9e1f ("usb: dwc2: Enable power down")
>>> caused the HiKey board to not correctly handle switching between
>>> usb-gadget and usb-host mode.
>>>
>>> Unplugging the OTG port would result in:
OTG port you mean MicroAB, Correct?
dwc2 driver loaded when some device connected to OTG port?
And below message printed after disconnect the device from OTG port?

>>> [   42.240973] dwc2 f72c.usb: dwc2_restore_host_registers: no host 
>>> registers to restore
>>> [   42.249066] dwc2 f72c.usb: dwc2_host_exit_hibernation: failed to 
>>> restore host registers
>>>
>>> And the USB-host ports would not function.
USB-host ports - you mean 2 USB A-ports, connected to TS3USB221 HUB?
Switching ports between OTG and Host ports via TS3USB221 Switch 
performing automatically or by some SW tool?

>>>
>>> And plugging in the OTG port, we would see:
>>> [   46.046557] WARNING: CPU: 3 PID: 6 at drivers/usb/dwc2/gadget.c:260 
>>> dwc2_hsotg_init_fifo+0x194/0x1a0
>>> [   46.055761] CPU: 3 PID: 6 Comm: kworker/u16:0 Not tainted 
>>> 4.17.0-rc5-00030-ge67da8c #231
>>> [   46.055767] Hardware name: HiKey Development Board (DT)
>>> [   46.055784] Workqueue: dwc2 dwc2_conn_id_status_change
>>> ...
>>>
>> Could you please send full log to debug.
> 
> Full dmesg log attached.
> 
> I unplugged the usb-otg port at 136
> and replugged it back in at 141
> 
> 
>>>p->uframe_sched = false;
>>>p->change_speed_quirk = true;
>>> + p->power_down = false;
>>
>> power_down declared as int, suggested to update as follow:
>>  p->power_down = DWC2_POWER_DOWN_PARAM_NONE;
>>
>> This can be accepted as temporary solution until we will fully debug
>> hibernation feature for HiKey platform.
> 
> Ok, will re-send with the suggested change above.
> 
> thanks
> -john
> 



Re: [PATCH] usb: dwc2: Fix HiKey regression caused by power_down feature

2018-05-21 Thread John Stultz
On Mon, May 21, 2018 at 1:45 AM, Minas Harutyunyan
 wrote:
> Hi John,
>
> On 5/19/2018 4:49 AM, John Stultz wrote:
>> In 4.17-rc, commit 03ea6d6e9e1f ("usb: dwc2: Enable power down")
>> caused the HiKey board to not correctly handle switching between
>> usb-gadget and usb-host mode.
>>
>> Unplugging the OTG port would result in:
>> [   42.240973] dwc2 f72c.usb: dwc2_restore_host_registers: no host 
>> registers to restore
>> [   42.249066] dwc2 f72c.usb: dwc2_host_exit_hibernation: failed to 
>> restore host registers
>>
>> And the USB-host ports would not function.
>>
>> And plugging in the OTG port, we would see:
>> [   46.046557] WARNING: CPU: 3 PID: 6 at drivers/usb/dwc2/gadget.c:260 
>> dwc2_hsotg_init_fifo+0x194/0x1a0
>> [   46.055761] CPU: 3 PID: 6 Comm: kworker/u16:0 Not tainted 
>> 4.17.0-rc5-00030-ge67da8c #231
>> [   46.055767] Hardware name: HiKey Development Board (DT)
>> [   46.055784] Workqueue: dwc2 dwc2_conn_id_status_change
>> ...
>>
> Could you please send full log to debug.

Full dmesg log attached.

I unplugged the usb-otg port at 136
and replugged it back in at 141


>>   p->uframe_sched = false;
>>   p->change_speed_quirk = true;
>> + p->power_down = false;
>
> power_down declared as int, suggested to update as follow:
> p->power_down = DWC2_POWER_DOWN_PARAM_NONE;
>
> This can be accepted as temporary solution until we will fully debug
> hibernation feature for HiKey platform.

Ok, will re-send with the suggested change above.

thanks
-john


dmesg.log
Description: Binary data


Re: [PATCH] usb: dwc2: Fix HiKey regression caused by power_down feature

2018-05-21 Thread Minas Harutyunyan
Hi John,

On 5/19/2018 4:49 AM, John Stultz wrote:
> In 4.17-rc, commit 03ea6d6e9e1f ("usb: dwc2: Enable power down")
> caused the HiKey board to not correctly handle switching between
> usb-gadget and usb-host mode.
> 
> Unplugging the OTG port would result in:
> [   42.240973] dwc2 f72c.usb: dwc2_restore_host_registers: no host 
> registers to restore
> [   42.249066] dwc2 f72c.usb: dwc2_host_exit_hibernation: failed to 
> restore host registers
> 
> And the USB-host ports would not function.
> 
> And plugging in the OTG port, we would see:
> [   46.046557] WARNING: CPU: 3 PID: 6 at drivers/usb/dwc2/gadget.c:260 
> dwc2_hsotg_init_fifo+0x194/0x1a0
> [   46.055761] CPU: 3 PID: 6 Comm: kworker/u16:0 Not tainted 
> 4.17.0-rc5-00030-ge67da8c #231
> [   46.055767] Hardware name: HiKey Development Board (DT)
> [   46.055784] Workqueue: dwc2 dwc2_conn_id_status_change
> ...
> 
Could you please send full log to debug.


> Thus, this patch sets the hisi params to disable the power_down
> flag by default, and gets thing working again.
> 
> Cc: John Youn 
> Cc: Vardan Mikayelyan 
> Cc: Artur Petrosyan 
> Cc: Grigor Tovmasyan 
> Cc: Felipe Balbi 
> Cc: linux-...@vger.kernel.org
> Signed-off-by: John Stultz 
> ---
>   drivers/usb/dwc2/params.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
> index f03e418..96b1b25 100644
> --- a/drivers/usb/dwc2/params.c
> +++ b/drivers/usb/dwc2/params.c
> @@ -70,6 +70,7 @@ static void dwc2_set_his_params(struct dwc2_hsotg *hsotg)
>   GAHBCFG_HBSTLEN_SHIFT;
>   p->uframe_sched = false;
>   p->change_speed_quirk = true;
> + p->power_down = false;

power_down declared as int, suggested to update as follow:
p->power_down = DWC2_POWER_DOWN_PARAM_NONE;

This can be accepted as temporary solution until we will fully debug 
hibernation feature for HiKey platform.

>   }
>   
>   static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg)
> 



[PATCH] usb: dwc2: Fix HiKey regression caused by power_down feature

2018-05-18 Thread John Stultz
In 4.17-rc, commit 03ea6d6e9e1f ("usb: dwc2: Enable power down")
caused the HiKey board to not correctly handle switching between
usb-gadget and usb-host mode.

Unplugging the OTG port would result in:
[   42.240973] dwc2 f72c.usb: dwc2_restore_host_registers: no host 
registers to restore
[   42.249066] dwc2 f72c.usb: dwc2_host_exit_hibernation: failed to restore 
host registers

And the USB-host ports would not function.

And plugging in the OTG port, we would see:
[   46.046557] WARNING: CPU: 3 PID: 6 at drivers/usb/dwc2/gadget.c:260 
dwc2_hsotg_init_fifo+0x194/0x1a0
[   46.055761] CPU: 3 PID: 6 Comm: kworker/u16:0 Not tainted 
4.17.0-rc5-00030-ge67da8c #231
[   46.055767] Hardware name: HiKey Development Board (DT)
[   46.055784] Workqueue: dwc2 dwc2_conn_id_status_change
...

Thus, this patch sets the hisi params to disable the power_down
flag by default, and gets thing working again.

Cc: John Youn 
Cc: Vardan Mikayelyan 
Cc: Artur Petrosyan 
Cc: Grigor Tovmasyan 
Cc: Felipe Balbi 
Cc: linux-...@vger.kernel.org
Signed-off-by: John Stultz 
---
 drivers/usb/dwc2/params.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
index f03e418..96b1b25 100644
--- a/drivers/usb/dwc2/params.c
+++ b/drivers/usb/dwc2/params.c
@@ -70,6 +70,7 @@ static void dwc2_set_his_params(struct dwc2_hsotg *hsotg)
GAHBCFG_HBSTLEN_SHIFT;
p->uframe_sched = false;
p->change_speed_quirk = true;
+   p->power_down = false;
 }
 
 static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg)
-- 
2.7.4