All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] usb: ehci: only shutdown opened controller
@ 2016-06-15  5:15 Peng Fan
  2016-06-15 22:00 ` Marek Vasut
  2016-06-17 22:49 ` Marek Vasut
  0 siblings, 2 replies; 3+ messages in thread
From: Peng Fan @ 2016-06-15  5:15 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: "Stefan Br?ns" <stefan.bruens@rwth-aachen.de>
Cc: Stephen Warren <swarren@nvidia.com>
---
 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,
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] usb: ehci: only shutdown opened controller
  2016-06-15  5:15 [U-Boot] [PATCH] usb: ehci: only shutdown opened controller Peng Fan
@ 2016-06-15 22:00 ` Marek Vasut
  2016-06-17 22:49 ` Marek Vasut
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2016-06-15 22:00 UTC (permalink / raw)
  To: u-boot

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.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: "Stefan Br?ns" <stefan.bruens@rwth-aachen.de>
> Cc: Stephen Warren <swarren@nvidia.com>

Acked-by: Marek Vasut <marex@denx.de>

> ---
>  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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] usb: ehci: only shutdown opened controller
  2016-06-15  5:15 [U-Boot] [PATCH] usb: ehci: only shutdown opened controller Peng Fan
  2016-06-15 22:00 ` Marek Vasut
@ 2016-06-17 22:49 ` Marek Vasut
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2016-06-17 22:49 UTC (permalink / raw)
  To: u-boot

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 <peng.fan@nxp.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: "Stefan Br?ns" <stefan.bruens@rwth-aachen.de>
> Cc: Stephen Warren <swarren@nvidia.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-17 22:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-15  5:15 [U-Boot] [PATCH] usb: ehci: only shutdown opened controller Peng Fan
2016-06-15 22:00 ` Marek Vasut
2016-06-17 22:49 ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.