From patchwork Tue Mar 19 17:53:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 229163 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 25D132C007B for ; Wed, 20 Mar 2013 04:57:31 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UI0jZ-0006gh-Ja; Tue, 19 Mar 2013 17:54:01 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UI0it-0006YU-8C for linux-arm-kernel@lists.infradead.org; Tue, 19 Mar 2013 17:53:25 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r2JHrEEh026254; Tue, 19 Mar 2013 12:53:14 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2JHrE7O000398; Tue, 19 Mar 2013 12:53:14 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Tue, 19 Mar 2013 12:53:14 -0500 Received: from localhost (kahuna.am.dhcp.ti.com [128.247.75.12]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2JHrEXl017677; Tue, 19 Mar 2013 12:53:14 -0500 From: Nishanth Menon To: Subject: [PATCH V2 8/8] cpufreq: OMAP: donot allow to be used with device tree Date: Tue, 19 Mar 2013 12:53:10 -0500 Message-ID: <1363715590-5131-9-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1363715590-5131-1-git-send-email-nm@ti.com> References: <1363715590-5131-1-git-send-email-nm@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130319_135319_386848_108731DC X-CRM114-Status: GOOD ( 13.59 ) X-Spam-Score: -9.4 (---------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-9.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.153 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -2.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Nishanth Menon , =?UTF-8?q?Beno=C3=AEt=20Cousson?= , linux-pm@vger.kernel.org, Kevin Hilman , Keerthy , devicetree-discuss@lists.ozlabs.org, cpufreq@vger.kernel.org, Santosh Shilimkar , Jon Hunter , Shawn Guo , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org We now use Soc generic cpufreq-cpu0 driver using DT entries. However to allow cpufreq-cpu0 and omap-cpufreq drivers to co-exist, we need to ensure the following using the same image: 1. With device tree boot, we use cpufreq-cpu0 2. With non device tree boot, we use omap-cpufreq In the case of (1), we will have cpu OPPs and regulator registered as part of the DT, to ensure that omap-cpufreq and cpufreq-cpu0 don't conflict in managing the frequency of the same cpu, we should not permit init to pass in omap-cpufreq. In the case of (2), we will not have the cpufreq-cpu0 device, hence only omap-cpufreq will be active. So, to acommodate both these usage conditions, we fail init of omap-cpufreq when we boot with device tree. Cc: Kevin Hilman Cc: Jon Hunter Cc: "BenoƮt Cousson" Cc: Santosh Shilimkar Cc: Shawn Guo Cc: Keerthy Cc: linux-omap@vger.kernel.org Cc: devicetree-discuss@lists.ozlabs.org Cc: linux-arm-kernel@lists.infradead.org Cc: cpufreq@vger.kernel.org Cc: linux-pm@vger.kernel.org Signed-off-by: Nishanth Menon Acked-by: Santosh Shilimkar --- Changes in V2: - donot remove support for omap-cpufreq in non-DT boot - little more verbose commit log V1: https://patchwork.kernel.org/patch/2273641/ drivers/cpufreq/omap-cpufreq.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c index 9128c07..9382ed0 100644 --- a/drivers/cpufreq/omap-cpufreq.c +++ b/drivers/cpufreq/omap-cpufreq.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -174,6 +175,19 @@ static inline void freq_table_free(void) static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy) { int result = 0; + struct device_node *np; + + /* + * If we have a device tree node describing OPPs, + * we will NOT permit usage of omap-cpufreq driver. + * use cpufreq-cpu0 driver to manage. + */ + if (of_have_populated_dt()) { + for_each_child_of_node(of_find_node_by_path("/cpus"), np) { + if (of_get_property(np, "operating-points", NULL)) + return -EPERM; + } + } mpu_clk = clk_get(NULL, "cpufreq_ck"); if (IS_ERR(mpu_clk))