From patchwork Fri Mar 22 18:11:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 10866411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A93414DE for ; Fri, 22 Mar 2019 18:11:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 424432A98B for ; Fri, 22 Mar 2019 18:11:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 236E52A99E; Fri, 22 Mar 2019 18:11:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBD722A996 for ; Fri, 22 Mar 2019 18:11:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728137AbfCVSLh (ORCPT ); Fri, 22 Mar 2019 14:11:37 -0400 Received: from muru.com ([72.249.23.125]:42150 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727801AbfCVSLh (ORCPT ); Fri, 22 Mar 2019 14:11:37 -0400 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 4DEAD80DB; Fri, 22 Mar 2019 18:11:50 +0000 (UTC) From: Tony Lindgren To: Alan Stern Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-omap@vger.kernel.org Subject: [PATCH] usb: host: ohci-platform: Implement ohci_platform_shutdown Date: Fri, 22 Mar 2019 11:11:27 -0700 Message-Id: <20190322181127.60640-1-tony@atomide.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If OHCI is runtime suspended, we can currently get an "imprecise external abort" on reboot with ohci-platform loaded when PM runtime is implemented for the SoC. Let's fix this by implementing ohci_platform_shutdown with PM runtime calls clocking the hardware before calling hcd->driver->shutdown. Fixes: 0aa0b93e7af6 ("usb: host: ohci-platform: Add basic runtime PM support") Signed-off-by: Tony Lindgren --- drivers/usb/host/ohci-platform.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -240,6 +240,22 @@ static int ohci_platform_probe(struct platform_device *dev) return err; } +static void ohci_platform_shutdown(struct platform_device *pdev) +{ + struct usb_hcd *hcd = platform_get_drvdata(pdev); + int err; + + err = pm_runtime_get_sync(&pdev->dev); + if (err < 0) + pm_runtime_put_noidle(&pdev->dev); + + if (hcd->driver->shutdown) + hcd->driver->shutdown(hcd); + + if (!err) + pm_runtime_put_sync(&pdev->dev); +} + static int ohci_platform_remove(struct platform_device *dev) { struct usb_hcd *hcd = platform_get_drvdata(dev); @@ -326,7 +342,7 @@ static struct platform_driver ohci_platform_driver = { .id_table = ohci_platform_table, .probe = ohci_platform_probe, .remove = ohci_platform_remove, - .shutdown = usb_hcd_platform_shutdown, + .shutdown = ohci_platform_shutdown, .driver = { .name = "ohci-platform", .pm = &ohci_platform_pm_ops,