USB mips timeout on reset complite
Hello,
here a little patch who implements a timeout on wait for reset complite of the USB controller. This avoids system hang if, for some reason, the USB controllor cannot reset correctly.
Ciao,
Rodolfo
Signature · 10 lines
GNU/Linux Solutions e-mail: giometti at enneenne.com Linux Device Driver giometti at gnudd.com Embedded Systems giometti at linux.it UNIX programming phone: +39 349 2432127 -------------- next part -------------- diff-tree ec82ef79b429e94308346beb549d4dd96dfac35e (from 3a5e21881a194f4d4e053be8410d82a2458e8544) Author: Rodolfo Giometti <[email protected]> Date: Tue Apr 11 14:35:25 2006 +0200 Timeout on wait for reset complite added.
cpu/mips/au1x00_usb_ohci.c +7 -1
@@ -1572,6 +1572,7 @@ int usb_lowlevel_init(void)u32 pin_func;u32 sys_freqctrl, sys_clksrc;u32 prid =read_c0_prid (); +int count =3000 ;dbg ("in usb_lowlevel_init\n" );
@@ -1641,8 +1642,13 @@ int usb_lowlevel_init(void)/* wait for reset complete (read register twice; see au1500 errata) */ while (au_readl (USB_HOST_CONFIG ), - !(au_readl (USB_HOST_CONFIG ) &USBH_ENABLE_RD )) + !(au_readl (USB_HOST_CONFIG ) &USBH_ENABLE_RD )) {udelay (1000 ); +if (--count ==0 ) { +err ("unable to reset USB host!!" ); +return -1 ; + } + }dbg ("OHCI clock running\n" );