From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Sat, 18 Jun 2016 00:49:07 +0200 Subject: [U-Boot] [PATCH] usb: ehci: only shutdown opened controller In-Reply-To: <1465967746-14641-1-git-send-email-peng.fan@nxp.com> References: <1465967746-14641-1-git-send-email-peng.fan@nxp.com> Message-ID: <57647E63.80603@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 06/15/2016 07:15 AM, Peng Fan wrote: > 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 to only shutdown the running controller. Applied, thanks > Signed-off-by: Peng Fan > Cc: Marek Vasut > Cc: Simon Glass > Cc: Mateusz Kulikowski > Cc: Hans de Goede > Cc: "Stefan Br?ns" > Cc: Stephen Warren > --- > drivers/usb/host/ehci-hcd.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c > index fa5d584..13aa70d 100644 > --- a/drivers/usb/host/ehci-hcd.c > +++ b/drivers/usb/host/ehci-hcd.c > @@ -210,6 +210,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, > -- Best regards, Marek Vasut