Skip to contentSkip to conversation

cpufreq: exynos: Fix the compile error

PATCH Superseded Jonghwan Choi 2 participants 3 messages May 16, 2014

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cpufreq: exynos: Fix the compile error

Commit 7da83a80 ("ARM: EXYNOS: Migrate Exynos specific macros from plat to mach") which lands in samsung tree causes build breakage for cpufreq-exynos like following:
drivers/cpufreq/exynos-cpufreq.c: In function 'exynos_cpufreq_probe':
drivers/cpufreq/exynos-cpufreq.c:166:2: error: implicit declaration of function 'soc_is_exynos4210' [-Werror=implicit-function-declaration]
drivers/cpufreq/exynos-cpufreq.c:168:2: error: implicit declaration of function 'soc_is_exynos4212' [-Werror=implicit-function-declaration]
drivers/cpufreq/exynos-cpufreq.c:168:2: error: implicit declaration of function 'soc_is_exynos4412' [-Werror=implicit-function-declaration]
drivers/cpufreq/exynos-cpufreq.c:170:2: error: implicit declaration of function 'soc_is_exynos5250' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[2]: *** [drivers/cpufreq/exynos-cpufreq.o] Error 1
make[2]: *** Waiting for unfinished jobs....
drivers/cpufreq/exynos4x12-cpufreq.c: In function 'exynos4x12_set_clkdiv':
drivers/cpufreq/exynos4x12-cpufreq.c:118:2: error: implicit declaration of function 'soc_is_exynos4212' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[2]: *** [drivers/cpufreq/exynos4x12-cpufreq.o] Error 1
make[1]: *** [drivers/cpufreq] Error 2
This fixes above error with getting SoC information via DT instead of soc_is_exynosXXXX().

---
 .../devicetree/bindings/cpufreq/cpufreq-exynos.txt |   18 ++++++++
 drivers/cpufreq/Kconfig.arm                        |    4 +-
 drivers/cpufreq/exynos-cpufreq.c                   |   47 +++++++++++++++++---
 drivers/cpufreq/exynos-cpufreq.h                   |    8 ++++
 drivers/cpufreq/exynos4x12-cpufreq.c               |   11 ++---
 5 files changed, 72 insertions(+), 16 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/cpufreq/cpufreq-exynos.txt
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/cpufreq/cpufreq-exynos.txt new file mode 100644
index 0000000..f5e8ac6

Documentation/devicetree/bindings/cpufreq/cpufreq-exynos.txt new file +18 -0
@@ -0,0 +1,18 @@
+
+Exynos cpufreq driver
+-------------------
+
+Exynos4210/4212/4412/5250 SoC cpufreq driver for CPU frequency scaling.
+
+Required properties:
+  - compatible: value should be either of the following.
+      (a) "samsung, exynos4210-cpufreq", for Exynos4210.
+      (b) "samsung, exynos4212-cpufreq", for Exynos4212.
+      (c) "samsung, exynos4412-cpufreq", for Exynos4412.
+      (d) "samsung, exynos5250-cpufreq", for Exynos5250.
+
+Example:
+--------
+	cpufreq@10030000 {
+		compatible = "samsung,exynos4210-cpufreq";
+	};
drivers/cpufreq/Kconfig.arm +2 -2
index 5805035..9606f90 100644
@@ -27,6 +27,8 @@ config ARM_VEXPRESS_SPC_CPUFREQ
 
 config ARM_EXYNOS_CPUFREQ
 	bool
+	depends on HAVE_CLK && OF
+	select PM_OPP
 
 config ARM_EXYNOS4210_CPUFREQ
 	bool "SAMSUNG EXYNOS4210"
@@ -64,8 +66,6 @@ config ARM_EXYNOS5250_CPUFREQ
 config ARM_EXYNOS5440_CPUFREQ
 	bool "SAMSUNG EXYNOS5440"
 	depends on SOC_EXYNOS5440
-	depends on HAVE_CLK && OF
-	select PM_OPP
 	default y
 	help
 	  This adds the CPUFreq driver for Samsung EXYNOS5440
drivers/cpufreq/exynos-cpufreq.c +40 -7

86 lines not on this page · raw message

drivers/cpufreq/exynos-cpufreq.h +8 -0
index 3ddade8..f189547 100644
@@ -17,6 +17,13 @@ enum cpufreq_level_index {
 	L20,
 };
 
+enum exynos_soc_type {
+	EXYNOS_SOC_4210,
+	EXYNOS_SOC_4212,
+	EXYNOS_SOC_4412,
+	EXYNOS_SOC_5250,
+};
+
 #define APLL_FREQ(f, a0, a1, a2, a3, a4, a5, a6, a7, b0, b1, b2, m, p, s) \
 	{ \
 		.freq = (f) * 1000, \
@@ -34,6 +41,7 @@ struct apll_freq {
 };
 
 struct exynos_dvfs_info {
+	enum exynos_soc_type type;
 	unsigned long	mpll_freq_khz;
 	unsigned int	pll_safe_idx;
 	struct clk	*cpu_clk;
drivers/cpufreq/exynos4x12-cpufreq.c +4 -7
index 466c76a..63a3907 100644
@@ -100,7 +100,6 @@ static struct apll_freq apll_freq_4412[] = {
 static void exynos4x12_set_clkdiv(unsigned int div_index)
 {
 	unsigned int tmp;
-	unsigned int stat_cpu1;
 
 	/* Change Divider - CPU0 */
 
@@ -115,13 +114,11 @@ static void exynos4x12_set_clkdiv(unsigned int div_index)
 	tmp = apll_freq_4x12[div_index].clk_div_cpu1;
 
 	__raw_writel(tmp, EXYNOS4_CLKDIV_CPU1);
-	if (soc_is_exynos4212())
-		stat_cpu1 = 0x11;
-	else
-		stat_cpu1 = 0x111;
 
-	while (__raw_readl(EXYNOS4_CLKDIV_STATCPU1) & stat_cpu1)
+	do {
 		cpu_relax();
+		tmp = __raw_readl(EXYNOS4_CLKDIV_STATCPU1);
+	} while (tmp != 0x0);
 }
 
 static void exynos4x12_set_apll(unsigned int index)
@@ -184,7 +181,7 @@ int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info)
 	if (IS_ERR(mout_apll))
 		goto err_mout_apll;
 
-	if (soc_is_exynos4212())
+	if (info->type == EXYNOS_SOC_4212)
 		apll_freq_4x12 = apll_freq_4212;
 	else
 		apll_freq_4x12 = apll_freq_4412;
Signature · 1 line
1.7.10.4
#1 lore raw

Hi Jonghwan,

Quoted 47 lines · Jonghwan Choi

Commit 7da83a80 ("ARM: EXYNOS: Migrate Exynos specific macros from plat to mach") which lands in samsung tree causes build breakage for cpufreq-exynos like following:
drivers/cpufreq/exynos-cpufreq.c: In function 'exynos_cpufreq_probe':
drivers/cpufreq/exynos-cpufreq.c:166:2: error: implicit declaration of function 'soc_is_exynos4210' [-Werror=implicit-function-declaration]
drivers/cpufreq/exynos-cpufreq.c:168:2: error: implicit declaration of function 'soc_is_exynos4212' [-Werror=implicit-function-declaration]
drivers/cpufreq/exynos-cpufreq.c:168:2: error: implicit declaration of function 'soc_is_exynos4412' [-Werror=implicit-function-declaration]
drivers/cpufreq/exynos-cpufreq.c:170:2: error: implicit declaration of function 'soc_is_exynos5250' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[2]: *** [drivers/cpufreq/exynos-cpufreq.o] Error 1
make[2]: *** Waiting for unfinished jobs....
drivers/cpufreq/exynos4x12-cpufreq.c: In function 'exynos4x12_set_clkdiv':
drivers/cpufreq/exynos4x12-cpufreq.c:118:2: error: implicit declaration of function 'soc_is_exynos4212' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[2]: *** [drivers/cpufreq/exynos4x12-cpufreq.o] Error 1
make[1]: *** [drivers/cpufreq] Error 2
This fixes above error with getting SoC information via DT instead of soc_is_exynosXXXX().

---
 .../devicetree/bindings/cpufreq/cpufreq-exynos.txt |   18 ++++++++
 drivers/cpufreq/Kconfig.arm                        |    4 +-
 drivers/cpufreq/exynos-cpufreq.c                   |   47 +++++++++++++++++---
 drivers/cpufreq/exynos-cpufreq.h                   |    8 ++++
 drivers/cpufreq/exynos4x12-cpufreq.c               |   11 ++---
 5 files changed, 72 insertions(+), 16 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/cpufreq/cpufreq-exynos.txt
Documentation/devicetree/bindings/cpufreq/cpufreq-exynos.txt new file +8 -0
new file mode 100644
index 0000000..f5e8ac6
@@ -0,0 +1,18 @@
+
+Exynos cpufreq driver
+-------------------
+
+Exynos4210/4212/4412/5250 SoC cpufreq driver for CPU frequency scaling.
+
+Required properties:
+  - compatible: value should be either of the following.

Documentation/devicetree/bindings/cpufreq/cpufreq-exynos.txt line 18

Quoted 10 lines
Documentation/devicetree/bindings/cpufreq/cpufreq-exynos.txt new file +10 -0
+      (a) "samsung, exynos4210-cpufreq", for Exynos4210.
+      (b) "samsung, exynos4212-cpufreq", for Exynos4212.
+      (c) "samsung, exynos4412-cpufreq", for Exynos4412.
+      (d) "samsung, exynos5250-cpufreq", for Exynos5250.
+
+Example:
+--------
+	cpufreq@10030000 {
+		compatible = "samsung,exynos4210-cpufreq";
+	};

Sorry, NAK. Cpufreq is not a real device on the SoC and this is not the right way to represent it in DT.

We have been discussing Exynos cpufreq framework rework, including DT support since quite a long time. so if you want to know details, please look at respective discussion threads. I don't have time to find them for you right now, but if you look for threads of cpufreq patches by Thomas Abraham and ones about Exynos multiplatform support, then you should have quite complete set of information.

In general, I can see three ways to "fix" this for 3.15:

1) revert moving soc_is_* macros to mach-exynos/common.h,

2) move soc_is_* macros to a header in mach-exynos/include/mach/,

3) use of_machine_is_compatible() or of_match_node() on root node in this driver to match directly with SoC compatible strings.

Probably option 3) would be preferred, as it would remove some of the dependencies of this driver on arch code and including plat/cpu.h (or mach/cpu.h as would be introduced by 2)) would be no longer necessary.

Best regards,
Tomasz

#2 lore raw
Quoted 5 lines · Tomasz Figa

We have been discussing Exynos cpufreq framework rework, including DT support since quite a long time. so if you want to know details, please look at respective discussion threads. I don't have time to find them for you right now, but if you look for threads of cpufreq patches by Thomas Abraham and ones about Exynos multiplatform support, then you should have quite complete set of information.

I will check that.

Quoted 4 lines

In general, I can see three ways to "fix" this for 3.15:

1) revert moving soc_is_* macros to mach-exynos/common.h,

Quoted 8 lines

2) move soc_is_* macros to a header in mach-exynos/include/mach/,

3) use of_machine_is_compatible() or of_match_node() on root node in this driver to match directly with SoC compatible strings.

Probably option 3) would be preferred, as it would remove some of the dependencies of this driver on arch code and including plat/cpu.h (or mach/cpu.h as would be introduced by 2)) would be no longer necessary.

Thanks~

Best Regards.