if (isp116x_check_platform_delay(isp116x)) {
ret = -ENODEV;
goto err6;
}
//调用函数usb_add_hcd填充usb_hcd 将这个hcd添加到系统.hcd就是host control driver的意思
//usb_add_hcd 会调用register_root_hub(hcd)来register a root hub
ret = usb_add_hcd(hcd, irq, irqflags);
//device_init_wakeup(struct device *dev, bool val);
// 初始化设备能不能唤醒系统,并且使用这个功能
//Enable given device to be a wakeup source
//Create a wakeup source object, register it and attach it to @dev.
device_wakeup_enable(hcd->self.controller);
if (irqstat & (HCuPINT_ATL | HCuPINT_SOF)) {
ret = IRQ_HANDLED;
finish_atl_transfers(isp116x);
}
if (irqstat & HCuPINT_OPR) {
u32 intstat = isp116x_read_reg32(isp116x, HCINTSTAT);
isp116x_write_reg32(isp116x, HCINTSTAT, intstat);
if (intstat & HCINT_UE) {
ERR("Unrecoverable error, HC is dead!\n");
/* IRQ's are off, we do no DMA,
perfectly ready to die ... */
hcd->state = HC_STATE_HALT;
usb_hc_died(hcd);
ret = IRQ_HANDLED;
goto done;
}
if (intstat & HCINT_RHSC)
/* When root hub or any of its ports is going
to come out of suspend, it may take more
than 10ms for status bits to stabilize. */
mod_timer(&hcd->rh_timer, jiffies
+ msecs_to_jiffies(20) + 1);
if (intstat & HCINT_RD) {
DBG("---- remote wakeup\n");
usb_hcd_resume_root_hub(hcd);
}
irqstat &= ~HCuPINT_OPR;
ret = IRQ_HANDLED;
}
if (irqstat & (HCuPINT_ATL | HCuPINT_SOF)) {
start_atl_transfers(isp116x);
}