From patchwork Tue Apr 14 06:14:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Can Guo X-Patchwork-Id: 11486823 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18CBB6CA for ; Tue, 14 Apr 2020 06:17:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E965F20767 for ; Tue, 14 Apr 2020 06:17:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WcxqE+H9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E965F20767 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=z7b+5Q1nxBCxmE5rwPJgbMCsZfDaC2BeCXG5F8a2+oM=; b=Wcx qE+H9+YyLUueYUhSvpVeoMrMutk/bs4tDXsYHABaS6CGGTeiJpGOQDOw5D0eweK3YQdGAY0EbwBxC REkt7WSTkK8fXJ7gRoh/MMcN4/x/d/B925jFLu7h6fRV9NxQCpbD7Z8QnO0wMdL/uEbeCVO0E00Xr kwwIEm23zU35an+HKGBkbTSVk7aQjVTCWFph8ZvbTBvNjCj2grqjxRFfHtrwqDQtZFCKdyjhBwyUO fVbM4WGDh79u29U6Z3y9V+GDfOBYFM/SVrwAib4RQB8ImcIeoeMMuoX/oFOm5daoiLv01WiONFwHr rKnJtDa0W8mOKb/E0m19u8h0xOg5JBQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOEsc-0003Lu-RR; Tue, 14 Apr 2020 06:17:06 +0000 Received: from labrats.qualcomm.com ([199.106.110.90]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOEsS-0003CP-Em; Tue, 14 Apr 2020 06:16:57 +0000 IronPort-SDR: GF+nhx7pQG5Eg2UGkLUudbnUbCQzLoEq+k3j4XEYypW5RCLFBgcA1kgW9dhsR/G1jrHiUQ2pfu y4tcVGbk6/oBJWG/HWuxHpiLGKh9Ujh2QzIpFKwO4FTUc9if6Jr1WeBNWUL8yJBUeC7UTcoM4I EU3QbUOhpMpT4IGo408k+3dMtD18YNm202DnGiZZMz/bjvXUZXWPNiP6Af9mYJeKv8p8sA8IAg RkJvlbQEnfZRQhOTMM1/o3dSLhfBAtguxNZPkYk9V2FZOW2VIEAUIFEJj87g44rsDN4GvnGP68 L2Y= X-IronPort-AV: E=Sophos;i="5.72,381,1580803200"; d="scan'208";a="46834943" Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by labrats.qualcomm.com with ESMTP; 13 Apr 2020 23:14:56 -0700 Received: from pacamara-linux.qualcomm.com ([192.168.140.135]) by ironmsg03-sd.qualcomm.com with ESMTP; 13 Apr 2020 23:14:54 -0700 Received: by pacamara-linux.qualcomm.com (Postfix, from userid 359480) id CE87E3B21; Mon, 13 Apr 2020 23:14:54 -0700 (PDT) From: Can Guo To: asutoshd@codeaurora.org, nguyenb@codeaurora.org, hongwus@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, cang@codeaurora.org Subject: [PATCH v2 1/1] scsi: ufs: full reinit upon resume if link was off Date: Mon, 13 Apr 2020 23:14:48 -0700 Message-Id: <1586844892-22720-1-git-send-email-cang@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200413_231656_536438_8C03D31E X-CRM114-Status: GOOD ( 11.79 ) X-Spam-Score: 0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bart Van Assche , "Martin K. Petersen" , Venkat Gopalakrishnan , "James E.J. Bottomley" , open list , Avri Altman , "moderated list:ARM/Mediatek SoC support" , Alim Akhtar , Matthias Brugger , Tomas Winkler , Stanley Chu , "moderated list:ARM/Mediatek SoC support" , Bean Huo MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Asutosh Das During suspend, if the link is put to off, it would require a full initialization during resume. This patch resets and restores both the host and the card during initialization, otherwise, host only reset and restore may fail occasionally. Signed-off-by: Asutosh Das Signed-off-by: Can Guo Reviewed-by: Bean Huo Reviewed-by: Alim Akhtar Acked-by: Stanley Chu Change since v1: - Incorporated Alim's comments. --- drivers/scsi/ufs/ufshcd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 64e42ef..90313c8 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8048,9 +8048,13 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) else goto vendor_suspend; } else if (ufshcd_is_link_off(hba)) { - ret = ufshcd_host_reset_and_restore(hba); /* - * ufshcd_host_reset_and_restore() should have already + * A full initialization of the host and the device is + * required since the link was put to off during suspend. + */ + ret = ufshcd_reset_and_restore(hba); + /* + * ufshcd_reset_and_restore() should have already * set the link state as active */ if (ret || !ufshcd_is_link_active(hba))