summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2016-06-06 16:08:02 +0800
committerPeng Fan <peng.fan@nxp.com>2016-06-06 16:08:02 +0800
commitcba5da05b1178c11d5c8f4037067e192c57a6450 (patch)
tree8f4562ac7de0e7032d6310f5ac4d4acef896cc2d
parentdf0052575b2bc9d66ae73584768e1a457ed5d914 (diff)
downloadu-boot-imx-cba5da05b1178c11d5c8f4037067e192c57a6450.zip
u-boot-imx-cba5da05b1178c11d5c8f4037067e192c57a6450.tar.gz
u-boot-imx-cba5da05b1178c11d5c8f4037067e192c57a6450.tar.bz2
MLK-12888 usb: ehci: only shutdown opened controller
If the usb controller is not running, no need to shutdown it, otherwise `usb stop` complains about: "EHCI failed to shut down host controller". To i.MX7D SDB, there are two usb ports, one Host, one OTG. If we only plug one udisk to the Host port and then `usb start`, the OTG controller for OTG port does not run actually. Then, if `usb stop`, the OTG controller for OTG port will also be shutdown, but it is not running. This patch adds a check that only shutdown the running controller. Signed-off-by: Peng Fan <peng.fan@nxp.com>
-rw-r--r--drivers/usb/host/ehci-hcd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 0113c6c..051e8b0 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -2,6 +2,7 @@
* Copyright (c) 2007-2008, Juniper Networks, Inc.
* Copyright (c) 2008, Excito Elektronik i Skåne AB
* Copyright (c) 2008, Michael Trimarchi <trimarchimichael@yahoo.it>
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
*
* All rights reserved.
*
@@ -210,6 +211,9 @@ static int ehci_shutdown(struct ehci_ctrl *ctrl)
return -EINVAL;
cmd = ehci_readl(&ctrl->hcor->or_usbcmd);
+ /* If not run, directly return */
+ if (!(cmd & CMD_RUN))
+ return 0;
cmd &= ~(CMD_PSE | CMD_ASE);
ehci_writel(&ctrl->hcor->or_usbcmd, cmd);
ret = handshake(&ctrl->hcor->or_usbsts, STS_ASS | STS_PSS, 0,