On Fri, 11 Mar 2005, peng peng wrote:

> HI, 
>  
>   I  use the following  code  to enable portsc of uhci
> under DOS,but the port enable failed (set the bit but
> it doesn`t take effect) , I don't know why . Is there
> anyone know what's the problem ?  Thanks :)
> 
> 
> static void uhci_reset_port(unsigned int port)
> {
>       unsigned short status;
> 
>       status = inw(port);
>       outw(status | USBPORTSC_PR, port);              /* reset port */

You should be more careful not to write out bits that are R/WC.

>       wait_ms(10);

This delay should be 50 ms according to the USB 2.0 spec.

>       outw(status & ~USBPORTSC_PR, port);
>       udelay(5);
> 
>       status = inw(port);
>       outw(status | USBPORTSC_PE, port);              /* enable port */
>       wait_ms(10);

You will probably need to clear USBPORTSC_PEC and USBPORTSC_CSC.

>       status = inw(port);
>       if(!(status & USBPORTSC_PE)) {
>               outw(status | USBPORTSC_PE, port);      /* one more try
> at enabling port */
>               wait_ms(50);
>       }

Keep in mind that setting the port-enable bit won't work if the port is
not connected.

Alan Stern



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to