Skip to content

Commit 1a2669d

Browse files
committed
clk: at91: clk-programmable: add support for parent_hw
Add support for parent_hw in programmable 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-programmable 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-6-claudiu.beznea@microchip.com
1 parent c2f2ca0 commit 1a2669d

14 files changed

Lines changed: 21 additions & 17 deletions

drivers/clk/at91/at91rm9200.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
171171
snprintf(name, sizeof(name), "prog%d", i);
172172

173173
hw = at91_clk_register_programmable(regmap, name,
174-
parent_names, 4, i,
174+
parent_names, NULL, 4, i,
175175
&at91rm9200_programmable_layout,
176176
NULL);
177177
if (IS_ERR(hw))

drivers/clk/at91/at91sam9260.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
448448
snprintf(name, sizeof(name), "prog%d", i);
449449

450450
hw = at91_clk_register_programmable(regmap, name,
451-
parent_names, 4, i,
451+
parent_names, NULL, 4, i,
452452
&at91rm9200_programmable_layout,
453453
NULL);
454454
if (IS_ERR(hw))

drivers/clk/at91/at91sam9g45.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
191191
snprintf(name, sizeof(name), "prog%d", i);
192192

193193
hw = at91_clk_register_programmable(regmap, name,
194-
parent_names, 5, i,
194+
parent_names, NULL, 5, i,
195195
&at91sam9g45_programmable_layout,
196196
NULL);
197197
if (IS_ERR(hw))

drivers/clk/at91/at91sam9n12.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
216216
snprintf(name, sizeof(name), "prog%d", i);
217217

218218
hw = at91_clk_register_programmable(regmap, name,
219-
parent_names, 5, i,
219+
parent_names, NULL, 5, i,
220220
&at91sam9x5_programmable_layout,
221221
NULL);
222222
if (IS_ERR(hw))

drivers/clk/at91/at91sam9rl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
148148
snprintf(name, sizeof(name), "prog%d", i);
149149

150150
hw = at91_clk_register_programmable(regmap, name,
151-
parent_names, 5, i,
151+
parent_names, NULL, 5, i,
152152
&at91rm9200_programmable_layout,
153153
NULL);
154154
if (IS_ERR(hw))

drivers/clk/at91/at91sam9x5.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
241241
snprintf(name, sizeof(name), "prog%d", i);
242242

243243
hw = at91_clk_register_programmable(regmap, name,
244-
parent_names, 5, i,
244+
parent_names, NULL, 5, i,
245245
&at91sam9x5_programmable_layout,
246246
NULL);
247247
if (IS_ERR(hw))

drivers/clk/at91/clk-programmable.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,16 @@ static const struct clk_ops programmable_ops = {
215215
struct clk_hw * __init
216216
at91_clk_register_programmable(struct regmap *regmap,
217217
const char *name, const char **parent_names,
218-
u8 num_parents, u8 id,
218+
struct clk_hw **parent_hws, u8 num_parents, u8 id,
219219
const struct clk_programmable_layout *layout,
220220
u32 *mux_table)
221221
{
222222
struct clk_programmable *prog;
223223
struct clk_hw *hw;
224-
struct clk_init_data init;
224+
struct clk_init_data init = {};
225225
int ret;
226226

227-
if (id > PROG_ID_MAX)
227+
if (id > PROG_ID_MAX || !(parent_names || parent_hws))
228228
return ERR_PTR(-EINVAL);
229229

230230
prog = kzalloc(sizeof(*prog), GFP_KERNEL);
@@ -233,7 +233,10 @@ at91_clk_register_programmable(struct regmap *regmap,
233233

234234
init.name = name;
235235
init.ops = &programmable_ops;
236-
init.parent_names = parent_names;
236+
if (parent_hws)
237+
init.parent_hws = (const struct clk_hw **)parent_hws;
238+
else
239+
init.parent_names = parent_names;
237240
init.num_parents = num_parents;
238241
init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE;
239242

drivers/clk/at91/dt-compat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ of_at91_clk_prog_setup(struct device_node *np,
770770
name = progclknp->name;
771771

772772
hw = at91_clk_register_programmable(regmap, name,
773-
parent_names, num_parents,
773+
parent_names, NULL, num_parents,
774774
id, layout, mux_table);
775775
if (IS_ERR(hw))
776776
continue;

drivers/clk/at91/pmc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock,
234234

235235
struct clk_hw * __init
236236
at91_clk_register_programmable(struct regmap *regmap, const char *name,
237-
const char **parent_names, u8 num_parents, u8 id,
237+
const char **parent_names, struct clk_hw **parent_hws,
238+
u8 num_parents, u8 id,
238239
const struct clk_programmable_layout *layout,
239240
u32 *mux_table);
240241

drivers/clk/at91/sam9x60.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
313313
snprintf(name, sizeof(name), "prog%d", i);
314314

315315
hw = at91_clk_register_programmable(regmap, name,
316-
parent_names, 6, i,
316+
parent_names, NULL, 6, i,
317317
&sam9x60_programmable_layout,
318318
NULL);
319319
if (IS_ERR(hw))

0 commit comments

Comments
 (0)