summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/hcd.c
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2019-08-29 07:30:27 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-09-03 15:54:55 +0200
commit34c7ed72f4f04e73901ca6ec2e1db6c040495935 (patch)
tree58bbc9540d05a5a23144196c1717bbb63ad6e0fb /drivers/usb/core/hcd.c
parentd7290cd04b4ede9cccc0cf1b72ee856fdf46cf8b (diff)
downloadlinux-stable-34c7ed72f4f04e73901ca6ec2e1db6c040495935.tar.gz
linux-stable-34c7ed72f4f04e73901ca6ec2e1db6c040495935.tar.bz2
linux-stable-34c7ed72f4f04e73901ca6ec2e1db6c040495935.zip
usb: core: phy: add support for PHY calibration
Some PHYs (for example Exynos5 USB3.0 DRD PHY) require calibration to be done after every USB HCD reset. Generic PHY framework has been already extended with phy_calibrate() function in commit 36914111e682 ("drivers: phy: add calibrate method"). This patch adds support for it to generic PHY handling code in USB HCD core. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Anand Moon <linux.amoon@gmail.com> Tested-by: Jochen Sprickerhof <jochen@sprickerhof.de> Link: https://lore.kernel.org/r/20190829053028.32438-2-m.szyprowski@samsung.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/hcd.c')
-rw-r--r--drivers/usb/core/hcd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 4ccfc8e59604..f225eaa98ff8 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2188,6 +2188,9 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg)
hcd->state = HC_STATE_RESUMING;
status = hcd->driver->bus_resume(hcd);
clear_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags);
+ if (status == 0)
+ status = usb_phy_roothub_calibrate(hcd->phy_roothub);
+
if (status == 0) {
struct usb_device *udev;
int port1;
@@ -2760,6 +2763,10 @@ int usb_add_hcd(struct usb_hcd *hcd,
}
hcd->rh_pollable = 1;
+ retval = usb_phy_roothub_calibrate(hcd->phy_roothub);
+ if (retval)
+ goto err_hcd_driver_setup;
+
/* NOTE: root hub and controller capabilities may not be the same */
if (device_can_wakeup(hcd->self.controller)
&& device_can_wakeup(&hcd->self.root_hub->dev))