From patchwork Wed Sep 10 04:29:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 37179 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AB0A820566 for ; Wed, 10 Sep 2014 04:29:31 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id vb8sf87183783obc.0 for ; Tue, 09 Sep 2014 21:29:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=7+iHWN13nEObRfv3SuaXRTUHYJSdDo1eUye0CMJcQgI=; b=ikF7wNeu1P0QvJtRpbiNDynoNiZa/W9Gi8DJ28vDM0Pymcu+ddsx5RKTsaoE1iAx4V 1VFcInSy569yB7/qwby6IPmJyFKy09LRCJ+NaP0tVrTbioD9qE0dyzQ34kgVkkLLx6sr 517GluVDiXIou84+AZf6Pcw1a5cnXd9QfKPAZvka6E9DQ1iX6UAeX3Y8Wm1L2ytckz0e iMZ80GVltGo6aDmHHRl1uU4YFbocEcY3++tFLG1vAiNA+mcZqOE9xffKig0kiuGTcnEp k9JdjZd5Ox0MmmMS4CrmUpEU0r3MAmOSb7PUovdNLyXgqrCTZkPjJg7sGfo8yFkf3FZD E77w== X-Gm-Message-State: ALoCoQl9Bx6sDyrllKIjfz/7EFQwvKR/k+cf9hHAiZhwcL5MKt1zpe0LP0ZPZpNEdmj1IlJRdVnt X-Received: by 10.182.28.102 with SMTP id a6mr11619723obh.44.1410323371057; Tue, 09 Sep 2014 21:29:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.197 with SMTP id w63ls1392881qge.93.gmail; Tue, 09 Sep 2014 21:29:30 -0700 (PDT) X-Received: by 10.53.6.132 with SMTP id cu4mr4661653vdd.62.1410323370925; Tue, 09 Sep 2014 21:29:30 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id cx4si5991862vcb.38.2014.09.09.21.29.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Sep 2014 21:29:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id lf12so18223855vcb.34 for ; Tue, 09 Sep 2014 21:29:30 -0700 (PDT) X-Received: by 10.52.141.76 with SMTP id rm12mr3667265vdb.71.1410323370839; Tue, 09 Sep 2014 21:29:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp381304vcb; Tue, 9 Sep 2014 21:29:30 -0700 (PDT) X-Received: by 10.70.134.231 with SMTP id pn7mr46604173pdb.82.1410323369983; Tue, 09 Sep 2014 21:29:29 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bb1si25830214pbb.173.2014.09.09.21.29.29 for ; Tue, 09 Sep 2014 21:29:29 -0700 (PDT) Received-SPF: none (google.com: linux-arm-msm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750851AbaIJE32 (ORCPT + 5 others); Wed, 10 Sep 2014 00:29:28 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:57785 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750734AbaIJE31 (ORCPT ); Wed, 10 Sep 2014 00:29:27 -0400 Received: by mail-pa0-f50.google.com with SMTP id bj1so4900504pad.23 for ; Tue, 09 Sep 2014 21:29:27 -0700 (PDT) X-Received: by 10.69.31.10 with SMTP id ki10mr35376395pbd.11.1410323367227; Tue, 09 Sep 2014 21:29:27 -0700 (PDT) Received: from localhost ([122.167.129.166]) by mx.google.com with ESMTPSA id b14sm13217102pdk.2.2014.09.09.21.29.25 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 09 Sep 2014 21:29:26 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, shawn.guo@linaro.org, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, spk.linux@gmail.com, thomas.ab@samsung.com, t.figa@samsung.com, santosh.shilimkar@ti.com, thomas.petazzoni@free-electrons.com, pramod.gurav@smartplayin.com, rob.herring@linaro.org, mike.turquette@linaro.org, Viresh Kumar Subject: [PATCH] cpufreq: dt: Support platforms with separate clock lines for each CPU Date: Wed, 10 Sep 2014 09:59:07 +0530 Message-Id: X-Mailer: git-send-email 2.0.3.693.g996b0fd Sender: linux-arm-msm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , There has been lots of discussion over mailing lists about how to get CPU's clock sharing information for platforms as CPUFreq core depends on that. It doesn't look that there will be any immediate solution to that as there are multiple views over how to get that from DT. But there are platforms (already upstreamed) which depend on this requirement and are waiting for a solution to sail through. The common thing about them (Krait and Mvebu) is that all CPUs have independent clock lines and that makes things easier for us. So, this patch creates another Kconfig option to indicate if all CPUs share same clock line or all have independent. The complex cases of multiple clusters having separate clock lines, but having same for all CPUs within a cluster isn't addressed yet. This is a *short-term* solution for getting these platforms up an running and a DT based solution should be upstreamed soon. Signed-off-by: Viresh Kumar Acked-by: Viresh Kumar Acked-by: Viresh Kumar Acked-by: Viresh Kumar --- Yesterday again I was pinged by Thomas about the status of this work and the thread isn't going anywhere. He is blocked with just this to get his platform running on mainline. Will it be possible to get this through as a temporary solution? drivers/cpufreq/Kconfig | 9 +++++++++ drivers/cpufreq/cpufreq-dt.c | 17 +++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index 3489f8f..a755227 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig @@ -196,6 +196,15 @@ config CPUFREQ_DT If in doubt, say N. +config CPUFREQ_DT_INDEPENDENT_CLOCKS + bool "CPUs change clocks independently" + depends on CPUFREQ_DT + help + Selecting this will make cpufreq-dt driver believe that all CPUs have + independent clock lines and so all will have separate 'struct + cpufreq_policy' instances for them. This must be replaced by proper DT + bindings later on. + menu "x86 CPU frequency scaling drivers" depends on X86 source "drivers/cpufreq/Kconfig.x86" diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index e002650..dbb6f22 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -266,9 +266,22 @@ static int cpufreq_init(struct cpufreq_policy *policy) policy->driver_data = priv; policy->clk = cpu_clk; - ret = cpufreq_generic_init(policy, freq_table, transition_latency); - if (ret) + ret = cpufreq_table_validate_and_show(policy, freq_table); + if (ret) { + dev_err(cpu_dev, "%s: invalid frequency table: %d\n", __func__, + ret); goto out_cooling_unregister; + } + + policy->cpuinfo.transition_latency = transition_latency; + +#ifndef CONFIG_CPUFREQ_DT_INDEPENDENT_CLOCKS + /* + * The driver only supports the SMP configuartion where all processors + * share the clock and voltage and clock. + */ + cpumask_setall(policy->cpus); +#endif return 0;