Subject: [PATCH v1 6/6] USB: MUSB: OMAP: get PHY by phandle for dt boot

From: [email-masked] (kishon)
Date: Tue, 22 Jan 2013 20:07:59 +0530

On Tuesday 22 January 2013 07:47 PM, Roger Quadros wrote:
> On 01/22/2013 11:58 AM, Kishon Vijay Abraham I wrote:
>> The OMAP glue has been modified to get PHY by phandle for dt boot.
>>
>> Signed-off-by: Kishon Vijay Abraham I <[email-masked]>
>> ---
>>   drivers/usb/musb/omap2430.c |    7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
>> index 1a8cf6d..e43faeb 100644
>> --- a/drivers/usb/musb/omap2430.c
>> +++ b/drivers/usb/musb/omap2430.c
>> @@ -345,7 +345,12 @@ static int omap2430_musb_init(struct musb *musb)
>>   	 * up through ULPI.  TWL4030-family PMICs include one,
>>   	 * which needs a driver, drivers aren't always needed.
>>   	 */
>> -	musb->xceiv = devm_usb_get_phy_dev(dev, 0);
>> +	if (dev->parent->of_node)
>> +		musb->xceiv = devm_usb_get_phy_by_phandle(dev->parent,
>> +		    "usb_phy", 0);
>> +	else
>> +		musb->xceiv = devm_usb_get_phy_dev(dev, 0);
>> +
>>   	if (IS_ERR_OR_NULL(musb->xceiv)) {
>>   		pr_err("HS USB OTG: no transceiver configured\n");
>>   		return -ENODEV;
>
> This will not work with PHY driver as a module. You need to use deferred probing mechanism here
> after you have addressed my comment in patch 2 and also devm_usb_get_phy_by_phandle()

IIUC, even using -EPROBE_DEFER might not help if we are making the PHY 
driver as module, since the kernel will try to probe only till the 
prompt comes.

And having -EPROBE_DEFER instead of -ENODEV might also not help since, 
the gadget driver wont be able to bind to UDC (usb_gadget_probe_driver 
will fail).

A lot of things need to be changed before we change to -EPROBE_DEFER IMO.

Thanks
Kishon