linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: at91: sama7g5: Allow MCK1 to be exported and referenced in DT
@ 2022-01-11 12:53 Tudor Ambarus
  2022-01-11 15:23 ` Claudiu.Beznea
  2022-01-25  1:05 ` Stephen Boyd
  0 siblings, 2 replies; 5+ messages in thread
From: Tudor Ambarus @ 2022-01-11 12:53 UTC (permalink / raw)
  To: mturquette, sboyd, claudiu.beznea
  Cc: nicolas.ferre, alexandre.belloni, ludovic.desroches, robh+dt,
	rdunlap, unixbhaskar, linux-clk, linux-arm-kernel, linux-kernel,
	devicetree, Tudor Ambarus

MCK1 feeds the External Bus Interface (EBI). EBI's clock rate is used
to translate EBI's timmings to SMC timings, thus we need to handle MCK1
in the EBI driver. Allow MCK1 to be referenced as a PMC_TYPE_CORE clock
from phandle in DT.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 drivers/clk/at91/sama7g5.c       | 8 +++++++-
 include/dt-bindings/clock/at91.h | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c
index 369dfafabbca..e43458673afb 100644
--- a/drivers/clk/at91/sama7g5.c
+++ b/drivers/clk/at91/sama7g5.c
@@ -302,6 +302,7 @@ static const struct {
  * @ep_count:		extra parents count
  * @ep_mux_table:	mux table for extra parents
  * @id:			clock id
+ * @eid:		export index in sama7g5->chws[] array
  * @c:			true if clock is critical and cannot be disabled
  */
 static const struct {
@@ -311,6 +312,7 @@ static const struct {
 	u8 ep_count;
 	u8 ep_mux_table[4];
 	u8 id;
+	u8 eid;
 	u8 c;
 } sama7g5_mckx[] = {
 	{ .n = "mck1",
@@ -319,6 +321,7 @@ static const struct {
 	  .ep_mux_table = { 5, },
 	  .ep_count = 1,
 	  .ep_chg_id = INT_MIN,
+	  .eid = PMC_MCK1,
 	  .c = 1, },
 
 	{ .n = "mck2",
@@ -913,7 +916,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
 	if (IS_ERR(regmap))
 		return;
 
-	sama7g5_pmc = pmc_data_allocate(PMC_CPU + 1,
+	sama7g5_pmc = pmc_data_allocate(PMC_MCK1 + 1,
 					nck(sama7g5_systemck),
 					nck(sama7g5_periphck),
 					nck(sama7g5_gck), 8);
@@ -1027,6 +1030,9 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
 			goto err_free;
 
 		alloc_mem[alloc_mem_size++] = mux_table;
+
+		if (sama7g5_mckx[i].eid)
+			sama7g5_pmc->chws[sama7g5_mckx[i].eid] = hw;
 	}
 
 	hw = at91_clk_sama7g5_register_utmi(regmap, "utmick", "main_xtal");
diff --git a/include/dt-bindings/clock/at91.h b/include/dt-bindings/clock/at91.h
index 98e1b2ab6403..8498c0cd95fe 100644
--- a/include/dt-bindings/clock/at91.h
+++ b/include/dt-bindings/clock/at91.h
@@ -35,6 +35,7 @@
 #define PMC_AUDIOIOPLL		(PMC_MAIN + 7)
 #define PMC_ETHPLL		(PMC_MAIN + 8)
 #define PMC_CPU			(PMC_MAIN + 9)
+#define PMC_MCK1		(PMC_MAIN + 10)
 
 #ifndef AT91_PMC_MOSCS
 #define AT91_PMC_MOSCS		0		/* MOSCS Flag */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: at91: sama7g5: Allow MCK1 to be exported and referenced in DT
  2022-01-11 12:53 [PATCH] clk: at91: sama7g5: Allow MCK1 to be exported and referenced in DT Tudor Ambarus
@ 2022-01-11 15:23 ` Claudiu.Beznea
  2022-01-25  1:05 ` Stephen Boyd
  1 sibling, 0 replies; 5+ messages in thread
From: Claudiu.Beznea @ 2022-01-11 15:23 UTC (permalink / raw)
  To: Tudor.Ambarus, mturquette, sboyd
  Cc: Nicolas.Ferre, alexandre.belloni, Ludovic.Desroches, robh+dt,
	rdunlap, unixbhaskar, linux-clk, linux-arm-kernel, linux-kernel,
	devicetree

On 11.01.2022 14:53, Tudor Ambarus wrote:
> MCK1 feeds the External Bus Interface (EBI). EBI's clock rate is used
> to translate EBI's timmings to SMC timings, thus we need to handle MCK1
> in the EBI driver. Allow MCK1 to be referenced as a PMC_TYPE_CORE clock
> from phandle in DT.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>

> ---
>  drivers/clk/at91/sama7g5.c       | 8 +++++++-
>  include/dt-bindings/clock/at91.h | 1 +
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c
> index 369dfafabbca..e43458673afb 100644
> --- a/drivers/clk/at91/sama7g5.c
> +++ b/drivers/clk/at91/sama7g5.c
> @@ -302,6 +302,7 @@ static const struct {
>   * @ep_count:		extra parents count
>   * @ep_mux_table:	mux table for extra parents
>   * @id:			clock id
> + * @eid:		export index in sama7g5->chws[] array
>   * @c:			true if clock is critical and cannot be disabled
>   */
>  static const struct {
> @@ -311,6 +312,7 @@ static const struct {
>  	u8 ep_count;
>  	u8 ep_mux_table[4];
>  	u8 id;
> +	u8 eid;
>  	u8 c;
>  } sama7g5_mckx[] = {
>  	{ .n = "mck1",
> @@ -319,6 +321,7 @@ static const struct {
>  	  .ep_mux_table = { 5, },
>  	  .ep_count = 1,
>  	  .ep_chg_id = INT_MIN,
> +	  .eid = PMC_MCK1,
>  	  .c = 1, },
>  
>  	{ .n = "mck2",
> @@ -913,7 +916,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
>  	if (IS_ERR(regmap))
>  		return;
>  
> -	sama7g5_pmc = pmc_data_allocate(PMC_CPU + 1,
> +	sama7g5_pmc = pmc_data_allocate(PMC_MCK1 + 1,
>  					nck(sama7g5_systemck),
>  					nck(sama7g5_periphck),
>  					nck(sama7g5_gck), 8);
> @@ -1027,6 +1030,9 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
>  			goto err_free;
>  
>  		alloc_mem[alloc_mem_size++] = mux_table;
> +
> +		if (sama7g5_mckx[i].eid)
> +			sama7g5_pmc->chws[sama7g5_mckx[i].eid] = hw;
>  	}
>  
>  	hw = at91_clk_sama7g5_register_utmi(regmap, "utmick", "main_xtal");
> diff --git a/include/dt-bindings/clock/at91.h b/include/dt-bindings/clock/at91.h
> index 98e1b2ab6403..8498c0cd95fe 100644
> --- a/include/dt-bindings/clock/at91.h
> +++ b/include/dt-bindings/clock/at91.h
> @@ -35,6 +35,7 @@
>  #define PMC_AUDIOIOPLL		(PMC_MAIN + 7)
>  #define PMC_ETHPLL		(PMC_MAIN + 8)
>  #define PMC_CPU			(PMC_MAIN + 9)
> +#define PMC_MCK1		(PMC_MAIN + 10)
>  
>  #ifndef AT91_PMC_MOSCS
>  #define AT91_PMC_MOSCS		0		/* MOSCS Flag */


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: at91: sama7g5: Allow MCK1 to be exported and referenced in DT
  2022-01-11 12:53 [PATCH] clk: at91: sama7g5: Allow MCK1 to be exported and referenced in DT Tudor Ambarus
  2022-01-11 15:23 ` Claudiu.Beznea
@ 2022-01-25  1:05 ` Stephen Boyd
  2022-02-25 10:31   ` Nicolas Ferre
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Boyd @ 2022-01-25  1:05 UTC (permalink / raw)
  To: Tudor Ambarus, claudiu.beznea, mturquette
  Cc: nicolas.ferre, alexandre.belloni, ludovic.desroches, robh+dt,
	rdunlap, unixbhaskar, linux-clk, linux-arm-kernel, linux-kernel,
	devicetree, Tudor Ambarus

Quoting Tudor Ambarus (2022-01-11 04:53:10)
> MCK1 feeds the External Bus Interface (EBI). EBI's clock rate is used
> to translate EBI's timmings to SMC timings, thus we need to handle MCK1
> in the EBI driver. Allow MCK1 to be referenced as a PMC_TYPE_CORE clock
> from phandle in DT.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: at91: sama7g5: Allow MCK1 to be exported and referenced in DT
  2022-01-25  1:05 ` Stephen Boyd
@ 2022-02-25 10:31   ` Nicolas Ferre
  2022-03-04 18:09     ` Nicolas Ferre
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Ferre @ 2022-02-25 10:31 UTC (permalink / raw)
  To: Stephen Boyd, Tudor Ambarus, claudiu.beznea, mturquette,
	Arnd Bergmann, Olof Johansson
  Cc: alexandre.belloni, robh+dt, rdunlap, unixbhaskar, linux-clk,
	linux-arm-kernel, linux-kernel, devicetree

On 25/01/2022 at 02:05, Stephen Boyd wrote:
> Quoting Tudor Ambarus (2022-01-11 04:53:10)
>> MCK1 feeds the External Bus Interface (EBI). EBI's clock rate is used
>> to translate EBI's timmings to SMC timings, thus we need to handle MCK1
>> in the EBI driver. Allow MCK1 to be referenced as a PMC_TYPE_CORE clock
>> from phandle in DT.
>>
>> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
>> ---
> 
> Applied to clk-next

Hi Stephen,

I depend on the PMC_MCK1 definition for some of the DT patches that I 
must queue for my pull request to arm-soc, for 5.18.

Would you mind doing an immutable branch for me to pull from, so that 
the build doesn't crash while the clock tree is not integrated yet with 
my patches?

Tell me if there's a better way, as well.

Thanks, best regards,
   Nicolas

-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: at91: sama7g5: Allow MCK1 to be exported and referenced in DT
  2022-02-25 10:31   ` Nicolas Ferre
@ 2022-03-04 18:09     ` Nicolas Ferre
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Ferre @ 2022-03-04 18:09 UTC (permalink / raw)
  To: Stephen Boyd, Tudor Ambarus, claudiu.beznea, mturquette,
	Arnd Bergmann, Olof Johansson
  Cc: alexandre.belloni, robh+dt, rdunlap, unixbhaskar, linux-clk,
	linux-arm-kernel, linux-kernel, devicetree

On 25/02/2022 at 11:31, Nicolas Ferre wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 25/01/2022 at 02:05, Stephen Boyd wrote:
>> Quoting Tudor Ambarus (2022-01-11 04:53:10)
>>> MCK1 feeds the External Bus Interface (EBI). EBI's clock rate is used
>>> to translate EBI's timmings to SMC timings, thus we need to handle MCK1
>>> in the EBI driver. Allow MCK1 to be referenced as a PMC_TYPE_CORE clock
>>> from phandle in DT.
>>>
>>> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
>>> ---
>>
>> Applied to clk-next
> 
> Hi Stephen,
> 
> I depend on the PMC_MCK1 definition for some of the DT patches that I
> must queue for my pull request to arm-soc, for 5.18.
> 
> Would you mind doing an immutable branch for me to pull from, so that
> the build doesn't crash while the clock tree is not integrated yet with
> my patches?

Stephen,

I added the needed chunk in the DT patch. I don't need this anymore.

Best regards,
   Nicolas

> Tell me if there's a better way, as well.
> 
> Thanks, best regards,
>     Nicolas
> 
> --
> Nicolas Ferre
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-04 18:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 12:53 [PATCH] clk: at91: sama7g5: Allow MCK1 to be exported and referenced in DT Tudor Ambarus
2022-01-11 15:23 ` Claudiu.Beznea
2022-01-25  1:05 ` Stephen Boyd
2022-02-25 10:31   ` Nicolas Ferre
2022-03-04 18:09     ` Nicolas Ferre

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).