[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241224032223.GC20573@localhost.localdomain>
Date: Tue, 24 Dec 2024 11:22:23 +0800
From: Peng Fan <peng.fan@....nxp.com>
To: Dario Binacchi <dario.binacchi@...rulasolutions.com>
Cc: linux-kernel@...r.kernel.org, linux-amarula@...rulasolutions.com,
Abel Vesa <abelvesa@...nel.org>, Fabio Estevam <festevam@...il.com>,
Michael Turquette <mturquette@...libre.com>,
Peng Fan <peng.fan@....com>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Sascha Hauer <s.hauer@...gutronix.de>,
Shawn Guo <shawnguo@...nel.org>, Stephen Boyd <sboyd@...nel.org>,
imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-clk@...r.kernel.org
Subject: Re: [PATCH v6 10/18] clk: imx: add hw API imx8m_anatop_get_clk_hw
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@...rulasolutions.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
Powered by blists - more mailing lists