From patchwork Tue Apr 17 03:32:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: leiwan@codeaurora.org X-Patchwork-Id: 10344271 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C8E1A60548 for ; Tue, 17 Apr 2018 03:32:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB682284CE for ; Tue, 17 Apr 2018 03:32:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A02A42885C; Tue, 17 Apr 2018 03:32:46 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_TVD_MIME_EPI 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 47931284CE for ; Tue, 17 Apr 2018 03:32:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751884AbeDQDco (ORCPT ); Mon, 16 Apr 2018 23:32:44 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37066 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751793AbeDQDcn (ORCPT ); Mon, 16 Apr 2018 23:32:43 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 24DA360863; Tue, 17 Apr 2018 03:32:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523935963; bh=6BTTJTSC7RAZeHJ4HFwLBHBUMEFxyVO/iQXpLLjGybM=; h=Date:From:To:Cc:Subject:From; b=dy1Qv6iRUzGeASyOcOU5TsOYPrqW1fwQC17hkI1KYJqJUYrlSJCxL62ZTWhVjf6OL RCE27r83sSe4HdjzTOY0U3NmRMTjdS9NjfBZ89Y4LaT0PPCNhGt3a0g1UomlNkKXf/ 9aE8BKSYqIVtv/9jBbh9o3JVLKGrvVvHEjhT37bU= Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 47C24607E1; Tue, 17 Apr 2018 03:32:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523935962; bh=6BTTJTSC7RAZeHJ4HFwLBHBUMEFxyVO/iQXpLLjGybM=; h=Date:From:To:Cc:Subject:From; b=BvjoaVw4NUhnvl8o4u2pNo51XXXU7JmIdkZXfs5QTihib7d4wavkfERFrPJT9Jni1 01opAmTgk5d8+dciNjPs3KFU62Yrc2AuKAuGN9uKB9P2My+nsc1wC30Yyw+GyLAnui TcQzrUJGG2eLyauT8P0LMyp5rmF85XX2R8w5jmjA= MIME-Version: 1.0 Date: Tue, 17 Apr 2018 11:32:42 +0800 From: leiwan@codeaurora.org To: mathias.nyman@intel.com, gregkh@linuxfoundation.org, ghackmann@google.com Cc: linux-usb@vger.kernel.org Subject: refine xhci-plat-Fix-xhci_plat-shutdown-sequence Message-ID: X-Sender: leiwan@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP xhci-plat Shutdown callback should check HCD_FLAG_HW_ACCESSIBLE before accessing any register. This should avoid hung with access controllers which support runtime suspend This can fix for issue of https://patchwork.kernel.org/patch/10339317/ corresponding upload in CAF: https://source.codeaurora.org/quic/la/kernel/msm-4.4/commit/?h=LV.HB.1.1.5-03810-8x96.0&id=a7a5307ee04ad349d365ad50f304605a9cd9bd0a full patch refer attachment. From 9b65acb64f1ad87d115fa147c9e947fb3d37471c Mon Sep 17 00:00:00 2001 From: Lei wang Date: Tue, 17 Apr 2018 10:55:35 +0800 Subject: [PATCH] xhci: plat: Fix xhci_plat shutdown hung xhci-plat Shutdown callback should check HCD_FLAG_HW_ACCESSIBLE before accessing any register. This should avoid hung with access controllers which support runtime suspend Signed-off-by: Lei wang --- drivers/usb/host/xhci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 9b27798..bdf914d 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -702,6 +702,10 @@ static void xhci_shutdown(struct usb_hcd *hcd) usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev)); spin_lock_irq(&xhci->lock); + if (!HCD_HW_ACCESSIBLE(hcd)) { + spin_unlock_irq(&xhci->lock); + return; + } xhci_halt(xhci); /* Workaround for spurious wakeups at shutdown with HSW */ if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) -- 1.9.1