usb: chipidea: otg: use usb autosuspend to suspend bus for HNP

Directly manipulate the controller regsiter to suspend the usb bus
for HNP is not the proper way, this should be done through the usbcore
by usb autosuspend. So to start HNP, autosuspend support should be
added for OTG devices interface driver if it's not enabled.

Signed-off-by: Li Jun <jun.li@freescale.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
This commit is contained in:
Li Jun 2015-12-15 17:51:29 +08:00 committed by Peter Chen
parent 43a404577a
commit 8c100e7440

View File

@ -485,20 +485,30 @@ static void ci_otg_loc_conn(struct otg_fsm *fsm, int on)
/* /*
* Generate SOF by host. * Generate SOF by host.
* This is controlled through suspend/resume the port.
* In host mode, controller will automatically send SOF. * In host mode, controller will automatically send SOF.
* Suspend will block the data on the port. * Suspend will block the data on the port.
*
* This is controlled through usbcore by usb autosuspend,
* so the usb device class driver need support autosuspend,
* otherwise the bus suspend will not happen.
*/ */
static void ci_otg_loc_sof(struct otg_fsm *fsm, int on) static void ci_otg_loc_sof(struct otg_fsm *fsm, int on)
{ {
struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); struct usb_device *udev;
if (on) if (!fsm->otg->host)
hw_write(ci, OP_PORTSC, PORTSC_W1C_BITS | PORTSC_FPR, return;
PORTSC_FPR);
else udev = usb_hub_find_child(fsm->otg->host->root_hub, 1);
hw_write(ci, OP_PORTSC, PORTSC_W1C_BITS | PORTSC_SUSP, if (!udev)
PORTSC_SUSP); return;
if (on) {
usb_disable_autosuspend(udev);
} else {
pm_runtime_set_autosuspend_delay(&udev->dev, 0);
usb_enable_autosuspend(udev);
}
} }
/* /*