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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2990AC00140 for ; Mon, 15 Aug 2022 08:32:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230269AbiHOIc6 (ORCPT ); Mon, 15 Aug 2022 04:32:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230153AbiHOIc5 (ORCPT ); Mon, 15 Aug 2022 04:32:57 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF72D1FCE2 for ; Mon, 15 Aug 2022 01:32:55 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id z16so8236999wrh.12 for ; Mon, 15 Aug 2022 01:32:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=EXcUj6FUGMW2MlOtvV9/2PElSz+xwYewruvcgvdHfEI=; b=E+a4ffEeT4ZE69D3v3rLDGnXGAvAneqQiKTSOUhWZoeEWxqK+CFjMXxsFy1IAn4Wtn rIMYWZmEb/mqrLK/nAOKnkiwLG8cJuGYE9bgjjoglIp02wsesEkBq3NLkntaNEbsu6jI 3wbQhyMul1lUBDNcHVvf2GnFxeOsCbDcHmsbKL1nImj3KLg+ws4SnQir2K0k5Q5iDapf TUsSOjcoApfw48ane2ipyMEEPqwDAqS8HT35M5Y/k/ajpfz2OwWj+O1dnCPhSr/I8zIx CKW3+aNTiGK/AYKoYzE8Y3WO67ZprZa1uzjMiwZXB3zTnPxH9Az3AdYMFVbSkAx4j95W EOLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=EXcUj6FUGMW2MlOtvV9/2PElSz+xwYewruvcgvdHfEI=; b=mtbb+MXXqXegk8/MYJv1axn/s3hcF/uAHFZgrBBzSCBHe85WBn0BeVYFwg4Wfp8b91 v0zFNsA+n1RKuqqEBL2rf4z9rGHpKVp81zQ83SaL6ETUo7mncQVtXWmEQPwBsuoT7Ip2 hHrlHgTibL9DVPT7qGQ/0IJybS8z9v9JVY0nAVicdlP/izUtqsIlWA4qhllmXctW+YSc pvFW7fk7iQ9S5S0FPvSOqR+YN+nErQbTkj4Bj/XyKRdlpbXwyA+2n50PwDtv8rIDW10B VC2/6+lE2YtFCwdAq45SqoEbyZlTOrzORC7uV3Z4xtYrf9CyyR5JZDlrXHfK3lZ1uyaW cCLQ== X-Gm-Message-State: ACgBeo1I//H4EbhfsLVOBLoM+e8yz67S7NjTKZH/h6GwqwKtVVmEHZGC Z8z6GUDkl6diqEOQ/Ok46ix5aA== X-Google-Smtp-Source: AA6agR6VhKLPX5i7Rn7Iy/3Orf0DZCRUMR3GZVnyS56g6AwGZI40CXBX8nlzjn+iA74ifxnIGCNYBg== X-Received: by 2002:a05:6000:1092:b0:21f:13e7:3cc with SMTP id y18-20020a056000109200b0021f13e703ccmr8544750wrw.671.1660552374551; Mon, 15 Aug 2022 01:32:54 -0700 (PDT) Received: from linaro.org ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id r187-20020a1c44c4000000b003a5f2cc2f1dsm4138540wma.42.2022.08.15.01.32.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 01:32:53 -0700 (PDT) Date: Mon, 15 Aug 2022 11:32:52 +0300 From: Abel Vesa To: "Peng Fan (OSS)" Cc: abelvesa@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-imx@nxp.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Peng Fan Subject: Re: [PATCH 2/2] clk: imx: support fsl,protected-clocks Message-ID: References: <20220815033632.1687854-1-peng.fan@oss.nxp.com> <20220815033632.1687854-3-peng.fan@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220815033632.1687854-3-peng.fan@oss.nxp.com> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 22-08-15 11:36:32, Peng Fan (OSS) wrote: > From: Peng Fan > > For the clocks listed in fsl,protected-clocks, enable them to avoid > Linux disable them. This will benifit root Linux and inmate cell run > on top of Jailhouse hypervisor, and benifit AMP case. Nitpick: s/benifit/benefit/ AMP? > > Signed-off-by: Peng Fan > --- > drivers/clk/imx/clk-imx8mm.c | 2 ++ > drivers/clk/imx/clk-imx8mn.c | 2 ++ > drivers/clk/imx/clk-imx8mp.c | 2 ++ > drivers/clk/imx/clk-imx8mq.c | 2 ++ > drivers/clk/imx/clk.c | 21 +++++++++++++++++++++ > drivers/clk/imx/clk.h | 2 ++ > 6 files changed, 31 insertions(+) > > diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c > index b6d275855b36..24ddb1620bce 100644 > --- a/drivers/clk/imx/clk-imx8mm.c > +++ b/drivers/clk/imx/clk-imx8mm.c > @@ -611,6 +611,8 @@ static int imx8mm_clocks_probe(struct platform_device *pdev) > > imx_register_uart_clocks(4); > > + imx_clk_protect(dev, hws); > + > return 0; > > unregister_hws: > diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c > index d37c45b676ab..57c486317d28 100644 > --- a/drivers/clk/imx/clk-imx8mn.c > +++ b/drivers/clk/imx/clk-imx8mn.c > @@ -604,6 +604,8 @@ static int imx8mn_clocks_probe(struct platform_device *pdev) > > imx_register_uart_clocks(4); > > + imx_clk_protect(dev, hws); > + > return 0; > > unregister_hws: > diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c > index 652ae58c2735..a95862cc04a4 100644 > --- a/drivers/clk/imx/clk-imx8mp.c > +++ b/drivers/clk/imx/clk-imx8mp.c > @@ -713,6 +713,8 @@ static int imx8mp_clocks_probe(struct platform_device *pdev) > > imx_register_uart_clocks(4); > > + imx_clk_protect(dev, hws); > + > return 0; > } > > diff --git a/drivers/clk/imx/clk-imx8mq.c b/drivers/clk/imx/clk-imx8mq.c > index 882dcad4817d..2868e2390667 100644 > --- a/drivers/clk/imx/clk-imx8mq.c > +++ b/drivers/clk/imx/clk-imx8mq.c > @@ -603,6 +603,8 @@ static int imx8mq_clocks_probe(struct platform_device *pdev) > > imx_register_uart_clocks(4); > > + imx_clk_protect(dev, hws); > + > return 0; > > unregister_hws: > diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c > index 5582f18dd632..307da8bd5243 100644 > --- a/drivers/clk/imx/clk.c > +++ b/drivers/clk/imx/clk.c > @@ -2,6 +2,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -214,4 +215,24 @@ static int __init imx_clk_disable_uart(void) > late_initcall_sync(imx_clk_disable_uart); > #endif > > +int imx_clk_protect(struct device *dev, struct clk_hw * const clks[]) > +{ > + struct device_node *np = dev->of_node; > + struct property *prop; > + const __be32 *p; > + u32 i; > + int ret; > + > + of_property_for_each_u32(np, "fsl,protected-clocks", prop, p, i) { > + ret = clk_prepare_enable(clks[i]->clk); I might be wrong here, but wouldn't CLK_IGNORE_UNUSED have the same effect? I don't think we should circumvent that by adding vendor specific dts properties. > + if (ret) { > + dev_err(dev, "failed to enable %s\n", clk_hw_get_name(clks[i])); > + return ret; > + } > + } > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(imx_clk_protect); > + > MODULE_LICENSE("GPL v2"); > diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h > index dd49f90110e8..3f8099190b99 100644 > --- a/drivers/clk/imx/clk.h > +++ b/drivers/clk/imx/clk.h > @@ -22,6 +22,8 @@ void imx_mmdc_mask_handshake(void __iomem *ccm_base, unsigned int chn); > void imx_unregister_clocks(struct clk *clks[], unsigned int count); > void imx_unregister_hw_clocks(struct clk_hw *hws[], unsigned int count); > > +int imx_clk_protect(struct device *dev, struct clk_hw * const clks[]); > + > extern void imx_cscmr1_fixup(u32 *val); > > enum imx_pllv1_type { > -- > 2.37.1 >