All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@oss.nxp.com>
To: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Cc: linux-kernel@vger.kernel.org, linux-amarula@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: Re: [PATCH v6 10/18] clk: imx: add hw API imx8m_anatop_get_clk_hw
Date: Tue, 24 Dec 2024 11:22:23 +0800	[thread overview]
Message-ID: <20241224032223.GC20573@localhost.localdomain> (raw)
In-Reply-To: <20241222170534.3621453-11-dario.binacchi@amarulasolutions.com>

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

  reply	other threads:[~2024-12-24  2:17 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-22 17:04 [PATCH v6 00/18] Support spread spectrum clocking for i.MX8N PLLs Dario Binacchi
2024-12-22 17:04 ` [PATCH v6 01/18] dt-bindings: clock: imx8mm: add VIDEO_PLL clocks Dario Binacchi
2024-12-22 17:04 ` [PATCH v6 02/18] clk: imx8mm: rename video_pll1 to video_pll Dario Binacchi
2024-12-24  3:17   ` Peng Fan
2024-12-22 17:04 ` [PATCH v6 03/18] dt-bindings: clock: imx8mp: add VIDEO_PLL clocks Dario Binacchi
2024-12-22 17:04 ` [PATCH v6 04/18] clk: imx8mp: rename video_pll1 to video_pll Dario Binacchi
2024-12-24  3:18   ` Peng Fan
2024-12-22 17:04 ` [PATCH v6 05/18] dt-bindings: clock: imx8m-anatop: add oscillators and PLLs Dario Binacchi
2024-12-23 15:06   ` Krzysztof Kozlowski
2024-12-22 17:04 ` [PATCH v6 06/18] arm64: dts: imx8mm: add anatop clocks Dario Binacchi
2024-12-22 17:04 ` [PATCH v6 07/18] arm64: dts: imx8mn: " Dario Binacchi
2024-12-22 17:04 ` [PATCH v6 08/18] arm64: dts: imx8mp: " Dario Binacchi
2024-12-22 17:04 ` [PATCH v6 09/18] arm64: dts: imx8mq: " Dario Binacchi
2024-12-22 17:04 ` [PATCH v6 10/18] clk: imx: add hw API imx8m_anatop_get_clk_hw Dario Binacchi
2024-12-24  3:22   ` Peng Fan [this message]
2024-12-24 12:18     ` Dario Binacchi
2024-12-25  0:59       ` Peng Fan
2024-12-22 17:04 ` [PATCH v6 11/18] clk: imx: add support for i.MX8MN anatop clock driver Dario Binacchi
2024-12-22 17:04 ` [PATCH v6 12/18] dt-bindings: clock: imx8m-clock: add PLLs Dario Binacchi
2024-12-23 15:06   ` Krzysztof Kozlowski
2024-12-22 17:04 ` [PATCH v6 13/18] arm64: dts: imx8mm: add PLLs to clock controller module (ccm) Dario Binacchi
2024-12-22 17:04 ` [PATCH v6 14/18] arm64: dts: imx8mn: " Dario Binacchi
2024-12-22 17:04 ` [PATCH v6 15/18] arm64: dts: imx8mp: " Dario Binacchi
2024-12-22 17:04 ` [PATCH v6 16/18] dt-bindings: clock: imx8m-clock: support spread spectrum clocking Dario Binacchi
2024-12-23 15:05   ` Krzysztof Kozlowski
2024-12-22 17:04 ` [PATCH v6 17/18] clk: imx: pll14xx: support spread spectrum clock generation Dario Binacchi
2024-12-24  3:32   ` Peng Fan
2024-12-22 17:04 ` [PATCH v6 18/18] clk: imx8mn: " Dario Binacchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241224032223.GC20573@localhost.localdomain \
    --to=peng.fan@oss.nxp.com \
    --cc=abelvesa@kernel.org \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-amarula@amarulasolutions.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=peng.fan@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.