Re: [PATCHv2] phy: omap-usb2: Enable runtime PM of omap-usb2 phy properly

Enric Balletbo Serra
2014-11-11T15:10:37Z

Hi all,

2014-11-04 0:29 GMT+01:00 Greg KH <gregkh@linuxfoundation.org>:
> On Mon, Nov 03, 2014 at 04:51:41PM +0530, Kishon Vijay Abraham I wrote:
>> Hi Greg,
>>
>> On Tuesday 07 October 2014 04:32 PM, Oussama Ghorbel wrote:
>> > The USB OTG port does not work since v3.16 on omap platform.
>> > This is a regression introduced by the commit
>> > eb82a3d846fa (phy: omap-usb2: Balance pm_runtime_enable() on probe failure
>> > and remove).
>> > This because the call to pm_runtime_enable() function is moved after the
>> > call to devm_phy_create() function, which has side effect since later in
>> > the subsequent calls of devm_phy_create() there is a check with
>> > pm_runtime_enabled() to configure few things.
>>
>> This is the only fix for this -rc cycle in the PHY susbsystem. So can you take
>> this directly? Or else I can prepare a pull request. Let me know.
>>
>> Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
>
> I don't have this in my archives anymore, please resend so that I can
> apply it from an email.
>
> thanks,
>
> greg k-h

I'm trying to use the OTG port as HOST on OMAP3-based platform
(IGEPv2), I saw that this patch is already applied in kernel
3.18.0-rc4 so I expected it to work, but I've some problems. To
explain the situation let me propose some test cases.

The first tests I made were configuring the MUSB OTG as HOST only
mode,In this mode test case A fails and test case B and C succeed.

USB Mode Selection (HOST only mode)
Test case A) Boot the system :
mode : b_idle
vbus : Vbus off, timeout 1100 msec
1) Ground ID-pin
mode : a_idle
vbus : Vbus off, timeout 1100 msec
2) Plug pendrive
mode : a_idle
vbus : Vbus off, timeout 1100 msec
Failed: Pendrive is not detected.

Test case B) Boot with ID-pin grounded :
mode : a_idle
vbus : Vbus off, timeout 1100 msec
1) Plug pendrive
mode : a_host
vbus : Vbus off, timeout 1100 msec
Success: Pendrive is detected

Test case C) Boot with ID-pin grounded and pendrive
mode : a_host
vbus : Vbus off, timeout 1100 msec
Success: Pendrive is detected

The second tests I made were configuring the MUSB OTG as Dual Role
mode,In this mode all test cases failed.

MUSB Mode Selection (Dual Role mode)
Test case A) Boot the system :
mode : b_idle
vbus : Vbus off, timeout 1100 msec
1) Ground ID-pin:
mode : a_idle
mode : Vbus off, timeout 1100 msec
2) Plug pendrive
mode : a_idle
vbus : Vbus off, timeout 1100 msec
Failed: Pendrive is not detected.

Test case B) Boot with ID-pin grounded :
mode : b_idle
vbus : Vbus off, timeout 1100 msec
1) Plug pendrive
mode : b_idle
vbus : Vbus off, timeout 1100 msec
Failed: Pendrive is not detected.

Test case C) Boot with ID-pin grounded and pendrive
mode : b_idle
vbus : Vbus off, timeout 1100 msec
Failed: Pendrive is not detected.

I got the mode and vbus values from sysfs:

cat /sys/bus/platform/drivers/musb-hdrc/musb-hdrc.0.auto/mode
cat /sys/bus/platform/drivers/musb-hdrc/musb-hdrc.0.auto/vbus

Did anybody test these test cases ?

I'm a bit surprised with the vbus status because always reports Vbus
off, although pendrive is working. I'm missing something ?

Note that if you see at the mode transitions something looks wrong.
For example, in Dual Role Mode test case B and C the mode is b_idle
instead of a_idle.

Thanks,
Enric