summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2021-04-02 14:07:49 +0300
committerMarek Vasut <marex@denx.de>2021-04-18 05:29:36 +0300
commit50d0146cb70abc76ac3c363cd0e30b8ea4e91d1d (patch)
treeba2c1bc7eb384b85fd6f828570c3c691a61b690a /drivers
parent6443a3bc40d247f0a02376e763f6e03085528631 (diff)
downloadu-boot-50d0146cb70abc76ac3c363cd0e30b8ea4e91d1d.tar.xz
usb: ehci-mx6: Add generic EHCI PHY support
In case PHY support is enabled, use the generic EHCI PHY support to start and stop the PHY. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Fabio Estevam <festevam@gmail.com> Cc: Peng Fan <peng.fan@nxp.com> Cc: Stefano Babic <sbabic@denx.de> Cc: Ye Li <ye.li@nxp.com> Cc: uboot-imx <uboot-imx@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/host/ehci-mx6.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index 68f6ecc872..8e20941855 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -425,6 +425,7 @@ struct ehci_mx6_priv_data {
struct usb_ehci *ehci;
struct udevice *vbus_supply;
struct clk clk;
+ struct phy phy;
enum usb_init_type init_type;
int portnr;
void __iomem *phy_addr;
@@ -684,22 +685,32 @@ static int ehci_usb_probe(struct udevice *dev)
mdelay(10);
+#if defined(CONFIG_PHY)
+ ret = ehci_setup_phy(dev, &priv->phy, 0);
+ if (ret)
+ goto err_regulator;
+#endif
+
hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength);
hcor = (struct ehci_hcor *)((uint32_t)hccr +
HC_LENGTH(ehci_readl(&(hccr)->cr_capbase)));
ret = ehci_register(dev, hccr, hcor, &mx6_ehci_ops, 0, priv->init_type);
if (ret)
- goto err_regulator;
+ goto err_phy;
return ret;
+err_phy:
+#if defined(CONFIG_PHY)
+ ehci_shutdown_phy(dev, &priv->phy);
err_regulator:
+#endif
#if CONFIG_IS_ENABLED(DM_REGULATOR)
if (priv->vbus_supply)
regulator_set_enable(priv->vbus_supply, false);
-#endif
err_clk:
+#endif
#if CONFIG_IS_ENABLED(CLK)
clk_disable(&priv->clk);
#else
@@ -715,6 +726,10 @@ int ehci_usb_remove(struct udevice *dev)
ehci_deregister(dev);
+#if defined(CONFIG_PHY)
+ ehci_shutdown_phy(dev, &priv->phy);
+#endif
+
#if CONFIG_IS_ENABLED(DM_REGULATOR)
if (priv->vbus_supply)
regulator_set_enable(priv->vbus_supply, false);