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,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 01E86C4CECD for ; Tue, 17 Sep 2019 16:32:21 +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 C916820665 for ; Tue, 17 Sep 2019 16:32:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tmqmaoYR"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="0XD7CRx+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C916820665 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:Message-Id:Date:Subject:From:To: References:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XYGaHL1PL6swrZnsgGDtuTdNIqj8MxVbmkvzbAwzgMc=; b=tmqmaoYR+lZ7qE ui7xrSskGFgw6hFz3qDjprpkr3xVHZYda7e3ac8bzMk6QQx3ntANFOHs7602vVHsPMkywiru+esBS sm2fZEJ3AWkU1NAPZ4TbrNft8ep7hZgZZE0HssOwbIf1ePdUEw5RmyAcVx3jRCsEQHSbV1sjXDOtN JRD3zmrRGqgj94dZelFS9XAsSpBSztHH/L1jTR/dr61/Tp13KNTOw2Ah1HawJiQtgplheVEoX4UkG d1FD/BybEMBASNCIX33tVe8ulX6dj66HoqE+eOvvUg5ryIamwcuvkIVuPwZUccXmcccomC9IiqF6L dEnC7y+ZacL7fCPeayww==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iAGOq-00009f-F2; Tue, 17 Sep 2019 16:32:20 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iAGOm-000090-Db for linux-arm-kernel@lists.infradead.org; Tue, 17 Sep 2019 16:32:18 +0000 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A838020665; Tue, 17 Sep 2019 16:32:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568737935; bh=1806vm0d1S7XVNXelbimfQVWSh7JvueRU/sHh9YNbiw=; h=In-Reply-To:References:Cc:To:From:Subject:Date:From; b=0XD7CRx+1osBMA4zjT/8TmoJe0X55eMamczxKoCew4bKMLIk/41z5gZxyf9kX/2S8 um24xOyvI1ebpkxiNyemF5ihma6sqIH+tEiT6/g0hnol6xPXVfJiIrm+YcUEM7rPHA /gboF+03MuWamm3fquJWhPiY4MIqH5gwyYz77DYY= MIME-Version: 1.0 In-Reply-To: References: <90bfeebcb76e76d286ed7f022ea9e0d9a569ebe2.1566315740.git.leonard.crestez@nxp.com> <20190916203312.CF8D02067B@mail.kernel.org> To: Leonard Crestez , Shawn Guo From: Stephen Boyd Subject: Re: [PATCH v2 1/7] clk: imx8m: Set CLK_GET_RATE_NOCACHE on dram_alt/apb User-Agent: alot/0.8.1 Date: Tue, 17 Sep 2019 09:32:14 -0700 Message-Id: <20190917163215.A838020665@mail.kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190917_093216_500487_29D5B578 X-CRM114-Status: GOOD ( 21.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Artur Świgoń , Jacky Bai , Viresh Kumar , Michael Turquette , Alexandre Bailon , "linux-clk@vger.kernel.org" , Abel Vesa , Saravana Kannan , Krzysztof Kozlowski , Chanwoo Choi , MyungJoo Ham , dl-linux-imx , "devicetree@vger.kernel.org" , "linux-pm@vger.kernel.org" , Rob Herring , "linux-arm-kernel@lists.infradead.org" , Aisheng Dong , Anson Huang , Kyungmin Park , "kernel@pengutronix.de" , Fabio Estevam , Georgi Djakov 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 Quoting Leonard Crestez (2019-09-16 16:03:53) > On 2019-09-16 11:33 PM, Stephen Boyd wrote: > > Quoting Leonard Crestez (2019-08-20 08:45:06) > >> Dram frequency changes required modifying these clocks outside the > >> control of clk framework. Mark them as CLK_GET_RATE_NOCACHE so that > >> rates are always read back from registers. > > > > Why can't we control the clks from the clk framework? Please add that > > information in the commit text here. > > OK, I will update commit message and comments > > These clocks are only modified for DRAM frequency switches during which > DRAM is briefly inaccessible. The switch is performed with a SMC call to > by TF-A which runs from a SRAM area. Upon returning to linux several > clocks bits are modified and we need to update them. > > For rate bits an easy solution is to just mark with > CLK_GET_RATE_NOCACHE, muxes are handled explicitly. Is there any reason to expose or control these clks from Linux then? It might be easier to just make any children clks of the DRAM frequency clk "root" clks and then ignore any frequency that they might have. Similarly, because the SMC call is used to change the frequency, it may be simpler to handle that completely outside of the clk framework (it may already be this way in this patch series but I haven't read everything here). > > Linux code performing the SMC call is also part of this series: > > https://patchwork.kernel.org/patch/11104145/ > > >> Signed-off-by: Leonard Crestez > >> --- > >> drivers/clk/imx/clk-imx8mm.c | 6 ++++-- > >> drivers/clk/imx/clk-imx8mn.c | 6 ++++-- > >> drivers/clk/imx/clk-imx8mq.c | 7 ++++--- > >> 3 files changed, 12 insertions(+), 7 deletions(-) > >> > >> diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c > >> index 4ead3ea2713c..6cac80550f43 100644 > >> --- a/drivers/clk/imx/clk-imx8mm.c > >> +++ b/drivers/clk/imx/clk-imx8mm.c > >> @@ -526,12 +526,14 @@ static int imx8mm_clocks_probe(struct platform_device *pdev) > >> /* IPG */ > >> clks[IMX8MM_CLK_IPG_ROOT] = imx_clk_divider2("ipg_root", "ahb", base + 0x9080, 0, 1); > >> clks[IMX8MM_CLK_IPG_AUDIO_ROOT] = imx_clk_divider2("ipg_audio_root", "audio_ahb", base + 0x9180, 0, 1); > >> > >> /* IP */ > >> - clks[IMX8MM_CLK_DRAM_ALT] = imx8m_clk_composite("dram_alt", imx8mm_dram_alt_sels, base + 0xa000); > >> - clks[IMX8MM_CLK_DRAM_APB] = imx8m_clk_composite_critical("dram_apb", imx8mm_dram_apb_sels, base + 0xa080); > >> + clks[IMX8MM_CLK_DRAM_ALT] = __imx8m_clk_composite("dram_alt", imx8mm_dram_alt_sels, base + 0xa000, > >> + CLK_GET_RATE_NOCACHE); > >> + clks[IMX8MM_CLK_DRAM_APB] = __imx8m_clk_composite("dram_apb", imx8mm_dram_apb_sels, base + 0xa080, > >> + CLK_IS_CRITICAL | CLK_GET_RATE_NOCACHE); > > > > Also, add a comment to this effect about why it can't be done from the > > clk framework wherever the CLK_GET_RATE_NOCACHE flag is set. Basically > > this flag is a hack and is an example of something that we need to fix. > > DRAM freq switch requires multiple clk changes to be performed > atomically while DRAM itself is not accessible so it's not something to > "fix". Ok. Fix may be the wrong word. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel