[PATCH 2/6] ehci: Handle hub port reset properly

Sascha Hauer s.hauer at pengutronix.de
Thu Jun 24 05:45:47 EDT 2010


This has been copied from the U-Boot ehci driver.

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

diff --git a/drivers/usb/usb_ehci_core.c b/drivers/usb/usb_ehci_core.c
index f3611cd..c5d4da3 100644
--- a/drivers/usb/usb_ehci_core.c
+++ b/drivers/usb/usb_ehci_core.c
@@ -676,6 +676,8 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
 				ehci_writel(status_reg, reg);
 				break;
 			} else {
+				int ret;
+
 				reg |= EHCI_PS_PR;
 				reg &= ~EHCI_PS_PE;
 				ehci_writel(status_reg, reg);
@@ -686,6 +688,22 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
 				 */
 				wait_ms(50);
 				ehci->portreset |= 1 << le16_to_cpu(req->index);
+				/* terminate the reset */
+				ehci_writel(status_reg, reg & ~EHCI_PS_PR);
+				/*
+				 * A host controller must terminate the reset
+				 * and stabilize the state of the port within
+				 * 2 milliseconds
+				 */
+				ret = handshake(status_reg, EHCI_PS_PR, 0,
+						2 * 1000);
+				if (!ret)
+					ehci->portreset |=
+						1 << le16_to_cpu(req->index);
+				else
+					printf("port(%d) reset error\n",
+						le16_to_cpu(req->index) - 1);
+
 			}
 			break;
 		default:
-- 
1.7.1




More information about the barebox mailing list