summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2017-08-09 04:54:53 -0500
committerJason Liu <jason.hui.liu@nxp.com>2017-11-03 02:37:08 +0800
commit3c59c8ea95d401d06736c68c186aec80e214bee8 (patch)
tree8bd0cec6c1bd51bc8cd2bfe484e2edce29b9d783
parent7594571c01b9e0e4ff8d34d57a98771240c7a3a8 (diff)
MLK-16175-1 usb: ehci-mx6: Turn on the power domain of USB PHY
Since there is no uclass for USB PHY. The device won't be setup for the USB PHY node in DTB. And its associated power domain device won't be turned on neither by DM framework. This patch modifies the ehci-mx6 driver to enable the power domain device before access the USB PHY. This is only for DM driver. For non-DM part, users still need to power on the USB PHY in boards/SoC codes. Signed-off-by: Ye Li <ye.li@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com>
-rw-r--r--drivers/usb/host/ehci-mx6.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index e3c3060b07..d0aad7ef29 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
* Copyright (C) 2010 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -21,6 +22,9 @@
#include <asm/arch/sys_proto.h>
#include "ehci.h"
+#if CONFIG_IS_ENABLED(POWER_DOMAIN)
+#include <power-domain.h>
+#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -605,6 +609,18 @@ static int ehci_usb_phy_mode(struct udevice *dev)
if ((fdt_addr_t)addr == FDT_ADDR_T_NONE)
return -EINVAL;
+ /* Need to power on the PHY before access it */
+#if CONFIG_IS_ENABLED(POWER_DOMAIN)
+ struct udevice phy_dev;
+ struct power_domain pd;
+
+ phy_dev.of_offset = phy_off;
+ if (!power_domain_get(&phy_dev, &pd)) {
+ if (power_domain_on(&pd))
+ return -EINVAL;
+ }
+#endif
+
phy_ctrl = (void __iomem *)(addr + USBPHY_CTRL);
val = readl(phy_ctrl);