From patchwork Sat Jan 4 06:35:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 11317559 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D6D09139A for ; Sat, 4 Jan 2020 06:35:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AFDC2222C4 for ; Sat, 4 Jan 2020 06:35:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JRArmoz9"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y1wY7mau" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AFDC2222C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=qnzWQ15xbgQV0xYY2tmqFlURzKXVA9e+hWazerQaqJo=; b=JRArmoz9yhHNgy JmS96iRtBC+KwBohgt0g9ywnu3lmG4ATpZWjgZ/WGrtkKZo3Cd3yaaw90atLhQ0r7blAMy2AbeoNO 4d7kjsXT7EBxzT2rnPao4bGORUZthNZEf9FRT1fYfTHBs2Jx62b+d1BZbUPSb5JADOpCZtPmfCJmL O1NRHvn0jNhvfqlHFjzvTKRoWmV0/mLVQpUQcdFXVemiphGnNrv5G3dDJKJ5/KKeiZEVTjYgWAd7d ILj3jxd9ROrUmhU1GOye+Oz2yMvMcdg4m6g29c2tC/eHA++lobOuhM0nYKKdfNOd3+4uaMuU9cReY iAqrb949d+ujdUATngyA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ind1w-0001bQ-1G; Sat, 04 Jan 2020 06:35:24 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ind1o-0001V7-68 for linux-arm-kernel@lists.infradead.org; Sat, 04 Jan 2020 06:35:17 +0000 Received: by mail-pf1-x444.google.com with SMTP id z16so24489061pfk.0 for ; Fri, 03 Jan 2020 22:35:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SloPzaQUm48i+euJ9SPgozPrNYGcAsYY8nvYw6D2HVg=; b=Y1wY7mauLBv7oaOllvmoHt99Z978+COG6HD/v3ZS9aRqidQWRBkkI9tf1M8ukgmWst AuruzHyn6ayI1c+1wqkA8ddbjl7wx+a9iKgAztxNlPcOKOQZc6g7MrZmYr5GJ8N8NTgN gv837uuURUGlAopvFZYTNTSjErozvuOQh9RflUcrzg9cc2Idul8rDTerV884kMbOtLUR tORJnoCo1YOFtfBaQQT7m1OWvaOjNVPQ+7ZrI54+5PPzS4EHJj2KFYxjYYaC+qQY8W/6 mq146l/vhc6g1KxupAoW4PpoyXVQkMIp89JtodfVSKz2cax1KNWsCwEmgKTg94MaqVVD qtFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SloPzaQUm48i+euJ9SPgozPrNYGcAsYY8nvYw6D2HVg=; b=PjWj5twJ9O3veA8K2aPZU//K6mXNXym4sh9n1mvT30prFHA9tuwZzunQXrPo5VICmS SZ1srGDNIbBSB1ucsuo4Jh+Gc1tgGeyXc+wYSDolhnWcY2xvpSnBHQuaEXVZt45HqWWf iFmYjAf2sE4SRMa7/S6yyA91zNjY0ohPvf2E6cra2OU3UsYZDfUnAQcXFTDae+5sJNcm 9kEXIVapRf22UO3p6vs+2D+NfxLi9V4sSpZRldEcDydJSpJnhj6EoinpVLN8I0I/cu9m xiVflZF8+XIs8llFm0JN3YQG2Hc2FDzLyN1uPkpSqbNHGuorQDryLqUkqVD9c5oioFdz 8vEQ== X-Gm-Message-State: APjAAAXduuUe3176l2lHtt0pPRjkmZYOz48LwQAZ5i+GLnkTNdnyVTmn 2TSGvzY3dbbmN3u84BYusV4= X-Google-Smtp-Source: APXvYqyRc2s3lo5lzbr/lBfdxvyvN66VWXyPfn741RO3s8zgkT2sjHUqc0sisIUEK81fxn9ePs6wzQ== X-Received: by 2002:a63:770c:: with SMTP id s12mr103738254pgc.25.1578119715439; Fri, 03 Jan 2020 22:35:15 -0800 (PST) Received: from anarsoul-thinkpad.lan (216-71-213-236.dyn.novuscom.net. [216.71.213.236]) by smtp.gmail.com with ESMTPSA id u2sm64761580pgc.19.2020.01.03.22.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 22:35:15 -0800 (PST) From: Vasily Khoruzhick To: Maxime Ripard , Chen-Yu Tsai , Rob Herring , Mark Rutland , Michael Turquette , Stephen Boyd , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH 1/3] clk: sunxi-ng: add mux and pll notifiers for A64 CPU clock Date: Fri, 3 Jan 2020 22:35:03 -0800 Message-Id: <20200104063505.219030-2-anarsoul@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200104063505.219030-1-anarsoul@gmail.com> References: <20200104063505.219030-1-anarsoul@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200103_223516_225475_2A05D493 X-CRM114-Status: GOOD ( 13.53 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (anarsoul[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasily Khoruzhick , Icenowy Zheng Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Icenowy Zheng The A64 PLL_CPU clock has the same instability if some factor changed without the PLL gated like other SoCs with sun6i-style CCU, e.g. A33, H3. Add the mux and pll notifiers for A64 CPU clock to workaround the problem. Fixes: c6a0637460c2 ("clk: sunxi-ng: Add A64 clocks") Signed-off-by: Icenowy Zheng Signed-off-by: Vasily Khoruzhick --- drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 28 ++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c index 49bd7a4c015c..5f66bf879772 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c @@ -921,11 +921,26 @@ static const struct sunxi_ccu_desc sun50i_a64_ccu_desc = { .num_resets = ARRAY_SIZE(sun50i_a64_ccu_resets), }; +static struct ccu_pll_nb sun50i_a64_pll_cpu_nb = { + .common = &pll_cpux_clk.common, + /* copy from pll_cpux_clk */ + .enable = BIT(31), + .lock = BIT(28), +}; + +static struct ccu_mux_nb sun50i_a64_cpu_nb = { + .common = &cpux_clk.common, + .cm = &cpux_clk.mux, + .delay_us = 1, /* > 8 clock cycles at 24 MHz */ + .bypass_index = 1, /* index of 24 MHz oscillator */ +}; + static int sun50i_a64_ccu_probe(struct platform_device *pdev) { struct resource *res; void __iomem *reg; u32 val; + int ret; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); reg = devm_ioremap_resource(&pdev->dev, res); @@ -939,7 +954,18 @@ static int sun50i_a64_ccu_probe(struct platform_device *pdev) writel(0x515, reg + SUN50I_A64_PLL_MIPI_REG); - return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_a64_ccu_desc); + ret = sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_a64_ccu_desc); + if (ret) + return ret; + + /* Gate then ungate PLL CPU after any rate changes */ + ccu_pll_notifier_register(&sun50i_a64_pll_cpu_nb); + + /* Reparent CPU during PLL CPU rate changes */ + ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk, + &sun50i_a64_cpu_nb); + + return 0; } static const struct of_device_id sun50i_a64_ccu_ids[] = { From patchwork Sat Jan 4 06:35:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 11317563 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B1F92921 for ; Sat, 4 Jan 2020 06:35:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8CB02222C4 for ; Sat, 4 Jan 2020 06:35:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="I+RIduck"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N3OQHln9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8CB02222C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U1qkjIyropHJutAU38z+letE5fDC7Nf+nNZQA9mAQvY=; b=I+RIduckDraX0E tjhCpyVSzsY9EOAAETIGIRTxs/aR9IrFeCKjXR48c/5hfhEPq/meRYtcHPqQti/N8USFZ2/Y5dlCC JWdWvFoD1VumofQ2CIMFkSclRYK9R55VIjNaOUCyBpy+r+10i+DFooboN7k3pqMWo4nFj4gtlXiCH wPh+qKB+w7yW6naCRIz8mJEU324/Wa3vuAwgE64lH5gLA3pCu9mBsGiUQDsDolYHDiFCHpYCwfCJN eEwY2W09eIc2BLBgs923v9poFZL6oCWRfqB74XkFPfHHiXFWcvjjlakZu6yy2VI5ZD3yywztcpIQ8 ch+bXM6ScMXhzOBJta0A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ind2D-0001ww-04; Sat, 04 Jan 2020 06:35:41 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ind1p-0001VY-3l for linux-arm-kernel@lists.infradead.org; Sat, 04 Jan 2020 06:35:18 +0000 Received: by mail-pf1-x436.google.com with SMTP id 4so24467233pfz.9 for ; Fri, 03 Jan 2020 22:35:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r5PKGVb0dDuVUlJ0+VCUDjDjxFbtyh7Bp6dOX8cXxZk=; b=N3OQHln9X+hJ8yMsU3mNQMI5zuWGRE/v6GRy3UBwgP8D5naP5ZA04A/HpAQrEwstIP GmaPV4f9hHw+7XGxv/LHzgBLnUYfUYkH9mTlEyr/K8ao7yMP3RRj8spC2iEeHV8E7cF5 PNJBsZp7Eof3ag+a6Sn6RA1npkxv5SjCkjxmJvHVUv6rMqcb4d7VjSv3tOLi4Bqdy4fR DRNSIWJsCuTqLfHGJnUuojWf7e2tOkG61r2XIMvLpLfepnaRi1ykKvLvdXI8E6GQ3i8z EPpyq3LAWRE2j0LhuGEqBbjZjuXGBpM31nkB1ySeQwgWbUIUS1QD2rHi2CjFzFClCXRB YXGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r5PKGVb0dDuVUlJ0+VCUDjDjxFbtyh7Bp6dOX8cXxZk=; b=ctir21li9VgVEXAQ+uxq0NST9+BUNq61tzit9qGDC5ET5GwCzZD8nI/6SaUOmKvJDJ r0znA7qPWsWPgEcm5bpdybRvPyfFlVG+TSFSDg3JNpwDYg+iVp/bSARgvo4WrdVc/LAR Z3gmxlIDK0CfXxrw0x7qD8aStiDeHxCZZ0qUAklJ7ssx4ROopFUMPXTtlxL0VYPyfwMY i4iqHj1Dn6V8BHLBq3uCWbpbPBlyrspubiwtVPUR/LZp52pagpddRwgdqX4giuqxCROP fotwChYcJYGZkJgTaz2Jw12VvzU+fAXkXvJi9d1Fgkv6UHXNnqVRj7MpNqJ9rCQz/smP /XnQ== X-Gm-Message-State: APjAAAUCkDWBzliC0oG9IFb7qVYpV5joZn3ATQmwiQ96s3rDETfjrP3O 7HWLkXmx9dsVhh3UfZqkjeM= X-Google-Smtp-Source: APXvYqwZj8SDI7DbUOwYdHKJrDNeMHcthHxarF0VkAChIuOoMuHZFsfaTqF6idwcE3+kpOQCLXH43w== X-Received: by 2002:a65:578e:: with SMTP id b14mr100617080pgr.444.1578119716337; Fri, 03 Jan 2020 22:35:16 -0800 (PST) Received: from anarsoul-thinkpad.lan (216-71-213-236.dyn.novuscom.net. [216.71.213.236]) by smtp.gmail.com with ESMTPSA id u2sm64761580pgc.19.2020.01.03.22.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 22:35:15 -0800 (PST) From: Vasily Khoruzhick To: Maxime Ripard , Chen-Yu Tsai , Rob Herring , Mark Rutland , Michael Turquette , Stephen Boyd , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH 2/3] clk: sunxi-ng: a64: export CLK_CPUX clock for DVFS Date: Fri, 3 Jan 2020 22:35:04 -0800 Message-Id: <20200104063505.219030-3-anarsoul@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200104063505.219030-1-anarsoul@gmail.com> References: <20200104063505.219030-1-anarsoul@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200103_223517_151235_73A280F4 X-CRM114-Status: GOOD ( 11.70 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (anarsoul[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:436 listed in] [list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Export CLK_CPUX so we can reference it in CPU node. Signed-off-by: Vasily Khoruzhick --- drivers/clk/sunxi-ng/ccu-sun50i-a64.h | 1 - include/dt-bindings/clock/sun50i-a64-ccu.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.h b/drivers/clk/sunxi-ng/ccu-sun50i-a64.h index 979929276709..116e6f826d04 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.h +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.h @@ -36,7 +36,6 @@ #define CLK_PLL_HSIC 18 #define CLK_PLL_DE 19 #define CLK_PLL_DDR1 20 -#define CLK_CPUX 21 #define CLK_AXI 22 #define CLK_APB 23 #define CLK_AHB1 24 diff --git a/include/dt-bindings/clock/sun50i-a64-ccu.h b/include/dt-bindings/clock/sun50i-a64-ccu.h index a8ac4cfcdcbc..e512a1c9b0fc 100644 --- a/include/dt-bindings/clock/sun50i-a64-ccu.h +++ b/include/dt-bindings/clock/sun50i-a64-ccu.h @@ -46,6 +46,7 @@ #define CLK_PLL_VIDEO0 7 #define CLK_PLL_PERIPH0 11 +#define CLK_CPUX 21 #define CLK_BUS_MIPI_DSI 28 #define CLK_BUS_CE 29 #define CLK_BUS_DMA 30 From patchwork Sat Jan 4 06:35:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 11317565 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 23D3F921 for ; Sat, 4 Jan 2020 06:35:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EAF402085B for ; Sat, 4 Jan 2020 06:35:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ej9bE1qG"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M4DKWAZE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAF402085B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D28B31b9A6w4gvmYCvppot7lJbHDyXTAw5zt9PGybMs=; b=Ej9bE1qGk5yB+C Bq5XhviXj6HY2DXj3LFhbDMVUN4ybc7C20uoV9BGX0qj0uBOTL18pTzTrLx2oMCq/VeNAdTuchcQd 0wtKiJ90Z3+/0DlmI0XYkVHHSPIYBLZW/OzzxbvLk14icAAoQ7gfsOgIcL0YshFJqZTGDPoOw1VG9 lzn/sLegXrAm/6mHmzJz+1YyVdcltCba5z7VKK6s5EGK/oavJ9goKQjgrqSZwRmg5V6h9PyADWwh2 oZztktoiwI+tRvXM4fHDTMEqXfqneFma0EWQoWQK+mpkeurSiU1mehUKQlD5YJUBMYVEX6bbfgnR6 c7d9Rwpdr47l0HS5tFEw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ind2P-00029a-Np; Sat, 04 Jan 2020 06:35:53 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ind1q-0001W4-Bh for linux-arm-kernel@lists.infradead.org; Sat, 04 Jan 2020 06:35:20 +0000 Received: by mail-pg1-x541.google.com with SMTP id s64so24358900pgb.9 for ; Fri, 03 Jan 2020 22:35:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yPtjDACR3H8K2uS1u9GQH0pid4N/OfHQXapx3wWocvc=; b=M4DKWAZE5QNZFoTHdeYXS06rY4JLo3uDrBNEw5WCHH+wu79VXgr/uRhsyCf60a2hTg bONQe20s3Sykap/CYALiA2SHNLVZRoJMEwez+lLdXdaU27GukTUeplxvqVxBM7KeaqF+ j3KKVdmgeBpMEtx3N3/zIArUM7ouuyYB3Wr6XSaCwMU92b6zZxoSO79Dw1KM7+TiHqS8 pebmaQ+9SXJNBrTeQ2sNRwc2wCGn9OSlTsZh3TRWCU5D9WPFLnYNIJj/rDx0BE/7drKh 6Tb7TRslU2/NzUvykRFommL8z+oQVhD09LS1czUHzTdT3BNuaoJSnqGOjjnRBZKOrckc lFmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yPtjDACR3H8K2uS1u9GQH0pid4N/OfHQXapx3wWocvc=; b=amhx7KphcwmgSAtrVc4rwZPiDIoqPIOT6QoC6yJHa1u1x5ZM5Q+8VKNIsdnVUEvHj4 PdWspUUBy8M8s+Mud2IoSi4QySaODPvUe9pf3emxonuV+vKnE+9FS4jfOvXk+TSbrSk1 +kMYI2Iezpq2UGjFk8XkU03dr6jzyoMp2PcK1q6BLVLTh3UsjUmpIZYmY+VauWrRIdIo Fm4M0p+QbhGrcU3eQR1BNPxrdgQVqgugTZMgS7c8CJUgQ+fv/Y/t9MAIsu8tEb/7GqPb NfX9wi4umhktLicJikp7r/ZXaOAE1+5K5Uv7i1UJr+grxC7LAyOvtAeIWqtfQm2gXsTS 4Fsw== X-Gm-Message-State: APjAAAVJUMR5ShTV3+Ccxdyfgjq4U622fYksGwAy7RtP93thUCgOTkwh eN4ZM0uBRQadzL0v6do3p+k= X-Google-Smtp-Source: APXvYqz5KiFQHxhZgupk5DoDrXsn58WhGeos+ZPkVYJG3AhthXc8O7ZT3cG/Nsr0Pl3lyJ9AXgGosg== X-Received: by 2002:a63:9d85:: with SMTP id i127mr95917777pgd.186.1578119717534; Fri, 03 Jan 2020 22:35:17 -0800 (PST) Received: from anarsoul-thinkpad.lan (216-71-213-236.dyn.novuscom.net. [216.71.213.236]) by smtp.gmail.com with ESMTPSA id u2sm64761580pgc.19.2020.01.03.22.35.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 22:35:16 -0800 (PST) From: Vasily Khoruzhick To: Maxime Ripard , Chen-Yu Tsai , Rob Herring , Mark Rutland , Michael Turquette , Stephen Boyd , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH 3/3] arm64: dts: allwinner: a64: enable DVFS Date: Fri, 3 Jan 2020 22:35:05 -0800 Message-Id: <20200104063505.219030-4-anarsoul@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200104063505.219030-1-anarsoul@gmail.com> References: <20200104063505.219030-1-anarsoul@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200103_223518_408828_FC1D5A7D X-CRM114-Status: GOOD ( 11.98 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (anarsoul[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add CPU regulator, CPU clock, operation points and thermal trip points to enable DVFS on A64 Signed-off-by: Vasily Khoruzhick --- .../allwinner/sun50i-a64-amarula-relic.dts | 4 + .../dts/allwinner/sun50i-a64-bananapi-m64.dts | 4 + .../dts/allwinner/sun50i-a64-nanopi-a64.dts | 4 + .../dts/allwinner/sun50i-a64-olinuxino.dts | 4 + .../dts/allwinner/sun50i-a64-orangepi-win.dts | 4 + .../boot/dts/allwinner/sun50i-a64-pine64.dts | 4 + .../dts/allwinner/sun50i-a64-pinebook.dts | 4 + .../allwinner/sun50i-a64-sopine-baseboard.dts | 4 + .../boot/dts/allwinner/sun50i-a64-sopine.dtsi | 4 + .../boot/dts/allwinner/sun50i-a64-teres-i.dts | 4 + arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 102 ++++++++++++++++++ 11 files changed, 142 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-amarula-relic.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-amarula-relic.dts index 5634245d11db..43f6ac0beed6 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-amarula-relic.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-amarula-relic.dts @@ -65,6 +65,10 @@ wifi_pwrseq: wifi-pwrseq { }; }; +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + &csi { status = "okay"; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts index 208373efee49..cbcab80de8c5 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts @@ -108,6 +108,10 @@ &codec_analog { status = "okay"; }; +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + &dai { status = "okay"; }; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts index 9b9d9157128c..6708acf94d01 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts @@ -87,6 +87,10 @@ wifi_pwrseq: wifi_pwrseq { }; }; +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + &de { status = "okay"; }; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts index 01a9a52edae4..f94e60eb4ec2 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts @@ -87,6 +87,10 @@ wifi_pwrseq: wifi_pwrseq { }; }; +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + &de { status = "okay"; }; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts index f54a415f2e3b..2793afba4884 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts @@ -123,6 +123,10 @@ &codec_analog { status = "okay"; }; +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + &dai { status = "okay"; }; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts index 409523cb0950..04aa452d4400 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts @@ -84,6 +84,10 @@ &codec_analog { status = "okay"; }; +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + &dai { status = "okay"; }; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts index 78c82a665c84..365d85c16deb 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts @@ -98,6 +98,10 @@ &codec_analog { status = "okay"; }; +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + &dai { status = "okay"; }; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts index 920103ec0046..e760e8efdf3e 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts @@ -100,6 +100,10 @@ &codec_analog { status = "okay"; }; +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + &dai { status = "okay"; }; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi index 9d20e13f0c02..3d8e2d452ce1 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi @@ -51,6 +51,10 @@ &codec_analog { cpvdd-supply = <®_eldo1>; }; +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + &mmc0 { pinctrl-names = "default"; pinctrl-0 = <&mmc0_pins>; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts index 970415106dcf..28edcef8bed1 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts @@ -104,6 +104,10 @@ &de { status = "okay"; }; +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + &ehci1 { status = "okay"; }; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi index 5e3f16c3b706..7f37c8cd1b6e 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi @@ -80,6 +80,52 @@ simplefb_hdmi: framebuffer-hdmi { }; }; + cpu0_opp_table: opp_table0 { + compatible = "operating-points-v2"; + opp-shared; + + opp-648000000 { + opp-hz = /bits/ 64 <648000000>; + opp-microvolt = <1040000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + opp-816000000 { + opp-hz = /bits/ 64 <816000000>; + opp-microvolt = <1100000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + opp-912000000 { + opp-hz = /bits/ 64 <912000000>; + opp-microvolt = <1120000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + opp-960000000 { + opp-hz = /bits/ 64 <960000000>; + opp-microvolt = <1160000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + opp-1008000000 { + opp-hz = /bits/ 64 <1008000000>; + opp-microvolt = <1200000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + opp-1056000000 { + opp-hz = /bits/ 64 <1056000000>; + opp-microvolt = <1240000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + opp-1104000000 { + opp-hz = /bits/ 64 <1104000000>; + opp-microvolt = <1260000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + opp-1152000000 { + opp-hz = /bits/ 64 <1152000000>; + opp-microvolt = <1300000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; + }; + cpus { #address-cells = <1>; #size-cells = <0>; @@ -90,6 +136,10 @@ cpu0: cpu@0 { reg = <0>; enable-method = "psci"; next-level-cache = <&L2>; + clocks = <&ccu CLK_CPUX>; + clock-names = "cpu"; + operating-points-v2 = <&cpu0_opp_table>; + #cooling-cells = <2>; }; cpu1: cpu@1 { @@ -98,6 +148,10 @@ cpu1: cpu@1 { reg = <1>; enable-method = "psci"; next-level-cache = <&L2>; + clocks = <&ccu CLK_CPUX>; + clock-names = "cpu"; + operating-points-v2 = <&cpu0_opp_table>; + #cooling-cells = <2>; }; cpu2: cpu@2 { @@ -106,6 +160,10 @@ cpu2: cpu@2 { reg = <2>; enable-method = "psci"; next-level-cache = <&L2>; + clocks = <&ccu CLK_CPUX>; + clock-names = "cpu"; + operating-points-v2 = <&cpu0_opp_table>; + #cooling-cells = <2>; }; cpu3: cpu@3 { @@ -114,6 +172,10 @@ cpu3: cpu@3 { reg = <3>; enable-method = "psci"; next-level-cache = <&L2>; + clocks = <&ccu CLK_CPUX>; + clock-names = "cpu"; + operating-points-v2 = <&cpu0_opp_table>; + #cooling-cells = <2>; }; L2: l2-cache { @@ -218,6 +280,46 @@ cpu_thermal: cpu0-thermal { polling-delay-passive = <0>; polling-delay = <0>; thermal-sensors = <&ths 0>; + + cooling-maps { + map0 { + trip = <&cpu_alert0>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + map1 { + trip = <&cpu_alert1>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + + trips { + cpu_alert0: cpu_alert0 { + /* milliCelsius */ + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_alert1: cpu_alert1 { + /* milliCelsius */ + temperature = <90000>; + hysteresis = <2000>; + type = "hot"; + }; + + cpu_crit: cpu_crit { + /* milliCelsius */ + temperature = <110000>; + hysteresis = <2000>; + type = "critical"; + }; + }; }; gpu0_thermal: gpu0-thermal {