aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2/core.c
diff options
context:
space:
mode:
authorJules Maselbas <jmaselbas@kalray.eu>2019-04-05 15:35:33 +0200
committerFelipe Balbi <felipe.balbi@linux.intel.com>2019-05-03 09:13:48 +0300
commit1e868545f2bb06f7dd4a1c97c5b9ed2615929cf0 (patch)
treeef9e99ed295f95cb82f1d060a1e2d80f91cb4bde /drivers/usb/dwc2/core.c
parentusb: dwc2: Move phy init into core (diff)
downloadlinux-dev-1e868545f2bb06f7dd4a1c97c5b9ed2615929cf0.tar.xz
linux-dev-1e868545f2bb06f7dd4a1c97c5b9ed2615929cf0.zip
usb: dwc2: gadget: Move gadget phy init into core phy init
Most of the phy initialization is shared between host and gadget, this adds the turnaround configuration only used by gadgets to the global phy init. Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc2/core.c')
-rw-r--r--drivers/usb/dwc2/core.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index 01ac4a064feb..8b499d643461 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -1152,6 +1152,15 @@ static int dwc2_hs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
usbcfg &= ~(GUSBCFG_ULPI_UTMI_SEL | GUSBCFG_PHYIF16);
if (hsotg->params.phy_utmi_width == 16)
usbcfg |= GUSBCFG_PHYIF16;
+
+ /* Set turnaround time */
+ if (dwc2_is_device_mode(hsotg)) {
+ usbcfg &= ~GUSBCFG_USBTRDTIM_MASK;
+ if (hsotg->params.phy_utmi_width == 16)
+ usbcfg |= 5 << GUSBCFG_USBTRDTIM_SHIFT;
+ else
+ usbcfg |= 9 << GUSBCFG_USBTRDTIM_SHIFT;
+ }
break;
default:
dev_err(hsotg->dev, "FS PHY selected at HS!\n");