From patchwork Thu May 14 09:39:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 6403741 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 16F34BEEE1 for ; Thu, 14 May 2015 09:39:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 388AD203F7 for ; Thu, 14 May 2015 09:39:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 07BC4203DA for ; Thu, 14 May 2015 09:39:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932265AbbENJj2 (ORCPT ); Thu, 14 May 2015 05:39:28 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:53140 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752903AbbENJj1 (ORCPT ); Thu, 14 May 2015 05:39:27 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie1.idc.renesas.com with ESMTP; 14 May 2015 18:39:25 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 1E47859343; Thu, 14 May 2015 18:39:25 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id F17AA480A4; Thu, 14 May 2015 18:39:24 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id D79BF480A3; Thu, 14 May 2015 18:39:24 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac4.idc.renesas.com with ESMTP id UAE17902; Thu, 14 May 2015 18:39:24 +0900 X-IronPort-AV: E=Sophos;i="5.13,426,1427727600"; d="scan'208";a="187345792" Received: from mail-hk1lp0119.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.119]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 14 May 2015 18:39:24 +0900 Authentication-Results: intel.com; dkim=none (message not signed) header.d=none; Received: from localhost (211.11.155.147) by HK2PR06MB0915.apcprd06.prod.outlook.com (25.162.246.30) with Microsoft SMTP Server (TLS) id 15.1.160.19; Thu, 14 May 2015 09:39:22 +0000 From: Yoshihiro Shimoda To: , CC: , , Yoshihiro Shimoda Subject: [PATCH v2 RFT] usb: xhci: Add to check CRR bit in xhci_suspend() Date: Thu, 14 May 2015 18:39:17 +0900 Message-ID: <1431596357-4460-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [211.11.155.147] X-ClientProxiedBy: OS1PR01CA0029.jpnprd01.prod.outlook.com (25.164.162.13) To HK2PR06MB0915.apcprd06.prod.outlook.com (25.162.246.30) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HK2PR06MB0915; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:HK2PR06MB0915; BCL:0; PCL:0; RULEID:; SRVR:HK2PR06MB0915; X-Forefront-PRVS: 0576145E86 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(6069001)(50466002)(48376002)(36756003)(87976001)(40100003)(122386002)(42382002)(229853001)(33646002)(50986999)(47776003)(66066001)(62966003)(77156002)(19580405001)(19580395003)(5001960100002)(107886002)(92566002)(78352002)(76506005)(42186005)(5001770100001)(189998001)(50226001)(46102003)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR06MB0915; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2015 09:39:22.6560 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB0915 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The STS_HALT is not set until the CRR (CMD_RING_RUNNING) is cleared on specific xHCI controllers (e.g. R-Car SoCs) after this driver set the R/S (CMD_RUN) to 0. So, to avoid using a quirks XHCI_SLOW_SUSPEND, this patch adds to wait for the CRR to clear. Signed-off-by: Yoshihiro Shimoda --- My environment (R-Car H2) could work correctly. I would like to know that this patch causes side effect or not. Also I'd like to know this patch can avoid the XHCI_SLOW_SUSPEND quirk on other environment (Fresco Logic XHCI controller). Changes from v1: - Remove a abort code. - Wait for the CRR to clear after this driver set the R/S to 0. - Rebase on the usb.git / usb-next branch. (commit id = aa519be34f45954f33a6c20430deac8e544a180f) drivers/usb/host/xhci.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index ec8ac16..a357917 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -923,6 +923,15 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) command &= ~CMD_RUN; writel(command, &xhci->op_regs->command); + /* + * The STS_HALT is not set until the CRR is cleared on specific + * xHCI controllers (e.g. R-Car SoCs) after this driver set the R/S + * to 0. So, to avoid using a quirks XHCI_SLOW_SUSPEND, this driver + * waits for the CRR to clear. + */ + xhci_handshake(&xhci->op_regs->cmd_ring, CMD_RING_RUNNING, 0, + 5 * 1000 * 1000); + /* Some chips from Fresco Logic need an extraordinary delay */ delay *= (xhci->quirks & XHCI_SLOW_SUSPEND) ? 10 : 1;