mirror of
git://git.9front.org/plan9front/plan9front
synced 2025-01-12 11:10:06 +00:00
devusb: fix enable delays to avoid device suspend (thanks cgnarne)
cgnarne experienced issues with his xbox controller when connected to uhci root-port. doing some experiments, we determined that the delay between clearing reset and setting enable needed to be between 5µs and 2.7ms for it to attach successfully. this timing is close to the 3ms idle time that makes devices enter suspend mode, so we concluded that the delay here must be shortend (50ms -> 2ms).
This commit is contained in:
parent
242e1dc552
commit
b849349e0c
1 changed files with 11 additions and 3 deletions
|
@ -1184,14 +1184,22 @@ rhubwrite(Ep *ep, void *a, long n)
|
||||||
if(port > 0){
|
if(port > 0){
|
||||||
dev->rhresetport = 0;
|
dev->rhresetport = 0;
|
||||||
|
|
||||||
/* some controllers have to clear reset and set enable manually */
|
/*
|
||||||
|
* Some controllers have to clear reset and set enable manually.
|
||||||
|
* We assume that clearing reset will transition the bus from
|
||||||
|
* SE0 to idle state, and setting enable starts transmitting
|
||||||
|
* SOF packets (keep alive).
|
||||||
|
*
|
||||||
|
* The delay between clearing reset and setting enable must
|
||||||
|
* not exceed 3ms as this makes devices suspend themselfs.
|
||||||
|
*/
|
||||||
if(hp->portreset != nil){
|
if(hp->portreset != nil){
|
||||||
(*hp->portreset)(hp, port, 0);
|
(*hp->portreset)(hp, port, 0);
|
||||||
tsleep(&up->sleep, return0, nil, 50);
|
tsleep(&up->sleep, return0, nil, 2);
|
||||||
}
|
}
|
||||||
if(hp->portenable != nil){
|
if(hp->portenable != nil){
|
||||||
(*hp->portenable)(hp, port, 1);
|
(*hp->portenable)(hp, port, 1);
|
||||||
tsleep(&up->sleep, return0, nil, 50);
|
tsleep(&up->sleep, return0, nil, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue