@@ -83,10 +83,10 @@ static const struct clk_ops h32mx_ops = {
struct clk_hw * __init
at91_clk_register_h32mx(struct regmap *regmap, const char *name,
- const char *parent_name)
+ const char *parent_name, struct clk_hw *parent_hw)
{
struct clk_sama5d4_h32mx *h32mxclk;
- struct clk_init_data init;
+ struct clk_init_data init = {};
int ret;
h32mxclk = kzalloc(sizeof(*h32mxclk), GFP_KERNEL);
@@ -95,8 +95,13 @@ at91_clk_register_h32mx(struct regmap *regmap, const char *name,
init.name = name;
init.ops = &h32mx_ops;
- init.parent_names = parent_name ? &parent_name : NULL;
- init.num_parents = parent_name ? 1 : 0;
+ if (parent_hw) {
+ init.parent_hws = (const struct clk_hw **)&parent_hw;
+ init.num_parents = 1;
+ } else {
+ init.parent_names = parent_name ? &parent_name : NULL;
+ init.num_parents = parent_name ? 1 : 0;
+ }
init.flags = CLK_SET_RATE_GATE;
h32mxclk->hw.init = &init;
@@ -201,7 +201,7 @@ static void __init of_sama5d4_clk_h32mx_setup(struct device_node *np)
parent_name = of_clk_get_parent_name(np, 0);
- hw = at91_clk_register_h32mx(regmap, name, parent_name);
+ hw = at91_clk_register_h32mx(regmap, name, parent_name, NULL);
if (IS_ERR(hw))
return;
@@ -150,7 +150,7 @@ at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock,
struct clk_hw * __init
at91_clk_register_h32mx(struct regmap *regmap, const char *name,
- const char *parent_name);
+ const char *parent_name, struct clk_hw *parent_hw);
struct clk_hw * __init
at91_clk_i2s_mux_register(struct regmap *regmap, const char *name,
@@ -276,7 +276,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
sama5d2_pmc->chws[PMC_MCK] = hw;
- hw = at91_clk_register_h32mx(regmap, "h32mxck", "masterck_div");
+ hw = at91_clk_register_h32mx(regmap, "h32mxck", "masterck_div", NULL);
if (IS_ERR(hw))
goto err_free;
@@ -214,7 +214,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
sama5d4_pmc->chws[PMC_MCK] = hw;
- hw = at91_clk_register_h32mx(regmap, "h32mxck", "masterck_div");
+ hw = at91_clk_register_h32mx(regmap, "h32mxck", "masterck_div", NULL);
if (IS_ERR(hw))
goto err_free;
Add support for parent_hw in h32mx clock driver. 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-h32mx 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@tuxon.dev> --- drivers/clk/at91/clk-h32mx.c | 13 +++++++++---- drivers/clk/at91/dt-compat.c | 2 +- drivers/clk/at91/pmc.h | 2 +- drivers/clk/at91/sama5d2.c | 2 +- drivers/clk/at91/sama5d4.c | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-)