Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OQGkC-0003hz-SL for mharc-grub-devel@gnu.org; Sun, 20 Jun 2010 05:23:13 -0400 Received: from [140.186.70.92] (port=58521 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQGk9-0003gY-CT for grub-devel@gnu.org; Sun, 20 Jun 2010 05:23:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OQGk8-0003l9-6O for grub-devel@gnu.org; Sun, 20 Jun 2010 05:23:09 -0400 Received: from smtp-out4.iol.cz ([194.228.2.92]:39605) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQGk7-0003l1-Se for grub-devel@gnu.org; Sun, 20 Jun 2010 05:23:08 -0400 Received: from antivir6.iol.cz (unknown [192.168.30.215]) by smtp-out4.iol.cz (Postfix) with ESMTP id F3CD8CE4448 for ; Sun, 20 Jun 2010 09:23:06 +0000 (UTC) Received: from localhost (antivir6.iol.cz [127.0.0.1]) by antivir6.iol.cz (Postfix) with ESMTP id DCD83720055 for ; Sun, 20 Jun 2010 11:23:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at iol.cz Received: from antivir6.iol.cz ([127.0.0.1]) by localhost (antivir6.iol.cz [127.0.0.1]) (amavisd-new, port 10224) with LMTP id mfdfg5rUQAoN for ; Sun, 20 Jun 2010 11:23:06 +0200 (CEST) Received: from port7.iol.cz (unknown [192.168.30.97]) by antivir6.iol.cz (Postfix) with ESMTP id B228A720059 for ; Sun, 20 Jun 2010 11:23:06 +0200 (CEST) X-SBRS: None X-SBRS-none: None X-RECVLIST: MTA-OUT-IOL X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AggCAEt7HUxVRnXk/2dsb2JhbAAHgxWBAY5KvC2QCYQrcAQ Received: from 228.117.broadband3.iol.cz (HELO [192.168.6.160]) ([85.70.117.228]) by port7.iol.cz with ESMTP; 20 Jun 2010 11:23:03 +0200 From: =?UTF-8?Q?Ale=C5=A1?= Nesrsta To: grub-devel@gnu.org Content-Type: multipart/mixed; boundary="=-NfLLG1rsNCxSf2H79oUc" Date: Sun, 20 Jun 2010 11:23:01 +0200 Message-Id: <1277025782.4952.6.camel@pracovna> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Subject: [Patch] USB UHCI portstatus correction X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jun 2010 09:23:10 -0000 --=-NfLLG1rsNCxSf2H79oUc Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi, I found some mistake in uhci.c in grub_uhci_portstatus when enable=0. There is proposal of correction. Without correction portstatus reported false timeout when enable=0 because it is waiting for reset to be done but none is performed... Best regards Ales --=-NfLLG1rsNCxSf2H79oUc Content-Disposition: attachment; filename=usb_patch_uhci_100620_0 Content-Type: text/x-patch; name=usb_patch_uhci_100620_0; charset=utf-8 Content-Transfer-Encoding: 7bit diff -urB ./usb/bus/usb/uhci.c ./usb_patched/bus/usb/uhci.c --- ./usb/bus/usb/uhci.c 2010-06-20 10:20:58.000000000 +0200 +++ ./usb_patched/bus/usb/uhci.c 2010-06-20 10:59:03.000000000 +0200 @@ -612,8 +612,23 @@ status = grub_uhci_readreg16 (u, reg); grub_dprintf ("uhci", "detect=0x%02x\n", status); + if (!enable) /* We don't need reset port */ + { + /* Disable the port. */ + grub_uhci_writereg16 (u, reg, 0 << 2); + grub_dprintf ("uhci", "waiting for the port to be disabled\n"); + endtime = grub_get_time_ms () + 1000; + while ((grub_uhci_readreg16 (u, reg) & (1 << 2))) + if (grub_get_time_ms () > endtime) + return grub_error (GRUB_ERR_IO, "UHCI Timed out"); + + status = grub_uhci_readreg16 (u, reg); + grub_dprintf ("uhci", ">3detect=0x%02x\n", status); + return GRUB_ERR_NONE; + } + /* Reset the port. */ - grub_uhci_writereg16 (u, reg, enable << 9); + grub_uhci_writereg16 (u, reg, 1 << 9); /* Wait for the reset to complete. XXX: How long exactly? */ grub_millisleep (50); /* For root hub should be nominaly 50ms */ @@ -623,7 +638,7 @@ grub_millisleep (10); /* Enable the port. */ - grub_uhci_writereg16 (u, reg, enable << 2); + grub_uhci_writereg16 (u, reg, 1 << 2); grub_millisleep (10); grub_dprintf ("uhci", "waiting for the port to be enabled\n"); --=-NfLLG1rsNCxSf2H79oUc--