From patchwork Wed Jan 8 05:23:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 11322815 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 6E5AC138D for ; Wed, 8 Jan 2020 05:24:15 +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 092F22072B for ; Wed, 8 Jan 2020 05:24:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OyfUS0ie"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ncdGwmPr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 092F22072B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=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=oQXeP2+fjVZX2p8w3ZOllSA6pMHpZj6oXh/7ymDjLSA=; b=OyfUS0ieb51M+D Ya4tA4kGp9HdmZV4c0a2uaz6DYg1LBr0/aHQAzfgid720LK6z3T80HCJvWSMMgLqokwpj58deZmq1 c9b80v4qTCLN1kxfqWEGTVJji/Lo3kLDxzABEBcE4lM9cJ7QU9YVGX4yxeVmJmvSM5rMWN/44MuOK 5QkaliVW2/ZbuQ/tPK2zIK/v4WlnEs8VtmrKNXl9aPsureFybTfLWjC3OeU1BO9zmW3e0+Zo3SjSt yJwPeZyjPl7oGN8MdkdBbU/kyGlrRMeraBV3TQME3GaRtH15o5mooIrfXS/ZYrpTRaz7meDot/nqN nEL/NsONhyjMVrdyAPSQ==; 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 1ip3pB-0004tP-Ty; Wed, 08 Jan 2020 05:24:09 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ip3p0-0004fa-Ph for linux-mediatek@lists.infradead.org; Wed, 08 Jan 2020 05:24:00 +0000 Received: by mail-pl1-x642.google.com with SMTP id f20so633961plj.5 for ; Tue, 07 Jan 2020 21:23:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DM0aqT7mORcDNurEQApqfEBtkQorM/LzpTMTVlrl9aM=; b=ncdGwmPrHI55/SBDBh0DPZoQrK3Lo1SJ9dJj2j29oKPgH8ThCHSPN8yJdVWZ+MwCoh AQH8qdCIHUUUgK3eD0s2gZ7Scd8kIBUxEuPYi/tYu6vCjPnwJEUy+Ic4IhNL/dhbVFoJ n9tJAzlRy9Zb0V7jWB54FlbdHEoNXslhoaz2A= 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=DM0aqT7mORcDNurEQApqfEBtkQorM/LzpTMTVlrl9aM=; b=HCr89p2n8HJJIwB2sWGnabYx7WzLgoUFDOtQuIjn2rslD8B+uFjk3PrmMzMyIhi/Fy LZJWxk5zYe9kf2aotqRE0P+2kSn7XYlZtwryGf2/QgSjLt2h+Hk/l5b7LP7qbUv/6tWT RICnFqTt915teceCZdEpDDPUS+650RA0aJ2B9eHU45rBhy4sS5KCOWDey1pr97/DdxL4 Kv30ZsWiMzUefSBH79vLeFlrqrnGz+JEnIryYQhgeEh9xItAj7q6t/9CDudb6Z+WjQW7 tZT9FStq0+wPu68OhkEQ8zck1GUvo3MTCAXGP3hI3LEAaDQc2T0f1Afa6x0SfSj/9Cid bm8g== X-Gm-Message-State: APjAAAWION7S6thrFekY4OtCndTudWlsHINjxJrrghg++lSFevL6H/ZQ v8Br9PQId3HFkJNZN/M+oSc093Hwq2c= X-Google-Smtp-Source: APXvYqx6Kh3IRlEF2mYf7QKx3EM0H7n0giv6QuZmqNIaB7ToM5za17Tr8aM8sd8jKkiVpN89SHLohQ== X-Received: by 2002:a17:902:6bca:: with SMTP id m10mr3635095plt.212.1578461038146; Tue, 07 Jan 2020 21:23:58 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:d8b7:33af:adcb:b648]) by smtp.gmail.com with ESMTPSA id n24sm387505pff.12.2020.01.07.21.23.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 21:23:57 -0800 (PST) From: Nicolas Boichat To: Rob Herring Subject: [PATCH v2 1/7] dt-bindings: gpu: mali-bifrost: Add Mediatek MT8183 Date: Wed, 8 Jan 2020 13:23:31 +0800 Message-Id: <20200108052337.65916-2-drinkcat@chromium.org> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog In-Reply-To: <20200108052337.65916-1-drinkcat@chromium.org> References: <20200108052337.65916-1-drinkcat@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200107_212358_833454_B0439C7A X-CRM114-Status: UNSURE ( 8.09 ) X-CRM114-Notice: Please train this message. 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:642 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_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Tomeu Vizoso , David Airlie , linux-kernel@vger.kernel.org, Liam Girdwood , dri-devel@lists.freedesktop.org, Steven Price , Mark Brown , linux-mediatek@lists.infradead.org, Alyssa Rosenzweig , Daniel Vetter , hsinyi@chromium.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org Define a compatible string for the Mali Bifrost GPU found in Mediatek's MT8183 SoCs. Signed-off-by: Nicolas Boichat --- .../bindings/gpu/arm,mali-bifrost.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml index 4ea6a8789699709..9e095608d2d98f0 100644 --- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml +++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml @@ -17,6 +17,7 @@ properties: items: - enum: - amlogic,meson-g12a-mali + - mediatek,mt8183-mali - realtek,rtd1619-mali - rockchip,px30-mali - const: arm,mali-bifrost # Mali Bifrost GPU model/revision is fully discoverable @@ -62,6 +63,23 @@ allOf: minItems: 2 required: - resets + - if: + properties: + compatible: + contains: + const: mediatek,mt8183-mali + then: + properties: + sram-supply: true + power-domains: + description: + List of phandle and PM domain specifier as documented in + Documentation/devicetree/bindings/power/power_domain.txt + minItems: 3 + maxItems: 3 + required: + - sram-supply + - power-domains examples: - | From patchwork Wed Jan 8 05:23:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 11322825 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 246281398 for ; Wed, 8 Jan 2020 05:24:49 +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 00CBF20705 for ; Wed, 8 Jan 2020 05:24:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UeutAj0h"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="NkVCUiKN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 00CBF20705 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=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=4x57alurc+Ie890p1HcJNxdciEvMY4+N62PaF9HUT48=; b=UeutAj0hAnQsk1 ryGPNwVTYbMjSOEZzkr1VTqZboEpXsOXfAc86XlOagD2xiw3nemLK0dENpvmHU/n4RS1vvGxa+/p/ iZUrwXmD/l1NmEmcvlSZ7L3uBHowE+Nsm68OIB6Ws3EhHbIhGqpnpf0Tewgj6WmK1jbHzzbBUZ+e+ OAIJuJgaVCiyBvbT/KQJ2Gwc9dUK6Htr2aopCXTK5IxESL8HVOf5/vQ2BntARHZzWk8yjvScQQXdR nQF024AnPouCC3bFC9iFy3NumWfC64shaDI14tgCtlURWyroMmsLVKz6S/9A2YL5XOX7RjPKW2ChQ e4z2ZH7Nb9pxhfjj5Dhg==; 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 1ip3pn-0005Wv-4z; Wed, 08 Jan 2020 05:24:47 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ip3p3-0004iP-OD for linux-mediatek@lists.infradead.org; Wed, 08 Jan 2020 05:24:04 +0000 Received: by mail-pf1-x442.google.com with SMTP id p14so1020629pfn.4 for ; Tue, 07 Jan 2020 21:24:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lllmZMa5R6OSarsk8DAetZxTWweyF2murgh0XlHq6j4=; b=NkVCUiKNiOJ9C+pbhXp0aEB19RPqRC6wDm+6NS8Rr/QZs/IAYhTqfvM5dahItDjNi2 w99fCIjhyz4QnH/H+A5Tkx79ELP7lzPKVSYKJ2AU6rLW3U7TWhWa7Q85F56l0LaPbz78 JJ7+bjD2dnlIc3L6d2ILkOPzx292Vi6xrOtKo= 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=lllmZMa5R6OSarsk8DAetZxTWweyF2murgh0XlHq6j4=; b=NkkLIfupBvknUPaj8JL0EsSo9ShCL3QwE3RT7idxsXrL5wkuLXV85e518BWS2/SPhB 12J29O4SKn2nKxZMfXUS1JDzwnqJZdcV0XHTPpb+FPmjCWfKMhjnxin1o3XjYzimKHo5 TxFC+VvMecowIe7RGIMHXhd7sq3HRxjdT0vkdHoZ/YTUnznp90x5JmDiabT6ri5+VnEs Rykoom0Gx6i0Xeb65A2xavrTVQAgYKIt0kyzAGtFxpmaypK42oVfcBTKw74Z5PdvMPqi 6MuOPoLsScldMtiiTtiMGvIgkvcuV7d5dPjdjcDSw454G3ziRBIZL3dS4bkZgmf+VApv G98g== X-Gm-Message-State: APjAAAV+AwNEqtw70qfaiLONLe5++4m0tU6PScXpj5mQJMT4MCDZaeFu K16H3Wd89u8JOZzJ0IJgSxtDEQ== X-Google-Smtp-Source: APXvYqy9kdjs/Um2IyO+H3n2Uvl2wwJ0A9aXcxstBbPu8pAseFU4tXf5tBo4X2iXZIDhrkk0EScOYA== X-Received: by 2002:a63:d041:: with SMTP id s1mr3417134pgi.363.1578461041186; Tue, 07 Jan 2020 21:24:01 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:d8b7:33af:adcb:b648]) by smtp.gmail.com with ESMTPSA id n24sm387505pff.12.2020.01.07.21.23.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 21:24:00 -0800 (PST) From: Nicolas Boichat To: Rob Herring Subject: [PATCH v2 2/7] arm64: dts: mt8183: Add node for the Mali GPU Date: Wed, 8 Jan 2020 13:23:32 +0800 Message-Id: <20200108052337.65916-3-drinkcat@chromium.org> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog In-Reply-To: <20200108052337.65916-1-drinkcat@chromium.org> References: <20200108052337.65916-1-drinkcat@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200107_212401_841047_B6A46FEE X-CRM114-Status: GOOD ( 12.49 ) 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:442 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_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Tomeu Vizoso , David Airlie , linux-kernel@vger.kernel.org, Liam Girdwood , dri-devel@lists.freedesktop.org, Steven Price , Mark Brown , linux-mediatek@lists.infradead.org, Alyssa Rosenzweig , Daniel Vetter , hsinyi@chromium.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org Add a basic GPU node for mt8183. Signed-off-by: Nicolas Boichat --- Upstreaming what matches existing bindings from our Chromium OS tree: https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-4.19/arch/arm64/boot/dts/mediatek/mt8183.dtsi#1348 The evb part of this change depends on this patch to add PMIC dtsi: https://patchwork.kernel.org/patch/10928161/ The binding we use with out-of-tree Mali drivers includes more clocks, this is used for devfreq: the out-of-tree driver switches clk_mux to clk_sub_parent (26Mhz), adjusts clk_main_parent, then switches clk_mux back to clk_main_parent: (see https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-4.19/drivers/gpu/arm/midgard/platform/mediatek/mali_kbase_runtime_pm.c#423) clocks = <&topckgen CLK_TOP_MFGPLL_CK>, <&topckgen CLK_TOP_MUX_MFG>, <&clk26m>, <&mfgcfg CLK_MFG_BG3D>; clock-names = "clk_main_parent", "clk_mux", "clk_sub_parent", "subsys_mfg_cg"; v2: - Use sram instead of mali_sram as SRAM supply name. - Rename mali@ to gpu@. arch/arm64/boot/dts/mediatek/mt8183-evb.dts | 7 ++ arch/arm64/boot/dts/mediatek/mt8183.dtsi | 104 ++++++++++++++++++++ 2 files changed, 111 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8183-evb.dts b/arch/arm64/boot/dts/mediatek/mt8183-evb.dts index 1fb195c683c3d01..7d609e0cd9b4975 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-evb.dts +++ b/arch/arm64/boot/dts/mediatek/mt8183-evb.dts @@ -7,6 +7,7 @@ /dts-v1/; #include "mt8183.dtsi" +#include "mt6358.dtsi" / { model = "MediaTek MT8183 evaluation board"; @@ -30,6 +31,12 @@ &auxadc { status = "okay"; }; +&gpu { + supply-names = "mali", "sram"; + mali-supply = <&mt6358_vgpu_reg>; + sram-supply = <&mt6358_vsram_gpu_reg>; +}; + &i2c0 { pinctrl-names = "default"; pinctrl-0 = <&i2c_pins_0>; diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi index 1ade9153e5c265b..4da3f1ed1c15bf3 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi @@ -597,6 +597,110 @@ mfgcfg: syscon@13000000 { #clock-cells = <1>; }; + gpu: gpu@13040000 { + compatible = "mediatek,mt8183-mali", "arm,mali-bifrost"; + reg = <0 0x13040000 0 0x4000>; + interrupts = + , + , + ; + interrupt-names = "job", "mmu", "gpu"; + + clocks = <&topckgen CLK_TOP_MFGPLL_CK>; + + power-domains = + <&scpsys MT8183_POWER_DOMAIN_MFG_CORE0>, + <&scpsys MT8183_POWER_DOMAIN_MFG_CORE1>, + <&scpsys MT8183_POWER_DOMAIN_MFG_2D>; + + operating-points-v2 = <&gpu_opp_table>; + }; + + gpu_opp_table: opp_table0 { + compatible = "operating-points-v2"; + opp-shared; + + opp-300000000 { + opp-hz = /bits/ 64 <300000000>; + opp-microvolt = <625000>, <850000>; + }; + + opp-320000000 { + opp-hz = /bits/ 64 <320000000>; + opp-microvolt = <631250>, <850000>; + }; + + opp-340000000 { + opp-hz = /bits/ 64 <340000000>; + opp-microvolt = <637500>, <850000>; + }; + + opp-360000000 { + opp-hz = /bits/ 64 <360000000>; + opp-microvolt = <643750>, <850000>; + }; + + opp-380000000 { + opp-hz = /bits/ 64 <380000000>; + opp-microvolt = <650000>, <850000>; + }; + + opp-400000000 { + opp-hz = /bits/ 64 <400000000>; + opp-microvolt = <656250>, <850000>; + }; + + opp-420000000 { + opp-hz = /bits/ 64 <420000000>; + opp-microvolt = <662500>, <850000>; + }; + + opp-460000000 { + opp-hz = /bits/ 64 <460000000>; + opp-microvolt = <675000>, <850000>; + }; + + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; + opp-microvolt = <687500>, <850000>; + }; + + opp-540000000 { + opp-hz = /bits/ 64 <540000000>; + opp-microvolt = <700000>, <850000>; + }; + + opp-580000000 { + opp-hz = /bits/ 64 <580000000>; + opp-microvolt = <712500>, <850000>; + }; + + opp-620000000 { + opp-hz = /bits/ 64 <620000000>; + opp-microvolt = <725000>, <850000>; + }; + + opp-653000000 { + opp-hz = /bits/ 64 <653000000>; + opp-microvolt = <743750>, <850000>; + }; + + opp-698000000 { + opp-hz = /bits/ 64 <698000000>; + opp-microvolt = <768750>, <868750>; + }; + + opp-743000000 { + opp-hz = /bits/ 64 <743000000>; + opp-microvolt = <793750>, <893750>; + }; + + opp-800000000 { + opp-hz = /bits/ 64 <800000000>; + opp-microvolt = <825000>, <925000>; + }; + }; + mmsys: syscon@14000000 { compatible = "mediatek,mt8183-mmsys", "syscon"; reg = <0 0x14000000 0 0x1000>; From patchwork Wed Jan 8 05:23:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 11322831 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 7F8281398 for ; Wed, 8 Jan 2020 05:24:52 +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 495F220705 for ; Wed, 8 Jan 2020 05:24:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="shRU1TxG"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Jfjo+Fag" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 495F220705 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=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=mWamViIbpy6hKq8i6pXHolxxdUVb+cDHlDoFcQKJhW0=; b=shRU1TxGfCH5oj 6OU8yedeFafhFXjghNvXgGl/LpMzpG+CGWPwiK81AiU6VUDo+p68BhRcfM9F7qHXAIZM7rRx8nKf7 K4ku2GeI2q3IrdeO6+BOij0T6QwO1dTVONoT6q/y4wVbkrtKaV6H0oIG+YV1o4xHkfkjMp1Q0O8vW frGL9Ng9n1Pe06CDmpJcPjuXlVRencdkKShj8dkAIF2+gscZMI9ewpDf5iS6haxHVwmIvCIoYay9g /MiWmNPbKRKoquQvCyCu/O/EUWuWcuJfIaghPAoenS6hyLD4+yDs4jughAfmzOsGvzJ5c0a1qTCeS Pxd9X15nNvQDoiM/1Qbg==; 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 1ip3pp-0005Zb-B4; Wed, 08 Jan 2020 05:24:49 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ip3p7-0004mq-Hw for linux-mediatek@lists.infradead.org; Wed, 08 Jan 2020 05:24:06 +0000 Received: by mail-pl1-x642.google.com with SMTP id az3so623794plb.11 for ; Tue, 07 Jan 2020 21:24:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VXWKPtv3cxE8lSp3PQIY49x0a4P+s/RHd/rRix+wGzg=; b=Jfjo+Faggwo7DaWWKVmhC7/00Vvhz+MTRYNmhAKQYX1HCOP3EYR8Lin5NwFPnmhjMY 4+Fb5Qu0e1wDWqALzow5cVbQpRrmDtK6+s0MWVLSCLeAn/oBigTNqV6pS0G3uvjzNP7g ZOYd16bXAfTR+SPI/3E9hzT5bBEzHfFjf0IP8= 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=VXWKPtv3cxE8lSp3PQIY49x0a4P+s/RHd/rRix+wGzg=; b=L/IZnHeDaphB45uZJCFtfc9jT72VfjX0hxPi78r6Wk84WnU9LbFZ8fHtb32A3WzjEa 6kxdnRdbZE7U2LMbhXz7ZQsfxb04sxLytODtqfJ4g5Gf2F0jrV64ADVIRcTt7ntDDwRt W8CAg3x5OBPMw8dHUYpD7W0s0SmqtA4Wj/NsT/DC/u/7dpgEkR45uZWE0Zyv0t0sK9LC Whf2oTNqyDN2jxT4hfPsZIUYLS+zSj9cU7p0mwRATb3v3AQOqD36tLhoezDxVC2aEj64 F6cs7L2vlN7/0jLScAftM4587LGEfh+5MPuJxfiQ2+S3xmL3jaoGwq5eOQuIZk7Yho0g IIlQ== X-Gm-Message-State: APjAAAWGuGmDLsleNN3OhCu6MIYpx25HFxdsmcdoJVYIgKjbPleK9XU/ 9FwEgDROGZmQi034k2ee+4tGjw== X-Google-Smtp-Source: APXvYqyHC+8oOSDbkbTqCwSPnXshCUeDVww8reRuLxI2n62N7ExPieyrDCDC2ipIyCqYctUkgXWJYA== X-Received: by 2002:a17:90a:3aaf:: with SMTP id b44mr2510426pjc.9.1578461044170; Tue, 07 Jan 2020 21:24:04 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:d8b7:33af:adcb:b648]) by smtp.gmail.com with ESMTPSA id n24sm387505pff.12.2020.01.07.21.24.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 21:24:03 -0800 (PST) From: Nicolas Boichat To: Rob Herring Subject: [PATCH v2 3/7] drm/panfrost: Improve error reporting in panfrost_gpu_power_on Date: Wed, 8 Jan 2020 13:23:33 +0800 Message-Id: <20200108052337.65916-4-drinkcat@chromium.org> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog In-Reply-To: <20200108052337.65916-1-drinkcat@chromium.org> References: <20200108052337.65916-1-drinkcat@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200107_212405_611551_02289B5C X-CRM114-Status: UNSURE ( 9.91 ) X-CRM114-Notice: Please train this message. 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:642 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_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Tomeu Vizoso , David Airlie , linux-kernel@vger.kernel.org, Liam Girdwood , dri-devel@lists.freedesktop.org, Steven Price , Mark Brown , linux-mediatek@lists.infradead.org, Alyssa Rosenzweig , Daniel Vetter , hsinyi@chromium.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org It is useful to know which component cannot be powered on. Signed-off-by: Nicolas Boichat Reviewed-by: Steven Price --- Was useful when trying to probe bifrost GPU, to understand what issue we are facing. --- drivers/gpu/drm/panfrost/panfrost_gpu.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c index 8822ec13a0d619f..ba02bbfcf28c011 100644 --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c @@ -308,21 +308,26 @@ void panfrost_gpu_power_on(struct panfrost_device *pfdev) gpu_write(pfdev, L2_PWRON_LO, pfdev->features.l2_present); ret = readl_relaxed_poll_timeout(pfdev->iomem + L2_READY_LO, val, val == pfdev->features.l2_present, 100, 1000); + if (ret) + dev_err(pfdev->dev, "error powering up gpu L2"); gpu_write(pfdev, STACK_PWRON_LO, pfdev->features.stack_present); - ret |= readl_relaxed_poll_timeout(pfdev->iomem + STACK_READY_LO, + ret = readl_relaxed_poll_timeout(pfdev->iomem + STACK_READY_LO, val, val == pfdev->features.stack_present, 100, 1000); + if (ret) + dev_err(pfdev->dev, "error powering up gpu stack"); gpu_write(pfdev, SHADER_PWRON_LO, pfdev->features.shader_present); - ret |= readl_relaxed_poll_timeout(pfdev->iomem + SHADER_READY_LO, + ret = readl_relaxed_poll_timeout(pfdev->iomem + SHADER_READY_LO, val, val == pfdev->features.shader_present, 100, 1000); + if (ret) + dev_err(pfdev->dev, "error powering up gpu shader"); gpu_write(pfdev, TILER_PWRON_LO, pfdev->features.tiler_present); - ret |= readl_relaxed_poll_timeout(pfdev->iomem + TILER_READY_LO, + ret = readl_relaxed_poll_timeout(pfdev->iomem + TILER_READY_LO, val, val == pfdev->features.tiler_present, 100, 1000); - if (ret) - dev_err(pfdev->dev, "error powering up gpu"); + dev_err(pfdev->dev, "error powering up gpu tiler"); } void panfrost_gpu_power_off(struct panfrost_device *pfdev) From patchwork Wed Jan 8 05:23:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 11322839 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 0C7C0138D for ; Wed, 8 Jan 2020 05:25:16 +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 DE82820705 for ; Wed, 8 Jan 2020 05:25:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KQm6oh10"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="KZ2Fr1SI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE82820705 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=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=RYHrSYgOt/4dT3wOydBU1/HDruCatZdUJXu47z/vxIM=; b=KQm6oh10zGG4GC tfELDQEU0y5AeH3iAh86DbEIlbJFZs5FWQ5qiY4Nm/1LzXUQL0dzcrCB2RtNuYJZsksDDppBq9fWH UV7UCTjyQYGwCBXxVyA/8LZrAbN9fmU1o0jfMIBLnjRZROV970AdJM/gmlHpqLudNEDRh4xxOF+Li +zH0QzRsjkY8c49EYnuFYqrVv4gSeWSDipJeCT6KCY9PgShv8my9qlAIlQzvlkm43CwwulRvnSHzu 89sdMf7RAkKsm9CKXHsvfpXdKkn3xbTOm+U/4r8lb8zZlm/ocLAJvA3y/gIJg7RiRKv+HADPz0vPk dtjE0mS0U4Has37PZ+oA==; 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 1ip3qD-0006sI-W5; Wed, 08 Jan 2020 05:25:14 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ip3pA-0004pa-3C for linux-mediatek@lists.infradead.org; Wed, 08 Jan 2020 05:24:09 +0000 Received: by mail-pl1-x641.google.com with SMTP id y8so619731pll.13 for ; Tue, 07 Jan 2020 21:24:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GZPi5S7C9JBOvDvG9rs8XlkVI4VOHpLwCsMiOaYI8o4=; b=KZ2Fr1SIWZOlOI/MInwohmz1Hb6Xx7Tq+QTxkCat51I7DcfFdbynSqAxDlo/ZrmAzy bzYx04hvPnPCCny7HlSE8qtcQ54XXy3skRRoKWw/srh/+NPKZBDJmkfK0r32EhMKP8As Ki1O01CCcGhKnBDTGVZ2lIeuDq9nZ6XwreZMY= 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=GZPi5S7C9JBOvDvG9rs8XlkVI4VOHpLwCsMiOaYI8o4=; b=iTh/TW8kYYQVVcXjwO+v2KNOlxFgtuaFwy9D1iMr5GzoFGeowk8wf+/3+FIXkvVpw9 1V0GDsAX9jm7uT+U4MMy7r8DznkmhC+C0GOpOBmgbJeR5tU5wZarP2UsiNdeRrJc1eFe 7VP6QA1mB5vwV/tdOcL5grv/Y3oLi+Mh5aeDwD6pRJP8TjHwLyPETcj3H+YjnBGVBrj/ prX2rNeRC0Zpm4SlyyU2rUFFvuFB4O3pWFsp+JU2Is713MVqjNTQxasjIgut4VATcJc6 jBLc7PUSEyWwPe/8/z3zqlDOwyontlbZnFx15iGh246GxSJ0mUzYB7yyR3Vvl90s40kR LYyQ== X-Gm-Message-State: APjAAAUNFBLcK6dqND5XwkuuxbjUk2uqmc1OPOMnHYMmpy0EFvY0zvGO WBo63M8JOk9D4pYR2dYDHm5CDQ== X-Google-Smtp-Source: APXvYqyXscgEKtXSz2fpP6ePSqF6Ze4O7OI5VBeA+RFqRdvOMivOeOELOfMM09JM7WNsSJ6itelcsA== X-Received: by 2002:a17:90a:d789:: with SMTP id z9mr2508178pju.5.1578461047043; Tue, 07 Jan 2020 21:24:07 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:d8b7:33af:adcb:b648]) by smtp.gmail.com with ESMTPSA id n24sm387505pff.12.2020.01.07.21.24.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 21:24:06 -0800 (PST) From: Nicolas Boichat To: Rob Herring Subject: [PATCH v2 4/7] drm/panfrost: Add support for a second regulator for the GPU Date: Wed, 8 Jan 2020 13:23:34 +0800 Message-Id: <20200108052337.65916-5-drinkcat@chromium.org> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog In-Reply-To: <20200108052337.65916-1-drinkcat@chromium.org> References: <20200108052337.65916-1-drinkcat@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200107_212408_160380_2D6A78C4 X-CRM114-Status: GOOD ( 12.88 ) 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:641 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_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Tomeu Vizoso , David Airlie , linux-kernel@vger.kernel.org, Liam Girdwood , dri-devel@lists.freedesktop.org, Steven Price , Mark Brown , linux-mediatek@lists.infradead.org, Alyssa Rosenzweig , Daniel Vetter , hsinyi@chromium.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org Some GPUs, namely, the bifrost/g72 part on MT8183, have a second regulator for their SRAM, let's add support for that. Signed-off-by: Nicolas Boichat --- drivers/gpu/drm/panfrost/panfrost_device.c | 21 +++++++++++++++++++++ drivers/gpu/drm/panfrost/panfrost_device.h | 1 + 2 files changed, 22 insertions(+) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c index 238fb6d54df4732..a0b0a6fef8b4e63 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -102,12 +102,33 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev) return ret; } + pfdev->regulator_sram = devm_regulator_get_optional(pfdev->dev, "sram"); + if (IS_ERR(pfdev->regulator_sram)) { + ret = PTR_ERR(pfdev->regulator_sram); + dev_err(pfdev->dev, "failed to get SRAM regulator: %d\n", ret); + goto err; + } + + if (pfdev->regulator_sram) { + ret = regulator_enable(pfdev->regulator_sram); + if (ret < 0) { + dev_err(pfdev->dev, + "failed to enable SRAM regulator: %d\n", ret); + goto err; + } + } + return 0; + +err: + regulator_disable(pfdev->regulator); + return ret; } static void panfrost_regulator_fini(struct panfrost_device *pfdev) { regulator_disable(pfdev->regulator); + regulator_disable(pfdev->regulator_sram); } int panfrost_device_init(struct panfrost_device *pfdev) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index 06713811b92cdf7..a124334d69e7e93 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -60,6 +60,7 @@ struct panfrost_device { struct clk *clock; struct clk *bus_clock; struct regulator *regulator; + struct regulator *regulator_sram; struct reset_control *rstc; struct panfrost_features features; From patchwork Wed Jan 8 05:23:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 11322843 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 952BE1398 for ; Wed, 8 Jan 2020 05:25:32 +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 72E0820705 for ; Wed, 8 Jan 2020 05:25:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="r2Fd+bRI"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="FDcmjcfu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72E0820705 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=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=af5q34ZmrGcc7W/9KokNNgsFID/2aEp6R6P9aOjeXU0=; b=r2Fd+bRIzSmahD aaPpSFH/wzGkE219qusq22M+jpVio8Sdxq/Dhi8zOSQDZIfpAbDe/oMswDR6iQi0SZMGTaChOg9IT giaceVDAFBFycnHix22ru6lstr68lCX3uUOYD84va5UqjXdiTkxtfJaYCCVQyguWRgs1BMrfIWJg6 WjGxSCQOXED9pSpmeEvFMGE5+Zmp+/PvHF9rCHlhFcpDWKjTJ3u/FbERgkoDqn7qEbS5reJmIIOWD smef9h3A0z537NtItRho14G5Ic/2ImZ1k7eMGM5jFhAZXWBUEhz70W/b36GZIstKM8YmTlH16Rj/x 40ucyp2QmhXaigilkl0A==; 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 1ip3qU-0007Oc-6M; Wed, 08 Jan 2020 05:25:30 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ip3pC-0004u9-Ek for linux-mediatek@lists.infradead.org; Wed, 08 Jan 2020 05:24:12 +0000 Received: by mail-pl1-x642.google.com with SMTP id c23so636949plz.4 for ; Tue, 07 Jan 2020 21:24:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ra+20wVCtfatvw0K5yioGbAxlT9AXOAj2fQq6fBwVqo=; b=FDcmjcfuosKrI1aVlpORYzf8ILvaDJIrH3VeYHavKxE5uksMP8wy+dqr+rtKJisPrE xlYwd3lJXAmmyLWii0G328QSVx2jDBV4cxAewFF92xHO+tmLrnXLqN8Ecyy75QFduPs7 CEirAlKXuTSmlbnNiX0sxmPpxKElpSFVyZKcs= 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=Ra+20wVCtfatvw0K5yioGbAxlT9AXOAj2fQq6fBwVqo=; b=c0eks0s29g98ZdZrm2R/66U3TXpTHZAuo4Huz4vc3/e/rruNiAY3p3WBgZaUVd3ENJ n0kJ9+jnvuC6K7XGTmg1oiHeCNgFpwLeRummZPM9P6iyKv4+zRZ00J1A5SVW9jPyGeq2 b5A7+Oa17FMpqBJcisNNBRZKXjFmpXY4QouThFHv0zt/VwjFviElzwj69MFLWBEo9+BR S+HNorkt8rm3QcLUpUqje0MnGRgq8PtK0aNhn/4KZIrUK3hHo5U4u6Dg/2WDoCLAiHv0 eQbtECbm2JqNcoBXLbw6YdXFJgi4GJPgz9i97e9xmEjZ5AFc+Qc6H4aC+1p2Pr87CXKj Olpw== X-Gm-Message-State: APjAAAURmNAl5ruV1OckCfx1A7cXRwswFuVCIE0R72lxvCgzc61Ib2v5 KRnI/KSne6jiz5oPVzuDtFcy6g== X-Google-Smtp-Source: APXvYqxY4WiSpt87/FZwdfEEf+Pbv809uvPrWp4yZnui6jFSnmuTtOBb/0vcAlWflwuVhfVm7OsonA== X-Received: by 2002:a17:90a:e389:: with SMTP id b9mr2426783pjz.7.1578461049926; Tue, 07 Jan 2020 21:24:09 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:d8b7:33af:adcb:b648]) by smtp.gmail.com with ESMTPSA id n24sm387505pff.12.2020.01.07.21.24.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 21:24:09 -0800 (PST) From: Nicolas Boichat To: Rob Herring Subject: [PATCH v2 5/7] drm/panfrost: Add support for multiple power domain support Date: Wed, 8 Jan 2020 13:23:35 +0800 Message-Id: <20200108052337.65916-6-drinkcat@chromium.org> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog In-Reply-To: <20200108052337.65916-1-drinkcat@chromium.org> References: <20200108052337.65916-1-drinkcat@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200107_212410_526266_C1217C48 X-CRM114-Status: GOOD ( 16.82 ) 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:642 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_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Tomeu Vizoso , David Airlie , linux-kernel@vger.kernel.org, Liam Girdwood , dri-devel@lists.freedesktop.org, Steven Price , Mark Brown , linux-mediatek@lists.infradead.org, Alyssa Rosenzweig , Daniel Vetter , hsinyi@chromium.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org When there is a single power domain per device, the core will ensure the power domains are all switched on. However, when there are multiple ones, as in MT8183 Bifrost GPU, we need to handle them in driver code. Signed-off-by: Nicolas Boichat --- The downstream driver we use on chromeos-4.19 currently uses 2 additional devices in device tree to accomodate for this [1], but I believe this solution is cleaner. [1] https://chromium.googlesource.com/chromiumos/third_party/kernel/+/refs/heads/chromeos-4.19/drivers/gpu/arm/midgard/platform/mediatek/mali_kbase_runtime_pm.c#31 drivers/gpu/drm/panfrost/panfrost_device.c | 87 ++++++++++++++++++++-- drivers/gpu/drm/panfrost/panfrost_device.h | 4 + 2 files changed, 83 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c index a0b0a6fef8b4e63..c6e9e059de94a4d 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include "panfrost_device.h" @@ -131,6 +132,67 @@ static void panfrost_regulator_fini(struct panfrost_device *pfdev) regulator_disable(pfdev->regulator_sram); } +static void panfrost_pm_domain_fini(struct panfrost_device *pfdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(pfdev->pm_domain_devs); i++) { + if (!pfdev->pm_domain_devs[i]) + break; + + if (pfdev->pm_domain_links[i]) + device_link_del(pfdev->pm_domain_links[i]); + + dev_pm_domain_detach(pfdev->pm_domain_devs[i], true); + } +} + +static int panfrost_pm_domain_init(struct panfrost_device *pfdev) +{ + int err; + int i, num_domains; + + num_domains = of_count_phandle_with_args(pfdev->dev->of_node, + "power-domains", + "#power-domain-cells"); + /* Single domains are handled by the core. */ + if (num_domains < 2) + return 0; + + if (num_domains > ARRAY_SIZE(pfdev->pm_domain_devs)) { + dev_err(pfdev->dev, "Too many pm-domains: %d\n", num_domains); + return -EINVAL; + } + + for (i = 0; i < num_domains; i++) { + pfdev->pm_domain_devs[i] = + dev_pm_domain_attach_by_id(pfdev->dev, i); + if (IS_ERR(pfdev->pm_domain_devs[i])) { + err = PTR_ERR(pfdev->pm_domain_devs[i]); + pfdev->pm_domain_devs[i] = NULL; + dev_err(pfdev->dev, + "failed to get pm-domain %d: %d\n", i, err); + goto err; + } + + pfdev->pm_domain_links[i] = device_link_add(pfdev->dev, + pfdev->pm_domain_devs[i], DL_FLAG_PM_RUNTIME | + DL_FLAG_STATELESS | DL_FLAG_RPM_ACTIVE); + if (!pfdev->pm_domain_links[i]) { + dev_err(pfdev->pm_domain_devs[i], + "adding device link failed!\n"); + err = -ENODEV; + goto err; + } + } + + return 0; + +err: + panfrost_pm_domain_fini(pfdev); + return err; +} + int panfrost_device_init(struct panfrost_device *pfdev) { int err; @@ -161,37 +223,45 @@ int panfrost_device_init(struct panfrost_device *pfdev) goto err_out1; } + err = panfrost_pm_domain_init(pfdev); + if (err) { + dev_err(pfdev->dev, "pm_domain init failed %d\n", err); + goto err_out2; + } + res = platform_get_resource(pfdev->pdev, IORESOURCE_MEM, 0); pfdev->iomem = devm_ioremap_resource(pfdev->dev, res); if (IS_ERR(pfdev->iomem)) { dev_err(pfdev->dev, "failed to ioremap iomem\n"); err = PTR_ERR(pfdev->iomem); - goto err_out2; + goto err_out3; } err = panfrost_gpu_init(pfdev); if (err) - goto err_out2; + goto err_out3; err = panfrost_mmu_init(pfdev); if (err) - goto err_out3; + goto err_out4; err = panfrost_job_init(pfdev); if (err) - goto err_out4; + goto err_out5; err = panfrost_perfcnt_init(pfdev); if (err) - goto err_out5; + goto err_out6; return 0; -err_out5: +err_out6: panfrost_job_fini(pfdev); -err_out4: +err_out5: panfrost_mmu_fini(pfdev); -err_out3: +err_out4: panfrost_gpu_fini(pfdev); +err_out3: + panfrost_pm_domain_fini(pfdev); err_out2: panfrost_reset_fini(pfdev); err_out1: @@ -208,6 +278,7 @@ void panfrost_device_fini(struct panfrost_device *pfdev) panfrost_mmu_fini(pfdev); panfrost_gpu_fini(pfdev); panfrost_reset_fini(pfdev); + panfrost_pm_domain_fini(pfdev); panfrost_regulator_fini(pfdev); panfrost_clk_fini(pfdev); } diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index a124334d69e7e93..92d471676fc7823 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -19,6 +19,7 @@ struct panfrost_job; struct panfrost_perfcnt; #define NUM_JOB_SLOTS 3 +#define MAX_PM_DOMAINS 3 struct panfrost_features { u16 id; @@ -62,6 +63,9 @@ struct panfrost_device { struct regulator *regulator; struct regulator *regulator_sram; struct reset_control *rstc; + /* pm_domains for devices with more than one. */ + struct device *pm_domain_devs[MAX_PM_DOMAINS]; + struct device_link *pm_domain_links[MAX_PM_DOMAINS]; struct panfrost_features features; From patchwork Wed Jan 8 05:23:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 11322845 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 45BD61398 for ; Wed, 8 Jan 2020 05:25:34 +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 2048320705 for ; Wed, 8 Jan 2020 05:25:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WV7ZRUHw"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="QLx9yX4o" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2048320705 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=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=bPROZIpydy6ztmy4ATmh12k3DZToblzswyBtwiAAY80=; b=WV7ZRUHw7PNkJL YW0BI0MoGSOS+BsguHguAqatqSLVJ2t1/2lrxQGfM312lIm1Rd68Tp4uJhZBFCWxea6Jlncua/6Wd pslqOIiwe+DASm43Mc07vsTA998lED6vOLLXwiwccpvJ4Mypcec7A0fc2TNtDmo0OcmOLq6SZDKQ+ onibaXQ742+HNQUkFW7bgd1CIHWR9j1tPhHXuh5q+MmN/jjCuom4RrAQwjfM1RCcQiWE82cipe/Cd xBhjjJi+q29er1DZ+B46qKEDpcT236zbRUt1NftvfdeAr7ZLY6S5J+B5wlwOocoQJJ9xDmPbZyZVe C7wHXBmXijL2Pmt5WZeQ==; 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 1ip3qW-0007R8-5U; Wed, 08 Jan 2020 05:25:32 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ip3pF-0004xH-Q3 for linux-mediatek@lists.infradead.org; Wed, 08 Jan 2020 05:24:15 +0000 Received: by mail-pj1-x1041.google.com with SMTP id n59so563794pjb.1 for ; Tue, 07 Jan 2020 21:24:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UOwyKJvK30gkDautsCvwyHXlhtr89ohJP+HqIMRnEEY=; b=QLx9yX4oKgUhsf9zqBiMKi9PC3cJUGptpG/rsIeA0xAbFDz3AFhMYQndfD4e5TiiA5 wduA+xP76VAH3pTE/Y7N2zNP97+RQWMddxzeUn/Nf0v4LIAyD01x4QhbaispCA389giy 7q8R+qc9ynzewq3J8aV43Z09BdUAkc5nDf8Fg= 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=UOwyKJvK30gkDautsCvwyHXlhtr89ohJP+HqIMRnEEY=; b=HdRO7EdSi/tE3Lu5RQKMt+6dO9ul9rLiKsLrNzidkAjr8BEtZrbTWswYl6ZG6pd+ym KAifmtCUpTeM6w5eCoayUTNgmFkOXR9tnboRNDYSkHeOJh46WhXKUHl4WiTOXXe/VrlN KjIk97K3kLOBGgQw6QJ29jbIqOiIDQvAhDx8BNXd16Elvj9dvCs94wJF7CVe25dn1x8v rQ3yQXxw412iwvWspiymvMGCbdrTsa/HMnskJ4kNNhEaw5SocAKOPScCOZL4xStHGULl VOlMRv/BsIaz515T9ReuDcOD+ZWNBvTxQMC7z0CvG6za1a0npiitq2XWvlZ5ZP2wIorp av7A== X-Gm-Message-State: APjAAAVmyMgf0jt+jLX+sReEEVAxruZMGavwCk4J00XKMGMRxjsGKa2S ubJQIVgN/5qzMCWDuO/4Dvk5mQ== X-Google-Smtp-Source: APXvYqyP94Ucu5iILCPq19i7mowizjkSB4O/xb8qsx3dYRf/q3ysQY9apimu4OZEq+YRXwTIHiTnjQ== X-Received: by 2002:a17:902:265:: with SMTP id 92mr3326908plc.188.1578461052777; Tue, 07 Jan 2020 21:24:12 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:d8b7:33af:adcb:b648]) by smtp.gmail.com with ESMTPSA id n24sm387505pff.12.2020.01.07.21.24.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 21:24:12 -0800 (PST) From: Nicolas Boichat To: Rob Herring Subject: [PATCH v2 6/7, RFC] drm/panfrost: Add bifrost compatible string Date: Wed, 8 Jan 2020 13:23:36 +0800 Message-Id: <20200108052337.65916-7-drinkcat@chromium.org> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog In-Reply-To: <20200108052337.65916-1-drinkcat@chromium.org> References: <20200108052337.65916-1-drinkcat@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200107_212414_045288_283D3867 X-CRM114-Status: UNSURE ( 9.65 ) X-CRM114-Notice: Please train this message. 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 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Tomeu Vizoso , David Airlie , linux-kernel@vger.kernel.org, Liam Girdwood , dri-devel@lists.freedesktop.org, Steven Price , Mark Brown , linux-mediatek@lists.infradead.org, Alyssa Rosenzweig , Daniel Vetter , hsinyi@chromium.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org For testing only, the driver doesn't really work yet, AFAICT. Signed-off-by: Nicolas Boichat Reviewed-by: Steven Price --- drivers/gpu/drm/panfrost/panfrost_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index 48e3c4165247cea..f3a4d77266ba961 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -591,6 +591,7 @@ static const struct of_device_id dt_match[] = { { .compatible = "arm,mali-t830" }, { .compatible = "arm,mali-t860" }, { .compatible = "arm,mali-t880" }, + { .compatible = "arm,mali-bifrost" }, {} }; MODULE_DEVICE_TABLE(of, dt_match); From patchwork Wed Jan 8 05:23:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 11322851 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 9F91A930 for ; Wed, 8 Jan 2020 05:26:07 +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 7B63D20678 for ; Wed, 8 Jan 2020 05:26:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RAJQPdEp"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="S3tVQZXg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B63D20678 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=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=akLa0yYaHedU9z6dKJGnWt7iFieJBu9vhMbB0iyRPxE=; b=RAJQPdEpbpTf7k eaRGaNedHHFLYUB4ady/KwO8foYefqrEuB7JiT4KVbzV9mFwTTnF9I6KqsjtlWPgr+zQ1iNAg21XJ gD75OtDHjT+Sgx17NGXk7RwcZm2yZtk+gWFnczmk5xm40nCwtS4PtdC85XxYlyyg+EVc4EzV967ZY YiLQkgEZX43cu2dQHOd75/Zw3GKrO395yCGLyr3WLq12uu1nyZUDb7IxlFWrNLLoVE1FrWT105w68 Oe3KVP5TTszQN+Gp12DRWQQTKDyIKZgYy9j7WRKnsOS8/vDPDHkOWt9dyASbx7MQGaKC8L7/hrUXj yY+j8P65Rj/X5fNJCnIw==; 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 1ip3r3-0007wj-Ne; Wed, 08 Jan 2020 05:26:05 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ip3pI-00050b-PB for linux-mediatek@lists.infradead.org; Wed, 08 Jan 2020 05:24:19 +0000 Received: by mail-pg1-x543.google.com with SMTP id b137so975434pga.6 for ; Tue, 07 Jan 2020 21:24:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tLPzDvqsyKjpMgl6ZY+ZEjymtgHHsFzBQXHTW4eiM1M=; b=S3tVQZXgAvZAvGKT4jucRDlF/M0TWOh+3V7E9ZFoKg0xoIXSRxIr5TYGLCUnvTfS9N f+oKg6lg9u0QxJzV+FId6ptqevsKmNbYDMNZJ9DJAVLRY/8KFELoCSNhdge1SKfgY0Xy AuK7NrZkfWLHM89vkHp0eJTBqDJW+EynagsuQ= 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=tLPzDvqsyKjpMgl6ZY+ZEjymtgHHsFzBQXHTW4eiM1M=; b=HuDnEmx6tf/IfN77DuXBzo0i6TaWZVYM6KRbgA7Sqqf8MJ7kwsSu9DsExPcNbyDGsL OcJYrJO9sl9x55OIlWhZCPdZr77MJ6/UsH1DSKYDV7hvxHka7OdWTt7Mlpfuc1Sifw96 kQGgw1cASThB2UC5zoE6qE+17SF546jet6v0jQjECDRaNV5GyY8q/5K/UFR9rW9PXBz4 IaEcQOUcx/m0CavoSxu0BYUc8SGZLgwucaUmyevBTmICxR9PH3dVKj0PkezFiHHWPdzx fLUrim4p5qG+BCpegpK+B96prD1hDYTBdlzgOSnT451npWKvyO/FFDeMWOII931cppUm uaNg== X-Gm-Message-State: APjAAAXVqbMoUY6l5S+M73HxB1pKiQoVgX/O2XeBKhkEYPCw1LmFXHmk 3fhm8ieevXMNN12dGHu/rraKog== X-Google-Smtp-Source: APXvYqzoefkOYFH4FXTTMbYJDxtsQiuVsYfMMaYxsSll0XpoVzmSh/ccdl9HE7eeGAdfYbzMduo/6Q== X-Received: by 2002:a63:ed56:: with SMTP id m22mr3334545pgk.261.1578461055680; Tue, 07 Jan 2020 21:24:15 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:d8b7:33af:adcb:b648]) by smtp.gmail.com with ESMTPSA id n24sm387505pff.12.2020.01.07.21.24.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 21:24:15 -0800 (PST) From: Nicolas Boichat To: Rob Herring Subject: [PATCH v2 7/7, RFC]: drm/panfrost: devfreq: Add support for 2 regulators Date: Wed, 8 Jan 2020 13:23:37 +0800 Message-Id: <20200108052337.65916-8-drinkcat@chromium.org> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog In-Reply-To: <20200108052337.65916-1-drinkcat@chromium.org> References: <20200108052337.65916-1-drinkcat@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200107_212416_832593_63318C5F X-CRM114-Status: GOOD ( 11.73 ) 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:543 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_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Tomeu Vizoso , David Airlie , linux-kernel@vger.kernel.org, Liam Girdwood , dri-devel@lists.freedesktop.org, Steven Price , Mark Brown , linux-mediatek@lists.infradead.org, Alyssa Rosenzweig , Daniel Vetter , hsinyi@chromium.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org The Bifrost GPU on MT8183 uses 2 regulators (core and SRAM) for devfreq, and provides OPP table with 2 sets of voltages. TODO: This is incomplete as we'll need add support for setting a pair of voltages as well. Signed-off-by: Nicolas Boichat --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 18 ++++++++++++++++++ drivers/gpu/drm/panfrost/panfrost_device.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 413987038fbfccb..5eb0effded7eb09 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -79,6 +79,22 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) struct devfreq *devfreq; struct thermal_cooling_device *cooling; + /* If we have 2 regulator, we need an OPP table with 2 voltages. */ + if (pfdev->regulator_sram) { + const char * const reg_names[] = { "mali", "sram" }; + + pfdev->devfreq.dev_opp_table = + dev_pm_opp_set_regulators(dev, + reg_names, ARRAY_SIZE(reg_names)); + if (IS_ERR(pfdev->devfreq.dev_opp_table)) { + ret = PTR_ERR(pfdev->devfreq.dev_opp_table); + pfdev->devfreq.dev_opp_table = NULL; + dev_err(dev, + "Failed to init devfreq opp table: %d\n", ret); + return ret; + } + } + ret = dev_pm_opp_of_add_table(dev); if (ret == -ENODEV) /* Optional, continue without devfreq */ return 0; @@ -119,6 +135,8 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) if (pfdev->devfreq.cooling) devfreq_cooling_unregister(pfdev->devfreq.cooling); dev_pm_opp_of_remove_table(&pfdev->pdev->dev); + if (pfdev->devfreq.dev_opp_table) + dev_pm_opp_put_regulators(pfdev->devfreq.dev_opp_table); } void panfrost_devfreq_resume(struct panfrost_device *pfdev) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index 92d471676fc7823..581da3fe5df8b17 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -91,10 +91,12 @@ struct panfrost_device { struct { struct devfreq *devfreq; struct thermal_cooling_device *cooling; + struct opp_table *dev_opp_table; ktime_t busy_time; ktime_t idle_time; ktime_t time_last_update; atomic_t busy_count; + struct panfrost_devfreq_slot slot[NUM_JOB_SLOTS]; } devfreq; };