devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@foss.st.com>
To: Alain Volmat <avolmat@me.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>, <linux-clk@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v3 6/7] clk: st: clkgen-fsyn: embed soc clock outputs within compatible data
Date: Wed, 31 Mar 2021 18:08:33 +0200	[thread overview]
Message-ID: <f2bbb7a2-a36e-5357-feb3-487d0b43989a@foss.st.com> (raw)
In-Reply-To: <20210330205125.25708-7-avolmat@me.com>

Hi Alain

On 3/30/21 10:51 PM, Alain Volmat wrote:
> In order to avoid relying on the old style description via the DT
> clock-output-names, add compatible data describing the flexgen
> outputs clocks for all STiH407/STiH410 and STiH418 SOCs.
> 
> In order to ease transition between the two methods, this commit
> introduce the new compatible without removing the old method.
> Once DTs will be fixed, the method relying on DT clock-output-names
> will be removed from this driver as well as old compatibles.
> 
> Signed-off-by: Alain Volmat <avolmat@me.com>
> ---
> v2: clk-s-c0-fs0-ch0 do not need to be CLK_IS_CRITICAL
> 
>  drivers/clk/st/clkgen-fsyn.c | 113 +++++++++++++++++++++++++++++++----
>  1 file changed, 101 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
> index dd6062e043e0..164285d6be97 100644
> --- a/drivers/clk/st/clkgen-fsyn.c
> +++ b/drivers/clk/st/clkgen-fsyn.c
> @@ -66,6 +66,16 @@ struct clkgen_quadfs_data {
>  			unsigned long *);
>  };
>  
> +struct clkgen_clk_out {
> +	const char *name;
> +	unsigned long flags;
> +};
> +
> +struct clkgen_quadfs_data_clks {
> +	struct clkgen_quadfs_data *data;
> +	const struct clkgen_clk_out *outputs;
> +};
> +
>  static const struct clk_ops st_quadfs_pll_c32_ops;
>  
>  static int clk_fs660c32_dig_get_params(unsigned long input,
> @@ -115,6 +125,18 @@ static const struct clkgen_quadfs_data st_fs660c32_C = {
>  	.get_rate	= clk_fs660c32_dig_get_rate,
>  };
>  
> +static const struct clkgen_clk_out st_fs660c32_C_clks[] = {
> +	{ .name = "clk-s-c0-fs0-ch0",	},
> +	{ .name = "clk-s-c0-fs0-ch1",	},
> +	{ .name = "clk-s-c0-fs0-ch2",	},
> +	{ .name = "clk-s-c0-fs0-ch3",	},
> +};
> +
> +static const struct clkgen_quadfs_data_clks st_fs660c32_C_data = {
> +	.data	= (struct clkgen_quadfs_data *)&st_fs660c32_C,
> +	.outputs	= st_fs660c32_C_clks,
> +};
> +
>  static const struct clkgen_quadfs_data st_fs660c32_D = {
>  	.nrst_present = true,
>  	.nrst	= { CLKGEN_FIELD(0x2a0, 0x1, 0),
> @@ -156,6 +178,46 @@ static const struct clkgen_quadfs_data st_fs660c32_D = {
>  	.get_params	= clk_fs660c32_dig_get_params,
>  	.get_rate	= clk_fs660c32_dig_get_rate,};
>  
> +static const struct clkgen_quadfs_data_clks st_fs660c32_D_data = {
> +	.data	= (struct clkgen_quadfs_data *)&st_fs660c32_D,
> +};
> +
> +static const struct clkgen_clk_out st_fs660c32_D0_clks[] = {
> +	{ .name = "clk-s-d0-fs0-ch0",	},
> +	{ .name = "clk-s-d0-fs0-ch1",	},
> +	{ .name = "clk-s-d0-fs0-ch2",	},
> +	{ .name = "clk-s-d0-fs0-ch3",	},
> +};
> +
> +static const struct clkgen_quadfs_data_clks st_fs660c32_D0_data = {
> +	.data	= (struct clkgen_quadfs_data *)&st_fs660c32_D,
> +	.outputs	= st_fs660c32_D0_clks,
> +};
> +
> +static const struct clkgen_clk_out st_fs660c32_D2_clks[] = {
> +	{ .name = "clk-s-d2-fs0-ch0",	},
> +	{ .name = "clk-s-d2-fs0-ch1",	},
> +	{ .name = "clk-s-d2-fs0-ch2",	},
> +	{ .name = "clk-s-d2-fs0-ch3",	},
> +};
> +
> +static const struct clkgen_quadfs_data_clks st_fs660c32_D2_data = {
> +	.data	= (struct clkgen_quadfs_data *)&st_fs660c32_D,
> +	.outputs	= st_fs660c32_D2_clks,
> +};
> +
> +static const struct clkgen_clk_out st_fs660c32_D3_clks[] = {
> +	{ .name = "clk-s-d3-fs0-ch0",	},
> +	{ .name = "clk-s-d3-fs0-ch1",	},
> +	{ .name = "clk-s-d3-fs0-ch2",	},
> +	{ .name = "clk-s-d3-fs0-ch3",	},
> +};
> +
> +static const struct clkgen_quadfs_data_clks st_fs660c32_D3_data = {
> +	.data	= (struct clkgen_quadfs_data *)&st_fs660c32_D,
> +	.outputs	= st_fs660c32_D3_clks,
> +};
> +
>  /**
>   * DOC: A Frequency Synthesizer that multiples its input clock by a fixed factor
>   *
> @@ -857,7 +919,7 @@ static struct clk * __init st_clk_register_quadfs_fsynth(
>  
>  static void __init st_of_create_quadfs_fsynths(
>  		struct device_node *np, const char *pll_name,
> -		struct clkgen_quadfs_data *quadfs, void __iomem *reg,
> +		struct clkgen_quadfs_data_clks *quadfs, void __iomem *reg,
>  		spinlock_t *lock)
>  {
>  	struct clk_onecell_data *clk_data;
> @@ -881,9 +943,15 @@ static void __init st_of_create_quadfs_fsynths(
>  		const char *clk_name;
>  		unsigned long flags = 0;
>  
> -		if (of_property_read_string_index(np, "clock-output-names",
> -						  fschan, &clk_name)) {
> -			break;
> +		if (quadfs->outputs) {
> +			clk_name = quadfs->outputs[fschan].name;
> +			flags = quadfs->outputs[fschan].flags;
> +		} else {
> +			if (of_property_read_string_index(np,
> +							"clock-output-names",
> +							fschan, &clk_name))
> +				break;
> +			of_clk_detect_critical(np, fschan, &flags);
>  		}
>  
>  		/*
> @@ -892,10 +960,8 @@ static void __init st_of_create_quadfs_fsynths(
>  		if (*clk_name == '\0')
>  			continue;
>  
> -		of_clk_detect_critical(np, fschan, &flags);
> -
>  		clk = st_clk_register_quadfs_fsynth(clk_name, pll_name,
> -						    quadfs, reg, fschan,
> +						    quadfs->data, reg, fschan,
>  						    flags, lock);
>  
>  		/*
> @@ -915,7 +981,7 @@ static void __init st_of_create_quadfs_fsynths(
>  }
>  
>  static void __init st_of_quadfs_setup(struct device_node *np,
> -		struct clkgen_quadfs_data *data)
> +		struct clkgen_quadfs_data_clks *datac)
>  {
>  	struct clk *clk;
>  	const char *pll_name, *clk_parent_name;
> @@ -940,7 +1006,7 @@ static void __init st_of_quadfs_setup(struct device_node *np,
>  
>  	spin_lock_init(lock);
>  
> -	clk = st_clk_register_quadfs_pll(pll_name, clk_parent_name, data,
> +	clk = st_clk_register_quadfs_pll(pll_name, clk_parent_name, datac->data,
>  			reg, lock);
>  	if (IS_ERR(clk))
>  		goto err_exit;
> @@ -950,7 +1016,7 @@ static void __init st_of_quadfs_setup(struct device_node *np,
>  			__clk_get_name(clk_get_parent(clk)),
>  			(unsigned int)clk_get_rate(clk));
>  
> -	st_of_create_quadfs_fsynths(np, pll_name, data, reg, lock);
> +	st_of_create_quadfs_fsynths(np, pll_name, datac, reg, lock);
>  
>  err_exit:
>  	kfree(pll_name); /* No longer need local copy of the PLL name */
> @@ -958,12 +1024,35 @@ static void __init st_of_quadfs_setup(struct device_node *np,
>  
>  static void __init st_of_quadfs660C_setup(struct device_node *np)
>  {
> -	st_of_quadfs_setup(np, (struct clkgen_quadfs_data *) &st_fs660c32_C);
> +	st_of_quadfs_setup(np,
> +		(struct clkgen_quadfs_data_clks *) &st_fs660c32_C_data);
>  }
>  CLK_OF_DECLARE(quadfs660C, "st,quadfs-pll", st_of_quadfs660C_setup);
>  
>  static void __init st_of_quadfs660D_setup(struct device_node *np)
>  {
> -	st_of_quadfs_setup(np, (struct clkgen_quadfs_data *) &st_fs660c32_D);
> +	st_of_quadfs_setup(np,
> +		(struct clkgen_quadfs_data_clks *) &st_fs660c32_D_data);
>  }
>  CLK_OF_DECLARE(quadfs660D, "st,quadfs", st_of_quadfs660D_setup);
> +
> +static void __init st_of_quadfs660D0_setup(struct device_node *np)
> +{
> +	st_of_quadfs_setup(np,
> +		(struct clkgen_quadfs_data_clks *) &st_fs660c32_D0_data);
> +}
> +CLK_OF_DECLARE(quadfs660D0, "st,quadfs-d0", st_of_quadfs660D0_setup);
> +
> +static void __init st_of_quadfs660D2_setup(struct device_node *np)
> +{
> +	st_of_quadfs_setup(np,
> +		(struct clkgen_quadfs_data_clks *) &st_fs660c32_D2_data);
> +}
> +CLK_OF_DECLARE(quadfs660D2, "st,quadfs-d2", st_of_quadfs660D2_setup);
> +
> +static void __init st_of_quadfs660D3_setup(struct device_node *np)
> +{
> +	st_of_quadfs_setup(np,
> +		(struct clkgen_quadfs_data_clks *) &st_fs660c32_D3_data);
> +}
> +CLK_OF_DECLARE(quadfs660D3, "st,quadfs-d3", st_of_quadfs660D3_setup);
> 

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks

  reply	other threads:[~2021-03-31 16:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 20:51 [PATCH v3 0/7] clk: st: embed clock outputs within drivers Alain Volmat
2021-03-30 20:51 ` [PATCH v3 1/7] clk: st: clkgen-pll: remove unused variable of struct clkgen_pll Alain Volmat
2021-03-31 16:07   ` Patrice CHOTARD
2021-03-30 20:51 ` [PATCH v3 2/7] clk: st: flexgen: embed soc clock outputs within compatible data Alain Volmat
2021-03-31 16:06   ` Patrice CHOTARD
2021-03-30 20:51 ` [PATCH v3 3/7] dt-bindings: clock: st: flexgen: add new introduced compatible Alain Volmat
2021-03-30 20:51 ` [PATCH v3 4/7] clk: st: clkgen-pll: embed soc clock outputs within compatible data Alain Volmat
2021-03-31 16:08   ` Patrice CHOTARD
2021-03-30 20:51 ` [PATCH v3 5/7] dt-bindings: clock: st: clkgen-pll: add new introduced compatible Alain Volmat
2021-03-30 20:51 ` [PATCH v3 6/7] clk: st: clkgen-fsyn: embed soc clock outputs within compatible data Alain Volmat
2021-03-31 16:08   ` Patrice CHOTARD [this message]
2021-03-30 20:51 ` [PATCH v3 7/7] dt-bindings: clock: st: clkgen-fsyn: add new introduced compatible Alain Volmat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f2bbb7a2-a36e-5357-feb3-487d0b43989a@foss.st.com \
    --to=patrice.chotard@foss.st.com \
    --cc=avolmat@me.com \
    --cc=devicetree@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).