mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Claudiu Beznea <claudiu.beznea@microchip.com>
To: <mturquette@baylibre.com>, <sboyd@kernel.org>,
	<nicolas.ferre@microchip.com>, <alexandre.belloni@bootlin.com>,
	<m.grzeschik@pengutronix.de>, <maxime@cerno.tech>,
	<windhl@126.com>
Cc: <linux-clk@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	Claudiu Beznea <claudiu.beznea@microchip.com>
Subject: [PATCH 02/11] clk: at91: clk-generated: add support for parent_hw
Date: Thu, 15 Jun 2023 12:32:18 +0300	[thread overview]
Message-ID: <20230615093227.576102-3-claudiu.beznea@microchip.com> (raw)
In-Reply-To: <20230615093227.576102-1-claudiu.beznea@microchip.com>

Add support for parent_hw in generic clock drivers.
With this parent-child relation is described with pointers rather
than strings making registration a bit faster.

All the SoC based drivers that rely on clk-generated were adapted
to the new API change. The switch itself for SoCs will be done
in subsequent patches.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/clk/at91/clk-generated.c | 11 +++++++++--
 drivers/clk/at91/dt-compat.c     |  2 +-
 drivers/clk/at91/pmc.h           |  3 ++-
 drivers/clk/at91/sam9x60.c       |  2 +-
 drivers/clk/at91/sama5d2.c       |  2 +-
 drivers/clk/at91/sama7g5.c       |  2 +-
 6 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c
index 943ea67bf135..4b4edeecc889 100644
--- a/drivers/clk/at91/clk-generated.c
+++ b/drivers/clk/at91/clk-generated.c
@@ -319,22 +319,29 @@ struct clk_hw * __init
 at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock,
 			    const struct clk_pcr_layout *layout,
 			    const char *name, const char **parent_names,
+			    struct clk_hw **parent_hws,
 			    u32 *mux_table, u8 num_parents, u8 id,
 			    const struct clk_range *range,
 			    int chg_pid)
 {
 	struct clk_generated *gck;
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	struct clk_hw *hw;
 	int ret;
 
+	if (!(parent_names || parent_hws))
+		return ERR_PTR(-ENOMEM);
+
 	gck = kzalloc(sizeof(*gck), GFP_KERNEL);
 	if (!gck)
 		return ERR_PTR(-ENOMEM);
 
 	init.name = name;
 	init.ops = &generated_ops;
-	init.parent_names = parent_names;
+	if (parent_hws)
+		init.parent_hws = (const struct clk_hw **)parent_hws;
+	else
+		init.parent_names = parent_names;
 	init.num_parents = num_parents;
 	init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE;
 	if (chg_pid >= 0)
diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c
index ecb0bebb8a7d..e5a56aaff96d 100644
--- a/drivers/clk/at91/dt-compat.c
+++ b/drivers/clk/at91/dt-compat.c
@@ -171,7 +171,7 @@ static void __init of_sama5d2_clk_generated_setup(struct device_node *np)
 
 		hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
 						 &dt_pcr_layout, name,
-						 parent_names, NULL,
+						 parent_names, NULL, NULL,
 						 num_parents, id, &range,
 						 chg_pid);
 		if (IS_ERR(hw))
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index 487e44deeca0..e947c78a82d0 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -144,7 +144,8 @@ struct clk_hw * __init
 at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock,
 			    const struct clk_pcr_layout *layout,
 			    const char *name, const char **parent_names,
-			    u32 *mux_table, u8 num_parents, u8 id,
+			    struct clk_hw **parent_hws, u32 *mux_table,
+			    u8 num_parents, u8 id,
 			    const struct clk_range *range, int chg_pid);
 
 struct clk_hw * __init
diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c
index e2f40f167c08..dcc8f8142180 100644
--- a/drivers/clk/at91/sam9x60.c
+++ b/drivers/clk/at91/sam9x60.c
@@ -351,7 +351,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
 		hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
 						 &sam9x60_pcr_layout,
 						 sam9x60_gck[i].n,
-						 parent_names, NULL, 6,
+						 parent_names, NULL, NULL, 6,
 						 sam9x60_gck[i].id,
 						 &sam9x60_gck[i].r, INT_MIN);
 		if (IS_ERR(hw))
diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
index 2ee8f10d3b03..18695c9c9beb 100644
--- a/drivers/clk/at91/sama5d2.c
+++ b/drivers/clk/at91/sama5d2.c
@@ -358,7 +358,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
 		hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
 						 &sama5d2_pcr_layout,
 						 sama5d2_gck[i].n,
-						 parent_names, NULL, 6,
+						 parent_names, NULL, NULL, 6,
 						 sama5d2_gck[i].id,
 						 &sama5d2_gck[i].r,
 						 sama5d2_gck[i].chg_pid);
diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c
index 42dc74dbfc28..e754c127b2b8 100644
--- a/drivers/clk/at91/sama7g5.c
+++ b/drivers/clk/at91/sama7g5.c
@@ -1111,7 +1111,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
 		hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
 						 &sama7g5_pcr_layout,
 						 sama7g5_gck[i].n,
-						 parent_names, mux_table,
+						 parent_names, NULL, mux_table,
 						 num_parents,
 						 sama7g5_gck[i].id,
 						 &sama7g5_gck[i].r,
-- 
2.34.1


  parent reply	other threads:[~2023-06-15  9:34 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15  9:32 [PATCH 00/11] clk: at91: add support for parent_data and parent_hw Claudiu Beznea
2023-06-15  9:32 ` [PATCH 01/11] clk: at91: clk-main: add support for parent_data/parent_hw Claudiu Beznea
2023-06-15 16:46   ` Maxime Ripard
2023-06-15  9:32 ` Claudiu Beznea [this message]
2023-06-15 16:46   ` [PATCH 02/11] clk: at91: clk-generated: add support for parent_hw Maxime Ripard
2023-06-15  9:32 ` [PATCH 03/11] clk: at91: clk-master: " Claudiu Beznea
2023-06-15 16:49   ` Maxime Ripard
2023-06-15  9:32 ` [PATCH 04/11] clk: at91: clk-peripheral: " Claudiu Beznea
2023-06-15 16:49   ` Maxime Ripard
2023-06-15  9:32 ` [PATCH 05/11] clk: at91: clk-programmable: " Claudiu Beznea
2023-06-15 16:49   ` Maxime Ripard
2023-06-15  9:32 ` [PATCH 06/11] clk: at91: clk-system: " Claudiu Beznea
2023-06-15 16:50   ` Maxime Ripard
2023-06-15  9:32 ` [PATCH 07/11] clk: at91: clk-utmi: " Claudiu Beznea
2023-06-15 16:50   ` Maxime Ripard
2023-06-15  9:32 ` [PATCH 08/11] clk: at91: clk-sam9x60-pll: " Claudiu Beznea
2023-06-15 16:50   ` Maxime Ripard
2023-06-15  9:32 ` [PATCH 09/11] clk: at91: sckc: switch to parent_data/parent_hw Claudiu Beznea
2023-06-15 16:50   ` Maxime Ripard
2023-06-15  9:32 ` [PATCH 10/11] clk: at91: sama7g5: switch to parent_hw and parent_data Claudiu Beznea
2023-06-15 16:52   ` Maxime Ripard
2023-06-15  9:32 ` [PATCH 11/11] clk: at91: sama7g5: s/ep_chg_chg_id/ep_chg_id Claudiu Beznea
2023-06-15 14:56   ` Maxime Ripard
2023-06-21  9:41 ` [PATCH 00/11] clk: at91: add support for parent_data and parent_hw Claudiu.Beznea

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=20230615093227.576102-3-claudiu.beznea@microchip.com \
    --to=claudiu.beznea@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    --cc=maxime@cerno.tech \
    --cc=mturquette@baylibre.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=sboyd@kernel.org \
    --cc=windhl@126.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®