From patchwork Wed Jan 13 06:07:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 363105 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10FAFC433E0 for ; Wed, 13 Jan 2021 06:08:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C679B23131 for ; Wed, 13 Jan 2021 06:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726654AbhAMGIX (ORCPT ); Wed, 13 Jan 2021 01:08:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726023AbhAMGIW (ORCPT ); Wed, 13 Jan 2021 01:08:22 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7169DC061795 for ; Tue, 12 Jan 2021 22:07:42 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id j13so496373pjz.3 for ; Tue, 12 Jan 2021 22:07:42 -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=y4TBp5q5xBws0la/+DZ2ckUg4m79Non3qFa6SgDcWGg=; b=cDWSghPuufn3T/EV4JMXVWkh1S3fdRZCrnlPlTRZ16a14aNsXdZDxwWefE0Xp2/i+j I8I9yNwSp696MaDC4TjhRJzfP08lzdEYiByq63mRxRM6LmQ2/4dpovkrZkOH71TdzI9c OFE8vud+3hPk2DXiUW4WFGyysg9gj2TiPRvv8= 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=y4TBp5q5xBws0la/+DZ2ckUg4m79Non3qFa6SgDcWGg=; b=NmmLDsRwUvuh/CafccWgw42OlFzZrroQbH6vELnZXmuObEqTSFVsoRI2du7WiaRuhA gNczrpIcv/f2CphNpR6deIxZ6DYaLfRWPFSgB5TDjBLe+1ijZhIAMuP2TKxbSNO0oOP/ 8vrkhcMQNpvpiwodlay1yrzDumcJBy7DCdZqysALU0rzqFCt1C+UiIyHRmDzdHem0Pa2 k9x8ki1zF9F+/QOqWOLdtpVXDczCtZmjoAJknXs5yGEaq76u8gnFoDe6OX/SLYuURzZ3 /H3UxE37Wrcc5Gyk+OuWEC+5HqfiGCUCgDMctzYADsMiTyOZK3hqclRS2xHV8vJrtom+ iBAg== X-Gm-Message-State: AOAM5328UhN1CSY8NPrSKZeWxj0QI4v0BzjPRWUvwxXQcGKyT/g5t9Xy 9mdXGFK8cRFPC1ECYNGVgxIbXg== X-Google-Smtp-Source: ABdhPJwqMhVQ0Txr7qf6NuMmSKMEj9dyClnXj9xuJtJgQ8aqhJwQ6WKmInVyh+8BthBlx3DeNuntPQ== X-Received: by 2002:a17:90a:e28c:: with SMTP id d12mr543887pjz.236.1610518062063; Tue, 12 Jan 2021 22:07:42 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:7220:84ff:fe09:41dc]) by smtp.gmail.com with ESMTPSA id y21sm1263556pfr.90.2021.01.12.22.07.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 22:07:41 -0800 (PST) From: Nicolas Boichat To: Rob Herring , Steven Price , Alyssa Rosenzweig Cc: Tomeu Vizoso , fshao@chromium.org, boris.brezillon@collabora.com, hsinyi@chromium.org, hoegsberg@chromium.org, Nicolas Boichat , Daniel Vetter , David Airlie , Matthias Brugger , Rob Herring , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v10 1/4] dt-bindings: gpu: mali-bifrost: Add Mediatek MT8183 Date: Wed, 13 Jan 2021 14:07:00 +0800 Message-Id: <20210113140546.v10.1.Ie74d3355761aab202d4825ac6f66d990bba0130e@changeid> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog In-Reply-To: <20210113060703.3122661-1-drinkcat@chromium.org> References: <20210113060703.3122661-1-drinkcat@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Define a compatible string for the Mali Bifrost GPU found in Mediatek's MT8183 SoCs. Signed-off-by: Nicolas Boichat Reviewed-by: Rob Herring --- Changes in v10: - Fix the binding to make sure sram-supply property can be provided. Changes in v6: - Rebased, actually tested with recent mesa driver. - No change Changes in v5: - Rename "2d" power domain to "core2" Changes in v4: - Add power-domain-names description (kept Alyssa's reviewed-by as the change is minor) Changes in v3: - No change .../bindings/gpu/arm,mali-bifrost.yaml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml index 184492162e7e..eac561582063 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 @@ -41,6 +42,8 @@ properties: mali-supply: true + sram-supply: true + operating-points-v2: true power-domains: @@ -87,6 +90,31 @@ allOf: then: required: - resets + - if: + properties: + compatible: + contains: + const: mediatek,mt8183-mali + then: + properties: + power-domains: + description: + List of phandle and PM domain specifier as documented in + Documentation/devicetree/bindings/power/power_domain.txt + minItems: 3 + maxItems: 3 + power-domain-names: + items: + - const: core0 + - const: core1 + - const: core2 + required: + - sram-supply + - power-domains + - power-domains-names + else: + properties: + sram-supply: false examples: - | From patchwork Wed Jan 13 06:07:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 362340 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B0AFC433DB for ; Wed, 13 Jan 2021 06:08:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F104323125 for ; Wed, 13 Jan 2021 06:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726695AbhAMGI6 (ORCPT ); Wed, 13 Jan 2021 01:08:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725887AbhAMGI5 (ORCPT ); Wed, 13 Jan 2021 01:08:57 -0500 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8D3CC0617A2 for ; Tue, 12 Jan 2021 22:07:45 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id q20so581600pfu.8 for ; Tue, 12 Jan 2021 22:07:45 -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=uSKByOICSjVjMjVCfEoqfBGplgqPjsRqiLT7P6WrDrg=; b=RlArDCzItkrBIPLsdNv2i0v1cNbze3bGswglgjIYL7SvzaTuP5TY8xE171Oy955lzr 4Ksnd4Qcs5Hcln29F2c4O9yvJtXPsK8bW/fb+9Q9pKBF3xOiTxnevDrlhQL9D5N7f2ZY pEAEys4j3cDxyVRr3wUSCqYdybKusqS33UTGs= 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=uSKByOICSjVjMjVCfEoqfBGplgqPjsRqiLT7P6WrDrg=; b=pha5+R1prDi/byfwkvGMR5Bp7kCZ4OtScBS/CkQrZj90dC3RFSCbSF0tAgvkjk3dcX fE80+hKel/06XMyhqAxPiZET0O7JGyJj3m4/VuPhPM0f6e4a0PW4c1mJGg7BKW4A7eCK NhGISE6rqMS4NkhniCwR85Q7PqZ4jcdKEDRtrK77hsTar5vl2iYvkVvqvX9mnxOXz8qk qK6fU29gggfVNwe+B7gBjLBvrJe++pwnPKa4ruYH+maNm4iTG9TbUgooNZ0dv6VJQrGn oWxgz8k5lRI+VwIqrXIvRx5I++/PdPqmwMtiDqJDpd/BVlIWQV0ADdH8BzH/6647pgqm II/Q== X-Gm-Message-State: AOAM531Vs6k1Iv6VclzsD5CLA1m2Vpp0aP6M7fJAU85AbE/JGTYqAl7i 95+0FtprByFlT5ApQa3UNa7Sow== X-Google-Smtp-Source: ABdhPJw62x/4MOjjGie1CHKrWtjV3n/t7fvqc9N7HS8aviE2ERZezMtrgnfsP+yxaZVpFKrr5NnoLw== X-Received: by 2002:a63:d303:: with SMTP id b3mr611858pgg.113.1610518065250; Tue, 12 Jan 2021 22:07:45 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:7220:84ff:fe09:41dc]) by smtp.gmail.com with ESMTPSA id y21sm1263556pfr.90.2021.01.12.22.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 22:07:44 -0800 (PST) From: Nicolas Boichat To: Rob Herring , Steven Price , Alyssa Rosenzweig Cc: Tomeu Vizoso , fshao@chromium.org, boris.brezillon@collabora.com, hsinyi@chromium.org, hoegsberg@chromium.org, Nicolas Boichat , Matthias Brugger , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v10 2/4] arm64: dts: mt8183: Add node for the Mali GPU Date: Wed, 13 Jan 2021 14:07:01 +0800 Message-Id: <20210113140546.v10.2.I9f45f5c1f975422d58b5904d11546349e9ccdc94@changeid> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog In-Reply-To: <20210113060703.3122661-1-drinkcat@chromium.org> References: <20210113060703.3122661-1-drinkcat@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add a basic GPU node for mt8183. Signed-off-by: Nicolas Boichat --- 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"; (based on discussions, this probably belongs in the clock core) This only matters for devfreq, that is disabled anyway as we don't have platform-specific code to handle >1 supplies. (no changes since v6) Changes in v6: - Add gpu regulators to kukui dtsi as well. - Power domains are now attached to spm, not scpsys - Drop R-B. Changes in v5: - Rename "2d" power domain to "core2" (keep R-B again). Changes in v4: - Add power-domain-names to describe the 3 domains. (kept Alyssa's reviewed-by as the change is minor) Changes in v3: - No changes Changes in v2: - Use sram instead of mali_sram as SRAM supply name. - Rename mali@ to gpu@. arch/arm64/boot/dts/mediatek/mt8183-evb.dts | 6 + .../arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 6 + arch/arm64/boot/dts/mediatek/mt8183.dtsi | 105 ++++++++++++++++++ 3 files changed, 117 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8183-evb.dts b/arch/arm64/boot/dts/mediatek/mt8183-evb.dts index cba2d8933e79..0a8c2fad8e16 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-evb.dts +++ b/arch/arm64/boot/dts/mediatek/mt8183-evb.dts @@ -42,6 +42,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-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi index bf2ad1294dd3..00d8e112cab9 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi @@ -249,6 +249,12 @@ &cpu7 { proc-supply = <&mt6358_vproc11_reg>; }; +&gpu { + supply-names = "mali", "sram"; + mali-supply = <&mt6358_vgpu_reg>; + sram-supply = <&mt6358_vsram_gpu_reg>; +}; + &i2c0 { pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins>; diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi index 5b782a4769e7..5430e05e18a0 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi @@ -964,6 +964,111 @@ 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 = + <&spm MT8183_POWER_DOMAIN_MFG_CORE0>, + <&spm MT8183_POWER_DOMAIN_MFG_CORE1>, + <&spm MT8183_POWER_DOMAIN_MFG_2D>; + power-domain-names = "core0", "core1", "core2"; + + 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>;