From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8FE61C433EF for ; Thu, 13 Jan 2022 06:02:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 2B22983EE2; Thu, 13 Jan 2022 06:02:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oAgSCirp3ADD; Thu, 13 Jan 2022 06:02:52 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 1525483E5E; Thu, 13 Jan 2022 06:02:52 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D68BEC0030; Thu, 13 Jan 2022 06:02:51 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id BCAC2C001E for ; Thu, 13 Jan 2022 06:02:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 970ED60DFD for ; Thu, 13 Jan 2022 06:02:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VLPsqJWwkpY7 for ; Thu, 13 Jan 2022 06:02:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by smtp3.osuosl.org (Postfix) with ESMTPS id 3AA9160DA5 for ; Thu, 13 Jan 2022 06:02:44 +0000 (UTC) X-UUID: 0ff5dd1f6a9c40a6a5f99d60d556b070-20220113 X-UUID: 0ff5dd1f6a9c40a6a5f99d60d556b070-20220113 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1319419179; Thu, 13 Jan 2022 14:02:40 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Thu, 13 Jan 2022 14:02:38 +0800 Received: from mhfsdcap04 (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 13 Jan 2022 14:02:37 +0800 Message-ID: <6d2759f9d2ea74affa040bfec524e87b765c67af.camel@mediatek.com> Subject: Re: [PATCH v2 5/6] memory: mtk-smi: Add sleep ctrl function From: Yong Wu To: Krzysztof Kozlowski , Rob Herring , Matthias Brugger Date: Thu, 13 Jan 2022 14:02:37 +0800 In-Reply-To: <22935ffa-469c-a609-c30b-919ba85b842c@canonical.com> References: <20220111063904.7583-1-yong.wu@mediatek.com> <20220111063904.7583-6-yong.wu@mediatek.com> <22935ffa-469c-a609-c30b-919ba85b842c@canonical.com> X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 X-MTK: N Cc: youlin.pei@mediatek.com, devicetree@vger.kernel.org, yi.kuo@mediatek.com, srv_heupstream@mediatek.com, Will Deacon , linux-kernel@vger.kernel.org, Krzysztof Kozlowski , iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, lc.kan@mediatek.com, anthony.huang@mediatek.com, anan.sun@mediatek.com, Robin Murphy , linux-arm-kernel@lists.infradead.org, AngeloGioacchino Del Regno X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Wed, 2022-01-12 at 11:27 +0100, Krzysztof Kozlowski wrote: > On 11/01/2022 07:39, Yong Wu wrote: > > Sleep control means that when the larb goes to sleep, we should > > wait a bit > > until all the current commands are finished. Thus, when the larb > > runtime > > suspends, we need to enable this function to wait until all the > > existed > > commands are finished. When the larb resumes, just disable this > > function. > > This function only improves the safety of bus. Add a new flag for > > this > > function. Prepare for mt8186. > > > > Signed-off-by: Anan Sun > > Signed-off-by: Yong Wu > > --- > > drivers/memory/mtk-smi.c | 35 ++++++++++++++++++++++++++++++++++- > > 1 file changed, 34 insertions(+), 1 deletion(-) [...] > > @@ -492,9 +521,13 @@ static int __maybe_unused > > mtk_smi_larb_resume(struct device *dev) > > static int __maybe_unused mtk_smi_larb_suspend(struct device *dev) > > { > > struct mtk_smi_larb *larb = dev_get_drvdata(dev); > > + int ret = 0; > > + > > + if (MTK_SMI_CAPS(larb->larb_gen->flags_general, > > MTK_SMI_FLAG_SLEEP_CTL)) > > + ret = mtk_smi_larb_sleep_ctrl_enable(larb); > > > > clk_bulk_disable_unprepare(larb->smi.clk_num, larb->smi.clks); > > - return 0; > > + return ret; > > I am wondering whether disabling clocks in error case is a proper > step. > On suspend error, the PM core won't run any further callbacks on this > device. This means, it won't be resumed and your clocks stay > disabled. I > think you should return early and leave the device in active state in > case of error. oh, Yes. Thanks for pointing this out. I will fix this in next version. > > > Best regards, > Krzysztof > > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu