From patchwork Tue May 12 10:47:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanley Chu X-Patchwork-Id: 11542963 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 7F52F1668 for ; Tue, 12 May 2020 10:48:28 +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 5C2BD205ED for ; Tue, 12 May 2020 10:48:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mgB9sFm/"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="h6l6wzrE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C2BD205ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=xqL6yUgJn/H7XA/5h9zWCyL5opn/ylgBsY0QlotZrlc=; b=mgB9sFm/agLeSq zjm/xsiu8hapEst3Cnku9RpvOT0xEqluzheeI3QtpkxFHdrz6cCCHc6lpuT5sYIsWjub9rWPo6xv4 DZygqfCGA+tOA3uOKNFIPED8P96+0hoeX9QsEqjpHHdtJnGAV/ckt4CBk6GUVw/gcqpvcUoTa3QZK SuiYxKbMPZkuHb4kekseFIPpbfSYCLtnfDKDG7B1Hc3ZDtYbyTysFC/kOLBQClgGLh3fRvaZgLzco J7XejPWb4L1il9QgQ1gcHWV3dt4qU3nrJZP6z1DCU8cDUSU4ANZBV6HGvp6MsIyjPElVF+/OOWs+i 22CYBAKwPcHSP9HDI3IA==; 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 1jYSSZ-0006hn-5A; Tue, 12 May 2020 10:48:27 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYSSC-0006Gs-Jn; Tue, 12 May 2020 10:48:05 +0000 X-UUID: ac14a916ab874d4781c7a60386d4be8f-20200512 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=SfDQhGdBasCQf6xPUtgVXlprnq+Pu6y0OxSgqJwkc34=; b=h6l6wzrEYPsUXWDlrS7KnHXj4kW5aiW17VLTM7bs/xZEJrUzvGKxdjjSeVyZSe0qik0y0JaeXWcfVbjE1Hp7p3wr3zgibNV8VaEm3EtS61C/96fefA9cy0O795zvRy12741VrthZmz6TepoxCFw++qoXAZfVZbMDRwhZ4hge8fw=; X-UUID: ac14a916ab874d4781c7a60386d4be8f-20200512 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 955324177; Tue, 12 May 2020 02:47:47 -0800 Received: from mtkmbs08n1.mediatek.inc (172.21.101.55) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 12 May 2020 03:47:50 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 12 May 2020 18:47:50 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 12 May 2020 18:47:50 +0800 From: Stanley Chu To: , , , , , Subject: [PATCH v1 1/4] scsi: ufs: Remove unnecessary memset for dev_info Date: Tue, 12 May 2020 18:47:47 +0800 Message-ID: <20200512104750.8711-2-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200512104750.8711-1-stanley.chu@mediatek.com> References: <20200512104750.8711-1-stanley.chu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200512_034804_651505_B12C7EC2 X-CRM114-Status: UNSURE ( 7.90 ) X-CRM114-Notice: Please train this message. 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.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bvanassche@acm.org, andy.teng@mediatek.com, chun-hung.wu@mediatek.com, kuohong.wang@mediatek.com, linux-kernel@vger.kernel.org, cang@codeaurora.org, linux-mediatek@lists.infradead.org, peter.wang@mediatek.com, matthias.bgg@gmail.com, Stanley Chu , linux-arm-kernel@lists.infradead.org, beanhuo@micron.com Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org The whole UFS host instance has been zero-initialized by scsi_host_alloc(), thus UFS driver does not need to clear "dev_info" member specifically in ufshcd_device_params_init(). Simply remove the unnecessary code. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 426073a518ef..41ad4501b0d0 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -7279,9 +7279,6 @@ static int ufshcd_device_params_init(struct ufs_hba *hba) bool flag; int ret; - /* Clear any previous UFS device information */ - memset(&hba->dev_info, 0, sizeof(hba->dev_info)); - /* Init check for device descriptor sizes */ ufshcd_init_desc_sizes(hba); From patchwork Tue May 12 10:47:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanley Chu X-Patchwork-Id: 11542979 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 E26591668 for ; Tue, 12 May 2020 10:59:12 +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 C03C420675 for ; Tue, 12 May 2020 10:59:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hJIDLSyx"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="U8zaTPpa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C03C420675 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=9XsuaAC0FOM7yD0iHzD58GJFIdVfENZYjYYyVqtYIkY=; b=hJIDLSyxjDUXc6 jLFtWaww+jKZrC0zD7lDiEMQwMswi36423FDltKKOvEvcHifYHIwRIicED0+YS4OqjQVdF/XRhWkh vYC8/SniobbBuUNZ/VqiioZpLec8Jl9poKSPCBTEPmVaZzFnEryYF+YrYK03Mbtge01vY9VjAMldF 6wpGp3ZT1PXbqjpjCefdnVZ0KPZcx3q35SVLvAoaaBj39hxbV+WiZ1I6qWMeFHsSx6HucUCiukZus QT4TvtyO6vpzPmod6vtIpcR1jqB4wDmuvWQgkDjv2/xe5zim1ElflhVtTBOEEeg/1DzzydcWOmUh/ wZlinWODQjSLQ3Acz7bg==; 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 1jYScx-00067c-CZ; Tue, 12 May 2020 10:59:11 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYSbw-0005AE-L7; Tue, 12 May 2020 10:58:10 +0000 X-UUID: 3ace2cd5c5da4b1780f03cc46d77bbc7-20200512 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=shvkj9A9bwueIh1LMlmBnCkpSglW983N02ZzRfmxG8k=; b=U8zaTPpa1DggylQs2rikllGQZntCC5iMNKr278anni0Hdre6Qam+L8M3+cJOhRgdhWxma0sEmT4/ik9ZWUCHDDox/iyxcvjAnI/VKKxh7YZdcZhgnQPYUp20VRgpn+rO9IEpx9SLQSyzIGOpgXSZzKU/RSmNBeDIG1LvrvoaDts=; X-UUID: 3ace2cd5c5da4b1780f03cc46d77bbc7-20200512 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1684698939; Tue, 12 May 2020 02:57:57 -0800 Received: from MTKMBS02N2.mediatek.inc (172.21.101.101) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 12 May 2020 03:48:00 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n2.mediatek.inc (172.21.101.101) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 12 May 2020 18:47:51 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 12 May 2020 18:47:50 +0800 From: Stanley Chu To: , , , , , Subject: [PATCH v1 2/4] scsi: ufs: Allow WriteBooster on UFS 2.2 devices Date: Tue, 12 May 2020 18:47:48 +0800 Message-ID: <20200512104750.8711-3-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200512104750.8711-1-stanley.chu@mediatek.com> References: <20200512104750.8711-1-stanley.chu@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: D1B50872121CB6B6D9F75C1A4FDBB9E9BC6FD434C636AD02B0AD00D4503F5AB22000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200512_035808_797189_003AE882 X-CRM114-Status: UNSURE ( 8.46 ) X-CRM114-Notice: Please train this message. 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.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bvanassche@acm.org, andy.teng@mediatek.com, chun-hung.wu@mediatek.com, kuohong.wang@mediatek.com, linux-kernel@vger.kernel.org, cang@codeaurora.org, linux-mediatek@lists.infradead.org, peter.wang@mediatek.com, matthias.bgg@gmail.com, Stanley Chu , linux-arm-kernel@lists.infradead.org, beanhuo@micron.com Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org According to the UFS specification, WriteBooster is officially supported by UFS 2.2. Since UFS 2.2 specification has been finalized in JEDEC and such devices have also showed up in the market, modify the checking rule for ufshcd_wb_probe() to allow these devices to enable WriteBooster. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 41ad4501b0d0..b298bdd3e697 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -6942,6 +6942,7 @@ static int ufs_get_device_desc(struct ufs_hba *hba) * UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES enabled */ if (dev_info->wspecversion >= 0x310 || + dev_info->wspecversion == 0x220 || (hba->dev_quirks & UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES)) ufshcd_wb_probe(hba, desc_buf); From patchwork Tue May 12 10:47:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanley Chu X-Patchwork-Id: 11542975 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 59DC9159A for ; Tue, 12 May 2020 10:58:55 +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 3769820675 for ; Tue, 12 May 2020 10:58:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="u3Qt9qK8"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="VO84Uakq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3769820675 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=rgnGShmTRAmI5pGiGYy8h7uoYw4m2QgTA2poVBakBhA=; b=u3Qt9qK8TSW22S zanUJ7jifUWTJbA4d9YcEp8SgQFIb1Aj/zoI0c9o/0vI/2tPiPNy1svY/IbWaT3ihaSYAEFLs3C4G OdKdYZ19ajWWYExkkDQatiBGX7YH4lJ64WDqUS8K5Oz8t+q7OUul0bZa5rCSay0aY4tZCBsbQMZpk hZiRu9LTG51sAC+2QQu2/j1ysoLxu5bvGqc4441J7+8aIuBooosiJPc2pTsZt2QBl+vW7dj0tGx1r ChFrzSK7Tk/NoTt04a2MR3uU0BTVLzUXRDG9pvKAYDCi1QSWngn9P9UHGckfbrydSmBb5WrZZL4FS c9AcmOViMCLiPbdib2aQ==; 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 1jYSce-0005ph-1r; Tue, 12 May 2020 10:58:52 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYSbq-00055Q-9p; Tue, 12 May 2020 10:58:03 +0000 X-UUID: cbd941b8b8194d3ba0099579d4178b79-20200512 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=WOoU1J20WnftJm5Uc9Ijpskv9v6giRhPTTZph1ObLMg=; b=VO84Uakq8sXEycU/82wnvka9mCVrsyNXVd+UeFFoLMeiXFkqbO8nmEtkVLVmJkV2G3lEKebE+oCqk9P5qAZJtW4CcobF6M5tS1vRDbJN7WiFqo0niwnil60rTkwVfmyvG1Rf1rGEtmbFcniepvGBlQUIlI0O9IaF7NlMy3m6NqQ=; X-UUID: cbd941b8b8194d3ba0099579d4178b79-20200512 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1669141065; Tue, 12 May 2020 02:57:47 -0800 Received: from mtkmbs05n1.mediatek.inc (172.21.101.15) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 12 May 2020 03:47:51 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs05n1.mediatek.inc (172.21.101.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 12 May 2020 18:47:51 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 12 May 2020 18:47:51 +0800 From: Stanley Chu To: , , , , , Subject: [PATCH v1 3/4] scsi: ufs: Fix index of attributes query for WriteBooster feature Date: Tue, 12 May 2020 18:47:49 +0800 Message-ID: <20200512104750.8711-4-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200512104750.8711-1-stanley.chu@mediatek.com> References: <20200512104750.8711-1-stanley.chu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200512_035802_362384_1F9E91C2 X-CRM114-Status: GOOD ( 11.89 ) 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.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bvanassche@acm.org, andy.teng@mediatek.com, chun-hung.wu@mediatek.com, kuohong.wang@mediatek.com, linux-kernel@vger.kernel.org, cang@codeaurora.org, linux-mediatek@lists.infradead.org, peter.wang@mediatek.com, matthias.bgg@gmail.com, Stanley Chu , linux-arm-kernel@lists.infradead.org, beanhuo@micron.com Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org For WriteBooster feature related attributes, the index used by query shall be LUN ID if LU Dedicated buffer mode is enabled. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufs-sysfs.c | 13 +++++++++++-- drivers/scsi/ufs/ufshcd.c | 16 ++++++++++------ drivers/scsi/ufs/ufshcd.h | 2 +- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index a0b3763e1dc2..2d71d232a69d 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c @@ -637,7 +637,7 @@ static ssize_t _name##_show(struct device *dev, \ int ret; \ struct ufs_hba *hba = dev_get_drvdata(dev); \ if (ufshcd_is_wb_flags(QUERY_FLAG_IDN##_uname)) \ - index = ufshcd_wb_get_flag_index(hba); \ + index = ufshcd_wb_get_query_index(hba); \ pm_runtime_get_sync(hba->dev); \ ret = ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_READ_FLAG, \ QUERY_FLAG_IDN##_uname, index, &flag); \ @@ -680,6 +680,12 @@ static const struct attribute_group ufs_sysfs_flags_group = { .attrs = ufs_sysfs_device_flags, }; +static inline bool ufshcd_is_wb_attrs(enum attr_idn idn) +{ + return ((idn >= QUERY_ATTR_IDN_WB_FLUSH_STATUS) && + (idn <= QUERY_ATTR_IDN_CURR_WB_BUFF_SIZE)); +} + #define UFS_ATTRIBUTE(_name, _uname) \ static ssize_t _name##_show(struct device *dev, \ struct device_attribute *attr, char *buf) \ @@ -687,9 +693,12 @@ static ssize_t _name##_show(struct device *dev, \ struct ufs_hba *hba = dev_get_drvdata(dev); \ u32 value; \ int ret; \ + u8 index = 0; \ + if (ufshcd_is_wb_attrs(QUERY_ATTR_IDN##_uname)) \ + index = ufshcd_wb_get_query_index(hba); \ pm_runtime_get_sync(hba->dev); \ ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, \ - QUERY_ATTR_IDN##_uname, 0, 0, &value); \ + QUERY_ATTR_IDN##_uname, index, 0, &value); \ pm_runtime_put_sync(hba->dev); \ if (ret) \ return -EINVAL; \ diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index b298bdd3e697..169a3379e468 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5212,7 +5212,7 @@ static int ufshcd_wb_ctrl(struct ufs_hba *hba, bool enable) else opcode = UPIU_QUERY_OPCODE_CLEAR_FLAG; - index = ufshcd_wb_get_flag_index(hba); + index = ufshcd_wb_get_query_index(hba); ret = ufshcd_query_flag_retry(hba, opcode, QUERY_FLAG_IDN_WB_EN, index, NULL); if (ret) { @@ -5238,7 +5238,7 @@ static int ufshcd_wb_toggle_flush_during_h8(struct ufs_hba *hba, bool set) else val = UPIU_QUERY_OPCODE_CLEAR_FLAG; - index = ufshcd_wb_get_flag_index(hba); + index = ufshcd_wb_get_query_index(hba); return ufshcd_query_flag_retry(hba, val, QUERY_FLAG_IDN_WB_BUFF_FLUSH_DURING_HIBERN8, index, NULL); @@ -5261,7 +5261,7 @@ static int ufshcd_wb_buf_flush_enable(struct ufs_hba *hba) if (!ufshcd_is_wb_allowed(hba) || hba->wb_buf_flush_enabled) return 0; - index = ufshcd_wb_get_flag_index(hba); + index = ufshcd_wb_get_query_index(hba); ret = ufshcd_query_flag_retry(hba, UPIU_QUERY_OPCODE_SET_FLAG, QUERY_FLAG_IDN_WB_BUFF_FLUSH_EN, index, NULL); @@ -5283,7 +5283,7 @@ static int ufshcd_wb_buf_flush_disable(struct ufs_hba *hba) if (!ufshcd_is_wb_allowed(hba) || !hba->wb_buf_flush_enabled) return 0; - index = ufshcd_wb_get_flag_index(hba); + index = ufshcd_wb_get_query_index(hba); ret = ufshcd_query_flag_retry(hba, UPIU_QUERY_OPCODE_CLEAR_FLAG, QUERY_FLAG_IDN_WB_BUFF_FLUSH_EN, index, NULL); @@ -5303,10 +5303,12 @@ static bool ufshcd_wb_presrv_usrspc_keep_vcc_on(struct ufs_hba *hba, { u32 cur_buf; int ret; + u8 index; + index = ufshcd_wb_get_query_index(hba); ret = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_READ_ATTR, QUERY_ATTR_IDN_CURR_WB_BUFF_SIZE, - 0, 0, &cur_buf); + index, 0, &cur_buf); if (ret) { dev_err(hba->dev, "%s dCurWriteBoosterBufferSize read failed %d\n", __func__, ret); @@ -5329,6 +5331,7 @@ static bool ufshcd_wb_keep_vcc_on(struct ufs_hba *hba) { int ret; u32 avail_buf; + u8 index; if (!ufshcd_is_wb_allowed(hba)) return false; @@ -5343,9 +5346,10 @@ static bool ufshcd_wb_keep_vcc_on(struct ufs_hba *hba) * buffer (dCurrentWriteBoosterBufferSize). There's no point in * keeping vcc on when current buffer is empty. */ + index = ufshcd_wb_get_query_index(hba); ret = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_READ_ATTR, QUERY_ATTR_IDN_AVAIL_WB_BUFF_SIZE, - 0, 0, &avail_buf); + index, 0, &avail_buf); if (ret) { dev_warn(hba->dev, "%s dAvailableWriteBoosterBufferSize read failed %d\n", __func__, ret); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 23a434c03c2a..ab0d180dad6c 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -861,7 +861,7 @@ static inline bool ufshcd_keep_autobkops_enabled_except_suspend( return hba->caps & UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND; } -static inline u8 ufshcd_wb_get_flag_index(struct ufs_hba *hba) +static inline u8 ufshcd_wb_get_query_index(struct ufs_hba *hba) { if (hba->dev_info.b_wb_buffer_type == WB_BUF_MODE_LU_DEDICATED) return hba->dev_info.wb_dedicated_lu; From patchwork Tue May 12 10:47:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanley Chu X-Patchwork-Id: 11542971 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 DEC261668 for ; Tue, 12 May 2020 10:58:36 +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 9638E20675 for ; Tue, 12 May 2020 10:58:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ktf9XaPK"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="E0Oj4jya" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9638E20675 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=dmdvo39d3L6YhsSVsBkW8zhnMc1hph60fO5t/tMrMxA=; b=ktf9XaPKPQwudi 1YV/j2OLAuONzVKYOomPMPz0oAnTnBQw2N/CyeN745il1e4kdTmi5nJq8N1xKsbtKdfZ43HE6qc18 pcvANmSL7qzWDXNZEGlwfmIfiPrQJhOUaQ/mObuht0NysVIWDs05I8kNfTWpzfDJOdPbyfciJJ5oS DDsk+CRGtFZVhHEUWB3P+4Uxxuv95uPE4y0EeUsVqUzw2rf7TNBtU7ZeluflkKMMyotFVvUPJ4/gE dU1KcFFuoj8sQrf9y1wywMByxnBeqffyG96azku22yC0etRkMPsmkxxOhRCIuT89/t2yCQq8heg9U cGeWbeoblWGmNdGTFiSg==; 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 1jYScL-0005XY-0Y; Tue, 12 May 2020 10:58:33 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYSbo-00055K-W8; Tue, 12 May 2020 10:58:02 +0000 X-UUID: c7ffb933f7a341759a084e31fb553b9d-20200512 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=IKn33P9Cpgwi7sGItZ+ecq2Xst+yvAek6OLFdWPgstE=; b=E0Oj4jyaFKBvi3Z7TKcUExZET0Hp1WFKSQqkEabtLC9ugEMvn5csM//v/8uBcaIo44YqURZ3IGm2sy+t+cawWJuAHHGI+IVwCYeA2UxEiTpdHnitTes0hDd27SjPmM3knN67fF6xENktXk3gj8M2TZGKGXYJE45hQBmwA4IT6Zk=; X-UUID: c7ffb933f7a341759a084e31fb553b9d-20200512 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 340804751; Tue, 12 May 2020 02:57:47 -0800 Received: from MTKMBS02N1.mediatek.inc (172.21.101.77) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 12 May 2020 03:47:51 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 12 May 2020 18:47:51 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 12 May 2020 18:47:51 +0800 From: Stanley Chu To: , , , , , Subject: [PATCH v1 4/4] scsi: ufs: Fix WriteBooster flush during runtime suspend Date: Tue, 12 May 2020 18:47:50 +0800 Message-ID: <20200512104750.8711-5-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200512104750.8711-1-stanley.chu@mediatek.com> References: <20200512104750.8711-1-stanley.chu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200512_035801_045861_708BE260 X-CRM114-Status: GOOD ( 14.88 ) 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.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bvanassche@acm.org, andy.teng@mediatek.com, chun-hung.wu@mediatek.com, kuohong.wang@mediatek.com, linux-kernel@vger.kernel.org, cang@codeaurora.org, linux-mediatek@lists.infradead.org, peter.wang@mediatek.com, matthias.bgg@gmail.com, Stanley Chu , linux-arm-kernel@lists.infradead.org, beanhuo@micron.com Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org Currently UFS host driver promises VCC supply if UFS device needs to do WriteBooster flush during runtime suspend. However the UFS specification mentions, "While the flushing operation is in progress, the device is in Active power mode." Therefore UFS host driver needs to promise more: Keep UFS device as "Active power mode", otherwise UFS device shall not do any flush if device enters Sleep or PowerDown power mode. Fix this by not changing device power mode if WriteBooster flush is required in ufshcd_suspend(). Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufs.h | 1 - drivers/scsi/ufs/ufshcd.c | 39 +++++++++++++++++++-------------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index b3135344ab3f..9e4bc2e97ada 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -577,7 +577,6 @@ struct ufs_dev_info { u32 d_ext_ufs_feature_sup; u8 b_wb_buffer_type; u32 d_wb_alloc_units; - bool keep_vcc_on; u8 b_presrv_uspc_en; }; diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 169a3379e468..2d0aff8ac260 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8101,8 +8101,7 @@ static void ufshcd_vreg_set_lpm(struct ufs_hba *hba) !hba->dev_info.is_lu_power_on_wp) { ufshcd_setup_vreg(hba, false); } else if (!ufshcd_is_ufs_dev_active(hba)) { - if (!hba->dev_info.keep_vcc_on) - ufshcd_toggle_vreg(hba->dev, hba->vreg_info.vcc, false); + ufshcd_toggle_vreg(hba->dev, hba->vreg_info.vcc, false); if (!ufshcd_is_link_active(hba)) { ufshcd_config_vreg_lpm(hba, hba->vreg_info.vccq); ufshcd_config_vreg_lpm(hba, hba->vreg_info.vccq2); @@ -8172,6 +8171,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) enum ufs_pm_level pm_lvl; enum ufs_dev_pwr_mode req_dev_pwr_mode; enum uic_link_state req_link_state; + bool keep_curr_dev_pwr_mode = false; hba->pm_op_in_progress = 1; if (!ufshcd_is_shutdown_pm(pm_op)) { @@ -8226,28 +8226,27 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) /* make sure that auto bkops is disabled */ ufshcd_disable_auto_bkops(hba); } + /* - * With wb enabled, if the bkops is enabled or if the - * configured WB type is 70% full, keep vcc ON - * for the device to flush the wb buffer + * If device needs to do BKOP or WB buffer flush, keep device + * power mode as "active power mode" and its VCC supply. */ - if ((hba->auto_bkops_enabled && ufshcd_is_wb_allowed(hba)) || - ufshcd_wb_keep_vcc_on(hba)) - hba->dev_info.keep_vcc_on = true; - else - hba->dev_info.keep_vcc_on = false; - } else { - hba->dev_info.keep_vcc_on = false; + keep_curr_dev_pwr_mode = hba->auto_bkops_enabled || + ufshcd_wb_keep_vcc_on(hba); } - if ((req_dev_pwr_mode != hba->curr_dev_pwr_mode) && - ((ufshcd_is_runtime_pm(pm_op) && !hba->auto_bkops_enabled) || - !ufshcd_is_runtime_pm(pm_op))) { - /* ensure that bkops is disabled */ - ufshcd_disable_auto_bkops(hba); - ret = ufshcd_set_dev_pwr_mode(hba, req_dev_pwr_mode); - if (ret) - goto enable_gating; + if (req_dev_pwr_mode != hba->curr_dev_pwr_mode) { + if ((ufshcd_is_runtime_pm(pm_op) && !hba->auto_bkops_enabled) || + !ufshcd_is_runtime_pm(pm_op)) { + /* ensure that bkops is disabled */ + ufshcd_disable_auto_bkops(hba); + } + + if (!keep_curr_dev_pwr_mode) { + ret = ufshcd_set_dev_pwr_mode(hba, req_dev_pwr_mode); + if (ret) + goto enable_gating; + } } flush_work(&hba->eeh_work);