aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorAntoine Tenart <antoine.tenart@free-electrons.com>2014-10-30 13:41:16 -0400
committerFelipe Balbi <balbi@ti.com>2014-11-03 11:02:50 -0500
commitef44cb4226d132146e44f8ea562a16b27ff61126 (patch)
treecec7cf8bd69f400de0fbdb76e6a43759a154d446 /drivers/usb/core
parent48bcc18076df4e07ef86226ac6ce795f64c84f7f (diff)
usb: allow to supply the PHY in the drivers when using HCD
This patch modify the generic code handling PHYs to allow them to be supplied from the drivers. This adds checks to ensure no PHY was already there when looking for one in the generic code. This also makes sure we do not modify its state in the generic HCD functions, it was provided by the driver. Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/hcd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index b84fb141e122..6a2a2fd990ab 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2648,7 +2648,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
2648 } 2648 }
2649 } 2649 }
2650 2650
2651 if (IS_ENABLED(CONFIG_GENERIC_PHY)) { 2651 if (IS_ENABLED(CONFIG_GENERIC_PHY) && !hcd->phy) {
2652 struct phy *phy = phy_get(hcd->self.controller, "usb"); 2652 struct phy *phy = phy_get(hcd->self.controller, "usb");
2653 2653
2654 if (IS_ERR(phy)) { 2654 if (IS_ERR(phy)) {
@@ -2668,6 +2668,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
2668 goto err_phy; 2668 goto err_phy;
2669 } 2669 }
2670 hcd->phy = phy; 2670 hcd->phy = phy;
2671 hcd->remove_phy = 1;
2671 } 2672 }
2672 } 2673 }
2673 2674
@@ -2814,7 +2815,7 @@ err_allocate_root_hub:
2814err_register_bus: 2815err_register_bus:
2815 hcd_buffer_destroy(hcd); 2816 hcd_buffer_destroy(hcd);
2816err_create_buf: 2817err_create_buf:
2817 if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->phy) { 2818 if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->remove_phy && hcd->phy) {
2818 phy_power_off(hcd->phy); 2819 phy_power_off(hcd->phy);
2819 phy_exit(hcd->phy); 2820 phy_exit(hcd->phy);
2820 phy_put(hcd->phy); 2821 phy_put(hcd->phy);
@@ -2898,7 +2899,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
2898 usb_deregister_bus(&hcd->self); 2899 usb_deregister_bus(&hcd->self);
2899 hcd_buffer_destroy(hcd); 2900 hcd_buffer_destroy(hcd);
2900 2901
2901 if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->phy) { 2902 if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->remove_phy && hcd->phy) {
2902 phy_power_off(hcd->phy); 2903 phy_power_off(hcd->phy);
2903 phy_exit(hcd->phy); 2904 phy_exit(hcd->phy);
2904 phy_put(hcd->phy); 2905 phy_put(hcd->phy);