All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Kukjin Kim <kgene.kim@samsung.com>
Cc: t.figa@samsung.com, mturquette@linaro.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org
Subject: [PATCH v2.1 1/9] ARM: S3C24XX: cpufreq-utils: don't write raw values to MPLLCON when using ccf
Date: Thu, 24 Apr 2014 00:08:23 +0200	[thread overview]
Message-ID: <2638137.1oBdcbvcY8@phil> (raw)
In-Reply-To: <5855371.5GIoOu8EnE@phil>

The s3c24xx cpufreq driver needs to change the mpll speed and was doing
this by writing raw values from a translation table into the MPLLCON
register.

Change this to use a regular clk_set_rate call when using the common
clock framework and only write the raw value in the samsung_clock case.

The s3c cpufreq driver does already aquire the mpll, so simply add a reference
to struct s3c_cpufreq_config to let set_fvco access it.

While struct clk is opaque the differenciation between samsung clock and
common clock is kept, as the samsung-clock mpll clk does not implement a
real set_rate.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/mach-s3c24xx/cpufreq-utils.c              | 8 ++++++++
 arch/arm/plat-samsung/include/plat/cpu-freq-core.h | 1 +
 drivers/cpufreq/s3c24xx-cpufreq.c                  | 1 +
 3 files changed, 10 insertions(+)

diff --git a/arch/arm/mach-s3c24xx/cpufreq-utils.c b/arch/arm/mach-s3c24xx/cpufreq-utils.c
index 2a0aa56..c1b7508 100644
--- a/arch/arm/mach-s3c24xx/cpufreq-utils.c
+++ b/arch/arm/mach-s3c24xx/cpufreq-utils.c
@@ -14,6 +14,7 @@
 #include <linux/errno.h>
 #include <linux/cpufreq.h>
 #include <linux/io.h>
+#include <linux/clk.h>
 
 #include <mach/map.h>
 #include <mach/regs-clock.h>
@@ -60,5 +61,12 @@ void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
  */
 void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg)
 {
+#ifdef CONFIG_SAMSUNG_CLOCK
 	__raw_writel(cfg->pll.driver_data, S3C2410_MPLLCON);
+#endif
+
+#ifdef CONFIG_COMMON_CLK
+	if (!IS_ERR(cfg->mpll))
+		clk_set_rate(cfg->mpll, cfg->pll.frequency);
+#endif
 }
diff --git a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
index 7231c8e..72d4178 100644
--- a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
+++ b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
@@ -119,6 +119,7 @@ struct s3c_plltab {
 struct s3c_cpufreq_config {
 	struct s3c_freq		freq;
 	struct s3c_freq		max;
+	struct clk		*mpll;
 	struct cpufreq_frequency_table pll;
 	struct s3c_clkdivs	divs;
 	struct s3c_cpufreq_info *info;	/* for core, not drivers */
diff --git a/drivers/cpufreq/s3c24xx-cpufreq.c b/drivers/cpufreq/s3c24xx-cpufreq.c
index be1b2b5..227ebf7 100644
--- a/drivers/cpufreq/s3c24xx-cpufreq.c
+++ b/drivers/cpufreq/s3c24xx-cpufreq.c
@@ -141,6 +141,7 @@ static int s3c_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
 
 static void s3c_cpufreq_setfvco(struct s3c_cpufreq_config *cfg)
 {
+	cfg->mpll = _clk_mpll;
 	(cfg->info->set_fvco)(cfg);
 }
 
-- 
1.9.0

WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2.1 1/9] ARM: S3C24XX: cpufreq-utils: don't write raw values to MPLLCON when using ccf
Date: Thu, 24 Apr 2014 00:08:23 +0200	[thread overview]
Message-ID: <2638137.1oBdcbvcY8@phil> (raw)
In-Reply-To: <5855371.5GIoOu8EnE@phil>

The s3c24xx cpufreq driver needs to change the mpll speed and was doing
this by writing raw values from a translation table into the MPLLCON
register.

Change this to use a regular clk_set_rate call when using the common
clock framework and only write the raw value in the samsung_clock case.

The s3c cpufreq driver does already aquire the mpll, so simply add a reference
to struct s3c_cpufreq_config to let set_fvco access it.

While struct clk is opaque the differenciation between samsung clock and
common clock is kept, as the samsung-clock mpll clk does not implement a
real set_rate.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/mach-s3c24xx/cpufreq-utils.c              | 8 ++++++++
 arch/arm/plat-samsung/include/plat/cpu-freq-core.h | 1 +
 drivers/cpufreq/s3c24xx-cpufreq.c                  | 1 +
 3 files changed, 10 insertions(+)

diff --git a/arch/arm/mach-s3c24xx/cpufreq-utils.c b/arch/arm/mach-s3c24xx/cpufreq-utils.c
index 2a0aa56..c1b7508 100644
--- a/arch/arm/mach-s3c24xx/cpufreq-utils.c
+++ b/arch/arm/mach-s3c24xx/cpufreq-utils.c
@@ -14,6 +14,7 @@
 #include <linux/errno.h>
 #include <linux/cpufreq.h>
 #include <linux/io.h>
+#include <linux/clk.h>
 
 #include <mach/map.h>
 #include <mach/regs-clock.h>
@@ -60,5 +61,12 @@ void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
  */
 void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg)
 {
+#ifdef CONFIG_SAMSUNG_CLOCK
 	__raw_writel(cfg->pll.driver_data, S3C2410_MPLLCON);
+#endif
+
+#ifdef CONFIG_COMMON_CLK
+	if (!IS_ERR(cfg->mpll))
+		clk_set_rate(cfg->mpll, cfg->pll.frequency);
+#endif
 }
diff --git a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
index 7231c8e..72d4178 100644
--- a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
+++ b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
@@ -119,6 +119,7 @@ struct s3c_plltab {
 struct s3c_cpufreq_config {
 	struct s3c_freq		freq;
 	struct s3c_freq		max;
+	struct clk		*mpll;
 	struct cpufreq_frequency_table pll;
 	struct s3c_clkdivs	divs;
 	struct s3c_cpufreq_info *info;	/* for core, not drivers */
diff --git a/drivers/cpufreq/s3c24xx-cpufreq.c b/drivers/cpufreq/s3c24xx-cpufreq.c
index be1b2b5..227ebf7 100644
--- a/drivers/cpufreq/s3c24xx-cpufreq.c
+++ b/drivers/cpufreq/s3c24xx-cpufreq.c
@@ -141,6 +141,7 @@ static int s3c_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
 
 static void s3c_cpufreq_setfvco(struct s3c_cpufreq_config *cfg)
 {
+	cfg->mpll = _clk_mpll;
 	(cfg->info->set_fvco)(cfg);
 }
 
-- 
1.9.0

  parent reply	other threads:[~2014-04-23 22:06 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23 19:32 [PATCH v2 0/9] ARM: S3C24XX: convert s3c2410, s3c2440 s3c2442 to common clock framework Heiko Stübner
2014-04-23 19:32 ` Heiko Stübner
2014-04-23 19:34 ` [PATCH v2 1/9] ARM: S3C24XX: cpufreq-utils: don't write raw values to MPLLCON when using ccf Heiko Stübner
2014-04-23 19:34   ` Heiko Stübner
2014-04-23 20:42   ` Sergei Shtylyov
2014-04-23 20:42     ` Sergei Shtylyov
2014-04-23 20:55     ` Tomasz Figa
2014-04-23 20:55       ` Tomasz Figa
2014-04-23 21:11       ` Heiko Stübner
2014-04-23 21:11         ` Heiko Stübner
2014-05-06  4:27         ` Kukjin Kim
2014-05-06  4:27           ` Kukjin Kim
2014-05-06 15:07           ` Tomasz Figa
2014-05-06 15:07             ` Tomasz Figa
2014-05-08 17:36           ` Tomasz Figa
2014-05-08 17:36             ` Tomasz Figa
2014-04-23 21:02     ` Sergei Shtylyov
2014-04-23 21:02       ` Sergei Shtylyov
2014-04-23 22:08   ` Heiko Stübner [this message]
2014-04-23 22:08     ` [PATCH v2.1 " Heiko Stübner
2014-04-23 19:34 ` [PATCH v2 2/9] clk: samsung: add clock driver for external clock outputs Heiko Stübner
2014-04-23 19:34   ` Heiko Stübner
2014-04-23 19:35 ` [PATCH v2 3/9] ARM: S3C24XX: enable usage of common dclk if common clock framework is enabled Heiko Stübner
2014-04-23 19:35   ` Heiko Stübner
2014-04-23 20:09   ` [PATCH v2.1 " Heiko Stübner
2014-04-23 20:09     ` Heiko Stübner
2014-05-09 16:49     ` Paul Bolle
2014-05-09 16:49       ` Paul Bolle
2014-05-09 17:53       ` Tomasz Figa
2014-05-09 17:53         ` Tomasz Figa
2014-05-09 23:07         ` Heiko Stübner
2014-05-09 23:07           ` Heiko Stübner
2014-05-09 23:11           ` Tomasz Figa
2014-05-09 23:11             ` Tomasz Figa
2014-05-09 23:33             ` Heiko Stübner
2014-05-09 23:33               ` Heiko Stübner
2014-05-12 22:47               ` Kukjin Kim
2014-05-12 22:47                 ` Kukjin Kim
2014-05-12 22:57                 ` Heiko Stübner
2014-05-12 22:57                   ` Heiko Stübner
2014-05-09 22:57       ` Heiko Stübner
2014-05-09 22:57         ` Heiko Stübner
2014-04-23 19:36 ` [PATCH v2 4/9] dt-bindings: add documentation for s3c2410 clock controller Heiko Stübner
2014-04-23 19:36   ` Heiko Stübner
2014-05-06 15:19   ` [ATTN] " Tomasz Figa
2014-05-06 15:19     ` Tomasz Figa
2014-04-23 19:36 ` [PATCH v2 5/9] clk: samsung: add clock controller driver for s3c2410, s3c2440 and s3c2442 Heiko Stübner
2014-04-23 19:36   ` Heiko Stübner
2014-04-23 19:37 ` [PATCH v2 6/9] ARM: S3C24XX: add platform code for conversion to the common clock framework Heiko Stübner
2014-04-23 19:37   ` Heiko Stübner
2014-04-23 19:37 ` [PATCH v2 7/9] ARM: S3C24XX: convert s3c2440 and s3c2442 to " Heiko Stübner
2014-04-23 19:37   ` Heiko Stübner
2014-04-23 19:38 ` [PATCH v2 8/9] ARM: S3C24XX: convert s3c2410 " Heiko Stübner
2014-04-23 19:38   ` Heiko Stübner
2014-04-23 20:10   ` [PATCH v2.1 " Heiko Stübner
2014-04-23 20:10     ` Heiko Stübner
2014-04-23 19:38 ` [PATCH v2 9/9] ARM: S3C24XX: remove legacy clock code Heiko Stübner
2014-04-23 19:38   ` Heiko Stübner
2014-04-23 20:11   ` [PATCH v2.1 " Heiko Stübner
2014-04-23 20:11     ` Heiko Stübner

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=2638137.1oBdcbvcY8@phil \
    --to=heiko@sntech.de \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=t.figa@samsung.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.