[PATCH 5/6] ehci: Force a ehci_halt before trying to reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As observed on OMAP some controllers do not like being
resetted when running.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/usb/usb_ehci_core.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/usb_ehci_core.c b/drivers/usb/usb_ehci_core.c
index e70e871..fe988c3 100644
--- a/drivers/usb/usb_ehci_core.c
+++ b/drivers/usb/usb_ehci_core.c
@@ -770,12 +770,33 @@ unknown:
 	return -1;
 }
 
+/* force HC to halt state from unknown (EHCI spec section 2.3) */
+static int ehci_halt(struct ehci_priv *ehci)
+{
+	u32	temp = ehci_readl(&ehci->hcor->or_usbsts);
+
+	/* disable any irqs left enabled by previous code */
+	ehci_writel(&ehci->hcor->or_usbintr, 0);
+
+	if (temp & STS_HALT)
+		return 0;
+
+	temp = ehci_readl(&ehci->hcor->or_usbcmd);
+	temp &= ~CMD_RUN;
+	ehci_writel(&ehci->hcor->or_usbcmd, temp);
+
+	return handshake(&ehci->hcor->or_usbsts,
+			  STS_HALT, STS_HALT, 16 * 125);
+}
+
 static int ehci_init(struct usb_host *host)
 {
 	struct ehci_priv *ehci = to_ehci(host);
 	uint32_t reg;
 	uint32_t cmd;
 
+	ehci_halt(ehci);
+
 	/* EHCI spec section 4.1 */
 	if (ehci_reset(ehci) != 0)
 		return -1;
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux