[PATCH v3 23/32] clk: at91: sama5d2: switch to parent_hw and parent_data

claudiu beznea claudiu.beznea at tuxon.dev
Sat Sep 6 11:48:33 PDT 2025


Hi, Ryan,

On 7/10/25 23:07, Ryan.Wanner at microchip.com wrote:
> From: Claudiu Beznea <claudiu.beznea at tuxon.dev>
> 
> Switch SAMA5D2 clocks to use parent_hw and parent_data. Having
> parent_hw instead of parent names improves to clock registration
> speed and re-parenting.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea at tuxon.dev>
> [ryan.wanner at microchip.com: Adjust commit message.]
> Signed-off-by: Ryan Wanner <Ryan.Wanner at microchip.com>
> ---
>   drivers/clk/at91/sama5d2.c | 168 +++++++++++++++++++------------------
>   1 file changed, 86 insertions(+), 82 deletions(-)
> 
> diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
> index f5d6c7a96cf2..538ffb8deedb 100644
> --- a/drivers/clk/at91/sama5d2.c
> +++ b/drivers/clk/at91/sama5d2.c
> @@ -37,9 +37,9 @@ static const struct clk_pcr_layout sama5d2_pcr_layout = {
>   	.pid_mask = GENMASK(6, 0),
>   };
>   
> -static const struct {
> +static struct {
>   	char *n;
> -	char *p;
> +	struct clk_hw *parent_hw;
>   	unsigned long flags;
>   	u8 id;
>   } sama5d2_systemck[] = {
> @@ -47,14 +47,14 @@ static const struct {
>   	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
>   	 * to keep it enabled in case there is no Linux consumer for it.
>   	 */
> -	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
> -	{ .n = "lcdck", .p = "masterck_div", .id = 3 },
> -	{ .n = "uhpck", .p = "usbck",        .id = 6 },
> -	{ .n = "udpck", .p = "usbck",        .id = 7 },
> -	{ .n = "pck0",  .p = "prog0",        .id = 8 },
> -	{ .n = "pck1",  .p = "prog1",        .id = 9 },
> -	{ .n = "pck2",  .p = "prog2",        .id = 10 },
> -	{ .n = "iscck", .p = "masterck_div", .id = 18 },
> +	{ .n = "ddrck", .id = 2, .flags = CLK_IS_CRITICAL },
> +	{ .n = "lcdck", .id = 3 },
> +	{ .n = "uhpck", .id = 6 },
> +	{ .n = "udpck", .id = 7 },
> +	{ .n = "pck0",  .id = 8 },
> +	{ .n = "pck1",  .id = 9 },
> +	{ .n = "pck2",  .id = 10 },
> +	{ .n = "iscck", .id = 18 },
>   };
>   
>   static const struct {
> @@ -164,25 +164,15 @@ static const struct clk_programmable_layout sama5d2_programmable_layout = {
>   
>   static void __init sama5d2_pmc_setup(struct device_node *np)
>   {
> +	struct clk_hw *hw, *audio_fracck_hw, *usbck_hw, *main_rc_hw, *main_osc_hw;
> +	const char *slow_clk_name = "slowck", *main_xtal_name = "main_xtal";
> +	u8 slow_clk_index = 0, main_xtal_index = 1;
>   	struct clk_range range = CLK_RANGE(0, 0);
> -	const char *slck_name, *mainxtal_name;
> -	struct pmc_data *sama5d2_pmc;
> -	const char *parent_names[6];
> +	struct clk_parent_data parent_data[6];
>   	struct regmap *regmap, *regmap_sfr;
> -	struct clk_hw *hw;
> -	int i;
> +	struct pmc_data *sama5d2_pmc;
>   	bool bypass;

Please keep these starting here:

> -
> -	i = of_property_match_string(np, "clock-names", "slow_clk");
> -	if (i < 0)
> -		return;
> -
> -	slck_name = of_clk_get_parent_name(np, i);
> -
> -	i = of_property_match_string(np, "clock-names", "main_xtal");
> -	if (i < 0)
> -		return;
> -	mainxtal_name = of_clk_get_parent_name(np, i);

ending here, and use the retrieved names with AT91_CLK_PD_NAME()




More information about the linux-arm-kernel mailing list