diff options
author | Li Jun <jun.li@freescale.com> | 2015-12-15 10:51:29 +0100 |
---|---|---|
committer | Peter Chen <peter.chen@freescale.com> | 2015-12-24 07:18:07 +0100 |
commit | 8c100e74409ad3bbcb8a1ccdff4540fc0aa7a0fc (patch) | |
tree | 394332ad518c473a52060e3a69ba15f4e0f5adf6 /drivers/usb | |
parent | usb: chipidea: host: set host to be null after hcd is freed (diff) | |
download | linux-8c100e74409ad3bbcb8a1ccdff4540fc0aa7a0fc.tar.xz linux-8c100e74409ad3bbcb8a1ccdff4540fc0aa7a0fc.zip |
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/chipidea/otg_fsm.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 00ab59d45da1..ba90dc66703d 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -485,20 +485,30 @@ static void ci_otg_loc_conn(struct otg_fsm *fsm, int on) /* * Generate SOF by host. - * This is controlled through suspend/resume the port. * In host mode, controller will automatically send SOF. * 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) { - struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); + struct usb_device *udev; - if (on) - hw_write(ci, OP_PORTSC, PORTSC_W1C_BITS | PORTSC_FPR, - PORTSC_FPR); - else - hw_write(ci, OP_PORTSC, PORTSC_W1C_BITS | PORTSC_SUSP, - PORTSC_SUSP); + if (!fsm->otg->host) + return; + + udev = usb_hub_find_child(fsm->otg->host->root_hub, 1); + if (!udev) + return; + + if (on) { + usb_disable_autosuspend(udev); + } else { + pm_runtime_set_autosuspend_delay(&udev->dev, 0); + usb_enable_autosuspend(udev); + } } /* |