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 69518C25B0E for ; Mon, 15 Aug 2022 08:32:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230471AbiHOIc6 (ORCPT ); Mon, 15 Aug 2022 04:32:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230219AbiHOIc6 (ORCPT ); Mon, 15 Aug 2022 04:32:58 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFCEE1FCE8 for ; Mon, 15 Aug 2022 01:32:55 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id h13so8257605wrf.6 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=mcMQ4t9SPoow0RUca8BYu5FPTS9LzE5KUtYBD3hPec6wFWsbZXK715immwozMpGvMo 5lJxDxYtinyZdzNoEUD3oCt7LT07r1GTJ45n9ggRB6wIt8EhAG0B6oEEqhenIxTg8QFf W6rZuTBOzZJOeCye4Fz5tf51kHczT4IKJ1TLxYle+JjN2254M0Vafvh7z3P6eWePjfy3 YKNCLJ9/McaXb0I13Q0VRc3t7GPKJG3o7SUdt5OVF/PXQ7YD2+jyIM2sxSE/BrJ2sYFF d1QIfCuU0jaCHK6fQaqnL9ieCY9iIJ/S0m3JhuXqyh9LhLvsuL5WRMALpgYNH4O1gDgG N49w== X-Gm-Message-State: ACgBeo31snqcmOO4AdaFZyl6MMrfTopvTPOTu+KEWDWR16tcIX+SIfMz V76t4453deAUDoe8PISVA2W+zV+ewf+9rA== 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: linux-clk@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 > 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BB26FC00140 for ; Mon, 15 Aug 2022 08:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OScA7esmcC/ZJiNbUNHWd4VtQQm6xyhhyEgCQ4hz/U0=; b=zxNUtYb5Ddt/rT 7GKhgBOleKhVgTmmw1PrIZPSoye49DSbr9MbRwI32B+S714Tg4H/dDWlKYlswO5eEer1kuBh0PfwX l5inTFOwuJX7vJfgE+uHPXBO2GrXNOmKBucxB8D0o7g09bciLZqJTAdX3c7TCkdPbxdcWSVglBLNW 5MVALIq4yAF43cQ+jaM+gtJeWNFULiwpo7bArLk1IUhnJ+Nt2s/h3j/NCVsA0FGeRVtrYYMbo4bPw ZIqlVqd+gdRtfYBpfMwioMOqjrjuIyzS43LxO/V3vEH6mOAKMsPyyBagiDQYaJPYZK1G8eE+u9Pfo sos1D/2A+BX6qi3TO/0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNVXB-00DE0U-Lh; Mon, 15 Aug 2022 08:33:17 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNVWq-00DDj6-8f for linux-arm-kernel@lists.infradead.org; Mon, 15 Aug 2022 08:33:06 +0000 Received: by mail-wr1-x42f.google.com with SMTP id p10so8259435wru.8 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=JZ4bVFrJll0XLRCId16Wb14MbddChgaAczb20iryfnb1ZfBZ55PK483lDX+3WvOrDI ueJpX6KsxuZP3c1gsgyYm1CixSll+AouFBIKgVhvJ1rVXCLL4rhGJON/wP6Ef0IX5IW9 v60gduUs30z4HrxNnRO+3xM9pKiywcwHjnvVyX6vXL47aJ5wQQZm06Xp0VE86j5Xk3Gx IMYuAoaaIj7axhNcxuKC0ww2xRomaeI7LyV/jCAjNFHALegz/zyZyrVRxkhWJ1FNtOHO ybTK5iQfxBThuTR9a9Fg9FJS2PNOyf/QkLQiLTxsYzArM1hOg3UntxrfBz4ya3KLIodQ TnTQ== X-Gm-Message-State: ACgBeo1KTBpJescK50f9L9FQpQvKRwSlljfTu404tZkwrMmZKtaKcbs3 DczrctKtZzJ0cUQ0Vw9w+T73Uw== 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-Disposition: inline In-Reply-To: <20220815033632.1687854-3-peng.fan@oss.nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220815_013256_423302_4B5563F7 X-CRM114-Status: GOOD ( 21.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel