From patchwork Wed May 12 09:41:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?UGV0ZXIgV2FuZyAo546L5L+h5Y+LKQ==?= X-Patchwork-Id: 12253157 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=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham 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 7C598C433B4 for ; Wed, 12 May 2021 09:41:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C40661263 for ; Wed, 12 May 2021 09:41:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230157AbhELJmq (ORCPT ); Wed, 12 May 2021 05:42:46 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:33148 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230096AbhELJmp (ORCPT ); Wed, 12 May 2021 05:42:45 -0400 X-UUID: e56e8992728249de8fb3b8181b729c22-20210512 X-UUID: e56e8992728249de8fb3b8181b729c22-20210512 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1059462927; Wed, 12 May 2021 17:41:34 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 12 May 2021 17:41:33 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 12 May 2021 17:41:32 +0800 From: To: , , , , , CC: , , , , , , Subject: [PATCH v3 1/1] scsi: ufs-mediatek: fix ufs power down specs violation Date: Wed, 12 May 2021 17:41:16 +0800 Message-ID: <1620812476-23730-2-git-send-email-peter.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1620812476-23730-1-git-send-email-peter.wang@mediatek.com> References: <1620812476-23730-1-git-send-email-peter.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Peter Wang As per specs, e.g, JESD220E chapter 7.2, while powering off the ufs device, RST_N signal should be between VSS(Ground) and VCCQ/VCCQ2. The power down sequence after fixing as below: Power down: 1. Assert RST_N low 2. Turn-off VCC 3. Turn-off VCCQ/VCCQ2 Change-Id: Ib35768d47026d111e1cdd3c4023f2e131b5e65e8 Signed-off-by: Peter Wang --- drivers/scsi/ufs/ufs-mediatek.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index c55202b..47f47ab 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -922,6 +922,7 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm) static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) { int err; + struct arm_smccc_res res; if (ufshcd_is_link_hibern8(hba)) { err = ufs_mtk_link_set_lpm(hba); @@ -941,6 +942,9 @@ static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) goto fail; } + if (ufshcd_is_shutdown_pm(pm_op)) + ufs_mtk_device_reset_ctrl(0, res); + return 0; fail: /*