core_if->op_state = A_HOST;
dwc_otg_set_force_mode(core_if, USB_MODE_FORCE_HOST);
- cancel_delayed_work(&pcd->check_vbus_work);
+ cancel_delayed_work_sync(&pcd->check_vbus_work);
/*
* Initialize the Core for Host mode.
pldata->phy_suspend(pldata, USB_PHY_ENABLED);
}
- if (!id) { /* Force Host */
- id_status_change(otg_dev->core_if, id);
- } else { /* Force Device */
- id_status_change(otg_dev->core_if, id);
- }
+ /* Force Device or Host by id */
+ id_status_change(otg_dev->core_if, id);
}
last_id = id;
schedule_delayed_work(&_pcd->check_id_work, (HZ));
if (pldata->phy_status == USB_PHY_ENABLED) {
/* release wake lock */
dwc_otg_msc_unlock(_pcd);
- /* no vbus detect here , close usb phy */
- pldata->phy_suspend(pldata, USB_PHY_SUSPEND);
- udelay(3);
- pldata->clock_enable(pldata, 0);
+ if (pldata->get_status(USB_STATUS_ID)) {
+ /* no vbus detect here , close usb phy */
+ pldata->phy_suspend(pldata, USB_PHY_SUSPEND);
+ udelay(3);
+ pldata->clock_enable(pldata, 0);
+ }
}
/* usb phy bypass to uart mode */
pldata->dwc_otg_uart_mode(pldata, PHY_UART_MODE);
}
- schedule_delayed_work(&_pcd->check_vbus_work, HZ);
+ if (pldata->get_status(USB_STATUS_ID))
+ schedule_delayed_work(&_pcd->check_vbus_work, HZ);
return;
connect: