diff options
Diffstat (limited to 'drivers/usb/host/xhci-plat.c')
-rw-r--r-- | drivers/usb/host/xhci-plat.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 0e11d61408ff..783e819139a7 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/of.h> | 17 | #include <linux/of.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/usb/phy.h> | ||
19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
20 | #include <linux/usb/xhci_pdriver.h> | 21 | #include <linux/usb/xhci_pdriver.h> |
21 | 22 | ||
@@ -155,12 +156,27 @@ static int xhci_plat_probe(struct platform_device *pdev) | |||
155 | if (HCC_MAX_PSA(xhci->hcc_params) >= 4) | 156 | if (HCC_MAX_PSA(xhci->hcc_params) >= 4) |
156 | xhci->shared_hcd->can_do_streams = 1; | 157 | xhci->shared_hcd->can_do_streams = 1; |
157 | 158 | ||
159 | hcd->usb_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0); | ||
160 | if (IS_ERR(hcd->usb_phy)) { | ||
161 | ret = PTR_ERR(hcd->usb_phy); | ||
162 | if (ret == -EPROBE_DEFER) | ||
163 | goto put_usb3_hcd; | ||
164 | hcd->usb_phy = NULL; | ||
165 | } else { | ||
166 | ret = usb_phy_init(hcd->usb_phy); | ||
167 | if (ret) | ||
168 | goto put_usb3_hcd; | ||
169 | } | ||
170 | |||
158 | ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); | 171 | ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); |
159 | if (ret) | 172 | if (ret) |
160 | goto put_usb3_hcd; | 173 | goto disable_usb_phy; |
161 | 174 | ||
162 | return 0; | 175 | return 0; |
163 | 176 | ||
177 | disable_usb_phy: | ||
178 | usb_phy_shutdown(hcd->usb_phy); | ||
179 | |||
164 | put_usb3_hcd: | 180 | put_usb3_hcd: |
165 | usb_put_hcd(xhci->shared_hcd); | 181 | usb_put_hcd(xhci->shared_hcd); |
166 | 182 | ||
@@ -184,6 +200,7 @@ static int xhci_plat_remove(struct platform_device *dev) | |||
184 | struct clk *clk = xhci->clk; | 200 | struct clk *clk = xhci->clk; |
185 | 201 | ||
186 | usb_remove_hcd(xhci->shared_hcd); | 202 | usb_remove_hcd(xhci->shared_hcd); |
203 | usb_phy_shutdown(hcd->usb_phy); | ||
187 | usb_put_hcd(xhci->shared_hcd); | 204 | usb_put_hcd(xhci->shared_hcd); |
188 | 205 | ||
189 | usb_remove_hcd(hcd); | 206 | usb_remove_hcd(hcd); |