Skip to contentSkip to conversation

OMAP3/AM3517 EHCI USB Issue

DISCUSSION Felipe Balbi 7 participants 17 messages Jul 28, 2014 – Sep 19, 2014 5 messages not in the archive USB

lore
Share & tools
lore
#5 lore raw
In reply to a message not in the archive
Quoted 97 lines · Michael Welling
Quoted 92 lines · Felipe Balbi

Hi,

Quoted 88 lines · Michael Welling
Quoted 67 lines · Alan Stern
Quoted 65 lines · Michael Welling

The plot thickens....

So if I run the above command before anything is plugged into the ports the HUB disconnects.

root@som3517:~# echo on > /sys/bus/usb/devices/1-1/power/control
[   63.068839] usb 1-1: USB disconnect, device number 2

Here is the output of the usbmon output when running the above command:

root@som3517:/sys/kernel/debug/usb/usbmon# cat 1t
de382e40 3788886573 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788890604 C Ci:001:00 0 4 = 07050000
de382e40 3788892965 S Ci:001:00 s a3 00 0000 0002 0004 4 <
de382e40 3788893093 C Ci:001:00 0 4 = 00010000
de382e40 3788894834 S Ci:001:00 s a3 00 0000 0003 0004 4 <
de382e40 3788894958 C Ci:001:00 0 4 = 00010000
de7d92c0 3788896519 S Ii:001:01 -115 4 <
de382e40 3788898778 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788900188 C Ci:001:00 0 4 = 07050000
de382e40 3788902705 S Co:001:00 s 23 01 0002 0001 0000 0
de382e40 3788905793 C Co:001:00 0 0
de382e40 3788940998 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3788942065 C Ii:001:01 0 1 = 02
de7d92c0 3788943013 S Ii:001:01 -115 4 <
de382e40 3788943145 C Ci:001:00 0 4 = 03050400
de382e40 3788961031 S Co:001:00 s 23 01 0012 0001 0000 0
de382e40 3788961175 C Co:001:00 0 0
de382e40 3788961304 S Ci:002:00 s 80 00 0000 0000 0002 2 <
de382e40 3788965395 C Ci:002:00 -71 0
de249040 3788966954 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3788968362 C Co:001:00 0 0
de249040 3789021103 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3789022194 C Ii:001:01 0 1 = 02
de7d92c0 3789022226 S Ii:001:01 -115 4 <
de249040 3789023423 C Ci:001:00 0 4 = 01051200
de249040 3789025010 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3789026815 C Co:001:00 0 0
de249040 3789230980 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789231111 C Ci:001:00 0 4 = 00010300
de249040 3789232280 S Co:001:00 s 23 01 0014 0001 0000 0
de249040 3789232404 C Co:001:00 0 0
de249040 3789233056 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789235345 C Co:001:00 0 0
de249040 3789236820 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789237201 C Co:001:00 0 0
de249040 3789238180 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789238510 C Co:001:00 0 0
de249040 3789240602 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789241661 C Ci:001:00 0 4 = 00010300
de249040 3789242264 S Co:001:00 s 23 01 0010 0001 0000 0
de249040 3789243921 C Co:001:00 0 0
de249040 3789246540 S Co:001:00 s 23 01 0011 0001 0000 0
de249040 3789246930 C Co:001:00 0 0
de2490c0 3789283096 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789286255 C Ci:001:00 0 4 = 00010000
de2490c0 3789330975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789332606 C Ci:001:00 0 4 = 00010000
de2490c0 3789371015 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789371146 C Ci:001:00 0 4 = 00010000
de2490c0 3789410975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789411097 C Ci:001:00 0 4 = 00010000
de2490c0 3789450972 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789451081 C Ci:001:00 0 4 = 00010000
de7d92c0 3789452462 C Ii:001:01 -2 0
Quoted 5 lines
Quoted 1 line

Not sure what any of it means.

Basically it means what you said above: the hub disconnected. I can't tell why. You'll have to ask someone who's familiar with the hardware on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 7 lines
Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

Signature · 1 line
balbi
#6 lore raw
Quoted 34 lines · Felipe Balbi
Quoted 25 lines · Michael Welling
Quoted 14 lines · Felipe Balbi
Quoted 14 lines
Quoted 4 lines

Basically it means what you said above: the hub disconnected. I can't tell why. You'll have to ask someone who's familiar with the hardware on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

Quoted 6 lines
Quoted 5 lines

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 7 lines
Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

Quoted 7 lines

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

I doubt that you have off-while-idle enabled as you need to manually enable the timeouts for UARTs for it to trigger :) I would check the related power and clock lines with a scope to see if there are glitches on them.

In any case, would be nice to have this EHCI stuff be sorted out for good in the mainline kernel as we do have things working pretty well for other things.

Regards,

Tony

#9 lore raw
In reply to Felipe Balbi

Hi Michael,

Quoted 106 lines · Felipe Balbi
Quoted 97 lines · Michael Welling
Quoted 92 lines · Felipe Balbi

Hi,

Quoted 88 lines · Michael Welling
Quoted 67 lines · Alan Stern
Quoted 65 lines · Michael Welling

The plot thickens....

So if I run the above command before anything is plugged into the ports the HUB disconnects.

root@som3517:~# echo on > /sys/bus/usb/devices/1-1/power/control
[   63.068839] usb 1-1: USB disconnect, device number 2

Here is the output of the usbmon output when running the above command:

root@som3517:/sys/kernel/debug/usb/usbmon# cat 1t
de382e40 3788886573 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788890604 C Ci:001:00 0 4 = 07050000
de382e40 3788892965 S Ci:001:00 s a3 00 0000 0002 0004 4 <
de382e40 3788893093 C Ci:001:00 0 4 = 00010000
de382e40 3788894834 S Ci:001:00 s a3 00 0000 0003 0004 4 <
de382e40 3788894958 C Ci:001:00 0 4 = 00010000
de7d92c0 3788896519 S Ii:001:01 -115 4 <
de382e40 3788898778 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788900188 C Ci:001:00 0 4 = 07050000
de382e40 3788902705 S Co:001:00 s 23 01 0002 0001 0000 0
de382e40 3788905793 C Co:001:00 0 0
de382e40 3788940998 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3788942065 C Ii:001:01 0 1 = 02
de7d92c0 3788943013 S Ii:001:01 -115 4 <
de382e40 3788943145 C Ci:001:00 0 4 = 03050400
de382e40 3788961031 S Co:001:00 s 23 01 0012 0001 0000 0
de382e40 3788961175 C Co:001:00 0 0
de382e40 3788961304 S Ci:002:00 s 80 00 0000 0000 0002 2 <
de382e40 3788965395 C Ci:002:00 -71 0
de249040 3788966954 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3788968362 C Co:001:00 0 0
de249040 3789021103 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3789022194 C Ii:001:01 0 1 = 02
de7d92c0 3789022226 S Ii:001:01 -115 4 <
de249040 3789023423 C Ci:001:00 0 4 = 01051200
de249040 3789025010 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3789026815 C Co:001:00 0 0
de249040 3789230980 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789231111 C Ci:001:00 0 4 = 00010300
de249040 3789232280 S Co:001:00 s 23 01 0014 0001 0000 0
de249040 3789232404 C Co:001:00 0 0
de249040 3789233056 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789235345 C Co:001:00 0 0
de249040 3789236820 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789237201 C Co:001:00 0 0
de249040 3789238180 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789238510 C Co:001:00 0 0
de249040 3789240602 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789241661 C Ci:001:00 0 4 = 00010300
de249040 3789242264 S Co:001:00 s 23 01 0010 0001 0000 0
de249040 3789243921 C Co:001:00 0 0
de249040 3789246540 S Co:001:00 s 23 01 0011 0001 0000 0
de249040 3789246930 C Co:001:00 0 0
de2490c0 3789283096 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789286255 C Ci:001:00 0 4 = 00010000
de2490c0 3789330975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789332606 C Ci:001:00 0 4 = 00010000
de2490c0 3789371015 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789371146 C Ci:001:00 0 4 = 00010000
de2490c0 3789410975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789411097 C Ci:001:00 0 4 = 00010000
de2490c0 3789450972 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789451081 C Ci:001:00 0 4 = 00010000
de7d92c0 3789452462 C Ii:001:01 -2 0
Quoted 5 lines
Quoted 1 line

Not sure what any of it means.

Basically it means what you said above: the hub disconnected. I can't tell why. You'll have to ask someone who's familiar with the hardware on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 7 lines
Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

Quoted 8 lines

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

The EHCI-omap driver when in use should prevent the USBHOST module from idling and this should in turn prevent the CORE from idling. So remote wakeup should work. It works fine in my setup with omap3beagle board OMAP3430/3530 ES3.1. I'm using a recent u-boot v2014.07-rc4.

It seems you are using an older silicon which needs single_ulpi_bypass flag set in platform data. Did your below patch fix the issue for you?
https://lkml.org/lkml/2014/7/28/745

cheers,
-roger

#10 lore raw
Quoted 93 lines · Roger Quadros

Hi Michael,

Quoted 90 lines · Felipe Balbi
Quoted 89 lines · Michael Welling
Quoted 88 lines · Felipe Balbi

Hi,

Quoted 85 lines · Michael Welling
Quoted 67 lines · Alan Stern
Quoted 65 lines · Michael Welling

The plot thickens....

So if I run the above command before anything is plugged into the ports the HUB disconnects.

root@som3517:~# echo on > /sys/bus/usb/devices/1-1/power/control
[   63.068839] usb 1-1: USB disconnect, device number 2

Here is the output of the usbmon output when running the above command:

root@som3517:/sys/kernel/debug/usb/usbmon# cat 1t
de382e40 3788886573 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788890604 C Ci:001:00 0 4 = 07050000
de382e40 3788892965 S Ci:001:00 s a3 00 0000 0002 0004 4 <
de382e40 3788893093 C Ci:001:00 0 4 = 00010000
de382e40 3788894834 S Ci:001:00 s a3 00 0000 0003 0004 4 <
de382e40 3788894958 C Ci:001:00 0 4 = 00010000
de7d92c0 3788896519 S Ii:001:01 -115 4 <
de382e40 3788898778 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788900188 C Ci:001:00 0 4 = 07050000
de382e40 3788902705 S Co:001:00 s 23 01 0002 0001 0000 0
de382e40 3788905793 C Co:001:00 0 0
de382e40 3788940998 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3788942065 C Ii:001:01 0 1 = 02
de7d92c0 3788943013 S Ii:001:01 -115 4 <
de382e40 3788943145 C Ci:001:00 0 4 = 03050400
de382e40 3788961031 S Co:001:00 s 23 01 0012 0001 0000 0
de382e40 3788961175 C Co:001:00 0 0
de382e40 3788961304 S Ci:002:00 s 80 00 0000 0000 0002 2 <
de382e40 3788965395 C Ci:002:00 -71 0
de249040 3788966954 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3788968362 C Co:001:00 0 0
de249040 3789021103 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3789022194 C Ii:001:01 0 1 = 02
de7d92c0 3789022226 S Ii:001:01 -115 4 <
de249040 3789023423 C Ci:001:00 0 4 = 01051200
de249040 3789025010 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3789026815 C Co:001:00 0 0
de249040 3789230980 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789231111 C Ci:001:00 0 4 = 00010300
de249040 3789232280 S Co:001:00 s 23 01 0014 0001 0000 0
de249040 3789232404 C Co:001:00 0 0
de249040 3789233056 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789235345 C Co:001:00 0 0
de249040 3789236820 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789237201 C Co:001:00 0 0
de249040 3789238180 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789238510 C Co:001:00 0 0
de249040 3789240602 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789241661 C Ci:001:00 0 4 = 00010300
de249040 3789242264 S Co:001:00 s 23 01 0010 0001 0000 0
de249040 3789243921 C Co:001:00 0 0
de249040 3789246540 S Co:001:00 s 23 01 0011 0001 0000 0
de249040 3789246930 C Co:001:00 0 0
de2490c0 3789283096 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789286255 C Ci:001:00 0 4 = 00010000
de2490c0 3789330975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789332606 C Ci:001:00 0 4 = 00010000
de2490c0 3789371015 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789371146 C Ci:001:00 0 4 = 00010000
de2490c0 3789410975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789411097 C Ci:001:00 0 4 = 00010000
de2490c0 3789450972 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789451081 C Ci:001:00 0 4 = 00010000
de7d92c0 3789452462 C Ii:001:01 -2 0
Quoted 5 lines
Quoted 1 line

Not sure what any of it means.

Basically it means what you said above: the hub disconnected. I can't tell why. You'll have to ask someone who's familiar with the hardware on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

It should be noted that the USB hardware work on the 3.2 kernel as well.

Quoted 25 lines
Quoted 16 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 7 lines
Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

Quoted 8 lines

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

Quoted 6 lines

The EHCI-omap driver when in use should prevent the USBHOST module from idling and this should in turn prevent the CORE from idling. So remote wakeup should work. It works fine in my setup with omap3beagle board OMAP3430/3530 ES3.1. I'm using a recent u-boot v2014.07-rc4.

It seems you are using an older silicon which needs single_ulpi_bypass flag set in platform data. Did your below patch fix the issue for you?
https://lkml.org/lkml/2014/7/28/745

Sadly, this did not fix the issue that I am having.

The problem seems to be the interaction between the PHY and the HUB on the hardware. The USB host works fine until the last device is removed from the HUB as long a device is plugged in during boot.

The HUB can be forced to stay on if a device is installed during boot. But if you boot without a device plugged in the hardware never detects thereafter.

Quoted 3 lines

cheers,
-roger

#7 lore raw
In reply to Tony Lindgren
Quoted 43 lines · Tony Lindgren
Quoted 34 lines · Felipe Balbi
Quoted 25 lines · Michael Welling
Quoted 14 lines · Felipe Balbi
Quoted 14 lines
Quoted 4 lines

Basically it means what you said above: the hub disconnected. I can't tell why. You'll have to ask someone who's familiar with the hardware on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

Quoted 6 lines
Quoted 5 lines

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 7 lines
Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

Quoted 7 lines

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

Quoted 8 lines

I doubt that you have off-while-idle enabled as you need to manually enable the timeouts for UARTs for it to trigger :) I would check the related power and clock lines with a scope to see if there are glitches on them.

In any case, would be nice to have this EHCI stuff be sorted out for good in the mainline kernel as we do have things working pretty well for other things.

Today I enabled debugging in the core hub driver and found that once the external HUB suspends, the root HUB suspends.

Once the root HUB suspends, it seems there is no way for the external HUB to wake the root HUB with the hardware setup that I have.

root@som3517:~# dmesg | grep hub
[    0.617964] usbcore: registered new interface driver hub
[    2.818449] hub 1-0:1.0: USB hub found
[    2.822980] hub 1-0:1.0: 3 ports detected
[    2.827354] hub 1-0:1.0: standalone hub
[    2.831402] hub 1-0:1.0: individual port power switching
[    2.837067] hub 1-0:1.0: individual port over-current protection
[    2.843400] hub 1-0:1.0: power on to power good time: 20ms
[    2.851414] hub 1-0:1.0: local power source is good
[    2.860133] hub 1-0:1.0: enabling power on all ports
[    3.169607] hub 1-0:1.0: state 7 ports 3 chg 0002 evt 0000
[    3.584251] hub 1-1:1.0: USB hub found
[    3.592571] hub 1-1:1.0: 2 ports detected
[    3.597095] hub 1-1:1.0: standalone hub
[    3.601187] hub 1-1:1.0: individual port power switching
[    3.606875] hub 1-1:1.0: individual port over-current protection
[    3.614899] hub 1-1:1.0: TT per port
[    3.618711] hub 1-1:1.0: TT requires at most 8 FS bit times (666 ns)
[    3.625558] hub 1-1:1.0: power on to power good time: 100ms
[    3.654652] hub 1-1:1.0: local power source is good
[    3.662134] hub 1-1:1.0: enabling power on all ports
[    3.766183] hub 1-1:1.0: state 7 ports 2 chg 0000 evt 0000
[    3.772116] hub 1-1:1.0: hub_suspend
[    3.804789] hub 1-0:1.0: hub_suspend

Here is what happens when I echo on into the power control for the HUB afterwards:

root@som3517:/# echo on > /sys/bus/usb/devices/1-1/power/control
[ 1050.003689] hub 1-0:1.0: hub_resume
[ 1050.011306] usb usb1-port1: status 0507 change 0000
[ 1050.019975] hub 1-0:1.0: state 7 ports 3 chg 0000 evt 0000
[ 1050.028076] usb 1-1: usb auto-resume
[ 1050.065904] hub 1-0:1.0: state 7 ports 3 chg 0000 evt 0002
[ 1050.084623] usb 1-1: finish resume
[ 1050.092469] usb 1-1: retry with reset-resume
[ 1050.156167] hub 1-0:1.0: port_wait_reset: err = -16
[ 1050.161331] usb usb1-port1: not enabled, trying reset again...
[ 1050.376402] usb usb1-port1: logical disconnect
[ 1050.381354] usb 1-1: gone after usb resume? status -19
[ 1050.386941] usb 1-1: can't resume, status -19
[ 1050.391537] usb usb1-port1: logical disconnect
[ 1050.400203] usb usb1-port1: status 0100, change 0003, 12 Mb/s
[ 1050.406410] usb 1-1: USB disconnect, device number 2
[ 1050.411650] usb 1-1: unregistering device
[ 1050.604563] usb usb1-port1: debounce total 100ms stable 100ms status 0x100
[ 1050.611901] hub 1-0:1.0: state 7 ports 3 chg 0000 evt 0000
[ 1050.618428] hub 1-0:1.0: hub_suspend

Further research led me to find multiple errata that may be causing this issue.

www.ti.com/lit/pdf/sprz306

Still does not explain why the same hardware works with the 2.6.37 and 3.2 kernels.

Quoted 4 lines

Regards,

Tony

#8 lore raw
Quoted 2 lines · Michael Welling

Today I enabled debugging in the core hub driver and found that once the external HUB suspends, the root HUB suspends.

Naturally. You can prevent that by forcing the root hub to remain active.

Quoted 18 lines

Once the root HUB suspends, it seems there is no way for the external HUB to wake the root HUB with the hardware setup that I have.

Here is what happens when I echo on into the power control for the HUB afterwards:

root@som3517:/# echo on > /sys/bus/usb/devices/1-1/power/control
[ 1050.003689] hub 1-0:1.0: hub_resume
[ 1050.011306] usb usb1-port1: status 0507 change 0000
[ 1050.019975] hub 1-0:1.0: state 7 ports 3 chg 0000 evt 0000
[ 1050.028076] usb 1-1: usb auto-resume
[ 1050.065904] hub 1-0:1.0: state 7 ports 3 chg 0000 evt 0002
[ 1050.084623] usb 1-1: finish resume
[ 1050.092469] usb 1-1: retry with reset-resume
[ 1050.156167] hub 1-0:1.0: port_wait_reset: err = -16
[ 1050.161331] usb usb1-port1: not enabled, trying reset again...
[ 1050.376402] usb usb1-port1: logical disconnect
[ 1050.381354] usb 1-1: gone after usb resume? status -19
Quoted 8 lines
[ 1050.386941] usb 1-1: can't resume, status -19
[ 1050.391537] usb usb1-port1: logical disconnect
[ 1050.400203] usb usb1-port1: status 0100, change 0003, 12 Mb/s
[ 1050.406410] usb 1-1: USB disconnect, device number 2
[ 1050.411650] usb 1-1: unregistering device
[ 1050.604563] usb usb1-port1: debounce total 100ms stable 100ms status 0x100
[ 1050.611901] hub 1-0:1.0: state 7 ports 3 chg 0000 evt 0000
[ 1050.618428] hub 1-0:1.0: hub_suspend

The hub disconnects.

Quoted 4 lines

Further research led me to find multiple errata that may be causing this issue.

www.ti.com/lit/pdf/sprz306

That 1.1.18 advisory looks pretty bad.

Quoted 2 lines

Still does not explain why the same hardware works with the 2.6.37 and 3.2 kernels.

Maybe you should try bisection. It's slow but it gives you an answer.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw
In reply to Michael Welling
Quoted 122 lines · Michael Welling
Quoted 93 lines · Roger Quadros

Hi Michael,

Quoted 90 lines · Felipe Balbi
Quoted 89 lines · Michael Welling
Quoted 88 lines · Felipe Balbi

Hi,

Quoted 85 lines · Michael Welling
Quoted 67 lines · Alan Stern
Quoted 65 lines · Michael Welling

The plot thickens....

So if I run the above command before anything is plugged into the ports the HUB disconnects.

root@som3517:~# echo on > /sys/bus/usb/devices/1-1/power/control
[   63.068839] usb 1-1: USB disconnect, device number 2

Here is the output of the usbmon output when running the above command:

root@som3517:/sys/kernel/debug/usb/usbmon# cat 1t
de382e40 3788886573 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788890604 C Ci:001:00 0 4 = 07050000
de382e40 3788892965 S Ci:001:00 s a3 00 0000 0002 0004 4 <
de382e40 3788893093 C Ci:001:00 0 4 = 00010000
de382e40 3788894834 S Ci:001:00 s a3 00 0000 0003 0004 4 <
de382e40 3788894958 C Ci:001:00 0 4 = 00010000
de7d92c0 3788896519 S Ii:001:01 -115 4 <
de382e40 3788898778 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788900188 C Ci:001:00 0 4 = 07050000
de382e40 3788902705 S Co:001:00 s 23 01 0002 0001 0000 0
de382e40 3788905793 C Co:001:00 0 0
de382e40 3788940998 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3788942065 C Ii:001:01 0 1 = 02
de7d92c0 3788943013 S Ii:001:01 -115 4 <
de382e40 3788943145 C Ci:001:00 0 4 = 03050400
de382e40 3788961031 S Co:001:00 s 23 01 0012 0001 0000 0
de382e40 3788961175 C Co:001:00 0 0
de382e40 3788961304 S Ci:002:00 s 80 00 0000 0000 0002 2 <
de382e40 3788965395 C Ci:002:00 -71 0
de249040 3788966954 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3788968362 C Co:001:00 0 0
de249040 3789021103 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3789022194 C Ii:001:01 0 1 = 02
de7d92c0 3789022226 S Ii:001:01 -115 4 <
de249040 3789023423 C Ci:001:00 0 4 = 01051200
de249040 3789025010 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3789026815 C Co:001:00 0 0
de249040 3789230980 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789231111 C Ci:001:00 0 4 = 00010300
de249040 3789232280 S Co:001:00 s 23 01 0014 0001 0000 0
de249040 3789232404 C Co:001:00 0 0
de249040 3789233056 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789235345 C Co:001:00 0 0
de249040 3789236820 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789237201 C Co:001:00 0 0
de249040 3789238180 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789238510 C Co:001:00 0 0
de249040 3789240602 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789241661 C Ci:001:00 0 4 = 00010300
de249040 3789242264 S Co:001:00 s 23 01 0010 0001 0000 0
de249040 3789243921 C Co:001:00 0 0
de249040 3789246540 S Co:001:00 s 23 01 0011 0001 0000 0
de249040 3789246930 C Co:001:00 0 0
de2490c0 3789283096 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789286255 C Ci:001:00 0 4 = 00010000
de2490c0 3789330975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789332606 C Ci:001:00 0 4 = 00010000
de2490c0 3789371015 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789371146 C Ci:001:00 0 4 = 00010000
de2490c0 3789410975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789411097 C Ci:001:00 0 4 = 00010000
de2490c0 3789450972 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789451081 C Ci:001:00 0 4 = 00010000
de7d92c0 3789452462 C Ii:001:01 -2 0
Quoted 5 lines
Quoted 1 line

Not sure what any of it means.

Basically it means what you said above: the hub disconnected. I can't tell why. You'll have to ask someone who's familiar with the hardware on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

It should be noted that the USB hardware work on the 3.2 kernel as well.

Quoted 25 lines
Quoted 24 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 7 lines
Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

Quoted 8 lines
Quoted 6 lines

The EHCI-omap driver when in use should prevent the USBHOST module from idling and this should in turn prevent the CORE from idling. So remote wakeup should work. It works fine in my setup with omap3beagle board OMAP3430/3530 ES3.1. I'm using a recent u-boot v2014.07-rc4.

It seems you are using an older silicon which needs single_ulpi_bypass flag set in platform data. Did your below patch fix the issue for you?
https://lkml.org/lkml/2014/7/28/745

Sadly, this did not fix the issue that I am having.

OK. what u-boot version you are on? I can try to test with the same version.

Quoted 4 lines

The problem seems to be the interaction between the PHY and the HUB on the hardware. The USB host works fine until the last device is removed from the HUB as long a device is plugged in during boot.

OK. The ULPI link seems to be dead after the external hub and PHY suspends. As 3.2 works for you it should be easy to find out what commit broke the functionality for older silicon.

Could you please find out the latest kernel version works for you. e.g. v3.4 or v3.8.

Then we can narrow down on the commits on the following files that are introduced in the next failing kernel version drivers/mfd/omap-usb-host.c
drivers/mfd/omap-usb-tll.c
drivers/usb/host/ehci-omap.c
arch/arm/mach-omap2/usb-host.c

Much of the cleanup was introduced in 3.9 so my guess is that v3.8 will work.
If 3.8 doesn't work then you will have to check all versions from v3.3 to v3.9 till you find the first failing version.

cheers,
-roger

#12 lore raw
Quoted 126 lines · Roger Quadros
Quoted 125 lines · Michael Welling
Quoted 93 lines · Roger Quadros

Hi Michael,

Quoted 90 lines · Felipe Balbi
Quoted 89 lines · Michael Welling
Quoted 88 lines · Felipe Balbi

Hi,

Quoted 85 lines · Michael Welling
Quoted 67 lines · Alan Stern
Quoted 65 lines · Michael Welling

The plot thickens....

So if I run the above command before anything is plugged into the ports the HUB disconnects.

root@som3517:~# echo on > /sys/bus/usb/devices/1-1/power/control
[   63.068839] usb 1-1: USB disconnect, device number 2

Here is the output of the usbmon output when running the above command:

root@som3517:/sys/kernel/debug/usb/usbmon# cat 1t
de382e40 3788886573 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788890604 C Ci:001:00 0 4 = 07050000
de382e40 3788892965 S Ci:001:00 s a3 00 0000 0002 0004 4 <
de382e40 3788893093 C Ci:001:00 0 4 = 00010000
de382e40 3788894834 S Ci:001:00 s a3 00 0000 0003 0004 4 <
de382e40 3788894958 C Ci:001:00 0 4 = 00010000
de7d92c0 3788896519 S Ii:001:01 -115 4 <
de382e40 3788898778 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788900188 C Ci:001:00 0 4 = 07050000
de382e40 3788902705 S Co:001:00 s 23 01 0002 0001 0000 0
de382e40 3788905793 C Co:001:00 0 0
de382e40 3788940998 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3788942065 C Ii:001:01 0 1 = 02
de7d92c0 3788943013 S Ii:001:01 -115 4 <
de382e40 3788943145 C Ci:001:00 0 4 = 03050400
de382e40 3788961031 S Co:001:00 s 23 01 0012 0001 0000 0
de382e40 3788961175 C Co:001:00 0 0
de382e40 3788961304 S Ci:002:00 s 80 00 0000 0000 0002 2 <
de382e40 3788965395 C Ci:002:00 -71 0
de249040 3788966954 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3788968362 C Co:001:00 0 0
de249040 3789021103 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3789022194 C Ii:001:01 0 1 = 02
de7d92c0 3789022226 S Ii:001:01 -115 4 <
de249040 3789023423 C Ci:001:00 0 4 = 01051200
de249040 3789025010 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3789026815 C Co:001:00 0 0
de249040 3789230980 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789231111 C Ci:001:00 0 4 = 00010300
de249040 3789232280 S Co:001:00 s 23 01 0014 0001 0000 0
de249040 3789232404 C Co:001:00 0 0
de249040 3789233056 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789235345 C Co:001:00 0 0
de249040 3789236820 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789237201 C Co:001:00 0 0
de249040 3789238180 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789238510 C Co:001:00 0 0
de249040 3789240602 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789241661 C Ci:001:00 0 4 = 00010300
de249040 3789242264 S Co:001:00 s 23 01 0010 0001 0000 0
de249040 3789243921 C Co:001:00 0 0
de249040 3789246540 S Co:001:00 s 23 01 0011 0001 0000 0
de249040 3789246930 C Co:001:00 0 0
de2490c0 3789283096 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789286255 C Ci:001:00 0 4 = 00010000
de2490c0 3789330975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789332606 C Ci:001:00 0 4 = 00010000
de2490c0 3789371015 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789371146 C Ci:001:00 0 4 = 00010000
de2490c0 3789410975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789411097 C Ci:001:00 0 4 = 00010000
de2490c0 3789450972 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789451081 C Ci:001:00 0 4 = 00010000
de7d92c0 3789452462 C Ii:001:01 -2 0
Quoted 5 lines
Quoted 1 line

Not sure what any of it means.

Basically it means what you said above: the hub disconnected. I can't tell why. You'll have to ask someone who's familiar with the hardware on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

It should be noted that the USB hardware work on the 3.2 kernel as well.

Quoted 28 lines
Quoted 16 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 7 lines
Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

Quoted 8 lines

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

The EHCI-omap driver when in use should prevent the USBHOST module from idling and this should in turn prevent the CORE from idling. So remote wakeup should work. It works fine in my setup with omap3beagle board OMAP3430/3530 ES3.1. I'm using a recent u-boot v2014.07-rc4.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

It seems you are using an older silicon which needs single_ulpi_bypass flag set in platform data. Did your below patch fix the issue for you?
https://lkml.org/lkml/2014/7/28/745

Sadly, this did not fix the issue that I am having.

OK. what u-boot version you are on? I can try to test with the same version.

2014.01-rc2-00028-gfef24f4-dirty

I used the Craneboard configuration and swapped in the pin multiplexing for our board.

The config

Quoted 10 lines
Quoted 4 lines

The problem seems to be the interaction between the PHY and the HUB on the hardware. The USB host works fine until the last device is removed from the HUB as long a device is plugged in during boot.

OK. The ULPI link seems to be dead after the external hub and PHY suspends. As 3.2 works for you it should be easy to find out what commit broke the functionality for older silicon.

Could you please find out the latest kernel version works for you. e.g. v3.4 or v3.8.

I will. Something tells me that the driver used to force the power on to avoid the suspend errata.

Quoted 12 lines

Then we can narrow down on the commits on the following files that are introduced in the next failing kernel version drivers/mfd/omap-usb-host.c
drivers/mfd/omap-usb-tll.c
drivers/usb/host/ehci-omap.c
arch/arm/mach-omap2/usb-host.c

Much of the cleanup was introduced in 3.9 so my guess is that v3.8 will work.
If 3.8 doesn't work then you will have to check all versions from v3.3 to v3.9 till you find the first failing version.

cheers,
-roger

#13 lore raw
Quoted 136 lines · Michael Welling
Quoted 126 lines · Roger Quadros
Quoted 125 lines · Michael Welling
Quoted 93 lines · Roger Quadros

Hi Michael,

Quoted 90 lines · Felipe Balbi
Quoted 89 lines · Michael Welling
Quoted 88 lines · Felipe Balbi

Hi,

Quoted 85 lines · Michael Welling
Quoted 67 lines · Alan Stern
Quoted 65 lines · Michael Welling

The plot thickens....

So if I run the above command before anything is plugged into the ports the HUB disconnects.

root@som3517:~# echo on > /sys/bus/usb/devices/1-1/power/control
[   63.068839] usb 1-1: USB disconnect, device number 2

Here is the output of the usbmon output when running the above command:

root@som3517:/sys/kernel/debug/usb/usbmon# cat 1t
de382e40 3788886573 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788890604 C Ci:001:00 0 4 = 07050000
de382e40 3788892965 S Ci:001:00 s a3 00 0000 0002 0004 4 <
de382e40 3788893093 C Ci:001:00 0 4 = 00010000
de382e40 3788894834 S Ci:001:00 s a3 00 0000 0003 0004 4 <
de382e40 3788894958 C Ci:001:00 0 4 = 00010000
de7d92c0 3788896519 S Ii:001:01 -115 4 <
de382e40 3788898778 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788900188 C Ci:001:00 0 4 = 07050000
de382e40 3788902705 S Co:001:00 s 23 01 0002 0001 0000 0
de382e40 3788905793 C Co:001:00 0 0
de382e40 3788940998 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3788942065 C Ii:001:01 0 1 = 02
de7d92c0 3788943013 S Ii:001:01 -115 4 <
de382e40 3788943145 C Ci:001:00 0 4 = 03050400
de382e40 3788961031 S Co:001:00 s 23 01 0012 0001 0000 0
de382e40 3788961175 C Co:001:00 0 0
de382e40 3788961304 S Ci:002:00 s 80 00 0000 0000 0002 2 <
de382e40 3788965395 C Ci:002:00 -71 0
de249040 3788966954 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3788968362 C Co:001:00 0 0
de249040 3789021103 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3789022194 C Ii:001:01 0 1 = 02
de7d92c0 3789022226 S Ii:001:01 -115 4 <
de249040 3789023423 C Ci:001:00 0 4 = 01051200
de249040 3789025010 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3789026815 C Co:001:00 0 0
de249040 3789230980 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789231111 C Ci:001:00 0 4 = 00010300
de249040 3789232280 S Co:001:00 s 23 01 0014 0001 0000 0
de249040 3789232404 C Co:001:00 0 0
de249040 3789233056 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789235345 C Co:001:00 0 0
de249040 3789236820 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789237201 C Co:001:00 0 0
de249040 3789238180 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789238510 C Co:001:00 0 0
de249040 3789240602 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789241661 C Ci:001:00 0 4 = 00010300
de249040 3789242264 S Co:001:00 s 23 01 0010 0001 0000 0
de249040 3789243921 C Co:001:00 0 0
de249040 3789246540 S Co:001:00 s 23 01 0011 0001 0000 0
de249040 3789246930 C Co:001:00 0 0
de2490c0 3789283096 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789286255 C Ci:001:00 0 4 = 00010000
de2490c0 3789330975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789332606 C Ci:001:00 0 4 = 00010000
de2490c0 3789371015 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789371146 C Ci:001:00 0 4 = 00010000
de2490c0 3789410975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789411097 C Ci:001:00 0 4 = 00010000
de2490c0 3789450972 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789451081 C Ci:001:00 0 4 = 00010000
de7d92c0 3789452462 C Ii:001:01 -2 0
Quoted 5 lines
Quoted 1 line

Not sure what any of it means.

Basically it means what you said above: the hub disconnected. I can't tell why. You'll have to ask someone who's familiar with the hardware on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

It should be noted that the USB hardware work on the 3.2 kernel as well.

Quoted 28 lines
Quoted 16 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 7 lines
Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

Quoted 8 lines

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

The EHCI-omap driver when in use should prevent the USBHOST module from idling and this should in turn prevent the CORE from idling. So remote wakeup should work. It works fine in my setup with omap3beagle board OMAP3430/3530 ES3.1. I'm using a recent u-boot v2014.07-rc4.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

It seems you are using an older silicon which needs single_ulpi_bypass flag set in platform data. Did your below patch fix the issue for you?
https://lkml.org/lkml/2014/7/28/745

Sadly, this did not fix the issue that I am having.

OK. what u-boot version you are on? I can try to test with the same version.

Quoted 6 lines

2014.01-rc2-00028-gfef24f4-dirty

I used the Craneboard configuration and swapped in the pin multiplexing for our board.

The config

Sorry I trialed off here. The configuration was modified slightly to add bootz and environment in the FAT partition in MMC.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

The problem seems to be the interaction between the PHY and the HUB on the hardware. The USB host works fine until the last device is removed from the HUB as long a device is plugged in during boot.

Quoted 9 lines
Quoted 5 lines

OK. The ULPI link seems to be dead after the external hub and PHY suspends. As 3.2 works for you it should be easy to find out what commit broke the functionality for older silicon.

Could you please find out the latest kernel version works for you. e.g. v3.4 or v3.8.

I will. Something tells me that the driver used to force the power on to avoid the suspend errata.

I have been having little success pin pointing the revision that caused this issue to start.
Looking through the commit logs, EHCI on OMAP has been problematic for quite some time.

My brain is scrambled.

Quoted 12 lines
Quoted 12 lines

Then we can narrow down on the commits on the following files that are introduced in the next failing kernel version drivers/mfd/omap-usb-host.c
drivers/mfd/omap-usb-tll.c
drivers/usb/host/ehci-omap.c
arch/arm/mach-omap2/usb-host.c

Much of the cleanup was introduced in 3.9 so my guess is that v3.8 will work.
If 3.8 doesn't work then you will have to check all versions from v3.3 to v3.9 till you find the first failing version.

cheers,
-roger

#21 lore raw
In reply to Michael Welling

Am 29.07.2014 17:20, schrieb Michael Welling:

Quoted 86 lines · Roger Quadros
Quoted 85 lines

Hi Michael,

Quoted 82 lines · Felipe Balbi
Quoted 81 lines · Michael Welling
Quoted 80 lines · Felipe Balbi

Hi,

Quoted 77 lines · Michael Welling
Quoted 67 lines · Alan Stern
Quoted 65 lines · Michael Welling

The plot thickens....

So if I run the above command before anything is plugged into the ports the HUB disconnects.

root@som3517:~# echo on > /sys/bus/usb/devices/1-1/power/control
[   63.068839] usb 1-1: USB disconnect, device number 2

Here is the output of the usbmon output when running the above command:

root@som3517:/sys/kernel/debug/usb/usbmon# cat 1t
de382e40 3788886573 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788890604 C Ci:001:00 0 4 = 07050000
de382e40 3788892965 S Ci:001:00 s a3 00 0000 0002 0004 4 <
de382e40 3788893093 C Ci:001:00 0 4 = 00010000
de382e40 3788894834 S Ci:001:00 s a3 00 0000 0003 0004 4 <
de382e40 3788894958 C Ci:001:00 0 4 = 00010000
de7d92c0 3788896519 S Ii:001:01 -115 4 <
de382e40 3788898778 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788900188 C Ci:001:00 0 4 = 07050000
de382e40 3788902705 S Co:001:00 s 23 01 0002 0001 0000 0
de382e40 3788905793 C Co:001:00 0 0
de382e40 3788940998 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3788942065 C Ii:001:01 0 1 = 02
de7d92c0 3788943013 S Ii:001:01 -115 4 <
de382e40 3788943145 C Ci:001:00 0 4 = 03050400
de382e40 3788961031 S Co:001:00 s 23 01 0012 0001 0000 0
de382e40 3788961175 C Co:001:00 0 0
de382e40 3788961304 S Ci:002:00 s 80 00 0000 0000 0002 2 <
de382e40 3788965395 C Ci:002:00 -71 0
de249040 3788966954 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3788968362 C Co:001:00 0 0
de249040 3789021103 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3789022194 C Ii:001:01 0 1 = 02
de7d92c0 3789022226 S Ii:001:01 -115 4 <
de249040 3789023423 C Ci:001:00 0 4 = 01051200
de249040 3789025010 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3789026815 C Co:001:00 0 0
de249040 3789230980 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789231111 C Ci:001:00 0 4 = 00010300
de249040 3789232280 S Co:001:00 s 23 01 0014 0001 0000 0
de249040 3789232404 C Co:001:00 0 0
de249040 3789233056 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789235345 C Co:001:00 0 0
de249040 3789236820 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789237201 C Co:001:00 0 0
de249040 3789238180 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789238510 C Co:001:00 0 0
de249040 3789240602 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789241661 C Ci:001:00 0 4 = 00010300
de249040 3789242264 S Co:001:00 s 23 01 0010 0001 0000 0
de249040 3789243921 C Co:001:00 0 0
de249040 3789246540 S Co:001:00 s 23 01 0011 0001 0000 0
de249040 3789246930 C Co:001:00 0 0
de2490c0 3789283096 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789286255 C Ci:001:00 0 4 = 00010000
de2490c0 3789330975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789332606 C Ci:001:00 0 4 = 00010000
de2490c0 3789371015 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789371146 C Ci:001:00 0 4 = 00010000
de2490c0 3789410975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789411097 C Ci:001:00 0 4 = 00010000
de2490c0 3789450972 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789451081 C Ci:001:00 0 4 = 00010000
de7d92c0 3789452462 C Ii:001:01 -2 0
Quoted 4 lines
Quoted 1 line

Not sure what any of it means.

Basically it means what you said above: the hub disconnected. I can't tell why. You'll have to ask someone who's familiar with the hardware on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

Quoted 28 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

It should be noted that the USB hardware work on the 3.2 kernel as well.

Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

Quoted 8 lines

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

The EHCI-omap driver when in use should prevent the USBHOST module from idling and this should in turn prevent the CORE from idling. So remote wakeup should work. It works fine in my setup with omap3beagle board OMAP3430/3530 ES3.1.

Have you test it with an external HUB?

Quoted 7 lines
Quoted 5 lines

I'm using a recent u-boot v2014.07-rc4.

It seems you are using an older silicon which needs single_ulpi_bypass flag set in platform data. Did your below patch fix the issue for you?
https://lkml.org/lkml/2014/7/28/745

Sadly, this did not fix the issue that I am having.

Quoted 7 lines

The problem seems to be the interaction between the PHY and the HUB on the hardware. The USB host works fine until the last device is removed from the HUB as long a device is plugged in during boot.

The HUB can be forced to stay on if a device is installed during boot. But if you boot without a device plugged in the hardware never detects thereafter.

I have the same issue with an OMAP3530 ES3.1 (Gumstix Overo Tide) and an USB2512 Hub on a developed expansion board.

I use an modified U-Boot 2014.07-rc2 and Linux 3.14.5 with device tree.

Regards,
Stefan

#14 lore raw
In reply to Roger Quadros
Quoted 135 lines · Roger Quadros
Quoted 122 lines · Michael Welling
Quoted 93 lines · Roger Quadros

Hi Michael,

Quoted 90 lines · Felipe Balbi
Quoted 89 lines · Michael Welling
Quoted 88 lines · Felipe Balbi

Hi,

Quoted 85 lines · Michael Welling
Quoted 67 lines · Alan Stern
Quoted 65 lines · Michael Welling

The plot thickens....

So if I run the above command before anything is plugged into the ports the HUB disconnects.

root@som3517:~# echo on > /sys/bus/usb/devices/1-1/power/control
[   63.068839] usb 1-1: USB disconnect, device number 2

Here is the output of the usbmon output when running the above command:

root@som3517:/sys/kernel/debug/usb/usbmon# cat 1t
de382e40 3788886573 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788890604 C Ci:001:00 0 4 = 07050000
de382e40 3788892965 S Ci:001:00 s a3 00 0000 0002 0004 4 <
de382e40 3788893093 C Ci:001:00 0 4 = 00010000
de382e40 3788894834 S Ci:001:00 s a3 00 0000 0003 0004 4 <
de382e40 3788894958 C Ci:001:00 0 4 = 00010000
de7d92c0 3788896519 S Ii:001:01 -115 4 <
de382e40 3788898778 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788900188 C Ci:001:00 0 4 = 07050000
de382e40 3788902705 S Co:001:00 s 23 01 0002 0001 0000 0
de382e40 3788905793 C Co:001:00 0 0
de382e40 3788940998 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3788942065 C Ii:001:01 0 1 = 02
de7d92c0 3788943013 S Ii:001:01 -115 4 <
de382e40 3788943145 C Ci:001:00 0 4 = 03050400
de382e40 3788961031 S Co:001:00 s 23 01 0012 0001 0000 0
de382e40 3788961175 C Co:001:00 0 0
de382e40 3788961304 S Ci:002:00 s 80 00 0000 0000 0002 2 <
de382e40 3788965395 C Ci:002:00 -71 0
de249040 3788966954 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3788968362 C Co:001:00 0 0
de249040 3789021103 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3789022194 C Ii:001:01 0 1 = 02
de7d92c0 3789022226 S Ii:001:01 -115 4 <
de249040 3789023423 C Ci:001:00 0 4 = 01051200
de249040 3789025010 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3789026815 C Co:001:00 0 0
de249040 3789230980 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789231111 C Ci:001:00 0 4 = 00010300
de249040 3789232280 S Co:001:00 s 23 01 0014 0001 0000 0
de249040 3789232404 C Co:001:00 0 0
de249040 3789233056 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789235345 C Co:001:00 0 0
de249040 3789236820 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789237201 C Co:001:00 0 0
de249040 3789238180 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789238510 C Co:001:00 0 0
de249040 3789240602 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789241661 C Ci:001:00 0 4 = 00010300
de249040 3789242264 S Co:001:00 s 23 01 0010 0001 0000 0
de249040 3789243921 C Co:001:00 0 0
de249040 3789246540 S Co:001:00 s 23 01 0011 0001 0000 0
de249040 3789246930 C Co:001:00 0 0
de2490c0 3789283096 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789286255 C Ci:001:00 0 4 = 00010000
de2490c0 3789330975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789332606 C Ci:001:00 0 4 = 00010000
de2490c0 3789371015 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789371146 C Ci:001:00 0 4 = 00010000
de2490c0 3789410975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789411097 C Ci:001:00 0 4 = 00010000
de2490c0 3789450972 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789451081 C Ci:001:00 0 4 = 00010000
de7d92c0 3789452462 C Ii:001:01 -2 0
Quoted 5 lines
Quoted 1 line

Not sure what any of it means.

Basically it means what you said above: the hub disconnected. I can't tell why. You'll have to ask someone who's familiar with the hardware on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

It should be noted that the USB hardware work on the 3.2 kernel as well.

Quoted 25 lines
Quoted 24 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 7 lines
Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

Quoted 8 lines
Quoted 6 lines

The EHCI-omap driver when in use should prevent the USBHOST module from idling and this should in turn prevent the CORE from idling. So remote wakeup should work. It works fine in my setup with omap3beagle board OMAP3430/3530 ES3.1. I'm using a recent u-boot v2014.07-rc4.

It seems you are using an older silicon which needs single_ulpi_bypass flag set in platform data. Did your below patch fix the issue for you?
https://lkml.org/lkml/2014/7/28/745

Sadly, this did not fix the issue that I am having.

OK. what u-boot version you are on? I can try to test with the same version.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

The problem seems to be the interaction between the PHY and the HUB on the hardware. The USB host works fine until the last device is removed from the HUB as long a device is plugged in during boot.

OK. The ULPI link seems to be dead after the external hub and PHY suspends. As 3.2 works for you it should be easy to find out what commit broke the functionality for older silicon.

So I found something today in our 3.2.21 kernel that probably worked around this suspend failure.

http://git.emacinc.com/source/linux-emac.git/commit/2ede90e83c2432de5932a03dd79edd543eca1053

Sadly this means the failure predates the 3.2 kernel.

So I commented out the usb_enable_autosuspend() calls in the core HUB driver and magically I can plug and unplug all day long without a problem.

So autosuspend is causing the failure.

Now what is the best way to implement a fix without trashing the kernel?

Quoted 14 lines

Could you please find out the latest kernel version works for you. e.g. v3.4 or v3.8.

Then we can narrow down on the commits on the following files that are introduced in the next failing kernel version drivers/mfd/omap-usb-host.c
drivers/mfd/omap-usb-tll.c
drivers/usb/host/ehci-omap.c
arch/arm/mach-omap2/usb-host.c

Much of the cleanup was introduced in 3.9 so my guess is that v3.8 will work.
If 3.8 doesn't work then you will have to check all versions from v3.3 to v3.9 till you find the first failing version.

cheers,
-roger

#15 lore raw
Quoted 149 lines · Michael Welling
Quoted 135 lines · Roger Quadros
Quoted 122 lines · Michael Welling
Quoted 93 lines · Roger Quadros

Hi Michael,

Quoted 90 lines · Felipe Balbi
Quoted 89 lines · Michael Welling
Quoted 88 lines · Felipe Balbi

Hi,

Quoted 85 lines · Michael Welling
Quoted 67 lines · Alan Stern
Quoted 65 lines · Michael Welling

The plot thickens....

So if I run the above command before anything is plugged into the ports the HUB disconnects.

root@som3517:~# echo on > /sys/bus/usb/devices/1-1/power/control
[   63.068839] usb 1-1: USB disconnect, device number 2

Here is the output of the usbmon output when running the above command:

root@som3517:/sys/kernel/debug/usb/usbmon# cat 1t
de382e40 3788886573 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788890604 C Ci:001:00 0 4 = 07050000
de382e40 3788892965 S Ci:001:00 s a3 00 0000 0002 0004 4 <
de382e40 3788893093 C Ci:001:00 0 4 = 00010000
de382e40 3788894834 S Ci:001:00 s a3 00 0000 0003 0004 4 <
de382e40 3788894958 C Ci:001:00 0 4 = 00010000
de7d92c0 3788896519 S Ii:001:01 -115 4 <
de382e40 3788898778 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788900188 C Ci:001:00 0 4 = 07050000
de382e40 3788902705 S Co:001:00 s 23 01 0002 0001 0000 0
de382e40 3788905793 C Co:001:00 0 0
de382e40 3788940998 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3788942065 C Ii:001:01 0 1 = 02
de7d92c0 3788943013 S Ii:001:01 -115 4 <
de382e40 3788943145 C Ci:001:00 0 4 = 03050400
de382e40 3788961031 S Co:001:00 s 23 01 0012 0001 0000 0
de382e40 3788961175 C Co:001:00 0 0
de382e40 3788961304 S Ci:002:00 s 80 00 0000 0000 0002 2 <
de382e40 3788965395 C Ci:002:00 -71 0
de249040 3788966954 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3788968362 C Co:001:00 0 0
de249040 3789021103 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3789022194 C Ii:001:01 0 1 = 02
de7d92c0 3789022226 S Ii:001:01 -115 4 <
de249040 3789023423 C Ci:001:00 0 4 = 01051200
de249040 3789025010 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3789026815 C Co:001:00 0 0
de249040 3789230980 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789231111 C Ci:001:00 0 4 = 00010300
de249040 3789232280 S Co:001:00 s 23 01 0014 0001 0000 0
de249040 3789232404 C Co:001:00 0 0
de249040 3789233056 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789235345 C Co:001:00 0 0
de249040 3789236820 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789237201 C Co:001:00 0 0
de249040 3789238180 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789238510 C Co:001:00 0 0
de249040 3789240602 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789241661 C Ci:001:00 0 4 = 00010300
de249040 3789242264 S Co:001:00 s 23 01 0010 0001 0000 0
de249040 3789243921 C Co:001:00 0 0
de249040 3789246540 S Co:001:00 s 23 01 0011 0001 0000 0
de249040 3789246930 C Co:001:00 0 0
de2490c0 3789283096 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789286255 C Ci:001:00 0 4 = 00010000
de2490c0 3789330975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789332606 C Ci:001:00 0 4 = 00010000
de2490c0 3789371015 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789371146 C Ci:001:00 0 4 = 00010000
de2490c0 3789410975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789411097 C Ci:001:00 0 4 = 00010000
de2490c0 3789450972 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789451081 C Ci:001:00 0 4 = 00010000
de7d92c0 3789452462 C Ii:001:01 -2 0
Quoted 5 lines
Quoted 1 line

Not sure what any of it means.

Basically it means what you said above: the hub disconnected. I can't tell why. You'll have to ask someone who's familiar with the hardware on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

It should be noted that the USB hardware work on the 3.2 kernel as well.

Quoted 25 lines
Quoted 24 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 7 lines
Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

Quoted 8 lines
Quoted 6 lines

The EHCI-omap driver when in use should prevent the USBHOST module from idling and this should in turn prevent the CORE from idling. So remote wakeup should work. It works fine in my setup with omap3beagle board OMAP3430/3530 ES3.1. I'm using a recent u-boot v2014.07-rc4.

It seems you are using an older silicon which needs single_ulpi_bypass flag set in platform data. Did your below patch fix the issue for you?
https://lkml.org/lkml/2014/7/28/745

Sadly, this did not fix the issue that I am having.

OK. what u-boot version you are on? I can try to test with the same version.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

The problem seems to be the interaction between the PHY and the HUB on the hardware. The USB host works fine until the last device is removed from the HUB as long a device is plugged in during boot.

OK. The ULPI link seems to be dead after the external hub and PHY suspends. As 3.2 works for you it should be easy to find out what commit broke the functionality for older silicon.

So I found something today in our 3.2.21 kernel that probably worked around this suspend failure.

http://git.emacinc.com/source/linux-emac.git/commit/2ede90e83c2432de5932a03dd79edd543eca1053

Quoted 8 lines

Sadly this means the failure predates the 3.2 kernel.

So I commented out the usb_enable_autosuspend() calls in the core HUB driver and magically I can plug and unplug all day long without a problem.

So autosuspend is causing the failure.

Now what is the best way to implement a fix without trashing the kernel?

It should be noted that the external HUB must be prevented from autosuspend otherwise the resume fails.

Quoted 15 lines
Quoted 15 lines

Could you please find out the latest kernel version works for you. e.g. v3.4 or v3.8.

Then we can narrow down on the commits on the following files that are introduced in the next failing kernel version drivers/mfd/omap-usb-host.c
drivers/mfd/omap-usb-tll.c
drivers/usb/host/ehci-omap.c
arch/arm/mach-omap2/usb-host.c

Much of the cleanup was introduced in 3.9 so my guess is that v3.8 will work.
If 3.8 doesn't work then you will have to check all versions from v3.3 to v3.9 till you find the first failing version.

cheers,
-roger

#16 lore raw
Quoted 155 lines · Michael Welling
Quoted 154 lines · Michael Welling
Quoted 135 lines · Roger Quadros
Quoted 122 lines · Michael Welling
Quoted 93 lines · Roger Quadros

Hi Michael,

Quoted 90 lines · Felipe Balbi
Quoted 89 lines · Michael Welling
Quoted 88 lines · Felipe Balbi

Hi,

Quoted 85 lines · Michael Welling
Quoted 67 lines · Alan Stern
Quoted 65 lines · Michael Welling

The plot thickens....

So if I run the above command before anything is plugged into the ports the HUB disconnects.

root@som3517:~# echo on > /sys/bus/usb/devices/1-1/power/control
[   63.068839] usb 1-1: USB disconnect, device number 2

Here is the output of the usbmon output when running the above command:

root@som3517:/sys/kernel/debug/usb/usbmon# cat 1t
de382e40 3788886573 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788890604 C Ci:001:00 0 4 = 07050000
de382e40 3788892965 S Ci:001:00 s a3 00 0000 0002 0004 4 <
de382e40 3788893093 C Ci:001:00 0 4 = 00010000
de382e40 3788894834 S Ci:001:00 s a3 00 0000 0003 0004 4 <
de382e40 3788894958 C Ci:001:00 0 4 = 00010000
de7d92c0 3788896519 S Ii:001:01 -115 4 <
de382e40 3788898778 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788900188 C Ci:001:00 0 4 = 07050000
de382e40 3788902705 S Co:001:00 s 23 01 0002 0001 0000 0
de382e40 3788905793 C Co:001:00 0 0
de382e40 3788940998 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3788942065 C Ii:001:01 0 1 = 02
de7d92c0 3788943013 S Ii:001:01 -115 4 <
de382e40 3788943145 C Ci:001:00 0 4 = 03050400
de382e40 3788961031 S Co:001:00 s 23 01 0012 0001 0000 0
de382e40 3788961175 C Co:001:00 0 0
de382e40 3788961304 S Ci:002:00 s 80 00 0000 0000 0002 2 <
de382e40 3788965395 C Ci:002:00 -71 0
de249040 3788966954 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3788968362 C Co:001:00 0 0
de249040 3789021103 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3789022194 C Ii:001:01 0 1 = 02
de7d92c0 3789022226 S Ii:001:01 -115 4 <
de249040 3789023423 C Ci:001:00 0 4 = 01051200
de249040 3789025010 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3789026815 C Co:001:00 0 0
de249040 3789230980 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789231111 C Ci:001:00 0 4 = 00010300
de249040 3789232280 S Co:001:00 s 23 01 0014 0001 0000 0
de249040 3789232404 C Co:001:00 0 0
de249040 3789233056 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789235345 C Co:001:00 0 0
de249040 3789236820 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789237201 C Co:001:00 0 0
de249040 3789238180 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789238510 C Co:001:00 0 0
de249040 3789240602 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789241661 C Ci:001:00 0 4 = 00010300
de249040 3789242264 S Co:001:00 s 23 01 0010 0001 0000 0
de249040 3789243921 C Co:001:00 0 0
de249040 3789246540 S Co:001:00 s 23 01 0011 0001 0000 0
de249040 3789246930 C Co:001:00 0 0
de2490c0 3789283096 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789286255 C Ci:001:00 0 4 = 00010000
de2490c0 3789330975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789332606 C Ci:001:00 0 4 = 00010000
de2490c0 3789371015 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789371146 C Ci:001:00 0 4 = 00010000
de2490c0 3789410975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789411097 C Ci:001:00 0 4 = 00010000
de2490c0 3789450972 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789451081 C Ci:001:00 0 4 = 00010000
de7d92c0 3789452462 C Ii:001:01 -2 0
Quoted 5 lines
Quoted 1 line

Not sure what any of it means.

Basically it means what you said above: the hub disconnected. I can't tell why. You'll have to ask someone who's familiar with the hardware on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

It should be noted that the USB hardware work on the 3.2 kernel as well.

Quoted 25 lines
Quoted 24 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 7 lines
Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

Quoted 8 lines
Quoted 6 lines

The EHCI-omap driver when in use should prevent the USBHOST module from idling and this should in turn prevent the CORE from idling. So remote wakeup should work. It works fine in my setup with omap3beagle board OMAP3430/3530 ES3.1. I'm using a recent u-boot v2014.07-rc4.

It seems you are using an older silicon which needs single_ulpi_bypass flag set in platform data. Did your below patch fix the issue for you?
https://lkml.org/lkml/2014/7/28/745

Sadly, this did not fix the issue that I am having.

OK. what u-boot version you are on? I can try to test with the same version.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

The problem seems to be the interaction between the PHY and the HUB on the hardware. The USB host works fine until the last device is removed from the HUB as long a device is plugged in during boot.

OK. The ULPI link seems to be dead after the external hub and PHY suspends. As 3.2 works for you it should be easy to find out what commit broke the functionality for older silicon.

So I found something today in our 3.2.21 kernel that probably worked around this suspend failure.

http://git.emacinc.com/source/linux-emac.git/commit/2ede90e83c2432de5932a03dd79edd543eca1053

Sadly this means the failure predates the 3.2 kernel.

So I commented out the usb_enable_autosuspend() calls in the core HUB driver and magically I can plug and unplug all day long without a problem.

Quoted 6 lines
Quoted 3 lines

So autosuspend is causing the failure.

Now what is the best way to implement a fix without trashing the kernel?

It should be noted that the external HUB must be prevented from autosuspend otherwise the resume fails.

OK. I was able to reproduce the issue on my beagleboard as well. The key to reproduce the issue is to use a device which has autosuspend working. Earlier I was using a mass storage device so couldn't reproduce the issue. On using a HUB I could see the issue. Debugging this issue is on my action list.

Meanwhile, if autosuspend is not that crucial for your application you could either disable autosuspend for the whole USB subsystem or for just that one HUB that is directly attached to the root port.

To disable the autosuspend for the whole USB you need to pass "usbcore.autosuspend=-1" via the command line. This will however not disable autosuspend for HUBs. This is a bug in the kernel from v3.8 onwards. For that you need the below patch. I will send it again on the mailing list.

cheers,
-roger

From: Roger Quadros <[email protected]>
Date: Mon, 4 Aug 2014 12:21:08 +0300
Subject: [PATCH] usb: hub: Prevent autosuspend if usbcore.autosuspend is -1

If user specifies that USB autosuspend must be disabled by module parameter "usbcore.autosuspend=-1" then we must prevent autosuspend of USB hub devices as well.

commit 596d789a211d introduced in v3.8 changed the original behaivour and stopped respecting the usbcore.autosuspend parameter for hubs.

---
 drivers/usb/core/hub.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/core/hub.c +5 -1
index 0e950ad..a287cd5 100644
@@ -1728,8 +1728,12 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
 	 * - Change autosuspend delay of hub can avoid unnecessary auto
 	 *   suspend timer for hub, also may decrease power consumption
 	 *   of USB bus.
+	 *
+	 * - If user has indicated to prevent autosuspend by passing
+	 *   usbcore.autosuspend = -1 then keep autosuspend disabled.
 	 */
-	pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
+	if (hdev->dev.power.autosuspend_delay >= 0)
+		pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
 
 	/*
 	 * Hubs have proper suspend/resume support, except for root hubs
Signature · 1 line
1.8.3.2
#17 lore raw
Quoted 156 lines · Roger Quadros
Quoted 155 lines · Michael Welling
Quoted 154 lines · Michael Welling
Quoted 135 lines · Roger Quadros
Quoted 122 lines · Michael Welling
Quoted 93 lines · Roger Quadros

Hi Michael,

Quoted 90 lines · Felipe Balbi
Quoted 89 lines · Michael Welling
Quoted 88 lines · Felipe Balbi

Hi,

Quoted 85 lines · Michael Welling
Quoted 67 lines · Alan Stern
Quoted 65 lines · Michael Welling

The plot thickens....

So if I run the above command before anything is plugged into the ports the HUB disconnects.

root@som3517:~# echo on > /sys/bus/usb/devices/1-1/power/control
[   63.068839] usb 1-1: USB disconnect, device number 2

Here is the output of the usbmon output when running the above command:

root@som3517:/sys/kernel/debug/usb/usbmon# cat 1t
de382e40 3788886573 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788890604 C Ci:001:00 0 4 = 07050000
de382e40 3788892965 S Ci:001:00 s a3 00 0000 0002 0004 4 <
de382e40 3788893093 C Ci:001:00 0 4 = 00010000
de382e40 3788894834 S Ci:001:00 s a3 00 0000 0003 0004 4 <
de382e40 3788894958 C Ci:001:00 0 4 = 00010000
de7d92c0 3788896519 S Ii:001:01 -115 4 <
de382e40 3788898778 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788900188 C Ci:001:00 0 4 = 07050000
de382e40 3788902705 S Co:001:00 s 23 01 0002 0001 0000 0
de382e40 3788905793 C Co:001:00 0 0
de382e40 3788940998 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3788942065 C Ii:001:01 0 1 = 02
de7d92c0 3788943013 S Ii:001:01 -115 4 <
de382e40 3788943145 C Ci:001:00 0 4 = 03050400
de382e40 3788961031 S Co:001:00 s 23 01 0012 0001 0000 0
de382e40 3788961175 C Co:001:00 0 0
de382e40 3788961304 S Ci:002:00 s 80 00 0000 0000 0002 2 <
de382e40 3788965395 C Ci:002:00 -71 0
de249040 3788966954 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3788968362 C Co:001:00 0 0
de249040 3789021103 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3789022194 C Ii:001:01 0 1 = 02
de7d92c0 3789022226 S Ii:001:01 -115 4 <
de249040 3789023423 C Ci:001:00 0 4 = 01051200
de249040 3789025010 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3789026815 C Co:001:00 0 0
de249040 3789230980 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789231111 C Ci:001:00 0 4 = 00010300
de249040 3789232280 S Co:001:00 s 23 01 0014 0001 0000 0
de249040 3789232404 C Co:001:00 0 0
de249040 3789233056 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789235345 C Co:001:00 0 0
de249040 3789236820 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789237201 C Co:001:00 0 0
de249040 3789238180 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789238510 C Co:001:00 0 0
de249040 3789240602 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789241661 C Ci:001:00 0 4 = 00010300
de249040 3789242264 S Co:001:00 s 23 01 0010 0001 0000 0
de249040 3789243921 C Co:001:00 0 0
de249040 3789246540 S Co:001:00 s 23 01 0011 0001 0000 0
de249040 3789246930 C Co:001:00 0 0
de2490c0 3789283096 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789286255 C Ci:001:00 0 4 = 00010000
de2490c0 3789330975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789332606 C Ci:001:00 0 4 = 00010000
de2490c0 3789371015 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789371146 C Ci:001:00 0 4 = 00010000
de2490c0 3789410975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789411097 C Ci:001:00 0 4 = 00010000
de2490c0 3789450972 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789451081 C Ci:001:00 0 4 = 00010000
de7d92c0 3789452462 C Ii:001:01 -2 0
Quoted 5 lines
Quoted 1 line

Not sure what any of it means.

Basically it means what you said above: the hub disconnected. I can't tell why. You'll have to ask someone who's familiar with the hardware on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

It should be noted that the USB hardware work on the 3.2 kernel as well.

Quoted 25 lines
Quoted 24 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 7 lines
Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

Quoted 8 lines
Quoted 6 lines

The EHCI-omap driver when in use should prevent the USBHOST module from idling and this should in turn prevent the CORE from idling. So remote wakeup should work. It works fine in my setup with omap3beagle board OMAP3430/3530 ES3.1. I'm using a recent u-boot v2014.07-rc4.

It seems you are using an older silicon which needs single_ulpi_bypass flag set in platform data. Did your below patch fix the issue for you?
https://lkml.org/lkml/2014/7/28/745

Sadly, this did not fix the issue that I am having.

OK. what u-boot version you are on? I can try to test with the same version.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

The problem seems to be the interaction between the PHY and the HUB on the hardware. The USB host works fine until the last device is removed from the HUB as long a device is plugged in during boot.

OK. The ULPI link seems to be dead after the external hub and PHY suspends. As 3.2 works for you it should be easy to find out what commit broke the functionality for older silicon.

So I found something today in our 3.2.21 kernel that probably worked around this suspend failure.

http://git.emacinc.com/source/linux-emac.git/commit/2ede90e83c2432de5932a03dd79edd543eca1053

Sadly this means the failure predates the 3.2 kernel.

So I commented out the usb_enable_autosuspend() calls in the core HUB driver and magically I can plug and unplug all day long without a problem.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

So autosuspend is causing the failure.

Now what is the best way to implement a fix without trashing the kernel?

It should be noted that the external HUB must be prevented from autosuspend otherwise the resume fails.

OK. I was able to reproduce the issue on my beagleboard as well. The key to reproduce the issue is to use a device which has autosuspend working. Earlier I was using a mass storage device so couldn't reproduce the issue. On using a HUB I could see the issue. Debugging this issue is on my action list.

I will keep an eye out for the fix if it is possible. The implementation of the remote resume workaround as listed in the sprz306d.pdf seems to hack into the core EHCI drivers and limits you to a single USB host.

Quoted 4 lines

Meanwhile, if autosuspend is not that crucial for your application you could either disable autosuspend for the whole USB subsystem or for just that one HUB that is directly attached to the root port.

To disable the autosuspend for the whole USB you need to pass "usbcore.autosuspend=-1" via the command line. This will however not disable autosuspend for HUBs. This is a bug in the kernel from v3.8 onwards. For that you need the below patch. I will send it again on the mailing list.

This fix should work for our current needs. I will test it and ensure that it works with our hardware.

Quoted 41 lines

cheers,
-roger

From: Roger Quadros <[email protected]>
Date: Mon, 4 Aug 2014 12:21:08 +0300
Subject: [PATCH] usb: hub: Prevent autosuspend if usbcore.autosuspend is -1

If user specifies that USB autosuspend must be disabled by module parameter "usbcore.autosuspend=-1" then we must prevent autosuspend of USB hub devices as well.

commit 596d789a211d introduced in v3.8 changed the original behaivour and stopped respecting the usbcore.autosuspend parameter for hubs.

---
 drivers/usb/core/hub.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/core/hub.c +5 -1
index 0e950ad..a287cd5 100644
@@ -1728,8 +1728,12 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
 	 * - Change autosuspend delay of hub can avoid unnecessary auto
 	 *   suspend timer for hub, also may decrease power consumption
 	 *   of USB bus.
+	 *
+	 * - If user has indicated to prevent autosuspend by passing
+	 *   usbcore.autosuspend = -1 then keep autosuspend disabled.
 	 */
-	pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
+	if (hdev->dev.power.autosuspend_delay >= 0)
+		pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
 
 	/*
 	 * Hubs have proper suspend/resume support, except for root hubs
Signature · 1 line
1.8.3.2
#18 lore raw

Hi Michael,

Quoted 164 lines · Michael Welling
Quoted 163 lines · Roger Quadros
Quoted 161 lines · Michael Welling
Quoted 149 lines · Michael Welling
Quoted 135 lines · Roger Quadros
Quoted 122 lines · Michael Welling
Quoted 93 lines · Roger Quadros

Hi Michael,

Quoted 90 lines · Felipe Balbi
Quoted 89 lines · Michael Welling
Quoted 88 lines · Felipe Balbi

Hi,

Quoted 85 lines · Michael Welling
Quoted 67 lines · Alan Stern
Quoted 65 lines · Michael Welling

The plot thickens....

So if I run the above command before anything is plugged into the ports
the HUB disconnects.

root@som3517:~# echo on > /sys/bus/usb/devices/1-1/power/control
[ 63.068839] usb 1-1: USB disconnect, device number 2

Here is the output of the usbmon output when running the above command:
root@som3517:/sys/kernel/debug/usb/usbmon# cat 1t
de382e40 3788886573 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788890604 C Ci:001:00 0 4 = 07050000
de382e40 3788892965 S Ci:001:00 s a3 00 0000 0002 0004 4 <
de382e40 3788893093 C Ci:001:00 0 4 = 00010000
de382e40 3788894834 S Ci:001:00 s a3 00 0000 0003 0004 4 <
de382e40 3788894958 C Ci:001:00 0 4 = 00010000
de7d92c0 3788896519 S Ii:001:01 -115 4 <
de382e40 3788898778 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788900188 C Ci:001:00 0 4 = 07050000
de382e40 3788902705 S Co:001:00 s 23 01 0002 0001 0000 0
de382e40 3788905793 C Co:001:00 0 0
de382e40 3788940998 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3788942065 C Ii:001:01 0 1 = 02
de7d92c0 3788943013 S Ii:001:01 -115 4 <
de382e40 3788943145 C Ci:001:00 0 4 = 03050400
de382e40 3788961031 S Co:001:00 s 23 01 0012 0001 0000 0
de382e40 3788961175 C Co:001:00 0 0
de382e40 3788961304 S Ci:002:00 s 80 00 0000 0000 0002 2 <
de382e40 3788965395 C Ci:002:00 -71 0
de249040 3788966954 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3788968362 C Co:001:00 0 0
de249040 3789021103 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3789022194 C Ii:001:01 0 1 = 02
de7d92c0 3789022226 S Ii:001:01 -115 4 <
de249040 3789023423 C Ci:001:00 0 4 = 01051200
de249040 3789025010 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3789026815 C Co:001:00 0 0
de249040 3789230980 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789231111 C Ci:001:00 0 4 = 00010300
de249040 3789232280 S Co:001:00 s 23 01 0014 0001 0000 0
de249040 3789232404 C Co:001:00 0 0
de249040 3789233056 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789235345 C Co:001:00 0 0
de249040 3789236820 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789237201 C Co:001:00 0 0
de249040 3789238180 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789238510 C Co:001:00 0 0
de249040 3789240602 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789241661 C Ci:001:00 0 4 = 00010300
de249040 3789242264 S Co:001:00 s 23 01 0010 0001 0000 0
de249040 3789243921 C Co:001:00 0 0
de249040 3789246540 S Co:001:00 s 23 01 0011 0001 0000 0
de249040 3789246930 C Co:001:00 0 0
de2490c0 3789283096 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789286255 C Ci:001:00 0 4 = 00010000
de2490c0 3789330975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789332606 C Ci:001:00 0 4 = 00010000
de2490c0 3789371015 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789371146 C Ci:001:00 0 4 = 00010000
de2490c0 3789410975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789411097 C Ci:001:00 0 4 = 00010000
de2490c0 3789450972 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789451081 C Ci:001:00 0 4 = 00010000
de7d92c0 3789452462 C Ii:001:01 -2 0

Quoted 5 lines
Quoted 1 line

Not sure what any of it means.

Basically it means what you said above: the hub disconnected. I can't tell why. You'll have to ask someone who's familiar with the hardware on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

It should be noted that the USB hardware work on the 3.2 kernel as well.

Quoted 25 lines
Quoted 24 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 7 lines
Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

Quoted 8 lines
Quoted 6 lines

The EHCI-omap driver when in use should prevent the USBHOST module from idling and this should in turn prevent the CORE from idling. So remote wakeup should work. It works fine in my setup with omap3beagle board OMAP3430/3530 ES3.1. I'm using a recent u-boot v2014.07-rc4.

It seems you are using an older silicon which needs single_ulpi_bypass flag set in platform data. Did your below patch fix the issue for you?
https://lkml.org/lkml/2014/7/28/745

Sadly, this did not fix the issue that I am having.

OK. what u-boot version you are on? I can try to test with the same version.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

The problem seems to be the interaction between the PHY and the HUB on the hardware. The USB host works fine until the last device is removed from the HUB as long a device is plugged in during boot.

OK. The ULPI link seems to be dead after the external hub and PHY suspends. As 3.2 works for you it should be easy to find out what commit broke the functionality for older silicon.

So I found something today in our 3.2.21 kernel that probably worked around this suspend failure.

http://git.emacinc.com/source/linux-emac.git/commit/2ede90e83c2432de5932a03dd79edd543eca1053

Quoted 8 lines

Sadly this means the failure predates the 3.2 kernel.

So I commented out the usb_enable_autosuspend() calls in the core HUB driver and magically I can plug and unplug all day long without a problem.

So autosuspend is causing the failure.

Now what is the best way to implement a fix without trashing the kernel?

It should be noted that the external HUB must be prevented from autosuspend otherwise the resume fails.

Quoted 7 lines
Quoted 2 lines

OK. I was able to reproduce the issue on my beagleboard as well. The key to reproduce the issue is to use a device which has autosuspend working. Earlier I was using a mass storage device so couldn't reproduce the issue. On using a HUB I could see the issue. Debugging this issue is on my action list.

I will keep an eye out for the fix if it is possible. The implementation of the remote resume workaround as listed in the sprz306d.pdf seems to hack into the core EHCI drivers and limits you to a single USB host.

Please see Advisory 1.1.33 HSUSB Interoperability Issue with SMSC USB3320 PHY (sprz306d errata doc).

It seems ULPI suspend/resume is broken and there is no workaround. So you have to prevent the USB device connected at root port from suspending.

cheers,
-roger

#19 lore raw

Hi Roger

Quoted 175 lines · Roger Quadros

Hi Michael,

Quoted 164 lines · Michael Welling
Quoted 163 lines · Roger Quadros
Quoted 161 lines · Michael Welling
Quoted 149 lines · Michael Welling
Quoted 135 lines · Roger Quadros
Quoted 122 lines · Michael Welling
Quoted 93 lines · Roger Quadros

Hi Michael,

Quoted 90 lines · Felipe Balbi
Quoted 89 lines · Michael Welling
Quoted 88 lines · Felipe Balbi

Hi,

Quoted 85 lines · Michael Welling
Quoted 72 lines · Alan Stern

On Fri, 25 Jul 2014, Michael Welling wrote:

The plot thickens....

So if I run the above command before anything is plugged into the ports
the HUB disconnects.

root@som3517:~# echo on > /sys/bus/usb/devices/1-1/power/control
[ 63.068839] usb 1-1: USB disconnect, device number 2

Here is the output of the usbmon output when running the above command:
root@som3517:/sys/kernel/debug/usb/usbmon# cat 1t
de382e40 3788886573 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788890604 C Ci:001:00 0 4 = 07050000
de382e40 3788892965 S Ci:001:00 s a3 00 0000 0002 0004 4 <
de382e40 3788893093 C Ci:001:00 0 4 = 00010000
de382e40 3788894834 S Ci:001:00 s a3 00 0000 0003 0004 4 <
de382e40 3788894958 C Ci:001:00 0 4 = 00010000
de7d92c0 3788896519 S Ii:001:01 -115 4 <
de382e40 3788898778 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de382e40 3788900188 C Ci:001:00 0 4 = 07050000
de382e40 3788902705 S Co:001:00 s 23 01 0002 0001 0000 0
de382e40 3788905793 C Co:001:00 0 0
de382e40 3788940998 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3788942065 C Ii:001:01 0 1 = 02
de7d92c0 3788943013 S Ii:001:01 -115 4 <
de382e40 3788943145 C Ci:001:00 0 4 = 03050400
de382e40 3788961031 S Co:001:00 s 23 01 0012 0001 0000 0
de382e40 3788961175 C Co:001:00 0 0
de382e40 3788961304 S Ci:002:00 s 80 00 0000 0000 0002 2 <
de382e40 3788965395 C Ci:002:00 -71 0
de249040 3788966954 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3788968362 C Co:001:00 0 0
de249040 3789021103 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de7d92c0 3789022194 C Ii:001:01 0 1 = 02
de7d92c0 3789022226 S Ii:001:01 -115 4 <
de249040 3789023423 C Ci:001:00 0 4 = 01051200
de249040 3789025010 S Co:001:00 s 23 03 0004 0001 0000 0
de249040 3789026815 C Co:001:00 0 0
de249040 3789230980 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789231111 C Ci:001:00 0 4 = 00010300
de249040 3789232280 S Co:001:00 s 23 01 0014 0001 0000 0
de249040 3789232404 C Co:001:00 0 0
de249040 3789233056 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789235345 C Co:001:00 0 0
de249040 3789236820 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789237201 C Co:001:00 0 0
de249040 3789238180 S Co:001:00 s 23 01 0001 0001 0000 0
de249040 3789238510 C Co:001:00 0 0
de249040 3789240602 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de249040 3789241661 C Ci:001:00 0 4 = 00010300
de249040 3789242264 S Co:001:00 s 23 01 0010 0001 0000 0
de249040 3789243921 C Co:001:00 0 0
de249040 3789246540 S Co:001:00 s 23 01 0011 0001 0000 0
de249040 3789246930 C Co:001:00 0 0
de2490c0 3789283096 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789286255 C Ci:001:00 0 4 = 00010000
de2490c0 3789330975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789332606 C Ci:001:00 0 4 = 00010000
de2490c0 3789371015 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789371146 C Ci:001:00 0 4 = 00010000
de2490c0 3789410975 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789411097 C Ci:001:00 0 4 = 00010000
de2490c0 3789450972 S Ci:001:00 s a3 00 0000 0001 0004 4 <
de2490c0 3789451081 C Ci:001:00 0 4 = 00010000
de7d92c0 3789452462 C Ii:001:01 -2 0

Not sure what any of it means.

Basically it means what you said above: the hub disconnected. I can't
tell why. You'll have to ask someone who's familiar with the hardware
on that board.

Sadly, there is no one more familar with this specific hardware than myself.

I can however ellaborate the hardware setup of the USB subsystem in case there is someone out there that has used a similar setup.

The board uses the AM3517 SoC from TI. The SoC's USB host port (HSUSB1) is connected to a USB3320 PHY. The PHY is connected to a USB2512 switch to provide two downstream USB ports.

The very same hardware worked with the 2.6.37 kernel that I am trying to move away from.

It should be noted that the USB hardware work on the 3.2 kernel as well.

Quoted 25 lines
Quoted 24 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Today I am going to try using 3.10 and 3.14 kernels see if they exhibit the same behavior.

It should be noted that the 3.10 kernel did not even detect the external HUB and the 3.14 kernel exhibits the same failure as 3.16.

Quoted 7 lines
Quoted 4 lines

Do you have off-while-idle enabled ? This could be, as Alan suggested, a problem with remote wakeup. EHCI on TI parts is kinda awkward, if you will, and getting remote wakeup with PM working, is generally a challenge.

How would one determine if off-while-idle is enabled? Is this a flag in an entry in the devicetree?

there is a pm_debug file on debugfs which you can use. Set autosuspend delay to UART (it's set to -1 by default, IIRC), then leave the board idle for a couple minutes, then read /sys/kernel/debug/pm_debug and see if the OFF() counters are increasing.

Adding linux-omap to Cc. Also Tony, who has a simple script to enable pm_runtime on UART.

Quoted 8 lines
Quoted 6 lines

The EHCI-omap driver when in use should prevent the USBHOST module from idling and this should in turn prevent the CORE from idling. So remote wakeup should work. It works fine in my setup with omap3beagle board OMAP3430/3530 ES3.1. I'm using a recent u-boot v2014.07-rc4.

It seems you are using an older silicon which needs single_ulpi_bypass flag set in platform data. Did your below patch fix the issue for you?
https://lkml.org/lkml/2014/7/28/745

Sadly, this did not fix the issue that I am having.

OK. what u-boot version you are on? I can try to test with the same version.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

The problem seems to be the interaction between the PHY and the HUB on the hardware. The USB host works fine until the last device is removed from the HUB as long a device is plugged in during boot.

OK. The ULPI link seems to be dead after the external hub and PHY suspends. As 3.2 works for you it should be easy to find out what commit broke the functionality for older silicon.

So I found something today in our 3.2.21 kernel that probably worked around this suspend failure.

http://git.emacinc.com/source/linux-emac.git/commit/2ede90e83c2432de5932a03dd79edd543eca1053

Quoted 8 lines

Sadly this means the failure predates the 3.2 kernel.

So I commented out the usb_enable_autosuspend() calls in the core HUB driver and magically I can plug and unplug all day long without a problem.

So autosuspend is causing the failure.

Now what is the best way to implement a fix without trashing the kernel?

It should be noted that the external HUB must be prevented from autosuspend otherwise the resume fails.

Quoted 7 lines
Quoted 2 lines

OK. I was able to reproduce the issue on my beagleboard as well. The key to reproduce the issue is to use a device which has autosuspend working. Earlier I was using a mass storage device so couldn't reproduce the issue. On using a HUB I could see the issue. Debugging this issue is on my action list.

I will keep an eye out for the fix if it is possible. The implementation of the remote resume workaround as listed in the sprz306d.pdf seems to hack into the core EHCI drivers and limits you to a single USB host.

Quoted 6 lines

Please see Advisory 1.1.33 HSUSB Interoperability Issue with SMSC USB3320 PHY (sprz306d errata doc).

It seems ULPI suspend/resume is broken and there is no workaround. So you have to prevent the USB device connected at root port from suspending.

It's very important to understand if this affect even OMAP4 and tusb1210 that is suggested by TI.

Michael

Quoted 6 lines

cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 4 lines
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |
#20 lore raw
Quoted 5 lines · Michael Trimarchi

Hi Roger

Quoted 2 lines · Roger Quadros

Hi Michael,

<snip>

Quoted 15 lines
Quoted 15 lines
Quoted 11 lines
Quoted 6 lines
Quoted 3 lines

It should be noted that the external HUB must be prevented from autosuspend otherwise the resume fails.

OK. I was able to reproduce the issue on my beagleboard as well. The key to reproduce the issue is to use a device which has autosuspend working. Earlier I was using a mass storage device so couldn't reproduce the issue. On using a HUB I could see the issue. Debugging this issue is on my action list.

I will keep an eye out for the fix if it is possible. The implementation of the remote resume workaround as listed in the sprz306d.pdf seems to hack into the core EHCI drivers and limits you to a single USB host.

Please see Advisory 1.1.33 HSUSB Interoperability Issue with SMSC USB3320 PHY (sprz306d errata doc).

Quoted 7 lines
Quoted 3 lines

It seems ULPI suspend/resume is broken and there is no workaround. So you have to prevent the USB device connected at root port from suspending.

It's very important to understand if this affect even OMAP4 and tusb1210 that is suggested by TI.

This particular issue was fixed in omap3630 ES1.1 onwards. But that doesn't mean OMAP4 is free of issues around USB EHCI. 4430 brought it's own set of issues which were fixed in 4460. But there were still some issues requiring software workaround especially around USB suspend/resume.

e.g. There is still an issue with both 4430 and 4460 called i701 (USB Host - Possible Interoperability With External PHY At Resume Time) which is observed on certain PHYs (at least not on usb3320). There is a software workaround for that.

cheers,
-roger