| Message ID | 20241222170534.3621453-11-dario.binacchi@amarulasolutions.com |
|---|---|
| State | New |
| Headers |
Return-Path:
<linux-amarula+bncBCQ4XFG47UFRB5MNUG5QMGQETQ5UTEQ@amarulasolutions.com>
X-Original-To: linux-amarula@patchwork.amarulasolutions.com
Delivered-To: linux-amarula@patchwork.amarulasolutions.com
Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com
[209.85.218.72])
by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4D4FF40CF6
for <linux-amarula@patchwork.amarulasolutions.com>;
Sun, 22 Dec 2024 18:05:58 +0100 (CET)
Received: by mail-ej1-f72.google.com with SMTP id
a640c23a62f3a-aa6a7bea04csf214442666b.3
for <linux-amarula@patchwork.amarulasolutions.com>;
Sun, 22 Dec 2024 09:05:58 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1734887158; cv=pass;
d=google.com; s=arc-20240605;
b=GBqz7aUpQU+ERakYeb3wlGwwOuD2G2tKvHrWam1Iq4qIDCO3MorFynltCA5jxYApOH
4TiE4xS41XRX8KOdj4+CJEgJ/MWTFEcO3uYwdFOB1PhmTtL8V288d1gZbAU4RQ0CIvni
msuz8K8tox6r7oNpeeNyywSAFUbbRva0q2yVcpJjVZuZ+tbIG4C97qn9kcHxQyXKOc0E
+H6oK5OOfW5pY9/I4s/Juu67vitkE8LTT2Z6HCEEimpdP2OGmw0CPTBS6D90pjAFaqlW
N0OzeNaK5HwVOY8nyFnX4Zgq8t+pFl0Mgd2TACa90b5MjoxgpIe9nFjHa9NXaOHQGGRu
fuMA==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20240605;
h=list-unsubscribe:list-archive:list-help:list-post:list-id
:mailing-list:precedence:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:dkim-signature;
bh=2gYlu539sfhnmC9yOSzvrEFd/AnUfFm7X89dl1H9JtM=;
fh=kSSC1FIYknqIZ1kH7GiQJURuo9QwisnXTL8hINGwzHk=;
b=LOo+ez5wUVeRhPYVzlXOQIB2swuVbhkjn4elxEM6ObfRc4YWPcB7TFeDJbYmeCz+gr
qqgSmMmXHLpdW+6cKVg5jGVkM0Sq85eWB9p9yDMHSGtvCwnPsak3geXBSIyc3qNjPoNG
cS80wOGWlPnwgpgsf3r2ySwyB9P9CWXSkWXAz0nkqf2XFuGErUT8l7HMcN0RiNSUDaE2
QCfMHDzGQAYwynJEhHfSS5O2F5AU/rbgpoUOya6CRRbgNAcYGx/WgyB9YKIgmHbz/4ZZ
LExeklorI6ts8wtOX1fdsZd9hVOoN86gli7a91An8z9oGmGh4WFFpt1BHwjrpJCGNxGR
5bbw==;
darn=patchwork.amarulasolutions.com
ARC-Authentication-Results: i=2; mx.google.com;
dkim=pass header.i=@amarulasolutions.com header.s=google
header.b=WgpODsqg;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=pass header.i=@amarulasolutions.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=amarulasolutions.com; s=google; t=1734887158; x=1735491958;
darn=patchwork.amarulasolutions.com;
h=list-unsubscribe:list-archive:list-help:list-post:list-id
:mailing-list:precedence:x-original-authentication-results
:x-original-sender:mime-version:references:in-reply-to:message-id
:date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=2gYlu539sfhnmC9yOSzvrEFd/AnUfFm7X89dl1H9JtM=;
b=D7JRW+VaiyHCqYGu6p5nG5NUE+DOBiNqP3x6e51M8RP9SCeb5oxmLYoentlWMs1gE4
NRdcgrpuEOSUaVkHp8edtfAOjP3hY+JdWOUefdA3ZSxuvy9R0v1YrfPXAtZIsrFyyrOW
LgnPSxgQQFIKGCAts/GPO9Ey+KoxfIv0+n9PE=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1734887158; x=1735491958;
h=list-unsubscribe:list-archive:list-help:list-post
:x-spam-checked-in-group:list-id:mailing-list:precedence
:x-original-authentication-results:x-original-sender:mime-version
:references:in-reply-to:message-id:date:subject:cc:to:from
:x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=2gYlu539sfhnmC9yOSzvrEFd/AnUfFm7X89dl1H9JtM=;
b=S8ZkaqD2cc2u5A41m6xgQCvacIsJFYxfkOMgZedNhF/fB1JvpuQaqJfB3TUd5k3Kkd
dZhF3Fz4oojQajOUJtiI20Thn1Tb90+J/gzZr0AK3bzfZ5Cqjuve7eN/YhFuohDK2tqM
y0kcxaiyO+D+0gPg4ebB5VXv05McHmj0JvCu0YFeZud3uWVVUKkH1ZE24egNfwGUCOxZ
SQKVPX6uli1Am22Q8gi4xAxvuTa1KPnvoQoaMtwAVxo4NVRpSM/NzYtT2i0AYnLWsaJH
FkNsIhkKsedIyQkC8VsGiVnruExOEXTbf8UnCBo/AS3KIbqpAqOlXDoAQQdne8d/misE
C9sg==
X-Forwarded-Encrypted: i=2;
AJvYcCX32jzZ/p9b5gH3GvopJaIjrdrEJbh/xZ8mdbkk3WPogg8FLQQv6FF8POENfohgFb4iYOIdVAkP3zYgfGu5@patchwork.amarulasolutions.com
X-Gm-Message-State: AOJu0Yxn4ZLREdnypelhlCSCq50Fae+KSGM53cE8s01ZGYUMyyAHrqJ3
UqmIOXiGFUJkfAKXtMP/YzmGZXjS1JK9SFjAWMeYQgFdnP5Csk8C6O/wE3yjIrUsoUtnm3LKtQ=
=
X-Google-Smtp-Source:
AGHT+IG/xeHK6uFN543MvtN3ts342DriOmK22t/iiZWxsMlmt/DzzzVMAIBTJB4VYwI1n71WKncs+w==
X-Received: by 2002:a17:907:1c03:b0:aa6:57aa:1fe9 with SMTP id
a640c23a62f3a-aac345f5cf0mr806488266b.51.1734887157917;
Sun, 22 Dec 2024 09:05:57 -0800 (PST)
X-BeenThere: linux-amarula@amarulasolutions.com
Received: by 2002:a50:9e66:0:b0:5d0:d5d6:eb6e with SMTP id
4fb4d7f45d1cf-5d8025a6c67ls18754a12.1.-pod-prod-07-eu;
Sun, 22 Dec 2024 09:05:56 -0800 (PST)
X-Received: by 2002:a17:907:6ea6:b0:aa6:8bb4:503b with SMTP id
a640c23a62f3a-aac345f3545mr981044266b.55.1734887156027;
Sun, 22 Dec 2024 09:05:56 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1734887156; cv=none;
d=google.com; s=arc-20240605;
b=T4R8tT6C/ysf0VHGXxSl1XYyXVytu6g5EKwpUAafu1orwe4Zj3fcEVMUjkoJXWf9fg
b4JTlNCt1OXvJzA6Jo1MWtGQC0xIvcknQh9i0LFktXuE/BmHhQB2eh/GUdwQnMbHOZR6
4+YYd0j9Ib4pcB1kMrez0kmReHUY4ofomYpa9lPvzC73bmLYM99sPuU9gaXCu81qmZAL
E43LPNFOOw4uuORHVu9ymwQZVg6iOIlHIYNSoVEXmicIiMDDDYGRAHUH0grnfyxOit9T
PCuLtQmhhdKSz7liyYaArLYj5bgPRRd7GNKNu3Gbhg1Se8Oi0hnKm3HxYg1KFpz/R/I2
WY6g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20240605;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:dkim-signature;
bh=sVXt77MmyayWVTjhC1zQYGhplrs4R1xCNUj96ytDRNM=;
fh=u/u80m6tBSaxW7VWG5AQatIbYzkIAnRGhZp/RTASK5o=;
b=bv7j7nGk1tPCHFiFe9mW0LXobLC2957LgLzJEdKng8J8aUXODrvVu5jYAUC7NmcZKf
Pt2W9pm9ndfpLLtYjdpN5Wc9g2EpY1ETL9HbMa7UndlLPxdsLtk1yxXYwtyRWfHNQpiT
ubiILfBUomqHMHtFW0jDj1EFt53hfPhidVr5LQ0UoF8tDcWfAZb2aB3LrbOeTo/ktZ1U
3TuJ2AmgR63oUqWuGMiVezPOaDrR0iSduhdi4oRreuulyN6j99Qu5BecMrDeQAOarucW
PrN1Eq5VTcX7dOrRpwsxpxQBj4Vl9ZEk3b/V8M0BKDufKFtqUkZVGtREdSRZ9vh/52Xn
TlsA==;
dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@amarulasolutions.com header.s=google
header.b=WgpODsqg;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=pass header.i=@amarulasolutions.com
Received: from mail-sor-f41.google.com (mail-sor-f41.google.com.
[209.85.220.41])
by mx.google.com with SMTPS id
a640c23a62f3a-aac0e841a7fsor262256866b.6.2024.12.22.09.05.55
for <linux-amarula@amarulasolutions.com>
(Google Transport Security);
Sun, 22 Dec 2024 09:05:56 -0800 (PST)
Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Gm-Gg: ASbGnctWwotlTwFszG8rh8dlU8Z9ONpqywB+eeJ6FwmYIOvlUa8+xtJ2ITJDklvDp33
/ssmcybJc6K9kXDkPxLBFI+Q+5ha3FTy95pWVK8w0g2pI/bEsvumCCQVY9hknmNQRr4ueWZ4uW6
65YbCjhwRT37JQ/pg7kRMW7xubWp8oS7rGKJ+ZcOPd2faUDl3xkrEUllV6IA4ONxAvdv3phKCd/
1s2wBmaa7TESdlOYVa2vLZYdNV0ukxUVewwkG5Ot4hXWJbj2XfO2sgexN4sC5CPrdDIZWQMjR5g
IL28IVHxmLRfPftDkezwip6vV5K6eDZsTzGPhFvNz6uWUQ==
X-Received: by 2002:a05:6402:51c8:b0:5d3:cd5b:64a9 with SMTP id
4fb4d7f45d1cf-5d81de39872mr7776824a12.34.1734887155565;
Sun, 22 Dec 2024 09:05:55 -0800 (PST)
Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.87])
by smtp.gmail.com with ESMTPSA id
a640c23a62f3a-aac0efe48d6sm414056566b.127.2024.12.22.09.05.54
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sun, 22 Dec 2024 09:05:55 -0800 (PST)
From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
To: linux-kernel@vger.kernel.org
Cc: linux-amarula@amarulasolutions.com,
Dario Binacchi <dario.binacchi@amarulasolutions.com>,
Abel Vesa <abelvesa@kernel.org>,
Fabio Estevam <festevam@gmail.com>,
Michael Turquette <mturquette@baylibre.com>,
Peng Fan <peng.fan@nxp.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Sascha Hauer <s.hauer@pengutronix.de>,
Shawn Guo <shawnguo@kernel.org>,
Stephen Boyd <sboyd@kernel.org>,
imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-clk@vger.kernel.org
Subject: [PATCH v6 10/18] clk: imx: add hw API imx8m_anatop_get_clk_hw
Date: Sun, 22 Dec 2024 18:04:25 +0100
Message-ID: <20241222170534.3621453-11-dario.binacchi@amarulasolutions.com>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20241222170534.3621453-1-dario.binacchi@amarulasolutions.com>
References: <20241222170534.3621453-1-dario.binacchi@amarulasolutions.com>
MIME-Version: 1.0
X-Original-Sender: dario.binacchi@amarulasolutions.com
X-Original-Authentication-Results: mx.google.com; dkim=pass
header.i=@amarulasolutions.com header.s=google header.b=WgpODsqg;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=pass header.i=@amarulasolutions.com
Content-Type: text/plain; charset="UTF-8"
Precedence: list
Mailing-list: list linux-amarula@amarulasolutions.com;
contact linux-amarula+owners@amarulasolutions.com
List-ID: <linux-amarula.amarulasolutions.com>
X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com
X-Google-Group-Id: 476853432473
List-Post:
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>,
<mailto:linux-amarula@amarulasolutions.com>
List-Help:
<https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>,
<mailto:linux-amarula+help@amarulasolutions.com>
List-Archive:
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/>
List-Unsubscribe:
<mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>,
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe>
|
| Series |
Support spread spectrum clocking for i.MX8N PLLs
|
|
Commit Message
Dario Binacchi
Dec. 22, 2024, 5:04 p.m. UTC
Get the hw of a clock registered by the anatop module. This function is
preparatory for future developments.
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
(no changes since v5)
Changes in v5:
- Consider CONFIG_CLK_IMX8M{M,N,P,Q}_MODULE to fix compilation errors
Changes in v4:
- New
drivers/clk/imx/clk.c | 28 ++++++++++++++++++++++++++++
drivers/clk/imx/clk.h | 7 +++++++
2 files changed, 35 insertions(+)
Comments
On Sun, Dec 22, 2024 at 06:04:25PM +0100, Dario Binacchi wrote: >Get the hw of a clock registered by the anatop module. This function is >preparatory for future developments. > >Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> > >--- > >(no changes since v5) > >Changes in v5: >- Consider CONFIG_CLK_IMX8M{M,N,P,Q}_MODULE to fix compilation errors > >Changes in v4: >- New > > drivers/clk/imx/clk.c | 28 ++++++++++++++++++++++++++++ > drivers/clk/imx/clk.h | 7 +++++++ > 2 files changed, 35 insertions(+) > >diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c >index df83bd939492..9a21f233e105 100644 >--- a/drivers/clk/imx/clk.c >+++ b/drivers/clk/imx/clk.c >@@ -128,6 +128,34 @@ struct clk_hw *imx_get_clk_hw_by_name(struct device_node *np, const char *name) > } > EXPORT_SYMBOL_GPL(imx_get_clk_hw_by_name); > >+#if defined(CONFIG_CLK_IMX8MM) || defined(CONFIG_CLK_IMX8MM_MODULE) || \ >+ defined(CONFIG_CLK_IMX8MN) || defined(CONFIG_CLK_IMX8MN_MODULE) || \ >+ defined(CONFIG_CLK_IMX8MP) || defined(CONFIG_CLK_IMX8MP_MODULE) || \ >+ defined(CONFIG_CLK_IMX8MQ) || defined(CONFIG_CLK_IMX8MQ_MODULE) drop the guarding macros, then this could be reused by i.MX9. >+struct clk_hw *imx8m_anatop_get_clk_hw(int id) how about change to struct clk_hw *imx_anatop_get_clk_hw(int id, struct device_node *np)? >+{ >+#if defined(CONFIG_CLK_IMX8MQ) || defined(CONFIG_CLK_IMX8MQ_MODULE) >+ const char *compatible = "fsl,imx8mq-anatop"; >+#else >+ const char *compatible = "fsl,imx8mm-anatop"; >+#endif >+ struct device_node *np; >+ struct of_phandle_args args; >+ struct clk_hw *hw; >+ >+ np = of_find_compatible_node(NULL, NULL, compatible); Then no need to find the compatible for every function call. >+ args.np = np; >+ args.args_count = 1; >+ args.args[0] = id; >+ of_node_put(np); >+ Thanks, Peng To unsubscribe from this group and stop receiving emails from it, send an email to linux-amarula+unsubscribe@amarulasolutions.com.
Hi Peng, On Tue, Dec 24, 2024 at 3:17 AM Peng Fan <peng.fan@oss.nxp.com> wrote: > > On Sun, Dec 22, 2024 at 06:04:25PM +0100, Dario Binacchi wrote: > >Get the hw of a clock registered by the anatop module. This function is > >preparatory for future developments. > > > >Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> > > > >--- > > > >(no changes since v5) > > > >Changes in v5: > >- Consider CONFIG_CLK_IMX8M{M,N,P,Q}_MODULE to fix compilation errors > > > >Changes in v4: > >- New > > > > drivers/clk/imx/clk.c | 28 ++++++++++++++++++++++++++++ > > drivers/clk/imx/clk.h | 7 +++++++ > > 2 files changed, 35 insertions(+) > > > >diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c > >index df83bd939492..9a21f233e105 100644 > >--- a/drivers/clk/imx/clk.c > >+++ b/drivers/clk/imx/clk.c > >@@ -128,6 +128,34 @@ struct clk_hw *imx_get_clk_hw_by_name(struct device_node *np, const char *name) > > } > > EXPORT_SYMBOL_GPL(imx_get_clk_hw_by_name); > > > >+#if defined(CONFIG_CLK_IMX8MM) || defined(CONFIG_CLK_IMX8MM_MODULE) || \ > >+ defined(CONFIG_CLK_IMX8MN) || defined(CONFIG_CLK_IMX8MN_MODULE) || \ > >+ defined(CONFIG_CLK_IMX8MP) || defined(CONFIG_CLK_IMX8MP_MODULE) || \ > >+ defined(CONFIG_CLK_IMX8MQ) || defined(CONFIG_CLK_IMX8MQ_MODULE) > > drop the guarding macros, then this could be reused by i.MX9. > > >+struct clk_hw *imx8m_anatop_get_clk_hw(int id) > > how about change to > struct clk_hw *imx_anatop_get_clk_hw(int id, struct device_node *np)? I designed this function so that the caller, i.e., the CCM driver, would no longer need to reference the anatop compatible in any way, but I agree with you that it would be better to add the np parameter. Do you think it would then make sense to add a phandle to the anatop node in the clk node? clk: clock-controller@30380000 { compatible = "fsl,imx8mn-ccm"; ... fsl,anatop = <&anatop> } So that we can call anatop_np = of_parse_phandle(np, "fsl,anatop", 0); instead of anatop_np = of_find_compatible_node(NULL, NULL, "fsl,imx8mn-anatop"); This would require an additional patch to Documentation/devicetree/bindings/clock/imx8m-clock.yaml, but it would make the CCM driver code more generic. What do you think? I’m waiting for your response before sending version 7. Thanks and regards, Dario > > >+{ > >+#if defined(CONFIG_CLK_IMX8MQ) || defined(CONFIG_CLK_IMX8MQ_MODULE) > >+ const char *compatible = "fsl,imx8mq-anatop"; > >+#else > >+ const char *compatible = "fsl,imx8mm-anatop"; > >+#endif > >+ struct device_node *np; > >+ struct of_phandle_args args; > >+ struct clk_hw *hw; > >+ > >+ np = of_find_compatible_node(NULL, NULL, compatible); > > Then no need to find the compatible for every function call. > > >+ args.np = np; > >+ args.args_count = 1; > >+ args.args[0] = id; > >+ of_node_put(np); > >+ > > Thanks, > Peng
> Subject: Re: [PATCH v6 10/18] clk: imx: add hw API > imx8m_anatop_get_clk_hw > > Hi Peng, > > On Tue, Dec 24, 2024 at 3:17 AM Peng Fan <peng.fan@oss.nxp.com> > wrote: > > > > On Sun, Dec 22, 2024 at 06:04:25PM +0100, Dario Binacchi wrote: > > >Get the hw of a clock registered by the anatop module. This function > > >is preparatory for future developments. > > > > > >Signed-off-by: Dario Binacchi > <dario.binacchi@amarulasolutions.com> > > > > > >--- > > > > > >(no changes since v5) > > > > > >Changes in v5: > > >- Consider CONFIG_CLK_IMX8M{M,N,P,Q}_MODULE to fix > compilation errors > > > > > >Changes in v4: > > >- New > > > > > > drivers/clk/imx/clk.c | 28 ++++++++++++++++++++++++++++ > > > drivers/clk/imx/clk.h | 7 +++++++ > > > 2 files changed, 35 insertions(+) > > > > > >diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c index > > >df83bd939492..9a21f233e105 100644 > > >--- a/drivers/clk/imx/clk.c > > >+++ b/drivers/clk/imx/clk.c > > >@@ -128,6 +128,34 @@ struct clk_hw > *imx_get_clk_hw_by_name(struct > > >device_node *np, const char *name) } > > >EXPORT_SYMBOL_GPL(imx_get_clk_hw_by_name); > > > > > >+#if defined(CONFIG_CLK_IMX8MM) || > defined(CONFIG_CLK_IMX8MM_MODULE) || \ > > >+ defined(CONFIG_CLK_IMX8MN) || > defined(CONFIG_CLK_IMX8MN_MODULE) || \ > > >+ defined(CONFIG_CLK_IMX8MP) || > defined(CONFIG_CLK_IMX8MP_MODULE) || \ > > >+ defined(CONFIG_CLK_IMX8MQ) || > > >+defined(CONFIG_CLK_IMX8MQ_MODULE) > > > > drop the guarding macros, then this could be reused by i.MX9. > > > > >+struct clk_hw *imx8m_anatop_get_clk_hw(int id) > > > > how about change to > > struct clk_hw *imx_anatop_get_clk_hw(int id, struct device_node > *np)? > > I designed this function so that the caller, i.e., the CCM driver, would no > longer need to reference the anatop compatible in any way, but I agree > with you that it would be better to add the np parameter. Do you > think it would then make sense to add a phandle to the anatop node > in the clk node? > > clk: clock-controller@30380000 { > compatible = "fsl,imx8mn-ccm"; > ... > fsl,anatop = <&anatop> > } This needs binding update, so needs DT maintainers to approve. I am fine with it. Regards, Peng > > So that we can call > anatop_np = of_parse_phandle(np, "fsl,anatop", 0); instead of > anatop_np = of_find_compatible_node(NULL, NULL, "fsl,imx8mn- > anatop"); This would require an additional patch to > Documentation/devicetree/bindings/clock/imx8m-clock.yaml, > but it would make the CCM driver code more generic. > > What do you think? I’m waiting for your response before sending > version 7. > > Thanks and regards, > Dario > > > > > > > > > >+{ > > >+#if defined(CONFIG_CLK_IMX8MQ) || > defined(CONFIG_CLK_IMX8MQ_MODULE) > > >+ const char *compatible = "fsl,imx8mq-anatop"; #else > > >+ const char *compatible = "fsl,imx8mm-anatop"; #endif > > >+ struct device_node *np; > > >+ struct of_phandle_args args; > > >+ struct clk_hw *hw; > > >+ > > >+ np = of_find_compatible_node(NULL, NULL, compatible); > > > > Then no need to find the compatible for every function call. > > > > >+ args.np = np; > > >+ args.args_count = 1; > > >+ args.args[0] = id; > > >+ of_node_put(np); > > >+ > > > > Thanks, > > Peng > > > > -- > > Dario Binacchi > > Senior Embedded Linux Developer > > dario.binacchi@amarulasolutions.com > > __________________________________ > > > Amarula Solutions SRL > > Via Le Canevare 30, 31100 Treviso, Veneto, IT > > T. +39 042 243 5310 > info@amarulasolutions.com > > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2F > www.amarulasolutions.com%2F&data=05%7C02%7Cpeng.fan%40nxp. > com%7C4e8243a5b9f94a532c8d08dd24152922%7C686ea1d3bc2b4c > 6fa92cd99c5c301635%7C0%7C0%7C638706395491848166%7CUnkn > own%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMD > AwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7 > C%7C%7C&sdata=0hMc9UwgFpa8VhOJvUVl3I3krgeFSzcB149zLRmHTx > g%3D&reserved=0 To unsubscribe from this group and stop receiving emails from it, send an email to linux-amarula+unsubscribe@amarulasolutions.com.
diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c index df83bd939492..9a21f233e105 100644 --- a/drivers/clk/imx/clk.c +++ b/drivers/clk/imx/clk.c @@ -128,6 +128,34 @@ struct clk_hw *imx_get_clk_hw_by_name(struct device_node *np, const char *name) } EXPORT_SYMBOL_GPL(imx_get_clk_hw_by_name); +#if defined(CONFIG_CLK_IMX8MM) || defined(CONFIG_CLK_IMX8MM_MODULE) || \ + defined(CONFIG_CLK_IMX8MN) || defined(CONFIG_CLK_IMX8MN_MODULE) || \ + defined(CONFIG_CLK_IMX8MP) || defined(CONFIG_CLK_IMX8MP_MODULE) || \ + defined(CONFIG_CLK_IMX8MQ) || defined(CONFIG_CLK_IMX8MQ_MODULE) +struct clk_hw *imx8m_anatop_get_clk_hw(int id) +{ +#if defined(CONFIG_CLK_IMX8MQ) || defined(CONFIG_CLK_IMX8MQ_MODULE) + const char *compatible = "fsl,imx8mq-anatop"; +#else + const char *compatible = "fsl,imx8mm-anatop"; +#endif + struct device_node *np; + struct of_phandle_args args; + struct clk_hw *hw; + + np = of_find_compatible_node(NULL, NULL, compatible); + args.np = np; + args.args_count = 1; + args.args[0] = id; + of_node_put(np); + + hw = __clk_get_hw(of_clk_get_from_provider(&args)); + pr_debug("%s: got clk: %s\n", __func__, clk_hw_get_name(hw)); + return hw; +} +EXPORT_SYMBOL_GPL(imx8m_anatop_get_clk_hw); +#endif + /* * This fixups the register CCM_CSCMR1 write value. * The write/read/divider values of the aclk_podf field diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index aa5202f284f3..52055fda3058 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -487,4 +487,11 @@ struct clk_hw *imx_clk_gpr_mux(const char *name, const char *compatible, u32 reg, const char **parent_names, u8 num_parents, const u32 *mux_table, u32 mask); +#if defined(CONFIG_CLK_IMX8MM) || defined(CONFIG_CLK_IMX8MM_MODULE) || \ + defined(CONFIG_CLK_IMX8MN) || defined(CONFIG_CLK_IMX8MN_MODULE) || \ + defined(CONFIG_CLK_IMX8MP) || defined(CONFIG_CLK_IMX8MP_MODULE) || \ + defined(CONFIG_CLK_IMX8MQ) || defined(CONFIG_CLK_IMX8MQ_MODULE) +struct clk_hw *imx8m_anatop_get_clk_hw(int id); +#endif + #endif