Skip to content

Commit 1a537f6

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

14 files changed

Lines changed: 24 additions & 19 deletions

drivers/clk/at91/at91rm9200.c

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

183183
for (i = 0; i < ARRAY_SIZE(at91rm9200_systemck); i++) {
184184
hw = at91_clk_register_system(regmap, at91rm9200_systemck[i].n,
185-
at91rm9200_systemck[i].p,
185+
at91rm9200_systemck[i].p, NULL,
186186
at91rm9200_systemck[i].id, 0);
187187
if (IS_ERR(hw))
188188
goto err_free;

drivers/clk/at91/at91sam9260.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
459459

460460
for (i = 0; i < data->num_sck; i++) {
461461
hw = at91_clk_register_system(regmap, data->sck[i].n,
462-
data->sck[i].p,
462+
data->sck[i].p, NULL,
463463
data->sck[i].id, 0);
464464
if (IS_ERR(hw))
465465
goto err_free;

drivers/clk/at91/at91sam9g45.c

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

203203
for (i = 0; i < ARRAY_SIZE(at91sam9g45_systemck); i++) {
204204
hw = at91_clk_register_system(regmap, at91sam9g45_systemck[i].n,
205-
at91sam9g45_systemck[i].p,
205+
at91sam9g45_systemck[i].p, NULL,
206206
at91sam9g45_systemck[i].id,
207207
at91sam9g45_systemck[i].flags);
208208
if (IS_ERR(hw))

drivers/clk/at91/at91sam9n12.c

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

228228
for (i = 0; i < ARRAY_SIZE(at91sam9n12_systemck); i++) {
229229
hw = at91_clk_register_system(regmap, at91sam9n12_systemck[i].n,
230-
at91sam9n12_systemck[i].p,
230+
at91sam9n12_systemck[i].p, NULL,
231231
at91sam9n12_systemck[i].id,
232232
at91sam9n12_systemck[i].flags);
233233
if (IS_ERR(hw))

drivers/clk/at91/at91sam9rl.c

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

160160
for (i = 0; i < ARRAY_SIZE(at91sam9rl_systemck); i++) {
161161
hw = at91_clk_register_system(regmap, at91sam9rl_systemck[i].n,
162-
at91sam9rl_systemck[i].p,
162+
at91sam9rl_systemck[i].p, NULL,
163163
at91sam9rl_systemck[i].id, 0);
164164
if (IS_ERR(hw))
165165
goto err_free;

drivers/clk/at91/at91sam9x5.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
252252

253253
for (i = 0; i < ARRAY_SIZE(at91sam9x5_systemck); i++) {
254254
hw = at91_clk_register_system(regmap, at91sam9x5_systemck[i].n,
255-
at91sam9x5_systemck[i].p,
255+
at91sam9x5_systemck[i].p, NULL,
256256
at91sam9x5_systemck[i].id,
257257
at91sam9x5_systemck[i].flags);
258258
if (IS_ERR(hw))
@@ -263,7 +263,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
263263

264264
if (has_lcdck) {
265265
hw = at91_clk_register_system(regmap, "lcdck", "masterck_div",
266-
3, 0);
266+
NULL, 3, 0);
267267
if (IS_ERR(hw))
268268
goto err_free;
269269

drivers/clk/at91/clk-system.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,15 @@ static const struct clk_ops system_ops = {
105105

106106
struct clk_hw * __init
107107
at91_clk_register_system(struct regmap *regmap, const char *name,
108-
const char *parent_name, u8 id, unsigned long flags)
108+
const char *parent_name, struct clk_hw *parent_hw, u8 id,
109+
unsigned long flags)
109110
{
110111
struct clk_system *sys;
111112
struct clk_hw *hw;
112-
struct clk_init_data init;
113+
struct clk_init_data init = {};
113114
int ret;
114115

115-
if (!parent_name || id > SYSTEM_MAX_ID)
116+
if (!(parent_name || parent_hw) || id > SYSTEM_MAX_ID)
116117
return ERR_PTR(-EINVAL);
117118

118119
sys = kzalloc(sizeof(*sys), GFP_KERNEL);
@@ -121,7 +122,10 @@ at91_clk_register_system(struct regmap *regmap, const char *name,
121122

122123
init.name = name;
123124
init.ops = &system_ops;
124-
init.parent_names = &parent_name;
125+
if (parent_hw)
126+
init.parent_hws = (const struct clk_hw **)&parent_hw;
127+
else
128+
init.parent_names = &parent_name;
125129
init.num_parents = 1;
126130
init.flags = CLK_SET_RATE_PARENT | flags;
127131

drivers/clk/at91/dt-compat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,8 +908,8 @@ static void __init of_at91rm9200_clk_sys_setup(struct device_node *np)
908908
if (!strcmp(sysclknp->name, "ddrck"))
909909
flags = CLK_IS_CRITICAL;
910910

911-
hw = at91_clk_register_system(regmap, name, parent_name, id,
912-
flags);
911+
hw = at91_clk_register_system(regmap, name, parent_name, NULL,
912+
id, flags);
913913
if (IS_ERR(hw))
914914
continue;
915915

drivers/clk/at91/pmc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ at91sam9x5_clk_register_smd(struct regmap *regmap, const char *name,
251251

252252
struct clk_hw * __init
253253
at91_clk_register_system(struct regmap *regmap, const char *name,
254-
const char *parent_name, u8 id, unsigned long flags);
254+
const char *parent_name, struct clk_hw *parent_hw,
255+
u8 id, unsigned long flags);
255256

256257
struct clk_hw * __init
257258
at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name,

drivers/clk/at91/sam9x60.c

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

325325
for (i = 0; i < ARRAY_SIZE(sam9x60_systemck); i++) {
326326
hw = at91_clk_register_system(regmap, sam9x60_systemck[i].n,
327-
sam9x60_systemck[i].p,
327+
sam9x60_systemck[i].p, NULL,
328328
sam9x60_systemck[i].id,
329329
sam9x60_systemck[i].flags);
330330
if (IS_ERR(hw))

0 commit comments

Comments
 (0)