Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2947099pxu; Mon, 7 Dec 2020 22:24:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7BmDqK53TskUHPoH0svlMfomUSM/aE0PD5f9Rk5i3xxrKedfFwHRo4cvClHS5dhFawMLm X-Received: by 2002:a50:a40c:: with SMTP id u12mr22914843edb.337.1607408653802; Mon, 07 Dec 2020 22:24:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607408653; cv=none; d=google.com; s=arc-20160816; b=WZ97vGS/bYIPrMtMR0m66r6ABQtdJ+fhAk3FDS/2xuHXVn0Re/ZrzltvkY3EaImRzR a2IYUgvFghGSWmIjDQcnUPw/yy8pvK9U6a72WN2kwEsRlHyEAnaiyb6dtXJMEO84pSId IKTZmq2bVU/PJq9YJTDq1JBNS3gKRk5kYnzyJH0IJSstsoCYOzz53HYqaH95Dz0pqSii B0dN+WQY3kEUa35JBRL1+toSc5dRXFhwtbHt2rWyEmvruMpBvt5Vbftvnn+T3Rg8urWE vZ7zVZgpNfTjXg99NFiIYqLZIMmek5+62/0T91l6TrqjNeGmn5tcILP1e5NPeTLlfQZg REkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=4mHfjiOKXut9yYJR1ebKdvckohWL762D8uIiOkfagso=; b=M7li56sHoY3NcXfKI2Rt3SCxi84VjwUD8P60IIciuNGJd9wuTcT6Bd2J/zXhOaN1R7 HqUx4LAtdSwTHqmiMXoHxe1zQ1LHmKG9eUd6emXNm1CI9UwPPj1Vm9yYdo3Tn81ykNzI 4CeYqzZ4MRYdK8H4AOu02dCWzfXZhC1c8qJXg7/9LQxR9TgrBZnJWBSFhSKBMvxRy/2B XIMeSyD3Y3bb4UThOtdbM5gU0K/7kKXKyuP79pH6TeprsU0+77Ybe8deD8pMW5Qe/nVz xab2n/cifNq2zNH1G5gIPmUQU5FbSrBfGUTbrGL/y6cQYfEezojaD3Un3OCbDZq3I+1E YiMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j18si4554067eds.46.2020.12.07.22.23.51; Mon, 07 Dec 2020 22:24:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726643AbgLHFun (ORCPT + 99 others); Tue, 8 Dec 2020 00:50:43 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:33695 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726338AbgLHFun (ORCPT ); Tue, 8 Dec 2020 00:50:43 -0500 X-UUID: ccabb92cb51d4d8eb6a95319ccbc93ab-20201208 X-UUID: ccabb92cb51d4d8eb6a95319ccbc93ab-20201208 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1708644948; Tue, 08 Dec 2020 13:49:57 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs02n2.mediatek.inc (172.21.101.101) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 8 Dec 2020 13:49:42 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 8 Dec 2020 13:49:42 +0800 From: Stanley Chu To: , , , , CC: , , , , , , , , , , , , , , , , Stanley Chu Subject: [PATCH v1] scsi: ufs: Ensure WriteBooster to be re-enabled after device reset Date: Tue, 8 Dec 2020 13:49:40 +0800 Message-ID: <20201208054940.1855-1-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: EE9471868BCE6F5EBDE13344911B30D28E13E0E7A3F5D3E610102976C6D9DA642000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org UFS 3.1 specification mentions that below WriteBooster flags will be set to default value, say disabled, after power cycle or any type of reset event. Thus we need to reset those flag variables kept in struct hba to align the device status and ensure WriteBooster related functions being configured properly after device reset. Without this fix, WriteBooster will not be enabled successfully by ufshcd_wb_ctrl() after device reset because hba->wb_enabled remains as true. Flags required to be reset to default values: - fWriteBoosterEn: hba->wb_enabled - fWriteBoosterBufferFlushEn: hba->wb_buf_flush_enabled - fWriteBoosterBufferFlushDuringHibernate: No variable mapped Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 7a7e056a33a9..c22887bee788 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -1218,8 +1218,11 @@ static inline void ufshcd_vops_device_reset(struct ufs_hba *hba) if (hba->vops && hba->vops->device_reset) { int err = hba->vops->device_reset(hba); - if (!err) + if (!err) { ufshcd_set_ufs_dev_active(hba); + hba->wb_enabled = false; + hba->wb_buf_flush_enabled = false; + } if (err != -EOPNOTSUPP) ufshcd_update_reg_hist(&hba->ufs_stats.dev_reset, err); } -- 2.18.0