Re: [PATCH] dwc2: wait for usb phy while probing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Sun, Oct 25, 2015 at 08:57:31AM +0100, Alexander Aring wrote:
> This patch adds support to return -EPROBE_DEFER if devm_phy_get reports
> it. If devm_phy_get returns -EPROBE_DEFER it could be that there is some
> usb phy but it's not probed before. Other return values should indicate
> a looking for an "old style USB PHY".
> 
> Cc: John Youn <johnyoun@xxxxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: Stephen Warren <swarren@xxxxxxxxxxxxx>
> Signed-off-by: Alexander Aring <alex.aring@xxxxxxxxx>
> ---
>  drivers/usb/dwc2/platform.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index 9093530..69258d0 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -228,6 +228,9 @@ static int dwc2_driver_probe(struct platform_device *dev)
>  	 */
>  	phy = devm_phy_get(&dev->dev, "usb2-phy");
>  	if (IS_ERR(phy)) {
> +		if (PTR_ERR(phy) == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;
> +

For gpios there are variants of devm_gpiod_get, that just return NULL
when no phy is specified in the device tree or the platform lookup
table. That would be devm_phy_get_optional(..) here.  And this one would
just ignore -ENOENT which would be better here, too.

Best regards
Uwe

>  		hsotg->phy = NULL;
>  		uphy = devm_usb_get_phy(&dev->dev, USB_PHY_TYPE_USB2);
>  		if (IS_ERR(uphy))
> -- 
> 2.6.1
> 
> 
> 

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux