Skip to content

Commit 00bd581

Browse files
committed
clk: at91: clk-generated: add support for parent_hw
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> Reviewed-by: Maxime Ripard <mripard@kernel.org> Link: https://lore.kernel.org/r/20230615093227.576102-3-claudiu.beznea@microchip.com
1 parent b5105e3 commit 00bd581

6 files changed

Lines changed: 15 additions & 7 deletions

File tree

drivers/clk/at91/clk-generated.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,22 +319,29 @@ struct clk_hw * __init
319319
at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock,
320320
const struct clk_pcr_layout *layout,
321321
const char *name, const char **parent_names,
322+
struct clk_hw **parent_hws,
322323
u32 *mux_table, u8 num_parents, u8 id,
323324
const struct clk_range *range,
324325
int chg_pid)
325326
{
326327
struct clk_generated *gck;
327-
struct clk_init_data init;
328+
struct clk_init_data init = {};
328329
struct clk_hw *hw;
329330
int ret;
330331

332+
if (!(parent_names || parent_hws))
333+
return ERR_PTR(-ENOMEM);
334+
331335
gck = kzalloc(sizeof(*gck), GFP_KERNEL);
332336
if (!gck)
333337
return ERR_PTR(-ENOMEM);
334338

335339
init.name = name;
336340
init.ops = &generated_ops;
337-
init.parent_names = parent_names;
341+
if (parent_hws)
342+
init.parent_hws = (const struct clk_hw **)parent_hws;
343+
else
344+
init.parent_names = parent_names;
338345
init.num_parents = num_parents;
339346
init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE;
340347
if (chg_pid >= 0)

drivers/clk/at91/dt-compat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static void __init of_sama5d2_clk_generated_setup(struct device_node *np)
171171

172172
hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
173173
&dt_pcr_layout, name,
174-
parent_names, NULL,
174+
parent_names, NULL, NULL,
175175
num_parents, id, &range,
176176
chg_pid);
177177
if (IS_ERR(hw))

drivers/clk/at91/pmc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ struct clk_hw * __init
144144
at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock,
145145
const struct clk_pcr_layout *layout,
146146
const char *name, const char **parent_names,
147-
u32 *mux_table, u8 num_parents, u8 id,
147+
struct clk_hw **parent_hws, u32 *mux_table,
148+
u8 num_parents, u8 id,
148149
const struct clk_range *range, int chg_pid);
149150

150151
struct clk_hw * __init

drivers/clk/at91/sam9x60.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
351351
hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
352352
&sam9x60_pcr_layout,
353353
sam9x60_gck[i].n,
354-
parent_names, NULL, 6,
354+
parent_names, NULL, NULL, 6,
355355
sam9x60_gck[i].id,
356356
&sam9x60_gck[i].r, INT_MIN);
357357
if (IS_ERR(hw))

drivers/clk/at91/sama5d2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
358358
hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
359359
&sama5d2_pcr_layout,
360360
sama5d2_gck[i].n,
361-
parent_names, NULL, 6,
361+
parent_names, NULL, NULL, 6,
362362
sama5d2_gck[i].id,
363363
&sama5d2_gck[i].r,
364364
sama5d2_gck[i].chg_pid);

drivers/clk/at91/sama7g5.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
11111111
hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
11121112
&sama7g5_pcr_layout,
11131113
sama7g5_gck[i].n,
1114-
parent_names, mux_table,
1114+
parent_names, NULL, mux_table,
11151115
num_parents,
11161116
sama7g5_gck[i].id,
11171117
&sama7g5_gck[i].r,

0 commit comments

Comments
 (0)