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 X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED 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 EA8B3C43381 for ; Wed, 13 Mar 2019 10:10:32 +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 B587F2171F for ; Wed, 13 Mar 2019 10:10:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="K9bh0p7F"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="K55Wf+r2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B587F2171F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.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: Date:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SiVs3sgTotNpTyf03yEWDXfPxkxAdlmP3Kf/sB/+Jh8=; b=K9bh0p7FW4uGtT M/pmhMDgnXy7bEfzbm1s1J1ibXKS/jqfqI30MV1dbgIRVC8xfG44p0OMvM7tN98EEDdfBS/WKJkln gMI8jsBBIT7q9eJxt1WKqHCHGGDOnXiIEde1DjUEv/l3eq+R1HqVlngpQZtFcWJ9tlLyzt5eE2Bil EFyHTfdMM04+UpmHGZbAXN1eqH/LKe0eA2CdK6p5oJT4jv1xn0z6D08WbINfFp+DX8DoWKc4VFbCt Jz9UKtlCk7fO3ay6BvVFTJSAGENWewLQqlfx2NF7hvTejw/iQf1xxvXMyxeu5DyaojFSRrnenY8KO qQMgyDLMMxih3OLjoJYg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h40q8-0003DP-Pw; Wed, 13 Mar 2019 10:10:24 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h40oS-00084R-3D; Wed, 13 Mar 2019 10:08:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZxB9e0NKdbSz/ZF81gTQuFm2WnaPsEdtNL7sa89fPnc=; b=K55Wf+r2Rd6GdtyK2+pmXL1lOg X93s1EFDqjsdIwt/qA7/Gi1jCAywLB2SkpU1iv0Jm6INtlrEmKSEJdYIlH6TC0c3tuEj0K4219Qmz MuM/e7l6a1dvB7jAnGBYhEimPoCjWQhgnGw+63POTtxms1YsH6kLgZp28BA5mbNAT6j4QTKcfmLLV fj7TwWmkwSfnv+C5utjrpdCNwe5nl56GeTNhvvLkjbSZSLWF/k8tNvfPTwjZ0AeGJyrPMATNGGzAL Rfko1AnrVFZEBbNEawUaV9pSlhhef1Ccxwaucm3RnPkiI3hqOJCDISEJsB59pGhJ+32Jghisiv8or 5UU33h/g==; Received: from mailgw02.mediatek.com ([216.200.240.185]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h40AQ-000848-UM; Wed, 13 Mar 2019 09:27:21 +0000 X-UUID: 13d4a461302647e398efaa48e39af802-20190313 X-UUID: 13d4a461302647e398efaa48e39af802-20190313 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 652408763; Wed, 13 Mar 2019 01:25:11 -0800 Received: from MTKMBS31N2.mediatek.inc (172.27.4.87) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 13 Mar 2019 02:25:10 -0700 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 13 Mar 2019 17:25:07 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 13 Mar 2019 17:25:06 +0800 Message-ID: <1552469107.7433.21.camel@mhfsdcap03> Subject: Re: [PATCH v6 12/22] memory: mtk-smi: Add gals support From: Yong Wu To: Matthias Brugger Date: Wed, 13 Mar 2019 17:25:07 +0800 In-Reply-To: <1550394300-17420-13-git-send-email-yong.wu@mediatek.com> References: <1550394300-17420-1-git-send-email-yong.wu@mediatek.com> <1550394300-17420-13-git-send-email-yong.wu@mediatek.com> X-Mailer: Evolution 3.2.3-0ubuntu6 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190313_092719_366996_04A7F862 X-CRM114-Status: GOOD ( 33.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: youlin.pei@mediatek.com, devicetree@vger.kernel.org, Nicolas Boichat , srv_heupstream@mediatek.com, Joerg Roedel , Will Deacon , linux-kernel@vger.kernel.org, Evan Green , Tomasz Figa , iommu@lists.linux-foundation.org, Rob Herring , linux-mediatek@lists.infradead.org, yingjoe.chen@mediatek.com, anan.sun@mediatek.com, Robin Murphy , Matthias Kaehlcke , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Matthias, A gentle ping for all the smi part here. >From Joerg, your review is expected before he apply. Thanks in advance. On Sun, 2019-02-17 at 17:04 +0800, Yong Wu wrote: > In some SoCs like mt8183, SMI add GALS(Global Async Local Sync) module > which can help synchronize for the modules in different clock frequency. > It can be seen as a "asynchronous fifo". This is a example diagram: > > M4U > | > ---------- > | | > gals0-rx gals1-rx > | | > | | > gals0-tx gals1-tx > | | > ------------ > SMI Common > ------------ > | > +-----+--------+-----+- ... > | | | | > | gals-rx gals-rx | > | | | | > | | | | > | gals-tx gals-tx | > | | | | > larb1 larb2 larb3 larb4 > > GALS only help transfer the command/data while it doesn't have the > configuring register, thus it has the special "smi" clock and doesn't > have the "apb" clock. From the diagram above, we add "gals0" and > "gals1" clocks for smi-common and add a "gals" clock for smi-larb. > > This patch adds gals clock supporting in the SMI. Note that some larbs > may still don't have the "gals" clock like larb1 and larb4 above. > > This is also a preparing patch for mt8183 which has GALS. > > CC: Matthias Brugger > Signed-off-by: Yong Wu > Reviewed-by: Evan Green > --- > drivers/memory/mtk-smi.c | 36 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) > > diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c > index 8a2f968..91634d7 100644 > --- a/drivers/memory/mtk-smi.c > +++ b/drivers/memory/mtk-smi.c > @@ -56,6 +56,7 @@ enum mtk_smi_gen { > > struct mtk_smi_common_plat { > enum mtk_smi_gen gen; > + bool has_gals; > }; > > struct mtk_smi_larb_gen { > @@ -63,11 +64,13 @@ struct mtk_smi_larb_gen { > int port_in_larb[MTK_LARB_NR_MAX + 1]; > void (*config_port)(struct device *); > unsigned int larb_direct_to_common_mask; > + bool has_gals; > }; > > struct mtk_smi { > struct device *dev; > struct clk *clk_apb, *clk_smi; > + struct clk *clk_gals0, *clk_gals1; > struct clk *clk_async; /*only needed by mt2701*/ > void __iomem *smi_ao_base; > > @@ -99,8 +102,20 @@ static int mtk_smi_enable(const struct mtk_smi *smi) > if (ret) > goto err_disable_apb; > > + ret = clk_prepare_enable(smi->clk_gals0); > + if (ret) > + goto err_disable_smi; > + > + ret = clk_prepare_enable(smi->clk_gals1); > + if (ret) > + goto err_disable_gals0; > + > return 0; > > +err_disable_gals0: > + clk_disable_unprepare(smi->clk_gals0); > +err_disable_smi: > + clk_disable_unprepare(smi->clk_smi); > err_disable_apb: > clk_disable_unprepare(smi->clk_apb); > err_put_pm: > @@ -110,6 +125,8 @@ static int mtk_smi_enable(const struct mtk_smi *smi) > > static void mtk_smi_disable(const struct mtk_smi *smi) > { > + clk_disable_unprepare(smi->clk_gals1); > + clk_disable_unprepare(smi->clk_gals0); > clk_disable_unprepare(smi->clk_smi); > clk_disable_unprepare(smi->clk_apb); > pm_runtime_put_sync(smi->dev); > @@ -310,6 +327,15 @@ static int mtk_smi_larb_probe(struct platform_device *pdev) > larb->smi.clk_smi = devm_clk_get(dev, "smi"); > if (IS_ERR(larb->smi.clk_smi)) > return PTR_ERR(larb->smi.clk_smi); > + > + if (larb->larb_gen->has_gals) { > + /* The larbs may still haven't gals even if the SoC support.*/ > + larb->smi.clk_gals0 = devm_clk_get(dev, "gals"); > + if (PTR_ERR(larb->smi.clk_gals0) == -ENOENT) > + larb->smi.clk_gals0 = NULL; > + else if (IS_ERR(larb->smi.clk_gals0)) > + return PTR_ERR(larb->smi.clk_gals0); > + } > larb->smi.dev = dev; > > if (larb->larb_gen->need_larbid) { > @@ -402,6 +428,16 @@ static int mtk_smi_common_probe(struct platform_device *pdev) > if (IS_ERR(common->clk_smi)) > return PTR_ERR(common->clk_smi); > > + if (common->plat->has_gals) { > + common->clk_gals0 = devm_clk_get(dev, "gals0"); > + if (IS_ERR(common->clk_gals0)) > + return PTR_ERR(common->clk_gals0); > + > + common->clk_gals1 = devm_clk_get(dev, "gals1"); > + if (IS_ERR(common->clk_gals1)) > + return PTR_ERR(common->clk_gals1); > + } > + > /* > * for mtk smi gen 1, we need to get the ao(always on) base to config > * m4u port, and we need to enable the aync clock for transform the smi _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel