From 9689929b4a2fe4694b9cc2f966a3276f7982e800 Mon Sep 17 00:00:00 2001 From: "crediar@rypp.net" Date: Sun, 24 Jun 2012 15:32:22 +0000 Subject: [PATCH] EHCI: *Added EHCI retry code, which should fix a few more USB devices that weren't working before. GCLoader: *Fixed a DSI crash when using the progressive mode. git-svn-id: svn://localhost/Users/andi/Downloads/code/trunk@5 be6c1b03-d731-4111-a574-e37d80d43941 --- ehci.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/ehci.c b/ehci.c index 08ae6df..529a5c0 100644 --- a/ehci.c +++ b/ehci.c @@ -180,7 +180,7 @@ static int handshake (void __iomem *ptr, usec--; } while (usec > 0); - ehci_dbg("\nEHCI:handshake timeout!!\n\n"); + ehci_dbg("EHCI:handshake timeout!!\n"); dump_qh(ehci->async); dump_qh(ehci->asyncqh); //BUG(); @@ -664,12 +664,26 @@ int ehci_reset_port(int port) struct ehci_device *dev = &ehci->devices[port]; u32 status = ehci_readl(status_reg); int retval = 0; - dev->id = 0; + + dev->id = 0; + if ((PORT_OWNER&status) || !(PORT_CONNECT&status)) { - ehci_writel( PORT_OWNER, status_reg); - //ehci_dbg ( "port %d had no usb2 device connected at startup %X \n", port,ehci_readl(status_reg)); - return -ENODEV;// no USB2 device connected + int retries = 10; + while (!(PORT_CONNECT&status) && retries > 0) + { + msleep(1000); // sleep 1 second + status = ehci_readl(status_reg); + ehci_dbg ( "EHCI:port %d status at retry %d %X \n", port,retries,status); + retries--; + } + + if( retries <= 0 ) + { + ehci_writel( PORT_OWNER, status_reg); + ehci_dbg ( "EHCI:port %d had no usb2 device connected at startup %X \n", port,ehci_readl(status_reg) ); + return -ENODEV;// no USB2 device connected + } } ehci_dbg ( "EHCI:port %d has usb2 device connected! reset it...\n", port);