Hi,
I written USB host controller Driver(OHCI Standard) for TI RM48L952 Safety Demo Kit , so when i running code, During enumeration, detection happening properly and next i trying to reset HC root hub port
as per below code,so reset completing within 2ms but as per OHCI standard datasheet it takes 10 ms minimum and after reset completion i waited 100ms to stable then im checking port enable status but still it is in disable state, so please tell me, how to reset the roothub port...
/* Reset RH port should hold 50ms with pulses of at least 10ms and
* gaps of at most 3ms (usb20 spec 7.1.7.5).
* After reset, the port will be enabled automatically (ohci spec
* 7.4.4).
*/
int total_delay = 100; /* 100 * 500us == 50ms */
while (total_delay > 0) {
if (!(OHCI_INST(dev->controller)->opreg->HcRhPortStatus[port]& CurrentConnectStatus))
return;
/* start reset */
OHCI_INST (dev->controller)->opreg->HcRhPortStatus[port] = (uint32)SetPortReset;
int timeout = 200; /* timeout after 200 * 500us == 100ms */
while ((OHCI_INST (dev->controller)->opreg->HcRhPortStatus[port]& (uint32)PortResetStatus)&& timeout--) {
// LED_TOGGLE();
udelay(500); total_delay--;
}
if (OHCI_INST (dev->controller)->opreg->HcRhPortStatus[port]& PortResetStatus) {
usb_debug("Warning: root-hub port reset timed out.\n");
break;
}
if ((200-timeout) < 20) {
usb_debug("Warning: port reset too short: %dms; "
"should be at least 10ms.\n",
(200-timeout)/2);
// total_delay = 0; /* can happen on QEMU */
}
/* clear reset status change */
OHCI_INST (dev->controller)->opreg->HcRhPortStatus[port] = PortResetStatusChange;
usb_debug ("rh port reset finished after %dms.\n", (200-timeout)/2);
}
mdelay(100); // wait for signal to stabilize
if (!(READ_OPREG(OHCI_INST(dev->controller), HcRhPortStatus[port]) & PortEnableStatus)) {
usb_debug ("port enable failed\n");
//diplay
write_byte_to_seg(8);
return;
}