[PATCH v2 18/32] clk: at91: clk-slow: add support for parent_hw
From: Ryan.Wanner
Date: Tue Jun 24 2025 - 11:28:22 EST
From: Claudiu Beznea <claudiu.beznea@xxxxxxxxx>
Add support for parent_hw in slow 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-slow 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@xxxxxxxxx>
[ryan.wanner@xxxxxxxxxxxxx: Remove SoC specific changes as they are
going to be coalesced into one SoC specific commit.]
Signed-off-by: Ryan Wanner <Ryan.Wanner@xxxxxxxxxxxxx>
---
drivers/clk/at91/clk-slow.c | 8 ++++++--
drivers/clk/at91/dt-compat.c | 2 +-
drivers/clk/at91/pmc.h | 1 +
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c
index ac9f7a48b76e..5b7fc6210e09 100644
--- a/drivers/clk/at91/clk-slow.c
+++ b/drivers/clk/at91/clk-slow.c
@@ -39,11 +39,12 @@ struct clk_hw * __init
at91_clk_register_sam9260_slow(struct regmap *regmap,
const char *name,
const char **parent_names,
+ struct clk_parent_data *parent_data,
int num_parents)
{
struct clk_sam9260_slow *slowck;
struct clk_hw *hw;
- struct clk_init_data init;
+ struct clk_init_data init = {};
int ret;
if (!name)
@@ -58,7 +59,10 @@ at91_clk_register_sam9260_slow(struct regmap *regmap,
init.name = name;
init.ops = &sam9260_slow_ops;
- init.parent_names = parent_names;
+ if (parent_data)
+ init.parent_data = (const struct clk_parent_data *)&parent_data;
+ else
+ init.parent_names = parent_names;
init.num_parents = num_parents;
init.flags = 0;
diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c
index 5afd7c9f53fd..fa8658d3be7b 100644
--- a/drivers/clk/at91/dt-compat.c
+++ b/drivers/clk/at91/dt-compat.c
@@ -823,7 +823,7 @@ static void __init of_at91sam9260_clk_slow_setup(struct device_node *np)
of_property_read_string(np, "clock-output-names", &name);
- hw = at91_clk_register_sam9260_slow(regmap, name, parent_names,
+ hw = at91_clk_register_sam9260_slow(regmap, name, parent_names, NULL,
num_parents);
if (IS_ERR(hw))
return;
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index e5ab2fb3bc89..24c32e42f264 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -273,6 +273,7 @@ struct clk_hw * __init
at91_clk_register_sam9260_slow(struct regmap *regmap,
const char *name,
const char **parent_names,
+ struct clk_parent_data *parent_data,
int num_parents);
struct clk_hw * __init
--
2.43.0