Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1400471ybp; Thu, 17 Oct 2019 12:13:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqxio95kp8s2zpmxjrOBkEI1yzUfaIBAlsi0esnBqp9uGG0vWcDzQmD++rcmm4Oqse1/+SnJ X-Received: by 2002:a17:906:4716:: with SMTP id y22mr5055388ejq.225.1571339616120; Thu, 17 Oct 2019 12:13:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571339616; cv=none; d=google.com; s=arc-20160816; b=loYbm1Xv8eABzn0Ie2/Tk6Qm6xCSFdMZJHlWVEVN8h7fHbbkbROqSaykHFx3NI4fQS tLf9ulkwUFneKuRN7lDnRCqzEwTMSa8b3Io3DB+Zmd+bZKWGN+aXEDGI47i8IwcGX/mk T+R1dJDI+243tVH/RJm063d7ghM7Kd+KWkYAap4vfvdi2dGkAV+F/bwtPVOAETr6sxuZ xtzCsG+2jf1BZGmkwNd00ZozNHpuII839TfazPu7YRu16E66VzjVlHyizESzvnxf1w7r UNJFFpYSUi3WAcj0z1YxDqELKDaIE8/Cge5dXGKV2/Iz/e/ffecUdTbq7V/QnUfVqpIJ JEXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EjE0ZxPyr4Y65kn0IJaFeWbKKwvkjdAo4HCcqnkUrl8=; b=zsUqQjYiRAXSgJ1wPAFmDBsg2ru0QezwbAojrLT0y3YpyPFXfbwzgrbjPhs9cnXFuj PB3GPTVodSP6YYSmmtoKcnFjQg3R1A2chPNYdszCsUXr6nfNaLkl1T78bYOJp4ipMGO/ qXGp/V4FZe3z7Zo6SyGm+w0QuT27G8QmHgLW74ic2y37ylKJA4AVtMyDmONVYB1HPWsX UDoeaQSzojBDdt0MSFCS0j4zii0S6k5vNkbRqWHfZp/kUg81gkPaqCVW6uxfINTmb/xw TLPUGkhZ5uPOwgGK1R4YaU4HK7taOeL1NUujtbjmqfyDgIrhOYnhywwzqj55rvhk2h2I kHAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=m6sBFB3K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g18si2042371edq.209.2019.10.17.12.13.12; Thu, 17 Oct 2019 12:13:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=m6sBFB3K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405216AbfJPWOJ (ORCPT + 99 others); Wed, 16 Oct 2019 18:14:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:46650 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395298AbfJPVzl (ORCPT ); Wed, 16 Oct 2019 17:55:41 -0400 Received: from localhost (unknown [192.55.54.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C79B021925; Wed, 16 Oct 2019 21:55:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571262940; bh=Q1iSEHmxWvAe4+jgyVigR4xHfYjuLUmCWmswNSncyW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m6sBFB3Kp3nQSxfjlZbo7ZwyVG+IF1+Pg7OyUjnLkPXyoHzrd1IWiZaTDSz0SZ+KN QTkBbVfvDFvb67I3xYq1WLkBwvmiDMsLHl/fHtj4n97ISwNG+0UndcngyKs/jZFMB0 yIdhrjulDbOLw9w+ckmbXgKGbrbOTuFZlVlB2O/s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rick Tseng , Mathias Nyman Subject: [PATCH 4.14 11/65] usb: xhci: wait for CNR controller not ready bit in xhci resume Date: Wed, 16 Oct 2019 14:50:25 -0700 Message-Id: <20191016214804.494024704@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214756.457746573@linuxfoundation.org> References: <20191016214756.457746573@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rick Tseng commit a70bcbc322837eda1ab5994d12db941dc9733a7d upstream. NVIDIA 3.1 xHCI card would lose power when moving power state into D3Cold. Thus we need to wait for CNR bit to clear in xhci resume, just as in xhci init. [Minor changes to comment and commit message -Mathias] Cc: Signed-off-by: Rick Tseng Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/1570190373-30684-6-git-send-email-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1044,6 +1044,18 @@ int xhci_resume(struct xhci_hcd *xhci, b hibernated = true; if (!hibernated) { + /* + * Some controllers might lose power during suspend, so wait + * for controller not ready bit to clear, just as in xHC init. + */ + retval = xhci_handshake(&xhci->op_regs->status, + STS_CNR, 0, 10 * 1000 * 1000); + if (retval) { + xhci_warn(xhci, "Controller not ready at resume %d\n", + retval); + spin_unlock_irq(&xhci->lock); + return retval; + } /* step 1: restore register */ xhci_restore_registers(xhci); /* step 2: initialize command ring buffer */