Re: [PATCH] USB: otg: twl4030: fix phy initialization

From: Ming Lei
Date: Sun Sep 05 2010 - 12:06:23 EST


2010/9/5 Felipe Balbi <me@xxxxxxxxxxxxxxx>:
> Hi,
>
> On Sun, 5 Sep 2010 14:42:51 +0800, Ming Lei <tom.leiming@xxxxxxxxx> wrote:
>> issue #1:(musb device not work with cable connected with PC)
>>         -twl->asleep is set as zero in .probe since bootloader has not
>> powerdown phy
>>         -EVENT_VBUS returned from twl4030_usb_linkstat since usb cable
>> is connected with PC
>>         -twl4030_phy_resume is called but does nothing since
>> twl->asleep is zero
>>         -the following are not called to initialize otg phy:
>>                  twl4030_phy_power / twl4030_i2c_access /
>>                  twl4030_usb_set_mode
>>         -so musb device mode does not work
>
> ok, I see. So what you could do is enable regulators on probe
> based on PHYPWR bit.

This patch will enable regulators on probe based on current link state
returned from twl4030_usb_linkstat instead of PHYPWR bit. If vbus or
ID event detected, call __twl4030_phy_resume to enable regulators/
phy power/set mode to make phy into work state, or else call
__twl4030_phy_power(0) to power down otg phy.

See twl4030_usb_phy_init introduced in the patch.

>> No, .asleep flag is set according to the current link state,
>> instead of the initial state of transceiver. I don't think the patch
>> will cause break anything. If you think it will, please describe the
>> break in detail.
>
> if we revert that patch, you'll see that usb3v1 ldos are left on

You commit before does fix one problem, which may keep phy in
power on even no cable connected, so I do not request a simple
revert, :-).

> if we never plug/unplug usb cable. AFAIR, the reset state of those
> LDOs is ON, so that's why we need that patch.

>From Table 5-373 of TPS65950 manual[1], usb3v1 ldo is in sleep state
after reset. But it is put into active state in twl4030_usb_ldo_init now,
seems activating it too early. I have verified it OK on beagle board to
remove the early activating of usb3v1 in twl4030_usb_ldo_init. I'll merge
it into the v2 of the patch and post it for your review.

>
> I'll try to work on it monday judging I'll have laptop and HW
> available by then.

Very good, thanks your work!

[1], TPS65950 Technical Reference Manual, http://www.ti.com/litv/pdf/swcu050e


thanks,
--
Lei Ming
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/