Skip to contentSkip to conversation

usb: ehci: only shutdown opened controller

PATCH New Peng Fan 2 participants 3 messages Jun 15, 2016 – Jun 17, 2016

Subsystems (2)
lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 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 to only shutdown the running controller.

Cc Marek Vasut <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mateusz Kulikowski <[email protected]>
Cc Hans de Goede <[email protected]>
Cc "Stefan Br?ns" <[email protected]>
Cc Stephen Warren <[email protected]>
---
 drivers/usb/host/ehci-hcd.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/host/ehci-hcd.c +3 -0
index fa5d584..13aa70d 100644
@@ -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,
Signature · 1 line
2.6.2
#1 lore raw

PATCH 1/1 usb: ehci: only shutdown opened controller

Quoted 12 lines · Peng Fan

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.

Quoted 7 lines
Cc Marek Vasut <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mateusz Kulikowski <[email protected]>
Cc Hans de Goede <[email protected]>
Cc "Stefan Br?ns" <[email protected]>
Cc Stephen Warren <[email protected]>
Quoted 19 lines
---
 drivers/usb/host/ehci-hcd.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/host/ehci-hcd.c +3 -0
index fa5d584..13aa70d 100644
@@ -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,
Signature · 2 lines
Best regards,
Marek Vasut
Applied
#2 lore raw

PATCH 1/1 usb: ehci: only shutdown opened controller

In reply to Peng Fan
Quoted 11 lines · Peng Fan

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

Quoted 26 lines
Cc Marek Vasut <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mateusz Kulikowski <[email protected]>
Cc Hans de Goede <[email protected]>
Cc "Stefan Br?ns" <[email protected]>
Cc Stephen Warren <[email protected]>
---
 drivers/usb/host/ehci-hcd.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/host/ehci-hcd.c +3 -0
index fa5d584..13aa70d 100644
@@ -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,
Signature · 2 lines
Best regards,
Marek Vasut