From patchwork Tue Feb 6 04:49:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Icenowy Zheng X-Patchwork-Id: 10202377 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 B1F1260134 for ; Tue, 6 Feb 2018 05:09:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A07C728879 for ; Tue, 6 Feb 2018 05:09:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9497A28A0B; Tue, 6 Feb 2018 05:09:12 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable 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 A08EF28879 for ; Tue, 6 Feb 2018 05:09:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Fim7RoeBJar7Gs7jtvWtOcBkGyJFVh08etrmc+oF3T0=; b=mG8HEJQ/0GxisL4teGlvhneurI gi9oryktn6iIWXB5rdo7hNM1V/Qxr7thq8H9DW9Hr/yNT/VvHQidYCqx6H9Vg+Ft1yjJIXXT53qYo X/18mt6Hx7+ExM0cK1nOZ1HEqrXRckhg+U81DW3+SCHLaF6+HTU6SIb7gzQIAONwzWAlpEbPMXKEn UPo/VaxSrxMHDjPA5boFjfPrCaSgdi54yTcayyLYHjoOfTNOER8pI2C2GLFtFULz9t6DGai94Sot6 w3JFJXnh+ekdkGq6G/EsiacL+cbb1YTrjnVN3Yu86jj3X4qmcKIXJ3DR6adHyrrJMbhSsRNwPTDF3 uui0rBPw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eivVG-000075-1n; Tue, 06 Feb 2018 05:09:10 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eivV4-0008Mc-SL for linux-arm-kernel@bombadil.infradead.org; Tue, 06 Feb 2018 05:08:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jRKHU0JIwOHSvSYTwxKDWPJWFwggrWmGN+dbRFHpBC8=; b=FyNrhwN/FH2Qohj8nxyciFg2B Eu9AzoATqVqXXZG/9NiMBiAwWH86FFxR3O11RLs5taAwnAUFr+cHg1jom8Xy3S5uI+bVZKcRb57e5 3lLJjOVTlU0tc9mIpFcN+qJk0KaXajv/qR1POa9+fs5cgOtMnkHQWitJaFUZOyN2sSVQoKILaEFWE 2sP+Tqv/CQlZX8fh67IUq4EgVp+swQ2T79L4BMl2rdUREoXYViEV/qdtf7r3CM79sfC24FGECNJpb HF6RA4UvRxs0/HkjbahhqgDNmuVIl0aP0Ho1zU6bPkF1VmCRmKH0cNJ4aPwHN8AVKi5LMj2GNgcH4 HPF5nXUzw==; Received: from bird.maple.relay.mailchannels.net ([23.83.214.17]) by merlin.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eivE0-0004Rz-In for linux-arm-kernel@lists.infradead.org; Tue, 06 Feb 2018 04:51:22 +0000 X-Sender-Id: lmn-tzduiowcrqmw|x-authsender|icenowy@aosc.io Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id A64215C0427; Tue, 6 Feb 2018 04:51:03 +0000 (UTC) Received: from hermes.aosc.io (unknown [100.96.30.35]) (Authenticated sender: lmn-TZDUIOWCRQMW) by relay.mailchannels.net (Postfix) with ESMTPA id CBA645C0087; Tue, 6 Feb 2018 04:51:02 +0000 (UTC) X-Sender-Id: lmn-tzduiowcrqmw|x-authsender|icenowy@aosc.io Received: from hermes.aosc.io (hermes.aosc.io [172.18.41.110]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.13.1); Tue, 06 Feb 2018 04:51:03 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: lmn-tzduiowcrqmw|x-authsender|icenowy@aosc.io X-MailChannels-Auth-Id: lmn-TZDUIOWCRQMW X-Arch-Reign: 5fe3df0c7a3515c2_1517892663428_3379010693 X-MC-Loop-Signature: 1517892663428:393806195 X-MC-Ingress-Time: 1517892663427 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id C7A6457019; Tue, 6 Feb 2018 04:50:58 +0000 (UTC) From: Icenowy Zheng To: Liam Girdwood , Rob Herring , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v2 05/10] ARM: sun8i: h3: add operating-points-v2 table for CPU Date: Tue, 6 Feb 2018 12:49:00 +0800 Message-Id: <20180206044905.30508-6-icenowy@aosc.io> In-Reply-To: <20180206044905.30508-1-icenowy@aosc.io> References: <20180206044905.30508-1-icenowy@aosc.io> 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: devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Icenowy Zheng MIME-Version: 1.0 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 The CPU on Allwinner H3 can do dynamic frequency scaling. Add a DVFS table based on the one shipped with Allwinner's H3 SDK. The voltage-frequency relationship seems to be conservative, and Armbian has another DVFS table which uses lower voltage at a certain frequency. However, the official one is chosen for safety. Frequencies higher than 1008MHz are temporarily dropped in the table, as they may lead to over voltage on boards without proper regulator settings or over temperature on boards with proper regulator settings. They will be added back once regulator settings are ready and thermal sensor driver is merged. In order to satisfy all different regulators (SY8106A which is 50mV per level, SY8113B which have two states: 1.1V and 1.3V, and some board with non-tweakable regulators), all the OPPs are defined with a range which has the target value as the minimum allowed value, and 1.3V (the highest VDD-CPUX voltage suggested by the datasheet) as the maximum allowed value. It's proven to work well with a board with SY8113B. Signed-off-by: Icenowy Zheng --- Changes in v2: - Switch to BSP OPP table, which is more conservative. arch/arm/boot/dts/sun8i-h3.dtsi | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi index 8495deecedad..36608c03f02b 100644 --- a/arch/arm/boot/dts/sun8i-h3.dtsi +++ b/arch/arm/boot/dts/sun8i-h3.dtsi @@ -43,32 +43,62 @@ #include "sunxi-h3-h5.dtsi" / { + cpu0_opp_table: opp_table0 { + compatible = "operating-points-v2"; + opp-shared; + + opp@648000000 { + opp-hz = /bits/ 64 <648000000>; + opp-microvolt = <1040000 1040000 1300000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + + opp@816000000 { + opp-hz = /bits/ 64 <816000000>; + opp-microvolt = <1100000 1100000 1300000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + + opp@1008000000 { + opp-hz = /bits/ 64 <1008000000>; + opp-microvolt = <1200000 1200000 1300000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + }; + cpus { #address-cells = <1>; #size-cells = <0>; - cpu@0 { + cpu0: cpu@0 { compatible = "arm,cortex-a7"; device_type = "cpu"; reg = <0>; + clocks = <&ccu CLK_CPUX>; + clock-names = "cpu"; + operating-points-v2 = <&cpu0_opp_table>; + #cooling-cells = <0x2>; }; cpu@1 { compatible = "arm,cortex-a7"; device_type = "cpu"; reg = <1>; + operating-points-v2 = <&cpu0_opp_table>; }; cpu@2 { compatible = "arm,cortex-a7"; device_type = "cpu"; reg = <2>; + operating-points-v2 = <&cpu0_opp_table>; }; cpu@3 { compatible = "arm,cortex-a7"; device_type = "cpu"; reg = <3>; + operating-points-v2 = <&cpu0_opp_table>; }; };