From patchwork Mon Feb 6 09:27:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 9557349 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1F6A76021C for ; Mon, 6 Feb 2017 09:36:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE19625404 for ; Mon, 6 Feb 2017 09:36:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D316327CF3; Mon, 6 Feb 2017 09:36:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7612326247 for ; Mon, 6 Feb 2017 09:36:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cafj5-0000ja-0D; Mon, 06 Feb 2017 09:36:47 +0000 Received: from mail-wm0-f43.google.com ([74.125.82.43]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cafj1-0000gh-A2 for linux-arm-kernel@lists.infradead.org; Mon, 06 Feb 2017 09:36:45 +0000 Received: by mail-wm0-f43.google.com with SMTP id b65so111683748wmf.0 for ; Mon, 06 Feb 2017 01:36:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=kX+iVFGb6mzU0xM1fAb5SLvqc/gPdDVOJLiy1vy/PjI=; b=SYpBIEqbpTGXA1nDZVUZxFD2Hs2Q0b6h7BGIMAKPLOT9AWQFG64ToeBuvWxZkaooSz Oxb1CbgYv9QS9B7ADlMOR7UnPjUfs/vrzfYH6gZkvH37vvw0AeSlKdXqS2mXO8uRpfUJ aPve5pmTk3hKHK+ytjxzkURXM0A6mDqy3Vep/Nek5V/JnXT0+K8Zqwh2zHW3bUD5DNcm mfYbc8kwhxQgNJcpxHrb38fwGE2UyZQFtQdLAuqEvV8yC6eGwfwUgCjnv+yZ/PltU9pF fzgWS1xHIm4pCUBsG/F19gxDysoVaAXq9M2myp9xW2mpWf72xCvnqWlTYbp4g40S8Zf7 thTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding; bh=kX+iVFGb6mzU0xM1fAb5SLvqc/gPdDVOJLiy1vy/PjI=; b=BQY6ALynyZrtft8wgXqompMFToXxG9y/E7DrtLcz/M9xXFA78HbrXedCgdYUuCHYjF 3WqrUVIt5XMbHx1wQg3UGXk5M+G9suuHYsRnKZ8mCU06YDXzU29uFxXK0DnWuaylRaWK LBM/Hv5yK82BEbRmI7B7ZxaBEqSRX3RdIBErbuicnzcysqB3AKlm2drfmW7e5tFLFxrP LOqXyqoaiwneD1mWci7hVZxdPc7ie5LdWSJa+mldLOINFntUR9sgd5R+d4WnFd48bxHP 955fOQ1kKuvqF6sJsE6fk1F0clM61ieTbjmz9UivL0KaS72yNXgNPqlK8uuArZ4ZNDxH uwtg== X-Gm-Message-State: AIkVDXKh9BaWoa2ahDuJ8Fkfq4lXd6UsMQnzyXaP8GvuNJ/L9liSLlmwCwmy9I9aJavaEZ/2 X-Received: by 10.223.166.181 with SMTP id t50mr8392892wrc.80.1486373267506; Mon, 06 Feb 2017 01:27:47 -0800 (PST) Received: from [192.168.1.21] ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id w99sm370974wrb.5.2017.02.06.01.27.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Feb 2017 01:27:47 -0800 (PST) Subject: Re: [PATCH 0/2] scpi: RfC - Allow to ignore invalid SCPI DVFS clock rates To: Heiner Kallweit , Sudeep Holla References: From: Neil Armstrong Organization: Baylibre Message-ID: Date: Mon, 6 Feb 2017 10:27:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170206_013643_510322_C6AA3D47 X-CRM114-Status: GOOD ( 19.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, "linux-arm-kernel@lists.infradead.org" , Kevin Hilman Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On 02/04/2017 10:03 PM, Heiner Kallweit wrote: > On the Odroid C2 (Amlogic S905GXBB) the firmware defines SCPI DVFS cpu > clock rates which make the system crash or at least unstable. > Therefore cpufreq can't be used on this system as of today. > Other systems might face similar issues with too optimistic SCPI SVFS > clock rates. > > This RfC patch series addresses this by allowing to define a max > frequency per clock via DT. All frequencies for the respective clock > exceeding this threshold will be ignored. > > Heiner Kallweit (2): > clk: scpi: RfC - Allow to ignore invalid SCPI DVFS clock rates > cpufreq: scpi: RfC - Allow to ignore invalid SCPI DVFS clock rates > > Documentation/devicetree/bindings/arm/arm,scpi.txt | 7 +++++++ > drivers/clk/clk-scpi.c | 15 ++++++++++++++- > drivers/cpufreq/scpi-cpufreq.c | 22 ++++++++++++++++++++++ > 3 files changed, 43 insertions(+), 1 deletion(-) > Hi Heiner, Thanks for this pathset, I have an alternative patchset for this feature. My patchset adds a maximum frequency in the cpu node, this permits cleanly specifying a max frequency per cluster and leave the SCPI code intact since it's only a protocol implementation. Please find below a simpler implementation only touching the scpi-cpufreq code. Anyway, Sudeep, could you give us your point of view about such changes ? Neil ----><-- diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt index a1bcfee..b813933 100644 --- a/Documentation/devicetree/bindings/arm/cpus.txt +++ b/Documentation/devicetree/bindings/arm/cpus.txt @@ -276,6 +276,14 @@ nodes to be present and contain the properties described below. where voltage is in uV, frequency is in MHz. + - arm,scpi-dvfs-max-freq + Usage: optional + Value type: + Definition: + Specifies the maximum DVFS frequency in Hz unit this + CPU can support when the OPP tables are obtained via + the SCP interface. + Example 1 (dual-cluster big.LITTLE system 32-bit): cpus { diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts index 238fbea..881f20c 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts @@ -137,6 +137,22 @@ }; }; +&cpu0 { + arm,scpi-dvfs-max-freq = <1536000000>; +}; + +&cpu1 { + arm,scpi-dvfs-max-freq = <1536000000>; +}; + +&cpu2 { + arm,scpi-dvfs-max-freq = <1536000000>; +}; + +&cpu3 { + arm,scpi-dvfs-max-freq = <1536000000>; +}; + &uart_AO { status = "okay"; pinctrl-0 = <&uart_ao_a_pins>; diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c index ea7a4e1..80a6f27b 100644 --- a/drivers/cpufreq/scpi-cpufreq.c +++ b/drivers/cpufreq/scpi-cpufreq.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "arm_big_little.h" @@ -54,6 +55,11 @@ static int scpi_init_opp_table(const struct cpumask *cpumask) struct scpi_opp *opp; struct device *cpu_dev = get_cpu_device(cpumask_first(cpumask)); struct scpi_dvfs_info *info = scpi_get_dvfs_info(cpu_dev); + u32 max_freq = 0; + + /* Eventually get a platform frequency limitation */ + of_property_read_u32(cpu_dev->of_node, "arm,scpi-dvfs-max-freq", + &max_freq); if (IS_ERR(info)) return PTR_ERR(info); @@ -62,6 +68,10 @@ static int scpi_init_opp_table(const struct cpumask *cpumask) return -EIO; for (opp = info->opps, idx = 0; idx < info->count; idx++, opp++) { + /* Drop unsupported frequencies */ + if (max_freq && opp->freq > max_freq) + continue; + ret = dev_pm_opp_add(cpu_dev, opp->freq, opp->m_volt * 1000); if (ret) { dev_warn(cpu_dev, "failed to add opp %uHz %umV\n",