From patchwork Fri Feb 5 01:36:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?RG9vSHl1biBId2FuZyjtmanrkZDtmIQvRGV2aWNlIFMvVyBTb2x1dGlvbiBMYWIuKE1YKS/sgrzshLHsoITsnpAp?= X-Patchwork-Id: 12069129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 642F7C433E9 for ; Fri, 5 Feb 2021 01:50:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 26BBF64FB0 for ; Fri, 5 Feb 2021 01:50:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232977AbhBEBtw (ORCPT ); Thu, 4 Feb 2021 20:49:52 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:55069 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229579AbhBEBtv (ORCPT ); Thu, 4 Feb 2021 20:49:51 -0500 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210205014907epoutp02817b45fd1adc8bc16d1eea3b5a670f5c~gtuHZssIe0979809798epoutp02H for ; Fri, 5 Feb 2021 01:49:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210205014907epoutp02817b45fd1adc8bc16d1eea3b5a670f5c~gtuHZssIe0979809798epoutp02H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1612489747; bh=C3dFxkK0kWLNWz5MmIHloF9lErrhh6j/ok64cvvAl6Y=; h=From:To:Cc:Subject:Date:References:From; b=tzdtumFK+qFsVNc+cpo0LFkdecvugofx3jXuVHzEwAhsbiOPnYor69ia5LMG7cZxX Ly7zEXx1Fr4KLGyvXw9liKMdyVabAnyU9eu+WwZXCuF3xYAFo4iZAjNhaIQTuKe0/t 5V428HP4g3i5qzex1qEg0uFq9Dam5gniGjmHcF/k= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20210205014906epcas1p1c5de1d16e2db96a8c052ac6d86425dcd~gtuF-tdVi2357423574epcas1p1T; Fri, 5 Feb 2021 01:49:06 +0000 (GMT) Received: from epsmges1p2.samsung.com (unknown [182.195.40.164]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4DWyy94czmz4x9Q2; Fri, 5 Feb 2021 01:49:05 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 03.39.63458.114AC106; Fri, 5 Feb 2021 10:49:05 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p1.samsung.com (KnoxPortal) with ESMTPA id 20210205014904epcas1p1b8cf04408ff6f5ef9ebd5c95b8a99f27~gtuESkyz52605026050epcas1p1I; Fri, 5 Feb 2021 01:49:04 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210205014904epsmtrp1feb7e5e70a6523803e15fa9afaf27abf~gtuERSRcE0437704377epsmtrp1X; Fri, 5 Feb 2021 01:49:04 +0000 (GMT) X-AuditID: b6c32a36-6dfff7000000f7e2-47-601ca4111fa3 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id D9.E8.13470.014AC106; Fri, 5 Feb 2021 10:49:04 +0900 (KST) Received: from localhost.localdomain (unknown [10.253.101.61]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210205014904epsmtip208ab073b333c2de67fe4bd3835b2fe17~gtuD_Hlv30103001030epsmtip2C; Fri, 5 Feb 2021 01:49:04 +0000 (GMT) From: DooHyun Hwang To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, cang@codeaurora.org, asutoshd@codeaurora.org, beanhuo@micron.com, jaegeuk@kernel.org, adrian.hunter@intel.com, satyat@google.com Cc: grant.jung@samsung.com, jt77.jang@samsung.com, junwoo80.lee@samsung.com, jangsub.yi@samsung.com, sh043.lee@samsung.com, cw9316.lee@samsung.com, sh8267.baek@samsung.com, wkon.kim@samsung.com, DooHyun Hwang Subject: [PATCH 1/3] scsi: ufs: retry link startup if that fails and device state is not active Date: Fri, 5 Feb 2021 10:36:31 +0900 Message-Id: <20210205013633.16243-1-dh0421.hwang@samsung.com> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA01Tf1BUVRSe+97btytI81wMbzsUuEQMILgLLF5RLInwjTpBWkxT0PIGXkAt uzv7lsaaaiSJXwsuoMwIESFYJGJMG9AuLqCLCmsUkyCJJeiEClL8DFATancfTfz3ne9855x7 vnuvCBffIyWiTLWe1akZlZR0I9q6A0NDNpzyTpGN5vgh+1gTiW7VtJGoI69XiCYeXiPRhduF BJpr/kqATlzJE6DOIbsQPVpuFqKx5iocFbQew1Dd9TYMme/1CVH78hEMDbRXk8jwi5lEDT0r GDKeuUmiTx53Emior1eAvmwdBui7q4vEC170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AAA= X-CMS-MailID: 20210205014904epcas1p1b8cf04408ff6f5ef9ebd5c95b8a99f27 X-Msg-Generator: CA X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210205014904epcas1p1b8cf04408ff6f5ef9ebd5c95b8a99f27 References: Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove unnecessary link startup command if it was completed. UniPro stack is reset and enabled when ufshc is enabled. The link startup command is issued after enabling ufshc, if link startup is completed, there is no needed to issue again. Signed-off-by: DooHyun Hwang --- drivers/scsi/ufs/ufshcd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 721f55db181f..286f7c918f0e 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4642,13 +4642,13 @@ static int ufshcd_link_startup(struct ufs_hba *hba) ufshcd_update_evt_hist(hba, UFS_EVT_LINK_STARTUP_FAIL, (u32)ret); - goto out; - } - if (link_startup_again) { - link_startup_again = false; - retries = DME_LINKSTARTUP_RETRIES; - goto link_startup; + if (link_startup_again) { + link_startup_again = false; + retries = DME_LINKSTARTUP_RETRIES; + goto link_startup; + } + goto out; } /* Mark that link is up in PWM-G1, 1-lane, SLOW-AUTO mode */ From patchwork Fri Feb 5 01:36:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?RG9vSHl1biBId2FuZyjtmanrkZDtmIQvRGV2aWNlIFMvVyBTb2x1dGlvbiBMYWIuKE1YKS/sgrzshLHsoITsnpAp?= X-Patchwork-Id: 12069131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 422B4C433E6 for ; Fri, 5 Feb 2021 01:50:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 044DD64FB1 for ; Fri, 5 Feb 2021 01:50:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233004AbhBEBt6 (ORCPT ); Thu, 4 Feb 2021 20:49:58 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:18878 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232902AbhBEBty (ORCPT ); Thu, 4 Feb 2021 20:49:54 -0500 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210205014909epoutp04754a44fb838c114267a68ef22d717ef5~gtuIrAq303209632096epoutp04O for ; Fri, 5 Feb 2021 01:49:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210205014909epoutp04754a44fb838c114267a68ef22d717ef5~gtuIrAq303209632096epoutp04O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1612489749; bh=wNEhNzaPW//33H4RoTFNNydg7Mr5bSv+r/oH3A9X9NU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XjpG6qAwKff0vqtwqRPrxXU7MRb0AJmSt/Jmy4V8PXUK1zfimv8HBzV5BFb6E3TOj yW+lN/iVSnac+1IC229RRYRxgpwfu/k0HU7X34kSOY/mGEOmcUJAn77xOK+mXP+QYo 9ARCRHsrHTXqiIuQevM3jDg+HCfowKmLqjwYYXdw= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20210205014907epcas1p47286e30d40ba35aee8dfc0c159555acc~gtuHZ-psj0170901709epcas1p4N; Fri, 5 Feb 2021 01:49:07 +0000 (GMT) Received: from epsmges1p5.samsung.com (unknown [182.195.40.162]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4DWyyC00Xgz4x9Q1; Fri, 5 Feb 2021 01:49:07 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id F1.AE.09577.214AC106; Fri, 5 Feb 2021 10:49:06 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p4.samsung.com (KnoxPortal) with ESMTPA id 20210205014906epcas1p4273577a5af2d2a0786ddf794cd32d494~gtuGBACXt1005010050epcas1p4q; Fri, 5 Feb 2021 01:49:06 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210205014906epsmtrp1acef36e8bd14993550ffa4bd1e96da8b~gtuF-Am8A0437704377epsmtrp1c; Fri, 5 Feb 2021 01:49:06 +0000 (GMT) X-AuditID: b6c32a39-c13ff70000002569-b2-601ca412a6e1 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 2E.4A.08745.214AC106; Fri, 5 Feb 2021 10:49:06 +0900 (KST) Received: from localhost.localdomain (unknown [10.253.101.61]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210205014905epsmtip2bfe60057017bbb33ae02403c8610daed~gtuFqfapT0103001030epsmtip2D; Fri, 5 Feb 2021 01:49:05 +0000 (GMT) From: DooHyun Hwang To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, cang@codeaurora.org, asutoshd@codeaurora.org, beanhuo@micron.com, jaegeuk@kernel.org, adrian.hunter@intel.com, satyat@google.com Cc: grant.jung@samsung.com, jt77.jang@samsung.com, junwoo80.lee@samsung.com, jangsub.yi@samsung.com, sh043.lee@samsung.com, cw9316.lee@samsung.com, sh8267.baek@samsung.com, wkon.kim@samsung.com, DooHyun Hwang Subject: [PATCH 2/3] scsi: ufs: set device state to power-off before 1st link startup Date: Fri, 5 Feb 2021 10:36:32 +0900 Message-Id: <20210205013633.16243-2-dh0421.hwang@samsung.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210205013633.16243-1-dh0421.hwang@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA01Ta1ATVxjt3V02CQps46N3MoxCai3SSUhIghcrlBkdXUcc6dhOi04JW1gg NCQxm3Ra2x+01MhLiIKjBVGBFirFwUJggCLPjkgLTHmoICrSIhYcLYIVRB5NWDvl37nnnvN9 93z3XiEufkpKhDqDhTUbGL2UdCdq2rYEyMTfeUcryrsR6hgtJ9G9czUkumK7JkDjz6+TqGUk jUBTFSVu6MyvNjfUeKNDgOYWKgRotCIPR6nVORgqGqjBUO2DTgGqX0jBUF/9WRJl3KwlUWn7 Ioayf7xDoq/nGwl0o/OaG/q+ehCgqt5nRNh6ui/rOEZfqLTSxQ3jGF1ZlkbS9qJmQH/T0UTQ MxWpJP3k/i2CznKUAXq6cgN9rDkDi1h1UL89gWViWbMPa4gxxuoM8SHSvQe0O7SaIIVSpgxG W6U+BiaJDZHuDI+Q7dLpnXGlPp8yequTimA4ThoQut1stFpYnwQjZwmRsqZYvUmpMMk5Jomz GuLlMcakbUqFIlDjVEbrEy4/RaYc0WfJLx5hyeB3QToQCSGlhrPl/SAduAvFVC2AOUtFGL+Y ArCwrJ3gF9MAlvT1Oi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LB7f13eweXx8eovFo2/LKkaPz5vkPNoP dDMFcEdx2aSk5mSWpRbp2yVwZWz4YlEwmbOi4fdbpgbGC+xdjBwcEgImEns6croYuTiEBHYw SpzqeMHSxcgJFJeR6L6/F6pGWOLw4WKImo+MEvsffWUDqWET0JPY07uKFSQhInCOSeL2vCWM IA6zwG9GiUk/mtlBqoQFQiXuPd3IBGKzCKhKTD38nxnE5hWwlZj1uo8RYpu8xJ/7PWBxTgE7 iYWd/8E2CAHVHHm2mhGiXlDi5MwnYNcxA9U3b53NPIFRYBaS1CwkqQWMTKsYJVMLinPTc4sN C4zyUsv1ihNzi0vz0vWS83M3MYKjVEtrB+OeVR/0DjEycTAeYpTgYFYS4U1sk0oQ4k1JrKxK LcqPLyrNSS0+xCjNwaIkznuh62S8kEB6YklqdmpqQWoRTJaJg1OqgWnpicravCTXiMPly89o 3YxZYLYneuMU94QrWewGofuXrJB6MXXa9x2n7jcWx9XL7Tm+VrnR8aqW2ZwHivX/X5lsP/SQ f2X9pmfrzrx6Gtp+4n1fepRGr8V2jqc1XHVJfO4Hm57tvCixusSRxYa9IOJUoIHc44JvVqef TbXkCUnjz10jOqes/17jkQ3P5Fi44jOMvwuEFp9P+nPasezsvC+f5W0mpDtLKBZcFf2dzRn5 UGTLrIgnW76Y5+/1jrnI0n4j/EufMG/ba54UhenpXwJPrvezavwozs6mtXBFrb6uxfsPe/rO Om5bbpSns9zIRaNxn1Ayl0/OD9mPv37VBqyPW/1PqVKgiN/wdVZdjxJLcUaioRZzUXEiADHx 7rBBAwAA X-CMS-MailID: 20210205014906epcas1p4273577a5af2d2a0786ddf794cd32d494 X-Msg-Generator: CA X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210205014906epcas1p4273577a5af2d2a0786ddf794cd32d494 References: <20210205013633.16243-1-dh0421.hwang@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In the ufshcd init sequence, device state should be power-off bacause the UFS device is not active. Signed-off-by: DooHyun Hwang --- drivers/scsi/ufs/ufshcd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 286f7c918f0e..32cb3b0dcbcf 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -9447,13 +9447,12 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) /* Hold auto suspend until async scan completes */ pm_runtime_get_sync(dev); atomic_set(&hba->scsi_block_reqs_cnt, 0); + /* - * We are assuming that device wasn't put in sleep/power-down - * state exclusively during the boot stage before kernel. - * This assumption helps avoid doing link startup twice during - * ufshcd_probe_hba(). + * The device-initialize-sequence hasn't been invoked yet. + * Set the device to power-off state */ - ufshcd_set_ufs_dev_active(hba); + ufshcd_set_ufs_dev_poweroff(hba); async_schedule(ufshcd_async_scan, hba); ufs_sysfs_add_nodes(hba->dev); From patchwork Fri Feb 5 01:36:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?RG9vSHl1biBId2FuZyjtmanrkZDtmIQvRGV2aWNlIFMvVyBTb2x1dGlvbiBMYWIuKE1YKS/sgrzshLHsoITsnpAp?= X-Patchwork-Id: 12069133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E7D8C43381 for ; Fri, 5 Feb 2021 01:50:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E2C764E16 for ; Fri, 5 Feb 2021 01:50:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229717AbhBEBuP (ORCPT ); Thu, 4 Feb 2021 20:50:15 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:55197 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233000AbhBEBt5 (ORCPT ); Thu, 4 Feb 2021 20:49:57 -0500 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210205014914epoutp0219fbca9ddbb6705bafaf077601ac6ce0~gtuNquTEo1143411434epoutp02H for ; Fri, 5 Feb 2021 01:49:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210205014914epoutp0219fbca9ddbb6705bafaf077601ac6ce0~gtuNquTEo1143411434epoutp02H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1612489754; bh=zBlATRvYraRdAaJGrKEnqYtMnm/p4bFoVfSg53NqXac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gs8sYTye/5T2GvL9cOWG363cbS++PQ338yXARUFpnA6GgY24rCoYYSn3XQ7fzh/Go 79kcrd36ozgwkFa/2Pf38Kvs1t4oYr+BKXyy9c/jTm3I9WUodQVo5L8Wvf+BqV3Dp6 Zc88c8JUYwmDiY6RrqgIMYz4ZugB3keAXmwVSRKE= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20210205014913epcas1p37bc49ec7611462940f04a7f86b146ea2~gtuM_-k381527315273epcas1p3L; Fri, 5 Feb 2021 01:49:13 +0000 (GMT) Received: from epsmges1p5.samsung.com (unknown [182.195.40.163]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4DWyyH1vQ8z4x9Q9; Fri, 5 Feb 2021 01:49:11 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 08.AE.09577.714AC106; Fri, 5 Feb 2021 10:49:11 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p3.samsung.com (KnoxPortal) with ESMTPA id 20210205014910epcas1p3bcaa909ace0684150973ccc3a35bb0de~gtuJ44pAx1526515265epcas1p3B; Fri, 5 Feb 2021 01:49:10 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210205014910epsmtrp255cb99957ee22a6dc5d543baad0532b9~gtuJ2FcS92849228492epsmtrp2o; Fri, 5 Feb 2021 01:49:10 +0000 (GMT) X-AuditID: b6c32a39-c13ff70000002569-c8-601ca417bf35 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id EC.E8.13470.614AC106; Fri, 5 Feb 2021 10:49:10 +0900 (KST) Received: from localhost.localdomain (unknown [10.253.101.61]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210205014910epsmtip2e954d452f0c93b43abedb0d53cdaac1d~gtuJkHrar0106301063epsmtip2B; Fri, 5 Feb 2021 01:49:09 +0000 (GMT) From: DooHyun Hwang To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, cang@codeaurora.org, asutoshd@codeaurora.org, beanhuo@micron.com, jaegeuk@kernel.org, adrian.hunter@intel.com, satyat@google.com Cc: grant.jung@samsung.com, jt77.jang@samsung.com, junwoo80.lee@samsung.com, jangsub.yi@samsung.com, sh043.lee@samsung.com, cw9316.lee@samsung.com, sh8267.baek@samsung.com, wkon.kim@samsung.com, DooHyun Hwang Subject: [PATCH 3/3] scsi: ufs: reset the ufs device before link startup retry Date: Fri, 5 Feb 2021 10:36:33 +0900 Message-Id: <20210205013633.16243-3-dh0421.hwang@samsung.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210205013633.16243-1-dh0421.hwang@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02Tf0xbVRTHc1/b15at81kG3CBiV52RKbQFSi8TGozgno5kGKNZnAYe8ELZ SltbujCTIb9SYWWjZIubVTbY+KFMaGCAiFB+LUINYfzYGJsYfoQFgTFHy4ZzwGx5LPLf95z7 Oeebc+69PJZwBffnpWsyab2GUotxL3ZLb5Ak2K8yIEn6MIeLHLM/4WjqYguOOkz9XDT/5BaO uqeL2Mhpq+agC7+bOMg+5uCif9dtXDRrs7JQYfNZDF0eb8FQ69wAF7Wt52NotO17HJlvt+Ko pm8DQyVX/8RR3pqdjcYG+jmoqvkOQNdGHrNjfMnRM6cxsrzRSF5pn8fIxtoinLRc7gJkgaOT Ta7aCnFy+d5dNnmmqRaQrsZA8usuM5aw41N1lIqmUmm9iNakaFPTNWnR4oMfJb6bKI+QyoJl kUghFmmoDDpaHBufEPxeuto9rlh0nFIb3akEymAQS5RReq0xkxaptIbMaDGtS1XrZFJdiIHK MBg1aSEp2oz9Mqk0VO4mk9Sq3vtv63K5WUO3snPAIOcU4PMgEQ6HbqyzTwEvnpBoBdA1/QOH CZwA2tongYcSEo8BnKgSPa/oGjmNM1AHgGfn/tkKXABa/jJv9sWJENh+unaz1W7CjsGJHzsx T8AilgGsuLuIeyhvIgHWFIxverCJvXDo6bNNLSCiYdOgk834vQLXJotZHs0nlLCi6BnOMC9C x7ezmwzLzeQ3f8fyGEAinw8r8pYBUxwLR5oucBntDRf6mra0P3Q96MAZbQawpEfJFF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NKTPrRzA5SJSzgJzF91XNmEJtFQFXiwu//jCA2r4CtxJZzn1ggtslL/LnfA1bDKWAn sbDzP9RFthJHnq2GqheUODnzCVg9M1B989bZzBMYBWYhSc1CklrAyLSKUTK1oDg3PbfYsMAw L7Vcrzgxt7g0L10vOT93EyM4RrU0dzBuX/VB7xAjEwfjIUYJDmYlEd7ENqkEId6UxMqq1KL8 +KLSnNTiQ4zSHCxK4rwXuk7GCwmkJ5akZqemFqQWwWSZODilGphcf7T9+mbPdJrTcoq97PN/ 2hrTL9323/LhXb9gbUxXvz/3o/nnaisOnKpTOvphU5h9c8QpXTvG6vlXLt+VfbFMe/v8nXxP 8nxlUkWEJHdm7EnI4KhbtPz6X81GdvmLL8padxxMqr63/47j44eO9w/9Z71csfjPUa9vm++v 3burtNTvmlbfXZ9zDr9nKv+dV3k0+o6tseiZikcT0lVW5B7t0/A3+n+p/Jwn+4zvt1Z9sIgJ 2xlyt/Aoa+nBmw8yn/o7nPoXezK5Jet2WJ1w2+2+1POHP2REr39qxmCx3yD57OXZtZG9a5uf vJ38qUst/EqpXH1EUZD0z7vbVX4pK3NJvF3vped0zOlS4T016acaSizFGYmGWsxFxYkALheC xEADAAA= X-CMS-MailID: 20210205014910epcas1p3bcaa909ace0684150973ccc3a35bb0de X-Msg-Generator: CA X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210205014910epcas1p3bcaa909ace0684150973ccc3a35bb0de References: <20210205013633.16243-1-dh0421.hwang@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If the link startup command fails, trigger hardware reset to reset the UFS device before link startup retry. Signed-off-by: DooHyun Hwang --- drivers/scsi/ufs/ufshcd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 32cb3b0dcbcf..a87e98631a72 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4644,7 +4644,15 @@ static int ufshcd_link_startup(struct ufs_hba *hba) (u32)ret); if (link_startup_again) { + int err = 0; + link_startup_again = false; + + /* Reset the attached device before retrying */ + err = ufshcd_vops_device_reset(hba); + if (err && (err != -EOPNOTSUPP)) + ufshcd_update_evt_hist(hba, UFS_EVT_DEV_RESET, err); + retries = DME_LINKSTARTUP_RETRIES; goto link_startup; }