mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] clk: samsung: Update PLL locktime and samsung function
       [not found] <CGME20250225132431epcas5p148b0c62e36ea09c35473c8da7f312ece@epcas5p1.samsung.com>
@ 2025-02-25 13:19 ` Varada Pavani
       [not found]   ` <CGME20250225132447epcas5p4576a3dac624edbd5edc0a047e008de05@epcas5p4.samsung.com>
       [not found]   ` <CGME20250225132507epcas5p455347acbd580b26ee807e467d3a6a05e@epcas5p4.samsung.com>
  0 siblings, 2 replies; 8+ messages in thread
From: Varada Pavani @ 2025-02-25 13:19 UTC (permalink / raw)
  To: krzk, aswani.reddy, pankaj.dubey, s.nawrocki, cw00.choi,
	alim.akhtar, mturquette, sboyd, linux-samsung-soc, linux-clk,
	linux-arm-kernel, linux-kernel
  Cc: gost.dev, Varada Pavani

This patch series updates samsung clock driver with common samsung
CCF function and defines locktime value for PLL142XX controller.

Changes since v1:
1. Addressed review comment by Krzysztof. Removed fixes tag and updated commit
message. Below is the link for v1.
https://patchwork.kernel.org/project/linux-clk/patch/20240926144513.71349-3-v.pavani@samsung.com/

Varada Pavani (2):
  clk: samsung: Use samsung CCF common function
	This patch is missed in this series https://patchwork.kernel.org/project/linux-clk/cover/20240926144513.71349-1-v.pavani@samsung.com/ hence posting again.
  clk: samsung: Fixes PLL locktime for PLL142XX used on FSD platfom
	Got review comment in this patch will address in next patch series.

 drivers/clk/samsung/clk-exynos4.c | 78 +++++++++++++++++--------------
 drivers/clk/samsung/clk-pll.c     |  7 ++-
 2 files changed, 50 insertions(+), 35 deletions(-)

-- 
2.17.1


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

* [PATCH v2 1/2] clk: samsung: Use samsung CCF common function
       [not found]   ` <CGME20250225132447epcas5p4576a3dac624edbd5edc0a047e008de05@epcas5p4.samsung.com>
@ 2025-02-25 13:19     ` Varada Pavani
  2025-03-05 19:15       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 8+ messages in thread
From: Varada Pavani @ 2025-02-25 13:19 UTC (permalink / raw)
  To: krzk, aswani.reddy, pankaj.dubey, s.nawrocki, cw00.choi,
	alim.akhtar, mturquette, sboyd, linux-samsung-soc, linux-clk,
	linux-arm-kernel, linux-kernel
  Cc: gost.dev, Varada Pavani

Use samsung CCF function which registers multiple clock providers using
single function call samsung_cmu_register_clocks().

Signed-off-by: Varada Pavani <v.pavani@samsung.com>
---
 drivers/clk/samsung/clk-exynos4.c | 78 +++++++++++++++++--------------
 1 file changed, 44 insertions(+), 34 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c
index 16be0c53903c..ca5036ba45b9 100644
--- a/drivers/clk/samsung/clk-exynos4.c
+++ b/drivers/clk/samsung/clk-exynos4.c
@@ -1269,6 +1269,45 @@ static const struct samsung_cpu_clock exynos4412_cpu_clks[] __initconst = {
 		CPUCLK_LAYOUT_E4210, e4412_armclk_d),
 };
 
+static const struct samsung_cmu_info cmu_info_exynos4 __initconst = {
+	.mux_clks		= exynos4_mux_clks,
+	.nr_mux_clks		= ARRAY_SIZE(exynos4_mux_clks),
+	.div_clks		= exynos4_div_clks,
+	.nr_div_clks		= ARRAY_SIZE(exynos4_div_clks),
+	.gate_clks		= exynos4_gate_clks,
+	.nr_gate_clks		= ARRAY_SIZE(exynos4_gate_clks),
+	.fixed_factor_clks	= exynos4_fixed_factor_clks,
+	.nr_fixed_factor_clks	= ARRAY_SIZE(exynos4_fixed_factor_clks),
+	.fixed_clks	= exynos4_fixed_rate_clks,
+	.nr_fixed_clks	= ARRAY_SIZE(exynos4_fixed_rate_clks),
+};
+
+static const struct samsung_cmu_info cmu_info_exynos4210 __initconst = {
+	.mux_clks		= exynos4210_mux_clks,
+	.nr_mux_clks		= ARRAY_SIZE(exynos4210_mux_clks),
+	.div_clks		= exynos4210_div_clks,
+	.nr_div_clks		= ARRAY_SIZE(exynos4210_div_clks),
+	.gate_clks		= exynos4210_gate_clks,
+	.nr_gate_clks		= ARRAY_SIZE(exynos4210_gate_clks),
+	.fixed_factor_clks	= exynos4210_fixed_factor_clks,
+	.nr_fixed_factor_clks	= ARRAY_SIZE(exynos4210_fixed_factor_clks),
+	.fixed_clks	= exynos4210_fixed_rate_clks,
+	.nr_fixed_clks	= ARRAY_SIZE(exynos4210_fixed_rate_clks),
+	.cpu_clks		= exynos4210_cpu_clks,
+	.nr_cpu_clks		= ARRAY_SIZE(exynos4210_cpu_clks),
+};
+
+static const struct samsung_cmu_info cmu_info_exynos4x12 __initconst = {
+	.mux_clks		= exynos4x12_mux_clks,
+	.nr_mux_clks		= ARRAY_SIZE(exynos4x12_mux_clks),
+	.div_clks		= exynos4x12_div_clks,
+	.nr_div_clks		= ARRAY_SIZE(exynos4x12_div_clks),
+	.gate_clks		= exynos4x12_gate_clks,
+	.nr_gate_clks		= ARRAY_SIZE(exynos4x12_gate_clks),
+	.fixed_factor_clks	= exynos4x12_fixed_factor_clks,
+	.nr_fixed_factor_clks	= ARRAY_SIZE(exynos4x12_fixed_factor_clks),
+};
+
 /* register exynos4 clocks */
 static void __init exynos4_clk_init(struct device_node *np,
 				    enum exynos4_soc soc)
@@ -1322,41 +1361,12 @@ static void __init exynos4_clk_init(struct device_node *np,
 					ARRAY_SIZE(exynos4x12_plls));
 	}
 
-	samsung_clk_register_fixed_rate(ctx, exynos4_fixed_rate_clks,
-			ARRAY_SIZE(exynos4_fixed_rate_clks));
-	samsung_clk_register_mux(ctx, exynos4_mux_clks,
-			ARRAY_SIZE(exynos4_mux_clks));
-	samsung_clk_register_div(ctx, exynos4_div_clks,
-			ARRAY_SIZE(exynos4_div_clks));
-	samsung_clk_register_gate(ctx, exynos4_gate_clks,
-			ARRAY_SIZE(exynos4_gate_clks));
-	samsung_clk_register_fixed_factor(ctx, exynos4_fixed_factor_clks,
-			ARRAY_SIZE(exynos4_fixed_factor_clks));
+	samsung_cmu_register_clocks(ctx, &cmu_info_exynos4);
 
-	if (exynos4_soc == EXYNOS4210) {
-		samsung_clk_register_fixed_rate(ctx, exynos4210_fixed_rate_clks,
-			ARRAY_SIZE(exynos4210_fixed_rate_clks));
-		samsung_clk_register_mux(ctx, exynos4210_mux_clks,
-			ARRAY_SIZE(exynos4210_mux_clks));
-		samsung_clk_register_div(ctx, exynos4210_div_clks,
-			ARRAY_SIZE(exynos4210_div_clks));
-		samsung_clk_register_gate(ctx, exynos4210_gate_clks,
-			ARRAY_SIZE(exynos4210_gate_clks));
-		samsung_clk_register_fixed_factor(ctx,
-			exynos4210_fixed_factor_clks,
-			ARRAY_SIZE(exynos4210_fixed_factor_clks));
-		samsung_clk_register_cpu(ctx, exynos4210_cpu_clks,
-				ARRAY_SIZE(exynos4210_cpu_clks));
-	} else {
-		samsung_clk_register_mux(ctx, exynos4x12_mux_clks,
-			ARRAY_SIZE(exynos4x12_mux_clks));
-		samsung_clk_register_div(ctx, exynos4x12_div_clks,
-			ARRAY_SIZE(exynos4x12_div_clks));
-		samsung_clk_register_gate(ctx, exynos4x12_gate_clks,
-			ARRAY_SIZE(exynos4x12_gate_clks));
-		samsung_clk_register_fixed_factor(ctx,
-			exynos4x12_fixed_factor_clks,
-			ARRAY_SIZE(exynos4x12_fixed_factor_clks));
+	if (exynos4_soc == EXYNOS4210)
+		samsung_cmu_register_clocks(ctx, &cmu_info_exynos4210);
+	else {
+		samsung_cmu_register_clocks(ctx, &cmu_info_exynos4x12);
 		if (soc == EXYNOS4412)
 			samsung_clk_register_cpu(ctx, exynos4412_cpu_clks,
 					ARRAY_SIZE(exynos4412_cpu_clks));
-- 
2.17.1


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

* [PATCH v2 2/2] clk: samsung: update PLL locktime for PLL142XX used on FSD platform
       [not found]   ` <CGME20250225132507epcas5p455347acbd580b26ee807e467d3a6a05e@epcas5p4.samsung.com>
@ 2025-02-25 13:19     ` Varada Pavani
  2025-03-01 14:14       ` Krzysztof Kozlowski
  2025-03-05 19:15       ` (subset) " Krzysztof Kozlowski
  0 siblings, 2 replies; 8+ messages in thread
From: Varada Pavani @ 2025-02-25 13:19 UTC (permalink / raw)
  To: krzk, aswani.reddy, pankaj.dubey, s.nawrocki, cw00.choi,
	alim.akhtar, mturquette, sboyd, linux-samsung-soc, linux-clk,
	linux-arm-kernel, linux-kernel
  Cc: gost.dev, Varada Pavani, stable

Currently PLL142XX locktime is 270. As per spec, it should be 150. Hence
update PLL142XX controller locktime to 150.

Cc: stable@vger.kernel.org
Signed-off-by: Varada Pavani <v.pavani@samsung.com>
---
 drivers/clk/samsung/clk-pll.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
index 2e94bba6c396..023a25af73c4 100644
--- a/drivers/clk/samsung/clk-pll.c
+++ b/drivers/clk/samsung/clk-pll.c
@@ -206,6 +206,7 @@ static const struct clk_ops samsung_pll3000_clk_ops = {
  */
 /* Maximum lock time can be 270 * PDIV cycles */
 #define PLL35XX_LOCK_FACTOR	(270)
+#define PLL142XX_LOCK_FACTOR	(150)
 
 #define PLL35XX_MDIV_MASK       (0x3FF)
 #define PLL35XX_PDIV_MASK       (0x3F)
@@ -272,7 +273,11 @@ static int samsung_pll35xx_set_rate(struct clk_hw *hw, unsigned long drate,
 	}
 
 	/* Set PLL lock time. */
-	writel_relaxed(rate->pdiv * PLL35XX_LOCK_FACTOR,
+	if (pll->type == pll_142xx)
+		writel_relaxed(rate->pdiv * PLL142XX_LOCK_FACTOR,
+			pll->lock_reg);
+	else
+		writel_relaxed(rate->pdiv * PLL35XX_LOCK_FACTOR,
 			pll->lock_reg);
 
 	/* Change PLL PMS values */
-- 
2.17.1


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

* Re: [PATCH v2 2/2] clk: samsung: update PLL locktime for PLL142XX used on FSD platform
  2025-02-25 13:19     ` [PATCH v2 2/2] clk: samsung: update PLL locktime for PLL142XX used on FSD platform Varada Pavani
@ 2025-03-01 14:14       ` Krzysztof Kozlowski
  2025-03-05 19:12         ` Krzysztof Kozlowski
  2025-03-05 19:15       ` (subset) " Krzysztof Kozlowski
  1 sibling, 1 reply; 8+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-01 14:14 UTC (permalink / raw)
  To: Varada Pavani, aswani.reddy, pankaj.dubey, s.nawrocki, cw00.choi,
	alim.akhtar, mturquette, sboyd, linux-samsung-soc, linux-clk,
	linux-arm-kernel, linux-kernel
  Cc: gost.dev, stable

On 25/02/2025 14:19, Varada Pavani wrote:
> Currently PLL142XX locktime is 270. As per spec, it should be 150. Hence
> update PLL142XX controller locktime to 150.
> 
> Cc: stable@vger.kernel.org

Fixes commit?

> Signed-off-by: Varada Pavani <v.pavani@samsung.com>
> ---
>  drivers/clk/samsung/clk-pll.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
> index 2e94bba6c396..023a25af73c4 100644
> --- a/drivers/clk/samsung/clk-pll.c
> +++ b/drivers/clk/samsung/clk-pll.c
> @@ -206,6 +206,7 @@ static const struct clk_ops samsung_pll3000_clk_ops = {
>   */
>  /* Maximum lock time can be 270 * PDIV cycles */
>  #define PLL35XX_LOCK_FACTOR	(270)
> +#define PLL142XX_LOCK_FACTOR	(150)
>  
>  #define PLL35XX_MDIV_MASK       (0x3FF)
>  #define PLL35XX_PDIV_MASK       (0x3F)
> @@ -272,7 +273,11 @@ static int samsung_pll35xx_set_rate(struct clk_hw *hw, unsigned long drate,
>  	}
>  
>  	/* Set PLL lock time. */
> -	writel_relaxed(rate->pdiv * PLL35XX_LOCK_FACTOR,
> +	if (pll->type == pll_142xx)
> +		writel_relaxed(rate->pdiv * PLL142XX_LOCK_FACTOR,
> +			pll->lock_reg);
> +	else
> +		writel_relaxed(rate->pdiv * PLL35XX_LOCK_FACTOR,
>  			pll->lock_reg);
>  
>  	/* Change PLL PMS values */


Best regards,
Krzysztof

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

* Re: [PATCH v2 2/2] clk: samsung: update PLL locktime for PLL142XX used on FSD platform
  2025-03-01 14:14       ` Krzysztof Kozlowski
@ 2025-03-05 19:12         ` Krzysztof Kozlowski
  2025-03-05 19:14           ` Krzysztof Kozlowski
  0 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-05 19:12 UTC (permalink / raw)
  To: Varada Pavani, aswani.reddy, pankaj.dubey, s.nawrocki, cw00.choi,
	alim.akhtar, mturquette, sboyd, linux-samsung-soc, linux-clk,
	linux-arm-kernel, linux-kernel
  Cc: gost.dev, stable

On 01/03/2025 15:14, Krzysztof Kozlowski wrote:
> On 25/02/2025 14:19, Varada Pavani wrote:
>> Currently PLL142XX locktime is 270. As per spec, it should be 150. Hence
>> update PLL142XX controller locktime to 150.
>>
>> Cc: stable@vger.kernel.org
> 
> Fixes commit?

If this is a fix, commit msg should describe the bug. You decided to
drop the fixes tag, but you kept stable, so this makes no sense.

Best regards,
Krzysztof

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

* Re: [PATCH v2 2/2] clk: samsung: update PLL locktime for PLL142XX used on FSD platform
  2025-03-05 19:12         ` Krzysztof Kozlowski
@ 2025-03-05 19:14           ` Krzysztof Kozlowski
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-05 19:14 UTC (permalink / raw)
  To: Varada Pavani, aswani.reddy, pankaj.dubey, s.nawrocki, cw00.choi,
	alim.akhtar, mturquette, sboyd, linux-samsung-soc, linux-clk,
	linux-arm-kernel, linux-kernel
  Cc: gost.dev, stable

On 05/03/2025 20:12, Krzysztof Kozlowski wrote:
> On 01/03/2025 15:14, Krzysztof Kozlowski wrote:
>> On 25/02/2025 14:19, Varada Pavani wrote:
>>> Currently PLL142XX locktime is 270. As per spec, it should be 150. Hence
>>> update PLL142XX controller locktime to 150.
>>>
>>> Cc: stable@vger.kernel.org
>>
>> Fixes commit?
> 
> If this is a fix, commit msg should describe the bug. You decided to
> drop the fixes tag, but you kept stable, so this makes no sense.
> 
Also in the future: run checkpatch.

CHECK: Alignment should match open parenthesis

Best regards,
Krzysztof

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

* Re: (subset) [PATCH v2 2/2] clk: samsung: update PLL locktime for PLL142XX used on FSD platform
  2025-02-25 13:19     ` [PATCH v2 2/2] clk: samsung: update PLL locktime for PLL142XX used on FSD platform Varada Pavani
  2025-03-01 14:14       ` Krzysztof Kozlowski
@ 2025-03-05 19:15       ` Krzysztof Kozlowski
  1 sibling, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-05 19:15 UTC (permalink / raw)
  To: krzk, aswani.reddy, pankaj.dubey, s.nawrocki, cw00.choi,
	alim.akhtar, mturquette, sboyd, linux-samsung-soc, linux-clk,
	linux-arm-kernel, linux-kernel, Varada Pavani
  Cc: gost.dev, stable


On Tue, 25 Feb 2025 18:49:18 +0530, Varada Pavani wrote:
> Currently PLL142XX locktime is 270. As per spec, it should be 150. Hence
> update PLL142XX controller locktime to 150.
> 
> 

Applied, thanks!

[2/2] clk: samsung: update PLL locktime for PLL142XX used on FSD platform
      https://git.kernel.org/krzk/linux/c/53517a70873c7a91675f7244768aad5006cc45de

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


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

* Re: [PATCH v2 1/2] clk: samsung: Use samsung CCF common function
  2025-02-25 13:19     ` [PATCH v2 1/2] clk: samsung: Use samsung CCF common function Varada Pavani
@ 2025-03-05 19:15       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-05 19:15 UTC (permalink / raw)
  To: Varada Pavani, aswani.reddy, pankaj.dubey, s.nawrocki, cw00.choi,
	alim.akhtar, mturquette, sboyd, linux-samsung-soc, linux-clk,
	linux-arm-kernel, linux-kernel
  Cc: gost.dev

On 25/02/2025 14:19, Varada Pavani wrote:
> Use samsung CCF function which registers multiple clock providers using
> single function call samsung_cmu_register_clocks().
> 
> Signed-off-by: Varada Pavani <v.pavani@samsung.com>
> ---
>  drivers/clk/samsung/clk-exynos4.c | 78 +++++++++++++++++--------------
>  1 file changed, 44 insertions(+), 34 deletions(-)

Please run scripts/checkpatch.pl and fix reported warnings. After that,
run also `scripts/checkpatch.pl --strict` and (probably) fix more
warnings. Some warnings can be ignored, especially from --strict run,
but the code here looks like it needs a fix. Feel free to get in touch
if the warning is not clear.

Best regards,
Krzysztof

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

end of thread, other threads:[~2025-03-05 19:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20250225132431epcas5p148b0c62e36ea09c35473c8da7f312ece@epcas5p1.samsung.com>
2025-02-25 13:19 ` [PATCH v2 0/2] clk: samsung: Update PLL locktime and samsung function Varada Pavani
     [not found]   ` <CGME20250225132447epcas5p4576a3dac624edbd5edc0a047e008de05@epcas5p4.samsung.com>
2025-02-25 13:19     ` [PATCH v2 1/2] clk: samsung: Use samsung CCF common function Varada Pavani
2025-03-05 19:15       ` Krzysztof Kozlowski
     [not found]   ` <CGME20250225132507epcas5p455347acbd580b26ee807e467d3a6a05e@epcas5p4.samsung.com>
2025-02-25 13:19     ` [PATCH v2 2/2] clk: samsung: update PLL locktime for PLL142XX used on FSD platform Varada Pavani
2025-03-01 14:14       ` Krzysztof Kozlowski
2025-03-05 19:12         ` Krzysztof Kozlowski
2025-03-05 19:14           ` Krzysztof Kozlowski
2025-03-05 19:15       ` (subset) " Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®