[U-Boot,v2,3/3] ubs: xhci-dwc3: Enable USB3 PHY when available
diff mbox series

Message ID 20180307092010.7091-4-vigneshr@ti.com
State Accepted
Commit 2fd4242cc50e2da6666028e65a10467171e3dab6
Delegated to: Bin Meng
Headers show
Series
  • xhci-dwc3: Couple of fixes for USB3 support
Related show

Commit Message

Vignesh Raghavendra March 7, 2018, 9:20 a.m. UTC
DWC3 USB3 controllers will need USB3 PHY to be enabled, in addition to
USB2 PHY, to be functional. Therefore enable USB3 PHY when available.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 drivers/usb/host/xhci-dwc3.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Bin Meng March 8, 2018, 4:14 a.m. UTC | #1
On Wed, Mar 7, 2018 at 5:20 PM, Vignesh R <vigneshr@ti.com> wrote:
> DWC3 USB3 controllers will need USB3 PHY to be enabled, in addition to
> USB2 PHY, to be functional. Therefore enable USB3 PHY when available.
>
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
>  drivers/usb/host/xhci-dwc3.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Patch
diff mbox series

diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c
index e61a04eeb8a8..1022dd551241 100644
--- a/drivers/usb/host/xhci-dwc3.c
+++ b/drivers/usb/host/xhci-dwc3.c
@@ -23,6 +23,7 @@  DECLARE_GLOBAL_DATA_PTR;
 
 struct xhci_dwc3_platdata {
 	struct phy usb_phy;
+	struct phy usb3_phy;
 };
 
 void dwc3_set_mode(struct dwc3 *dwc3_reg, u32 mode)
@@ -175,6 +176,13 @@  static int xhci_dwc3_probe(struct udevice *dev)
 		return ret;
 	}
 
+	ret = xhci_dwc3_setup_phy(dev, 1, &plat->usb3_phy);
+	if (ret) {
+		pr_err("Failed to setup USB3 PHY for %s\n", dev->name);
+		xhci_dwc3_shutdown_phy(&plat->usb_phy);
+		return ret;
+	}
+
 	dwc3_reg = (struct dwc3 *)((char *)(hccr) + DWC3_REG_OFFSET);
 
 	dwc3_core_init(dwc3_reg);
@@ -198,6 +206,9 @@  static int xhci_dwc3_remove(struct udevice *dev)
 	if (ret)
 		pr_err("Can't shutdown USB PHY for %s\n", dev->name);
 
+	ret = xhci_dwc3_shutdown_phy(&plat->usb3_phy);
+	if (ret)
+		pr_err("Can't shutdown USB3 PHY for %s\n", dev->name);
 
 	return xhci_deregister(dev);
 }