mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
usb: hcd: Initialize USB phy if needed
This adds external USB phy support to USB HCD driver that allows to find and initialize external USB phy, bound to the HCD, when the HCD is added. The usb_add_hcd function returns -EPROBE_DEFER if the USB phy, bound to the HCD, is not ready. If no USB phy is bound, the HCD is initialized as usual. Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
103e127d1f
commit
1ae5799ef6
1 changed files with 18 additions and 0 deletions
|
@ -2589,6 +2589,24 @@ int usb_add_hcd(struct usb_hcd *hcd,
|
|||
int retval;
|
||||
struct usb_device *rhdev;
|
||||
|
||||
if (IS_ENABLED(CONFIG_USB_PHY) && !hcd->phy) {
|
||||
struct usb_phy *phy = usb_get_phy_dev(hcd->self.controller, 0);
|
||||
|
||||
if (IS_ERR(phy)) {
|
||||
retval = PTR_ERR(phy);
|
||||
if (retval == -EPROBE_DEFER)
|
||||
return retval;
|
||||
} else {
|
||||
retval = usb_phy_init(phy);
|
||||
if (retval) {
|
||||
usb_put_phy(phy);
|
||||
return retval;
|
||||
}
|
||||
hcd->phy = phy;
|
||||
hcd->remove_phy = 1;
|
||||
}
|
||||
}
|
||||
|
||||
dev_info(hcd->self.controller, "%s\n", hcd->product_desc);
|
||||
|
||||
/* Keep old behaviour if authorized_default is not in [0, 1]. */
|
||||
|
|
Loading…
Reference in a new issue