Skip to content

Commit a673dae

Browse files
committed
clk: at91: clk-sam9x60-pll: add support for parent_hw
Add support for parent_hw in SAM9X60 PLL 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-sam9x60-pll 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-9-claudiu.beznea@microchip.com
1 parent 077782e commit a673dae

4 files changed

Lines changed: 17 additions & 9 deletions

File tree

drivers/clk/at91/clk-sam9x60-pll.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock,
616616
{
617617
struct sam9x60_frac *frac;
618618
struct clk_hw *hw;
619-
struct clk_init_data init;
619+
struct clk_init_data init = {};
620620
unsigned long parent_rate, irqflags;
621621
unsigned int val;
622622
int ret;
@@ -629,7 +629,10 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock,
629629
return ERR_PTR(-ENOMEM);
630630

631631
init.name = name;
632-
init.parent_names = &parent_name;
632+
if (parent_name)
633+
init.parent_names = &parent_name;
634+
else
635+
init.parent_hws = (const struct clk_hw **)&parent_hw;
633636
init.num_parents = 1;
634637
if (flags & CLK_SET_RATE_GATE)
635638
init.ops = &sam9x60_frac_pll_ops;
@@ -692,14 +695,15 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock,
692695

693696
struct clk_hw * __init
694697
sam9x60_clk_register_div_pll(struct regmap *regmap, spinlock_t *lock,
695-
const char *name, const char *parent_name, u8 id,
698+
const char *name, const char *parent_name,
699+
struct clk_hw *parent_hw, u8 id,
696700
const struct clk_pll_characteristics *characteristics,
697701
const struct clk_pll_layout *layout, u32 flags,
698702
u32 safe_div)
699703
{
700704
struct sam9x60_div *div;
701705
struct clk_hw *hw;
702-
struct clk_init_data init;
706+
struct clk_init_data init = {};
703707
unsigned long irqflags;
704708
unsigned int val;
705709
int ret;
@@ -716,7 +720,10 @@ sam9x60_clk_register_div_pll(struct regmap *regmap, spinlock_t *lock,
716720
return ERR_PTR(-ENOMEM);
717721

718722
init.name = name;
719-
init.parent_names = &parent_name;
723+
if (parent_hw)
724+
init.parent_hws = (const struct clk_hw **)&parent_hw;
725+
else
726+
init.parent_names = &parent_name;
720727
init.num_parents = 1;
721728
if (flags & CLK_SET_RATE_GATE)
722729
init.ops = &sam9x60_div_pll_ops;

drivers/clk/at91/pmc.h

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

221221
struct clk_hw * __init
222222
sam9x60_clk_register_div_pll(struct regmap *regmap, spinlock_t *lock,
223-
const char *name, const char *parent_name, u8 id,
223+
const char *name, const char *parent_name,
224+
struct clk_hw *parent_hw, u8 id,
224225
const struct clk_pll_characteristics *characteristics,
225226
const struct clk_pll_layout *layout, u32 flags,
226227
u32 safe_div);

drivers/clk/at91/sam9x60.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
246246
goto err_free;
247247

248248
hw = sam9x60_clk_register_div_pll(regmap, &pmc_pll_lock, "pllack_divck",
249-
"pllack_fracck", 0, &plla_characteristics,
249+
"pllack_fracck", NULL, 0, &plla_characteristics,
250250
&pll_div_layout,
251251
/*
252252
* This feeds CPU. It should not
@@ -266,7 +266,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
266266
goto err_free;
267267

268268
hw = sam9x60_clk_register_div_pll(regmap, &pmc_pll_lock, "upllck_divck",
269-
"upllck_fracck", 1, &upll_characteristics,
269+
"upllck_fracck", NULL, 1, &upll_characteristics,
270270
&pll_div_layout,
271271
CLK_SET_RATE_GATE |
272272
CLK_SET_PARENT_GATE |

drivers/clk/at91/sama7g5.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
975975
case PLL_TYPE_DIV:
976976
hw = sam9x60_clk_register_div_pll(regmap,
977977
&pmc_pll_lock, sama7g5_plls[i][j].n,
978-
sama7g5_plls[i][j].p, i,
978+
sama7g5_plls[i][j].p, NULL, i,
979979
sama7g5_plls[i][j].c,
980980
sama7g5_plls[i][j].l,
981981
sama7g5_plls[i][j].f,

0 commit comments

Comments
 (0)