Commit cba5da05b1178c11d5c8f4037067e192c57a6450
1 parent
df0052575b
Exists in
smarc-rel_imx_4.1.15_2.0.0_ga
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>
Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff
drivers/usb/host/ehci-hcd.c
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | * Copyright (c) 2007-2008, Juniper Networks, Inc. |
3 | 3 | * Copyright (c) 2008, Excito Elektronik i Skåne AB |
4 | 4 | * Copyright (c) 2008, Michael Trimarchi <trimarchimichael@yahoo.it> |
5 | + * Copyright (C) 2016 Freescale Semiconductor, Inc. | |
5 | 6 | * |
6 | 7 | * All rights reserved. |
7 | 8 | * |
... | ... | @@ -210,6 +211,9 @@ |
210 | 211 | return -EINVAL; |
211 | 212 | |
212 | 213 | cmd = ehci_readl(&ctrl->hcor->or_usbcmd); |
214 | + /* If not run, directly return */ | |
215 | + if (!(cmd & CMD_RUN)) | |
216 | + return 0; | |
213 | 217 | cmd &= ~(CMD_PSE | CMD_ASE); |
214 | 218 | ehci_writel(&ctrl->hcor->or_usbcmd, cmd); |
215 | 219 | ret = handshake(&ctrl->hcor->or_usbsts, STS_ASS | STS_PSS, 0, |