From patchwork Fri May 16 07:50:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jhbird.choi@samsung.com X-Patchwork-Id: 4187921 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EF751BFF02 for ; Fri, 16 May 2014 07:53:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5518C20306 for ; Fri, 16 May 2014 07:53:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2EB022026F for ; Fri, 16 May 2014 07:53:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WlCuq-0006Qn-Ck; Fri, 16 May 2014 07:50:52 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WlCum-0006NQ-Sc for linux-arm-kernel@lists.infradead.org; Fri, 16 May 2014 07:50:50 +0000 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N5N00BZBPS0PC70@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 16 May 2014 16:50:24 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.51]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id DF.7A.11120.043C5735; Fri, 16 May 2014 16:50:24 +0900 (KST) X-AuditID: cbfee68f-b7eff6d000002b70-46-5375c3402d16 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 78.C7.25708.F33C5735; Fri, 16 May 2014 16:50:24 +0900 (KST) Received: from DOJHBIRDCHO03 ([12.36.166.127]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N5N00HOKPRZP070@mmp1.samsung.com>; Fri, 16 May 2014 16:50:23 +0900 (KST) From: Jonghwan Choi To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, cpufreq@vger.kernel.org Subject: [PATCH] cpufreq: exynos: Fix the compile error Date: Fri, 16 May 2014 16:50:23 +0900 Message-id: <006c01cf70db$7e7f3b90$7b7db2b0$@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-index: Ac9w2z44Fo+9D400SYumpXvYHylYSw== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBIsWRmVeSWpSXmKPExsVy+t8zY12Hw6XBBueOc1k8bfrBbjH/yDlW i94FV9ksNj2+xmox4/w+Jov+hb1MFhu/ejiwe9y5tofNY/OSeo++LasYPR4tbmH0+LxJLoA1 issmJTUnsyy1SN8ugSuj68VTpoK39hU7F31hb2BcadrFyMkhIWAicaTzJyOELSZx4d56ti5G Lg4hgWWMEncW9jDCFF160wWVWMQocfLAYijnH6NEz+tl7CBVbAK6EsfWb2EFSYgINDFKvLr5 m7mLkYODWaBSYu4XYZAaYQELiV9LF4DVswioSvx6/AxsA6+ApUTHhn1QtqDEj8n3WEBsZgEt ifU7jzNB2PISm9e8ZYa4SEFix9nXjCDjRQT0JP5MZoUoEZHY9+IdI8gJEgLn2CXWv9vLDLFL QOLb5EMsIPUSArISmw5AjZGUOLjiBssERrFZSDbPQrJ5FpLNs5CsWMDIsopRNLUguaA4Kb3I WK84Mbe4N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5T1BhCN3m+MmGV6GC+16D5TX/Dg+gffjqQDGu+eCXzV5mK5l dGpwmn37kPYyqcnXW99VcZ7pZ1jb5mPy9kcXp/i2aCslL/ZlNhaBZ/M8XdTlBI8q9yVKK0YI vtDdGOldY3r+/FP19TOiHB4osRRnJBpqMRcVJwIAZOdGXjgDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140516_005049_114905_A466DAF6 X-CRM114-Status: GOOD ( 20.33 ) X-Spam-Score: -5.6 (-----) Cc: "'Rafael J. Wysocki'" , 'Viresh Kumar' , 'Kukjin Kim' X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(). Signed-off-by: Jonghwan Choi --- .../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 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; diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-exynos.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-exynos.txt new file mode 100644 index 0000000..f5e8ac6 --- /dev/null +++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-exynos.txt @@ -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"; + }; diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 5805035..9606f90 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm @@ -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 diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index f99cfe2..cfc8c75 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c @@ -16,7 +16,10 @@ #include #include #include +#include #include +#include +#include #include @@ -155,19 +158,44 @@ static struct cpufreq_driver exynos_driver = { #endif }; +static const struct of_device_id exynos_cpufreq_match[] = { + { .compatible = "samsung,exynos4210-cpufreq", .data = (void*)EXYNOS_SOC_4210 }, + { .compatible = "samsung,exynos4212-cpufreq", .data = (void*)EXYNOS_SOC_4212 }, + { .compatible = "samsung,exynos4412-cpufreq", .data = (void*)EXYNOS_SOC_4412 }, + { .compatible = "samsung,exynos5250-cpufreq", .data = (void*)EXYNOS_SOC_5250 }, + {}, +}; +MODULE_DEVICE_TABLE(of, exynos_cpufreq_match); + static int exynos_cpufreq_probe(struct platform_device *pdev) { int ret = -EINVAL; + struct device_node *np; + const struct of_device_id *match; + + np = pdev->dev.of_node; + if (!np) + return -ENODEV; + + match = of_match_device(exynos_cpufreq_match, &pdev->dev); + if (!match) { + pr_err("%s: Unknown device mode\n", __func__); + goto err_put_node; + } exynos_info = kzalloc(sizeof(*exynos_info), GFP_KERNEL); - if (!exynos_info) - return -ENOMEM; + if (!exynos_info) { + ret = -ENOMEM; + goto err_put_node; + } + + exynos_info->type = (long)match->data; - if (soc_is_exynos4210()) + if (exynos_info->type == EXYNOS_SOC_4210) ret = exynos4210_cpufreq_init(exynos_info); - else if (soc_is_exynos4212() || soc_is_exynos4412()) + else if (exynos_info->type == EXYNOS_SOC_4212 || exynos_info->type == EXYNOS_SOC_4412) ret = exynos4x12_cpufreq_init(exynos_info); - else if (soc_is_exynos5250()) + else if (exynos_info->type == EXYNOS_SOC_5250) ret = exynos5250_cpufreq_init(exynos_info); else return 0; @@ -189,20 +217,25 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) /* Done here as we want to capture boot frequency */ locking_frequency = clk_get_rate(exynos_info->cpu_clk) / 1000; - if (!cpufreq_register_driver(&exynos_driver)) + if (!cpufreq_register_driver(&exynos_driver)) { + of_node_put(np); return 0; + } pr_err("%s: failed to register cpufreq driver\n", __func__); regulator_put(arm_regulator); err_vdd_arm: kfree(exynos_info); - return -EINVAL; +err_put_node: + of_node_put(np); + return ret; } static struct platform_driver exynos_cpufreq_platdrv = { .driver = { .name = "exynos-cpufreq", .owner = THIS_MODULE, + .of_match_table = exynos_cpufreq_match, }, .probe = exynos_cpufreq_probe, }; diff --git a/drivers/cpufreq/exynos-cpufreq.h b/drivers/cpufreq/exynos-cpufreq.h index 3ddade8..f189547 100644 --- a/drivers/cpufreq/exynos-cpufreq.h +++ b/drivers/cpufreq/exynos-cpufreq.h @@ -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; diff --git a/drivers/cpufreq/exynos4x12-cpufreq.c b/drivers/cpufreq/exynos4x12-cpufreq.c index 466c76a..63a3907 100644 --- a/drivers/cpufreq/exynos4x12-cpufreq.c +++ b/drivers/cpufreq/exynos4x12-cpufreq.c @@ -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); }