linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Suspend to disk with usb connected fails to detect usb(reset) during resume
@ 2017-11-07  8:04 Ivid Suvarna
  2017-11-07 15:49 ` Alan Stern
  0 siblings, 1 reply; 5+ messages in thread
From: Ivid Suvarna @ 2017-11-07  8:04 UTC (permalink / raw)
  To: linux-usb, balbi, gregkh, billyaraujo, johnyoun, dinguyen,
	felipe.balbi, Alan Stern
  Cc: linux-kernel, Laurent Pinchart, Oliver Neukum, Johan Hovold,
	Michal Nazarewicz, Vincent Pelletier, Jerry Zhang, John Keeping,
	Krzysztof Opasiak, Abdulhadi Mohamed, Matthew Wilcox,
	Janusz Dziedzic

Hi,

I am trying to support suspend to disk(hibernate) on Hikey with 4.4
kernel. During suspend, I could see the usb devices getting reset and I
can access them properly. Message can be seen as below:

usb 1-1: reset high-speed USB device number 2 using dwc2
usb 1-1.2: reset high-speed USB device number 3 using dwc2
usb 1-1.2.4: reset high-speed USB device number 4 using dwc2


But after resume, usb gets disconnected and I could not access it
anymore:

usb 1-1: USB disconnect, device number 2
usb 1-1.2: USB disconnect, device number 3
usb 1-1.2.4: USB disconnect, device number 4

However "dwc2 f72c0000.usb" gets setup properly. I guess it is OTG. I
have connected only keyboard to USB Type-A. OTG is not connected.

I have changed the hibernation default value to 1 in
"drivers/usb/dwc2/platform.c" in params_hi6220 since hibernation by
default is disabled, but still the issue exists.

Is the dwc2_suspend() and dwc2_resume() functions support only suspend
to mem? Is there any hack such that we can forcefully reset the
USB(dwc2) on resume in dwc2_resume() code path. I tried adding
usb_reset_device() to dwc2_resume() path but that gave a panic as
expected. I tried to skip suspend in dwc2_suspend(), but still the usb
disconnects.

I added "dwc2_lowlevel_hw_init" to resume path just to check but still
no use. Is the power to hub lost or clock is not set properly or
something because I could not understand what is the problem.

Below is some more dmesg log:

ivid@ivid:~# dmesg | grep usb
[    0.408019] usbcore: registered new interface driver usbfs
[    0.408099] usbcore: registered new interface driver hub
[    0.408224] usbcore: registered new device driver usb
[    0.486321] usbcore: registered new interface driver asix
[    0.486403] usbcore: registered new interface driver ax88179_178a
[    0.486583] dwc2 f72c0000.usb: Configuration mismatch. Forcing host
mode
[    0.487491] usbcore: registered new interface driver usb-storage
[    0.581006] usbcore: registered new interface driver usbhid
[    0.581052] usbhid: USB HID core driver
[    2.054331] dwc2 f72c0000.usb: Configuration mismatch. Forcing host
mode
[    2.059779] f72c0000.usb supply vusb_d not found, using dummy
regulator
[    2.065133] f72c0000.usb supply vusb_a not found, using dummy
regulator
[    2.939845] dwc2 f72c0000.usb: DWC OTG Controller
[    2.943587] dwc2 f72c0000.usb: new USB bus registered, assigned bus
number 1
[    2.951537] dwc2 f72c0000.usb: irq 37, io mem 0x00000000
[    3.342725] usb 1-1: new high-speed USB device number 2 using dwc2

Below are some additional debug logs.

* During suspend:

dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -104
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -2
dwc2 f72c0000.usb: DWC OTG HCD URB Dequeue
dwc2 f72c0000.usb: Called usb_hcd_giveback_urb()
dwc2 f72c0000.usb:   urb->status = -2

* During resume:

dwc2 f72c0000.usb: ClearPortFeature USB_PORT_FEAT_ENABLE
usb 1-1: USB disconnect, device number 2
done.
usb 1-1.2: USB disconnect, device number 3
asix 1-1.2:1.0 eth0: unregister 'asix' usb-f72c0000.usb-1.2, ASIX
AX88772 USB 2.0 Ethernet
dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00,
ep->hcpriv=ffffffc02ee7d900
dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00,
ep->hcpriv=          (null)
dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x81,
ep->hcpriv=ffffffc02e823f00
dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x82,
ep->hcpriv=ffffffc02e827e00
dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x03,
ep->hcpriv=ffffffc02eeb7800
dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00,
ep->hcpriv=ffffffc02e827000
dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x00,
ep->hcpriv=          (null)
dwc2 f72c0000.usb: DWC OTG HCD EP DISABLE: bEndpointAddress=0x81,
ep->hcpriv=ffffffc02ee7d800
dwc2 f72c0000.usb: SetPortFeature
dwc2 f72c0000.usb: SetPortFeature - USB_PORT_FEAT_POWER

*  I also tried adding "usb: dwc2: Add reset control to dwc2" patch to
4.4 kernel and reset_control_deassert in "_dwc2_hcd_resume", but it
results in panic.

* I am able to reproduce the same issue in 4.9 kernel too.

Any help would be appreciated

Thanks,
Ivid

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Suspend to disk with usb connected fails to detect usb(reset) during resume
  2017-11-07  8:04 Suspend to disk with usb connected fails to detect usb(reset) during resume Ivid Suvarna
@ 2017-11-07 15:49 ` Alan Stern
  2017-11-08 12:29   ` Ivid Suvarna
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Stern @ 2017-11-07 15:49 UTC (permalink / raw)
  To: Ivid Suvarna
  Cc: USB list, balbi, gregkh, billyaraujo, johnyoun, dinguyen,
	Felipe Balbi, Kernel development list, Laurent Pinchart,
	Oliver Neukum, Johan Hovold, Michal Nazarewicz,
	Vincent Pelletier, Jerry Zhang, John Keeping, Krzysztof Opasiak,
	Abdulhadi Mohamed, Matthew Wilcox, Janusz Dziedzic

On Tue, 7 Nov 2017, Ivid Suvarna wrote:

> Hi,
> 
> I am trying to support suspend to disk(hibernate) on Hikey with 4.4
> kernel. During suspend, I could see the usb devices getting reset and I
> can access them properly. Message can be seen as below:
> 
> usb 1-1: reset high-speed USB device number 2 using dwc2
> usb 1-1.2: reset high-speed USB device number 3 using dwc2
> usb 1-1.2.4: reset high-speed USB device number 4 using dwc2

You might start by asking why the devices need to be reset during 
suspend.  I can't see any reason for doing this.

Alan Stern

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Suspend to disk with usb connected fails to detect usb(reset) during resume
  2017-11-07 15:49 ` Alan Stern
@ 2017-11-08 12:29   ` Ivid Suvarna
  2017-11-08 15:42     ` Alan Stern
  2017-11-09 15:17     ` Dinh Nguyen
  0 siblings, 2 replies; 5+ messages in thread
From: Ivid Suvarna @ 2017-11-08 12:29 UTC (permalink / raw)
  To: Alan Stern
  Cc: USB list, balbi, gregkh, Billy Araujo, johnyoun, dinguyen,
	Felipe Balbi, Kernel development list, Laurent Pinchart,
	Oliver Neukum, Johan Hovold, Michal Nazarewicz,
	Vincent Pelletier, Jerry Zhang, John Keeping, Krzysztof Opasiak,
	Abdulhadi Mohamed, Matthew Wilcox, Janusz Dziedzic

On Tue, Nov 7, 2017 at 9:19 PM, Alan Stern <stern@rowland.harvard.edu> wrote:
> On Tue, 7 Nov 2017, Ivid Suvarna wrote:
>
>> Hi,
>>
>> I am trying to support suspend to disk(hibernate) on Hikey with 4.4
>> kernel. During suspend, I could see the usb devices getting reset and I
>> can access them properly. Message can be seen as below:
>>
>> usb 1-1: reset high-speed USB device number 2 using dwc2
>> usb 1-1.2: reset high-speed USB device number 3 using dwc2
>> usb 1-1.2.4: reset high-speed USB device number 4 using dwc2
>
> You might start by asking why the devices need to be reset during
> suspend.  I can't see any reason for doing this.
>
> Alan Stern
>

Yes please. Could you explain as to why the usb needs to reset while
suspending?
This scenario is also observed in normal suspend to ram.

And why the USB gets disconnected on resume from hibernation.
I checked the register dump of usb in /sys/kernel/debug and all
registers after resume have zero value.

But if I run "usb start" from uboot and then resume, I see that usb
gets initialized again and I am able to use USB on resume.

Thanks,
Ivid

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Suspend to disk with usb connected fails to detect usb(reset) during resume
  2017-11-08 12:29   ` Ivid Suvarna
@ 2017-11-08 15:42     ` Alan Stern
  2017-11-09 15:17     ` Dinh Nguyen
  1 sibling, 0 replies; 5+ messages in thread
From: Alan Stern @ 2017-11-08 15:42 UTC (permalink / raw)
  To: Ivid Suvarna
  Cc: USB list, balbi, gregkh, Billy Araujo, johnyoun, dinguyen,
	Felipe Balbi, Kernel development list, Laurent Pinchart,
	Oliver Neukum, Johan Hovold, Michal Nazarewicz,
	Vincent Pelletier, Jerry Zhang, John Keeping, Krzysztof Opasiak,
	Abdulhadi Mohamed, Matthew Wilcox, Janusz Dziedzic

On Wed, 8 Nov 2017, Ivid Suvarna wrote:

> On Tue, Nov 7, 2017 at 9:19 PM, Alan Stern <stern@rowland.harvard.edu> wrote:
> > On Tue, 7 Nov 2017, Ivid Suvarna wrote:
> >
> >> Hi,
> >>
> >> I am trying to support suspend to disk(hibernate) on Hikey with 4.4
> >> kernel. During suspend, I could see the usb devices getting reset and I
> >> can access them properly. Message can be seen as below:
> >>
> >> usb 1-1: reset high-speed USB device number 2 using dwc2
> >> usb 1-1.2: reset high-speed USB device number 3 using dwc2
> >> usb 1-1.2.4: reset high-speed USB device number 4 using dwc2
> >
> > You might start by asking why the devices need to be reset during
> > suspend.  I can't see any reason for doing this.
> >
> > Alan Stern
> >
> 
> Yes please. Could you explain as to why the usb needs to reset while
> suspending?

I cannot explain it.  USB devices do not need to be reset during system 
suspend.

Alan Stern

> This scenario is also observed in normal suspend to ram.
> 
> And why the USB gets disconnected on resume from hibernation.
> I checked the register dump of usb in /sys/kernel/debug and all
> registers after resume have zero value.
> 
> But if I run "usb start" from uboot and then resume, I see that usb
> gets initialized again and I am able to use USB on resume.
> 
> Thanks,
> Ivid

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Suspend to disk with usb connected fails to detect usb(reset) during resume
  2017-11-08 12:29   ` Ivid Suvarna
  2017-11-08 15:42     ` Alan Stern
@ 2017-11-09 15:17     ` Dinh Nguyen
  1 sibling, 0 replies; 5+ messages in thread
From: Dinh Nguyen @ 2017-11-09 15:17 UTC (permalink / raw)
  To: Ivid Suvarna, Alan Stern
  Cc: USB list, balbi, gregkh, Billy Araujo, johnyoun, Felipe Balbi,
	Kernel development list, Laurent Pinchart, Oliver Neukum,
	Johan Hovold, Michal Nazarewicz, Vincent Pelletier, Jerry Zhang,
	John Keeping, Krzysztof Opasiak, Abdulhadi Mohamed,
	Matthew Wilcox, Janusz Dziedzic



On 11/08/2017 06:29 AM, Ivid Suvarna wrote:
> On Tue, Nov 7, 2017 at 9:19 PM, Alan Stern <stern@rowland.harvard.edu> wrote:
>> On Tue, 7 Nov 2017, Ivid Suvarna wrote:
>>
>>> Hi,
>>>
>>> I am trying to support suspend to disk(hibernate) on Hikey with 4.4
>>> kernel. During suspend, I could see the usb devices getting reset and I
>>> can access them properly. Message can be seen as below:
>>>
>>> usb 1-1: reset high-speed USB device number 2 using dwc2
>>> usb 1-1.2: reset high-speed USB device number 3 using dwc2
>>> usb 1-1.2.4: reset high-speed USB device number 4 using dwc2
>>
>> You might start by asking why the devices need to be reset during
>> suspend.  I can't see any reason for doing this.
>>
>> Alan Stern
>>
> 
> Yes please. Could you explain as to why the usb needs to reset while
> suspending?
> This scenario is also observed in normal suspend to ram.
> 
> And why the USB gets disconnected on resume from hibernation.
> I checked the register dump of usb in /sys/kernel/debug and all
> registers after resume have zero value.
> 

Registers with zero value is indicative of a clock not getting turned
on, at least that I have encountered with DWC2 on the SoCFPGA platform.

Dinh

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-09 15:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-07  8:04 Suspend to disk with usb connected fails to detect usb(reset) during resume Ivid Suvarna
2017-11-07 15:49 ` Alan Stern
2017-11-08 12:29   ` Ivid Suvarna
2017-11-08 15:42     ` Alan Stern
2017-11-09 15:17     ` Dinh Nguyen

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).