From patchwork Tue Mar 3 13:03:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 45366 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3B2872142B for ; Tue, 3 Mar 2015 13:04:13 +0000 (UTC) Received: by wiwl15 with SMTP id l15sf14909020wiw.0 for ; Tue, 03 Mar 2015 05:04:12 -0800 (PST) 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:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=GkBNkubh8JuLlY9e80YF/C4bY6SuskkekQpecfODNuo=; b=S64B0iPuKBRpKYpSus3aQ5htcgwFGjp9WYDwFrxM7As5xBbrqIH2J5DV0peLtbQvim TDdX5xgsW6pUms2Q6WQBZPMCXF7gTVRxP+nWTWA2AnRMhGrv7CvJfDEeIjr6j4TzM5UL TvUi+pmk3dg1ExpXDr0y/AlWE7cqVWsk/5xhcJ86EIIswRG2qMQOuTV/cc55xqA0oDLT KZ1tJyAN9wONblmp3OuIu6Q8dQiigkh1B7yq1RBp+m3Q7i+KTA/YgY1ay2KHAUqMMC4S 4MLL5QzzeW0nwLbg+4DhdNrjeje6m0DIOFHCHtlT0hw/gXuFFGThwbJtUHKtdtHgi0K8 5r+g== X-Gm-Message-State: ALoCoQmPHeE18E5pXQVIqXXAkb5PJBle03CtVVJOimIfRZGd7bJi5vnZCwpoOrtBTu0JYlCc14PU X-Received: by 10.112.126.194 with SMTP id na2mr4647515lbb.18.1425387852295; Tue, 03 Mar 2015 05:04:12 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.233 with SMTP id y9ls37688lae.9.gmail; Tue, 03 Mar 2015 05:04:12 -0800 (PST) X-Received: by 10.152.30.7 with SMTP id o7mr6602757lah.22.1425387852125; Tue, 03 Mar 2015 05:04:12 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id qv10si470590lbb.83.2015.03.03.05.04.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2015 05:04:12 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by labgd6 with SMTP id gd6so37232570lab.8 for ; Tue, 03 Mar 2015 05:04:11 -0800 (PST) X-Received: by 10.112.162.167 with SMTP id yb7mr28112984lbb.76.1425387851915; Tue, 03 Mar 2015 05:04:11 -0800 (PST) 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.112.35.133 with SMTP id h5csp549221lbj; Tue, 3 Mar 2015 05:04:10 -0800 (PST) X-Received: by 10.70.6.1 with SMTP id w1mr56400197pdw.62.1425387849872; Tue, 03 Mar 2015 05:04:09 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id et13si715529pac.236.2015.03.03.05.04.04; Tue, 03 Mar 2015 05:04:09 -0800 (PST) Received-SPF: none (google.com: linux-pm-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 S1756562AbbCCNDx (ORCPT + 11 others); Tue, 3 Mar 2015 08:03:53 -0500 Received: from mail-pd0-f171.google.com ([209.85.192.171]:40470 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756560AbbCCNDv (ORCPT ); Tue, 3 Mar 2015 08:03:51 -0500 Received: by pdbfp1 with SMTP id fp1so11118594pdb.7 for ; Tue, 03 Mar 2015 05:03:51 -0800 (PST) X-Received: by 10.68.172.162 with SMTP id bd2mr1231108pbc.89.1425387830941; Tue, 03 Mar 2015 05:03:50 -0800 (PST) Received: from localhost.localdomain ([180.150.148.224]) by mx.google.com with ESMTPSA id ak7sm971123pad.47.2015.03.03.05.03.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Mar 2015 05:03:50 -0800 (PST) From: Leo Yan To: Viresh Kumar , Shawn Guo , Thomas Petazzoni , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH 1/2] cpufreq-dt: support cluster level clock Date: Tue, 3 Mar 2015 21:03:36 +0800 Message-Id: <1425387817-11382-2-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1425387817-11382-1-git-send-email-leo.yan@linaro.org> References: <1425387817-11382-1-git-send-email-leo.yan@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: leo.yan@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.215.49 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: , In the previous code, cpufreq-dt driver support single clock shared by all CPUs or every CPU has dedicated clock; but it cannot support cluster level clock domain, which is very common implementation for ARM SoCs. So this patch add the support for cluster level clock; which use the platform parameter "clk_domain_boundary" to indicate whether the clock domain is bound to system level, cluster level or CPU level. Signed-off-by: Leo Yan --- drivers/cpufreq/Kconfig | 5 +++-- drivers/cpufreq/cpufreq-dt.c | 14 +++++++++++++- include/linux/cpufreq-dt.h | 16 ++++++++++++---- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index a171fef..fe1aee1 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig @@ -193,8 +193,9 @@ config CPUFREQ_DT select PM_OPP help This adds a generic DT based cpufreq driver for frequency management. - It supports both uniprocessor (UP) and symmetric multiprocessor (SMP) - systems which share clock and voltage across all CPUs. + It supports uniprocessor (UP), and symmetric multiprocessor (SMP) + systems which share clock and voltage across all CPUs; and it also + supports cluster level or cpu level's clock domain. If in doubt, say N. diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index bab67db..c03532c 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -294,8 +294,20 @@ static int cpufreq_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency = transition_latency; pd = cpufreq_get_driver_data(); - if (!pd || !pd->independent_clocks) + if (!pd || pd->clk_domain_boundary == CPUFREQ_DT_CLK_PER_SYS) cpumask_setall(policy->cpus); + else if (pd->clk_domain_boundary == CPUFREQ_DT_CLK_PER_CLUSTER) + cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu)); + else if (pd->clk_domain_boundary != CPUFREQ_DT_CLK_PER_CPU) { + /* + * If each CPU has its own clock, don't need bind cpus; + * otherwise will handle wrong parameter. + */ + dev_err(cpu_dev, "%s: invalid clk boundary value: %d\n", + __func__, pd->clk_domain_boundary); + ret = -EINVAL; + goto out_free_cpufreq_table; + } of_node_put(np); diff --git a/include/linux/cpufreq-dt.h b/include/linux/cpufreq-dt.h index 0414009..d6fe6e3 100644 --- a/include/linux/cpufreq-dt.h +++ b/include/linux/cpufreq-dt.h @@ -10,13 +10,21 @@ #ifndef __CPUFREQ_DT_H__ #define __CPUFREQ_DT_H__ +enum cpufreq_dt_clk_type { + CPUFREQ_DT_CLK_PER_SYS = 0, + CPUFREQ_DT_CLK_PER_CLUSTER, + CPUFREQ_DT_CLK_PER_CPU, +}; + struct cpufreq_dt_platform_data { /* - * True when each CPU has its own clock to control its - * frequency, false when all CPUs are controlled by a single - * clock. + * Use this to distinguish three kinds of clock domain: + * + * - all CPUs are controlled by a single clock; + * - all CPUs in cluster share one clock; + * - each CPU has its own clock to control its frequency; */ - bool independent_clocks; + enum cpufreq_dt_clk_type clk_domain_boundary; }; #endif /* __CPUFREQ_DT_H__ */