From: ebiederm@xmission.com (Eric W. Biederman)
To: "Lu, Yinghai" <yinghai.lu@amd.com>
Cc: "David Brownell" <david-b@pacbell.net>,
"Peter Stuge" <stuge-linuxbios@cdy.org>,
linux-usb-devel@lists.sourceforge.net,
"Stefan Reinauer" <stepan@coresystems.de>,
"Greg KH" <gregkh@suse.de>,
linux-kernel@vger.kernel.org, linuxbios@linuxbios.org,
"Andi Kleen" <ak@suse.de>
Subject: Re: [LinuxBIOS] [linux-usb-devel] [RFC][PATCH 0/2] x86_64 Early usb debug port support.
Date: Tue, 05 Dec 2006 16:50:05 -0700 [thread overview]
Message-ID: <m13b7t7viq.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <5986589C150B2F49A46483AC44C7BCA490728A@ssvlexmb2.amd.com> (Yinghai Lu's message of "Tue, 5 Dec 2006 15:29:32 -0800")
"Lu, Yinghai" <yinghai.lu@amd.com> writes:
> -----Original Message-----
> From: linuxbios-bounces@linuxbios.org
> [mailto:linuxbios-bounces@linuxbios.org] On Behalf Of
> ebiederm@xmission.com
> Sent: Tuesday, December 05, 2006 3:01 AM
>
>>+static int ehci_wait_for_port(int port)
>>+{
>>+ unsigned status;
>>+ int ret, reps;
>>+ for (reps = 0; reps >= 0; reps++) {
>>+ status = readl(&ehci_regs->status);
>>+ if (status & STS_PCD) {
>>+ ret = ehci_reset_port(port);
>>+ if (ret == 0)
>>+ return 0;
>>+ }
>>+ }
>>+ return -ENOTCONN;
>>+}
>>+
>
> What do you mean by
> + for (reps = 0; reps >= 0; reps++) {
> ?
If you will not reps is negative. Roughly it is a loop
that will timeout eventually if a usb debug cable is not present.
Putting some deliberate delays in there so I could be certain
of timing out after a second or two would probably be better, but
I don't have anything that resembles a good timer at that point.
The problem is you have to wait until the ehci notices your usb
debug cable before you reset it and get it going and that can be a
non-trivial amount of time. So the loop is 100% necessary.
So since I didn't know how many loop iterations made sense I allowed
it to loop for 2^31 times or until reps goes negative.
Eric
next prev parent reply other threads:[~2006-12-05 23:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-05 23:29 Lu, Yinghai
2006-12-05 23:50 ` Eric W. Biederman [this message]
2006-12-06 15:31 ` Segher Boessenkool
2006-12-06 0:00 Lu, Yinghai
2006-12-06 21:08 Lu, Yinghai
2006-12-07 9:51 ` [LinuxBIOS] " Peter Stuge
2006-12-07 22:06 Lu, Yinghai
2006-12-08 3:48 Lu, Yinghai
2006-12-08 7:14 ` Greg KH
2006-12-08 8:52 ` Yinghai Lu
2006-12-08 7:42 ` Eric W. Biederman
2006-12-08 8:53 ` Yinghai Lu
2006-12-08 9:07 ` Eric W. Biederman
2006-12-13 7:00 ` Yinghai Lu
2006-12-13 7:29 ` Eric W. Biederman
2006-12-13 10:09 ` Yinghai Lu
2006-12-13 10:41 ` Yinghai Lu
2006-12-09 3:16 Lu, Yinghai
2006-12-09 10:54 ` Peter Stuge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m13b7t7viq.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=ak@suse.de \
--cc=david-b@pacbell.net \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=linuxbios@linuxbios.org \
--cc=stepan@coresystems.de \
--cc=stuge-linuxbios@cdy.org \
--cc=yinghai.lu@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®