From patchwork Thu May 30 08:35:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 13679903 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E1C04C25B74 for ; Thu, 30 May 2024 08:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ojWQ0b2MWifneyP6SWllMlL0oJitBi3xbuigAJTyN5g=; b=A9bNFnkIeUniA+kXO0FHXKmNQ8 WOinFHD+OW/9xARh3EqGlHnSO517uU4YwQh5UOGDbKFCBXVNxuLiJgbwnlC8W1H66WsZodisZ2055 pGqjt/7217l1nfrw3mzoeNEvoIUU7IGnINM6yui4UgzphRrpoL+Rno3AFG31ag6BTNjcSzcrd4gUD Uri8LdYofOTBiWTkyFyPvvEo3xj6VSZo85/6Byj9d+yxEW/mP85u/kLBXMtL4Ty1ogPzEv/K4R56L ujRGVN1G6TE247CBoBxE536rX9u4iButm7DKRePCeuVduD+YliRXK4K6lBD/uu3B8sFQaLbWzZSk8 jCeazKOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbFz-00000006dn6-1J9T; Thu, 30 May 2024 08:35:31 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbFt-00000006dk9-1ntq for linux-mediatek@lists.infradead.org; Thu, 30 May 2024 08:35:28 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1f44b42e9a6so5156525ad.0 for ; Thu, 30 May 2024 01:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1717058124; x=1717662924; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ojWQ0b2MWifneyP6SWllMlL0oJitBi3xbuigAJTyN5g=; b=GcQ+y4Yj2qp+ueY7rOUalZS7PelFoLpktwn1wD7MNRg3rQih1u6Q67yWMRznKzvYzX FX4xoddCNWV3mWvHTAi9/ynM11vhY3WvokPnDwnbULBqxIq00u7W0WHVLGhv0grmOXij AlkZ4NZ9GHZ98ncGeOBlEF9vLB10OBFyMz7sU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717058124; x=1717662924; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ojWQ0b2MWifneyP6SWllMlL0oJitBi3xbuigAJTyN5g=; b=pMsBvMFBfBI+ILIZrm73OdYYgXeUTXuc7peJL2yKac0/MGNSwIa948IoYXYdmcT36n Lf91Zq7mNZ2krygbWIWH9ZB/Lnz5wrDJRZ4/PRR28CK8+GAVHFmjYqCqdhBTTJsKdDSQ DAMxaaTG62KpXs6LwK/J37U2sY+i/t/GiIX+SyLGj6rTmYUBoVbWbDdrGW86DXsrcfyX vi/q0MVsij0fK90J2yz6g64e0wERH0I9wS7R3XcSKEfwKdydP7bXNjspF0X426CL0E3m preM/aYb9pMtkVMY/rRHdWPOBi3mJZ2rECcE3dM8D6AdkL93gh2UYrcpK28FNH21dA1t Zz5w== X-Forwarded-Encrypted: i=1; AJvYcCWmeVkWB/ZtMv3u1aNRfAhisdQOcm/zcCU0E+N9sBFFX2Kr6dzLSO6nFZsB4hl+22Ri202ZPo9Auj17cWYMuClLU7MJ2iQ3CSucxFvIGUqAVDYK X-Gm-Message-State: AOJu0YwRuw/lFBFpEqlIC6g+zyyq5RndQJcGbbAX7FHXfVLqUAC8WCB+ A/xTzTuGR0aPBBB25GjtCv7KX169R1EY/SkIOsZbTXyJ02X+iD4BNGn2IOZpvw== X-Google-Smtp-Source: AGHT+IGtD/EP0lwVmYxNyzuz01IBLVY6csgHPTcXqWU5CemCG3sK1VS5I0qtjDvBKandh/VKDc1VCA== X-Received: by 2002:a17:902:e810:b0:1e4:9c2f:d343 with SMTP id d9443c01a7336-1f6193fad6fmr15805455ad.7.1717058123772; Thu, 30 May 2024 01:35:23 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:65f0:63a9:90bb:50b8]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f617390fe7sm10950635ad.146.2024.05.30.01.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:35:23 -0700 (PDT) From: Chen-Yu Tsai To: Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: Chen-Yu Tsai , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] dt-bindings: clock: mediatek: Add mt8173 mfgtop Date: Thu, 30 May 2024 16:35:00 +0800 Message-ID: <20240530083513.4135052-2-wenst@chromium.org> X-Mailer: git-send-email 2.45.1.288.g0e0cd299f1-goog In-Reply-To: <20240530083513.4135052-1-wenst@chromium.org> References: <20240530083513.4135052-1-wenst@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_013526_843859_B6DE390E X-CRM114-Status: GOOD ( 17.06 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org The MFG (GPU) block on the MT8173 has a small glue layer, named MFG_TOP in the datasheet, that contains clock gates, some power sequence signal delays, and other unknown registers that get toggled when the GPU is powered on. The clock gates are exposed as clocks provided by a clock controller, while the power sequencing bits are exposed as one singular power domain. Signed-off-by: Chen-Yu Tsai Reviewed-by: Conor Dooley --- .../clock/mediatek,mt8173-mfgtop.yaml | 71 +++++++++++++++++++ include/dt-bindings/clock/mt8173-clk.h | 7 ++ 2 files changed, 78 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml diff --git a/Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml b/Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml new file mode 100644 index 000000000000..03c3c1f8cf75 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml @@ -0,0 +1,71 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- + +$id: http://devicetree.org/schemas/clock/mediatek,mt8173-mfgtop.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek MT8173 MFG TOP controller + +maintainers: + - AngeloGioacchino Del Regno + +description: + The MFG TOP glue layer controls various signals going to the MFG (GPU) + block on the MT8173. + +properties: + compatible: + const: mediatek,mt8173-mfgtop + + reg: + maxItems: 1 + + clocks: + minItems: 4 + maxItems: 4 + + clock-names: + items: + - const: sys + - const: mem + - const: core + - const: clk26m + + power-domains: + maxItems: 1 + + '#clock-cells': + const: 1 + + '#power-domain-cells': + const: 0 + +required: + - compatible + - reg + - clocks + - clock-names + - power-domains + - '#clock-cells' + - '#power-domain-cells' + +additionalProperties: false + +examples: + - | + #include + #include + + mfgtop: clock-controller@13fff000 { + compatible = "mediatek,mt8173-mfgtop"; + reg = <0x13fff000 0x1000>; + clocks = <&topckgen CLK_TOP_AXI_MFG_IN_SEL>, + <&topckgen CLK_TOP_MEM_MFG_IN_SEL>, + <&topckgen CLK_TOP_MFG_SEL>, + <&clk26m>; + clock-names = "sys", "mem", "core", "clk26m"; + power-domains = <&spm MT8173_POWER_DOMAIN_MFG>; + #clock-cells = <1>; + #power-domain-cells = <0>; + }; diff --git a/include/dt-bindings/clock/mt8173-clk.h b/include/dt-bindings/clock/mt8173-clk.h index 3d00c98b9654..89e982f771db 100644 --- a/include/dt-bindings/clock/mt8173-clk.h +++ b/include/dt-bindings/clock/mt8173-clk.h @@ -243,6 +243,13 @@ #define CLK_IMG_FD 7 #define CLK_IMG_NR_CLK 8 +/* MFG_SYS */ + +#define CLK_MFG_AXI 0 +#define CLK_MFG_MEM 1 +#define CLK_MFG_G3D 2 +#define CLK_MFG_26M 3 + /* MM_SYS */ #define CLK_MM_SMI_COMMON 1 From patchwork Thu May 30 08:35:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 13679905 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 888B2C25B78 for ; Thu, 30 May 2024 08:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kAVvhQV9mDNvHBPovdoxXEWHQ5sjxf2IkeHwkDa/ZGA=; b=0RbE9GyRZZbE+fZ4rzBgOXawhz rnFBW3yj8s7uXahhquz3g/pi3/+hc46JwrTGmQXIlSBZ0V1Ic8cvLZ9V/5ulydTUgJF2EQM32G7hy gm7cbdvdQpecUQzzKiQYxrm6K5rEFteEfFH7VGXBSCoSPeIUH3J8dJN1rqPqPA8vFJYksNwcV4s5Q p6DsKhH9qa4fYW/MDokIgrIX7FIhUdp/MWSOwtteyx2mEjNkruWH+43MbbDOST/SdSIs7gBCWe1AA 2YUodkeiBqRs5/RmsOHRlQJeOAcp17fUKLb7nd+XGnos7tU3e+0PwDQymt6V7N5nDOfwt7rJrZdM1 0vu5gWog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbGF-00000006dxY-33kg; Thu, 30 May 2024 08:35:47 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbFw-00000006dl4-0Fpw for linux-mediatek@lists.infradead.org; Thu, 30 May 2024 08:35:30 +0000 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1f44b42d1caso5195635ad.0 for ; Thu, 30 May 2024 01:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1717058127; x=1717662927; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kAVvhQV9mDNvHBPovdoxXEWHQ5sjxf2IkeHwkDa/ZGA=; b=H2yclDJF9tuMEh0zqYrZ+o7l0k/K9se56P8qEzi7AbQ9wDCxgqhFrHUqfNO+k1EXxX OALNZf7laYF9dKnVnVI2FW2EqTdraIrOBAqLX5lbmzx1T0j8QufaMIWcFwgDeue+tFv5 Pl2Ajvp0brQ3m5RAYK9KD72jCcld9taIFlPDY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717058127; x=1717662927; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kAVvhQV9mDNvHBPovdoxXEWHQ5sjxf2IkeHwkDa/ZGA=; b=RtpslfOayoaZnsEcMU94slR6YKCLlVTV1XojSNYTDhai4UQSnlpm8XBSESr1i1AHm0 gpqUIcfpB5Hw4zA33R8R5B2wkiZgWsrRYXZx+BlOKUHxlMM9fy2cKItHiHD/Y/7GrlHu AxvB27kvAKn3tvQ2qw98R2wdDc7LUmIPo5qOneue9A8bTJWQDAxjtOPys36rgxYfMKhs Z8/YCg80DbRd9b+LSxL5fBILIQHY0KTntG0l9peQ4dEybULdF+3LdXtVSwX/uFmMfqjD mK96Qf/2K6aM45+x/dTLi/sFNl4cVf/TTI+sVMvFrT4HUFRt+YkISRx9c46mzMdy9gTh 1qwg== X-Forwarded-Encrypted: i=1; AJvYcCUJ1bSVY/Rjvk9TyYGU+jKUTcLY1HREb2la9e6NtGKNDGxsm6Kb1dc2fcVGCFeCAk3x47LauxtTppRI5X7uUtozLajntu7pv4kJInRPDbvH1ies X-Gm-Message-State: AOJu0YzPXWYLz2aoTS7EvLolrPxLZPeIMFA7y2zuBpFcAAX0sW6M1Qcp kAZ/lFTiz/WDaUDEU0XyyMq36ZL96Sn6EVscnoD2u5EUE+ANQKQnmOSLGkUeKw== X-Google-Smtp-Source: AGHT+IHoBbIOM5vNh6pT5ABfKxUt7FMpI6uVxEi+iIx5qDC7QCH2GBkDA8qTZy2Bcn1PQP+qDLEUiA== X-Received: by 2002:a17:902:f70f:b0:1f4:9c26:d036 with SMTP id d9443c01a7336-1f6193ee9d9mr14442085ad.14.1717058127331; Thu, 30 May 2024 01:35:27 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:65f0:63a9:90bb:50b8]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f617390fe7sm10950635ad.146.2024.05.30.01.35.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:35:26 -0700 (PDT) From: Chen-Yu Tsai To: Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: Chen-Yu Tsai , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] clk: mediatek: Add mt8173-mfgtop driver Date: Thu, 30 May 2024 16:35:01 +0800 Message-ID: <20240530083513.4135052-3-wenst@chromium.org> X-Mailer: git-send-email 2.45.1.288.g0e0cd299f1-goog In-Reply-To: <20240530083513.4135052-1-wenst@chromium.org> References: <20240530083513.4135052-1-wenst@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_013528_154744_A2ED2F80 X-CRM114-Status: GOOD ( 24.70 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org The MFG (GPU) block on the MT8173 has a small glue layer, named MFG_TOP in the datasheet, that contains clock gates, some power sequence signal delays, and other unknown registers that get toggled when the GPU is powered on. The clock gates are exposed as clocks provided by a clock controller, while the power sequencing bits are exposed as one singular power domain. Signed-off-by: Chen-Yu Tsai --- drivers/clk/mediatek/Kconfig | 9 + drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8173-mfgtop.c | 240 +++++++++++++++++++++++ 3 files changed, 250 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig index 70a005e7e1b1..9e279c739f1c 100644 --- a/drivers/clk/mediatek/Kconfig +++ b/drivers/clk/mediatek/Kconfig @@ -500,6 +500,15 @@ config COMMON_CLK_MT8173_IMGSYS help This driver supports MediaTek MT8173 imgsys clocks. +config COMMON_CLK_MT8173_MFGTOP + tristate "Clock and power driver for MediaTek MT8173 mfgtop" + depends on COMMON_CLK_MT8173 + default COMMON_CLK_MT8173 + select PM_GENERIC_DOMAINS + select PM_GENERIC_DOMAINS_OF + help + This driver supports MediaTek MT8173 mfgtop clocks and power domain. + config COMMON_CLK_MT8173_MMSYS tristate "Clock driver for MediaTek MT8173 mmsys" depends on COMMON_CLK_MT8173 diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile index eeccfa039896..fdd3a76e12a1 100644 --- a/drivers/clk/mediatek/Makefile +++ b/drivers/clk/mediatek/Makefile @@ -77,6 +77,7 @@ obj-$(CONFIG_COMMON_CLK_MT8167_VDECSYS) += clk-mt8167-vdec.o obj-$(CONFIG_COMMON_CLK_MT8173) += clk-mt8173-apmixedsys.o clk-mt8173-infracfg.o \ clk-mt8173-pericfg.o clk-mt8173-topckgen.o obj-$(CONFIG_COMMON_CLK_MT8173_IMGSYS) += clk-mt8173-img.o +obj-$(CONFIG_COMMON_CLK_MT8173_MFGTOP) += clk-mt8173-mfgtop.o obj-$(CONFIG_COMMON_CLK_MT8173_MMSYS) += clk-mt8173-mm.o obj-$(CONFIG_COMMON_CLK_MT8173_VDECSYS) += clk-mt8173-vdecsys.o obj-$(CONFIG_COMMON_CLK_MT8173_VENCSYS) += clk-mt8173-vencsys.o diff --git a/drivers/clk/mediatek/clk-mt8173-mfgtop.c b/drivers/clk/mediatek/clk-mt8173-mfgtop.c new file mode 100644 index 000000000000..85fa7a7453ed --- /dev/null +++ b/drivers/clk/mediatek/clk-mt8173-mfgtop.c @@ -0,0 +1,240 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2024 Google LLC + * Author: Chen-Yu Tsai + * + * Based on driver in downstream ChromeOS v5.15 kernel. + * + * Copyright (c) 2014 MediaTek Inc. + * Author: Chiawen Lee + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "clk-gate.h" +#include "clk-mtk.h" + +static const struct mtk_gate_regs mfg_cg_regs = { + .sta_ofs = 0x0000, + .clr_ofs = 0x0008, + .set_ofs = 0x0004, +}; + +#define GATE_MFG(_id, _name, _parent, _shift, _flags) \ + GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, _shift, &mtk_clk_gate_ops_setclr, _flags) + +/* TODO: The block actually has dividers for the core and mem clocks. */ +static const struct mtk_gate mfg_clks[] = { + GATE_MFG(CLK_MFG_AXI, "mfg_axi", "axi_mfg_in_sel", 0, CLK_SET_RATE_PARENT), + GATE_MFG(CLK_MFG_MEM, "mfg_mem", "mem_mfg_in_sel", 1, CLK_SET_RATE_PARENT), + GATE_MFG(CLK_MFG_G3D, "mfg_g3d", "mfg_sel", 2, CLK_SET_RATE_PARENT), + GATE_MFG(CLK_MFG_26M, "mfg_26m", "clk26m", 3, 0), +}; + +static const struct mtk_clk_desc mfg_desc = { + .clks = mfg_clks, + .num_clks = ARRAY_SIZE(mfg_clks), +}; + +struct mt8173_mfgtop_data { + struct clk_hw_onecell_data *clk_data; + struct regmap *regmap; + struct generic_pm_domain genpd; + struct of_phandle_args parent_pd, child_pd; + struct clk *clk_26m; +}; + +static const struct of_device_id of_match_clk_mt8173_mfgtop[] = { + { .compatible = "mediatek,mt8173-mfgtop", .data = &mfg_desc }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, of_match_clk_mt8173_mfgtop); + +/* Delay count in clock cycles */ +#define MFG_ACTIVE_POWER_CON0 0x24 + #define RST_B_DELAY_CNT GENMASK(7, 0) /* pwr_rst_b de-assert delay during power-up */ + #define CLK_EN_DELAY_CNT GENMASK(15, 8) /* CLK_DIS deassert delay during power-up */ + #define CLK_DIS_DELAY_CNT GENMASK(23, 16) /* CLK_DIS assert delay during power-down */ + +#define MFG_ACTIVE_POWER_CON1 0x28 + #define PWR_ON_S_DELAY_CNT GENMASK(7, 0) /* pwr_on_s assert delay during power-up */ + #define ISO_DELAY_CNT GENMASK(15, 8) /* ISO assert delay during power-down */ + #define ISOOFF_DELAY_CNT GENMASK(23, 16) /* ISO de-assert delay during power-up */ + #define RST__DELAY_CNT GENMASK(31, 24) /* pwr_rsb_b assert delay during power-down */ + +static int clk_mt8173_mfgtop_power_on(struct generic_pm_domain *domain) +{ + struct mt8173_mfgtop_data *data = container_of(domain, struct mt8173_mfgtop_data, genpd); + + /* drives internal power management */ + clk_prepare_enable(data->clk_26m); + + /* Power on/off delays for various signals */ + regmap_write(data->regmap, MFG_ACTIVE_POWER_CON0, + FIELD_PREP(RST_B_DELAY_CNT, 77) | + FIELD_PREP(CLK_EN_DELAY_CNT, 61) | + FIELD_PREP(CLK_DIS_DELAY_CNT, 60)); + regmap_write(data->regmap, MFG_ACTIVE_POWER_CON1, + FIELD_PREP(PWR_ON_S_DELAY_CNT, 11) | + FIELD_PREP(ISO_DELAY_CNT, 68) | + FIELD_PREP(ISOOFF_DELAY_CNT, 69) | + FIELD_PREP(RST__DELAY_CNT, 77)); + + /* Magic numbers related to core switch sequence and delays */ + regmap_write(data->regmap, 0xe0, 0x7a710184); + regmap_write(data->regmap, 0xe4, 0x835f6856); + regmap_write(data->regmap, 0xe8, 0x002b0234); + regmap_write(data->regmap, 0xec, 0x80000000); + regmap_write(data->regmap, 0xa0, 0x08000000); + + return 0; +} + +static int clk_mt8173_mfgtop_power_off(struct generic_pm_domain *domain) +{ + struct mt8173_mfgtop_data *data = container_of(domain, struct mt8173_mfgtop_data, genpd); + + /* Magic numbers related to core switch sequence and delays */ + regmap_write(data->regmap, 0xec, 0); + + /* drives internal power management */ + clk_disable_unprepare(data->clk_26m); + + return 0; +} + +static int clk_mt8173_mfgtop_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *node = dev->of_node; + struct mt8173_mfgtop_data *data; + int ret; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + platform_set_drvdata(pdev, data); + + data->clk_data = mtk_devm_alloc_clk_data(dev, ARRAY_SIZE(mfg_clks)); + if (!data->clk_data) + return -ENOMEM; + + /* MTK clock gates also uses regmap */ + data->regmap = device_node_to_regmap(node); + if (IS_ERR(data->regmap)) + return dev_err_probe(dev, PTR_ERR(data->regmap), "Failed to get regmap\n"); + + data->child_pd.np = node; + data->child_pd.args_count = 0; + ret = of_parse_phandle_with_args(node, "power-domains", "#power-domain-cells", 0, + &data->parent_pd); + if (ret) + return dev_err_probe(dev, ret, "Failed to parse power domain\n"); + + devm_pm_runtime_enable(dev); + /* + * Do a pm_runtime_resume_and_get() to workaround a possible + * deadlock between clk_register() and the genpd framework. + */ + ret = pm_runtime_resume_and_get(dev); + if (ret) { + dev_err_probe(dev, ret, "Failed to runtime resume device\n"); + goto put_of_node; + } + + ret = mtk_clk_register_gates(dev, node, mfg_clks, ARRAY_SIZE(mfg_clks), + data->clk_data); + if (ret) { + dev_err_probe(dev, ret, "Failed to register clock gates\n"); + goto put_pm_runtime; + } + + data->clk_26m = clk_hw_get_clk(data->clk_data->hws[CLK_MFG_26M], "26m"); + if (IS_ERR(data->clk_26m)) { + dev_err_probe(dev, PTR_ERR(data->clk_26m), "Failed to get 26 MHz clock\n"); + goto unregister_clks; + } + + ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, data->clk_data); + if (ret) { + dev_err_probe(dev, ret, "Failed to add clk OF provider\n"); + goto put_26m_clk; + } + + data->genpd.name = "mfg_apm"; + data->genpd.power_on = clk_mt8173_mfgtop_power_on; + data->genpd.power_off = clk_mt8173_mfgtop_power_off; + ret = pm_genpd_init(&data->genpd, NULL, true); + if (ret) { + dev_err_probe(dev, ret, "Failed to add power domain\n"); + goto del_clk_provider; + } + + ret = of_genpd_add_provider_simple(node, &data->genpd); + if (ret) { + dev_err_probe(dev, ret, "Failed to add power domain OF provider\n"); + goto remove_pd; + } + + ret = of_genpd_add_subdomain(&data->parent_pd, &data->child_pd); + if (ret) { + dev_err_probe(dev, ret, "Failed to link PM domains\n"); + goto del_pd_provider; + } + + pm_runtime_put(dev); + return 0; + +del_pd_provider: + of_genpd_del_provider(node); +remove_pd: + pm_genpd_remove(&data->genpd); +del_clk_provider: + of_clk_del_provider(node); +put_26m_clk: + clk_put(data->clk_26m); +unregister_clks: + mtk_clk_unregister_gates(mfg_clks, ARRAY_SIZE(mfg_clks), data->clk_data); +put_pm_runtime: + pm_runtime_put(dev); +put_of_node: + of_node_put(data->parent_pd.np); + return ret; +} + +static void clk_mt8173_mfgtop_remove(struct platform_device *pdev) +{ + struct mt8173_mfgtop_data *data = platform_get_drvdata(pdev); + struct device_node *node = pdev->dev.of_node; + + of_genpd_remove_subdomain(&data->parent_pd, &data->child_pd); + of_genpd_del_provider(node); + pm_genpd_remove(&data->genpd); + of_clk_del_provider(node); + clk_put(data->clk_26m); + mtk_clk_unregister_gates(mfg_clks, ARRAY_SIZE(mfg_clks), data->clk_data); +} + +static struct platform_driver clk_mt8173_mfgtop_drv = { + .probe = clk_mt8173_mfgtop_probe, + .remove_new = clk_mt8173_mfgtop_remove, + .driver = { + .name = "clk-mt8173-mfgtop", + .of_match_table = of_match_clk_mt8173_mfgtop, + }, +}; +module_platform_driver(clk_mt8173_mfgtop_drv); + +MODULE_DESCRIPTION("MediaTek MT8173 mfgtop clock driver"); +MODULE_LICENSE("GPL"); From patchwork Thu May 30 08:35:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 13679906 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 72807C25B74 for ; Thu, 30 May 2024 08:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7xwThRWWm7RGJSY39HVyy4ljf9OK8/1xd1SRHdwBmpo=; b=mR1y4FhCiUHFgY0XbgwvCUvarQ z7pKivwtF9uyGonQN/6/BzOmEcxL5ZEcK5ypD+MQKHy1ZoK2MVFeLynoBVvN8bw/nkAVtiJGp/b4B bcw1han8x4EXZwsIl6+41fvlhaqFzuky+EyRLU5Yq0yyoV9PeR3TUHj7fjIbp3MYsvwW9FcJak342 Rdc3Z/IuNL+tgCcvvAQSGHeyMEF84VNPJDJwdvT4mv9GhpbzlTT8qCuFOYIFDDSaUmruw+EaOxbaj ZLYvJXE1nRnutgfKBm4YM33hCMgW5MxZzw/sc+9ZQ9CsHMMiye6FtQ/I9UVX+StFU/uBbUxnUJ4qt bHiTDMxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbGc-00000006e95-26oq; Thu, 30 May 2024 08:36:10 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbFz-00000006dn5-3bcx for linux-mediatek@lists.infradead.org; Thu, 30 May 2024 08:35:34 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1f480624d04so5933935ad.2 for ; Thu, 30 May 2024 01:35:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1717058131; x=1717662931; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7xwThRWWm7RGJSY39HVyy4ljf9OK8/1xd1SRHdwBmpo=; b=jx3GQdKBprVG7MRQUjDPO82gcD97AEk+Qpjs11qTHZIh+wE5NVfAu+AIFahEt/MwCb DjKJm9tvzgum61YGjWdRTOGccQmk4ni88Qe6NTM1Ws6El4OKirHLNoy5Ca6r8aFjCN6r PkGwXCPlK8Vr1E3VTdPYehYcPyXfA7ohKoPMw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717058131; x=1717662931; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7xwThRWWm7RGJSY39HVyy4ljf9OK8/1xd1SRHdwBmpo=; b=AWEXlA9xPv8CZ+qnTL+ho+CHFMcJZt+9Ezly4q7M/r4aCN3IaUNEIRxr1SC8MLn1Ru XexoqDQ8ZNf9eD7LdiSeQSbCJRlFtFTqsehfXSIPa59HQMgEFYIm2F/q7j/sdwMiZlnc axMSWgrQ+Am4mMxY0pprgLH/hreb8uCXhpsC35obKRp6vBHixd29gL9h79DKZLNS3+Ho Ll0FGdydIHgl90F7mMQJr7bCChWwJuCrBDKe3jQZfypFC20o62lTOqExodmh+O9Gg684 5xG6QXE05cnZGc5etKHI93bqtVzXJKseceuhaRZm5OKyemKZl+vEVM1WNOaI16ahopGd szQw== X-Forwarded-Encrypted: i=1; AJvYcCVBN1m5lsVtUMotZKxLWv0QkY9klpkgi98ddOKmz7ERaAhJoYvIghFHc7x3fAssUZ2+M/RS5TZpN/tcxAB1sqngNc0Z10kEI4OGDoNsyqbaFeqO X-Gm-Message-State: AOJu0YxZ4RWP7fM4hkUEPvcG/KWwUPxwJZvtyz1aFU6YtBVAjrNROb/D KP5/Lk6LJ/+XZkFtn1m3xagID9N6jSbMovPHZY+F/HPIXDEqYj65KrhsKyHKQw== X-Google-Smtp-Source: AGHT+IEp028TMUUWRl/RXoMRYp1icLkfUsk+YnlWATTbz/4qqOD7Tx9V/9ogbJ57638g/PX+8PWjow== X-Received: by 2002:a17:902:c409:b0:1f5:e796:f26a with SMTP id d9443c01a7336-1f6193f2c1cmr16752955ad.5.1717058130799; Thu, 30 May 2024 01:35:30 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:65f0:63a9:90bb:50b8]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f617390fe7sm10950635ad.146.2024.05.30.01.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:35:30 -0700 (PDT) From: Chen-Yu Tsai To: Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: Chen-Yu Tsai , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU Date: Thu, 30 May 2024 16:35:02 +0800 Message-ID: <20240530083513.4135052-4-wenst@chromium.org> X-Mailer: git-send-email 2.45.1.288.g0e0cd299f1-goog In-Reply-To: <20240530083513.4135052-1-wenst@chromium.org> References: <20240530083513.4135052-1-wenst@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_013532_007261_39CD1FF2 X-CRM114-Status: GOOD ( 11.68 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org The MediaTek MT8173 comes with a PowerVR Rogue GX6250, which is one of the Series6XT GPUs, another sub-family of the Rogue family. This was part of the very first few versions of the PowerVR submission, but was later dropped. The compatible string has been updated to follow the new naming scheme adopted for the AXE series. In a previous iteration of the PowerVR binding submission [1], the number of clocks required for the 6XT family was mentioned to be always 3. This is also reflected here. [1] https://lore.kernel.org/dri-devel/6eeccb26e09aad67fb30ffcd523c793a43c79c2a.camel@imgtec.com/ Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Conor Dooley --- .../bindings/gpu/img,powervr-rogue.yaml | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml b/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml index 256e252f8087..48aa205b66b4 100644 --- a/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml +++ b/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml @@ -12,10 +12,17 @@ maintainers: properties: compatible: - items: - - enum: - - ti,am62-gpu - - const: img,img-axe # IMG AXE GPU model/revision is fully discoverable + oneOf: + - items: + - enum: + - mediatek,mt8173-gpu + # PowerVR 6XT GPU model/revision is fully discoverable + - const: img,powervr-6xt + - items: + - enum: + - ti,am62-gpu + # IMG AXE GPU model/revision is fully discoverable + - const: img,img-axe reg: maxItems: 1 @@ -56,6 +63,15 @@ allOf: properties: clocks: maxItems: 1 + - if: + properties: + compatible: + contains: + const: img,powervr-6xt + then: + properties: + clocks: + minItems: 3 examples: - | From patchwork Thu May 30 08:35:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 13679907 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D53A8C25B78 for ; Thu, 30 May 2024 08:36:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IHkwqtBAKIh1FT18Wf08tYxtDsD9mBo3yYE6cpTa5lo=; b=olzEs7MGGBuIA/LprAXA1mY2kc oJwxfgg1W1emKLMQCOFC0XtPhPtVpZPBcs0aWGWHXuaCJ7G5WgaLIT04zNiTpizlZzHRwA5FnOLOw J8lgtQlOVdFW2fnQsUTTh0bULSL+WVot9Yfk7/vxVoJ2FKV91EmoTh5xPUUgGXI8I/GN5qLQLItWq jRGy7rxknMv/J954RhNxDY53mLfwfvQg1UjImBVz9rlVQKD1Isngna/2BVRE+Gu/B4E+D0boBajuz gYZCdJFrIYayBC6JWLHzKiX7FoNc5mE1101BKUKmKHPxqMBEQie4qAGmGUHd7sctsOPndzQI7AoCZ 2T0ErNmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbGp-00000006eGU-1NVz; Thu, 30 May 2024 08:36:25 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbG2-00000006dpN-3ow6 for linux-mediatek@lists.infradead.org; Thu, 30 May 2024 08:35:38 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1f44b4404dfso5772005ad.0 for ; Thu, 30 May 2024 01:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1717058134; x=1717662934; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IHkwqtBAKIh1FT18Wf08tYxtDsD9mBo3yYE6cpTa5lo=; b=iQuZwjqwzlrIQ3nG04EOIWVW6DcuVe6gTx9q/LX+o2eE8Fo0jUwnhDPC03KsO5P9cy 1e3WxjnYhd7gdm7fXG4NnZbw5uo1Zu5vmcmz2jwZZ3zv4fWh6u4m+zO+eHTZa5q7Bigk JR/Ug2eQpnT1/B0Q10ZWYF2ftHl5WG3Tfv1Zs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717058134; x=1717662934; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IHkwqtBAKIh1FT18Wf08tYxtDsD9mBo3yYE6cpTa5lo=; b=Vm494CWrgd/ibbY0y5fXuD4l35G/DUf3THujnbZ7E34TQMTjbHaL8h3zk64qL2Uvak NC4JkkkntyMQmGcP/Fuy2+SCnWlS2xbDC2mbEqTxQKnk5AyUHGxJK0RZ8KBerLQfMRS9 ay+anMDb1YJx3Em/mlNJtqx+jDclrt7dKRzwfKTBCLbSfQ1OLa01YTxmkIlmFMRt7dVY egRyW2Ym/3yb0HQZ0T+jk/1k36enWyIgxgziGuOnIyZOn6YVe1FCETB/hsq7Y2EC8Ujq kqqvlLJe75E970DKm2JdIOuH332DquiWbxMwVjSCI87X7IIPorgxRPxRqPexuUPUgrZq 83dw== X-Forwarded-Encrypted: i=1; AJvYcCVxr7Rhss6fFnk1HKkJwno0kSY1LfT9uW5jMcF1wrs+vX2BwwIitgEQyRv9idDnIycaZuPQAVBwuNnFDR85xIPYXxkG5/jTkCWktmdIBLqFFWd1 X-Gm-Message-State: AOJu0YxYHCQvzGpLnNw6nBlsQeTyAwNhWZj2XTrczjemFIF4Br8J7QEp G20eyjM29r8lkuuTOUjRmNp5oIzwACAQLv5EqOQYJ4udN+WowshXs2j7p1EsBg== X-Google-Smtp-Source: AGHT+IGaMXKlAuHj3tKDXFrEymwDvO07A1BRFroXZlN02EvX5mN7HsOfQHvylgHcYJoSPTNjRI9s+A== X-Received: by 2002:a17:903:2095:b0:1f4:768b:445e with SMTP id d9443c01a7336-1f619605ee4mr11933665ad.24.1717058134222; Thu, 30 May 2024 01:35:34 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:65f0:63a9:90bb:50b8]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f617390fe7sm10950635ad.146.2024.05.30.01.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:35:33 -0700 (PDT) From: Chen-Yu Tsai To: Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: Chen-Yu Tsai , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] drm/imagination: Add compatible string entry for Series6XT Date: Thu, 30 May 2024 16:35:03 +0800 Message-ID: <20240530083513.4135052-5-wenst@chromium.org> X-Mailer: git-send-email 2.45.1.288.g0e0cd299f1-goog In-Reply-To: <20240530083513.4135052-1-wenst@chromium.org> References: <20240530083513.4135052-1-wenst@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_013535_009585_0C8531BF X-CRM114-Status: GOOD ( 10.44 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org The MediaTek MT8173 comes with a PowerVR Rogue GX6250, which is part of the Series6XT, another variation of the Rogue family of GPUs. Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno --- drivers/gpu/drm/imagination/pvr_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/imagination/pvr_drv.c b/drivers/gpu/drm/imagination/pvr_drv.c index 5c3b2d58d766..3d1a933c8303 100644 --- a/drivers/gpu/drm/imagination/pvr_drv.c +++ b/drivers/gpu/drm/imagination/pvr_drv.c @@ -1475,6 +1475,7 @@ pvr_remove(struct platform_device *plat_dev) static const struct of_device_id dt_match[] = { { .compatible = "img,img-axe", .data = NULL }, + { .compatible = "img,powervr-6xt", .data = NULL }, {} }; MODULE_DEVICE_TABLE(of, dt_match); From patchwork Thu May 30 08:35:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 13679929 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 333E4C25B74 for ; Thu, 30 May 2024 08:36:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SmWglR2Ij5/TGj5MHHzWjORF1jpZWpClgT/eZSAiwmw=; b=dmLE7k6TS4GlUZOYZARH4VpwOZ 0NmlVfTAAGoism2rdmf03cIvx06mMGeltqnL7Q8GViILzk2bhfJnoLx9kJnBvXYkwCAJ/RmiVoLOE yDUQJiD3wHElxcE0KKhqXG5KiKsvYH0S9Jev9Aa6AR5idHu6qIwU8Nu66n8Wlqt1TPmGmyPlqjs+O Ztjp+GnzxXqVxOR+dLBSgFPRKKP1btMPZI5akRwcThaqCwPXjVEHt+1g2l/mA8SAaFP5KB8BFyaP1 nWVqKxqgOSEkRNNl1R9KAVv5K5DNckprVepGe4plXGm2QlA6ezX2CcI72qqvvkQlIzRL/HyWd0jkR sEABFapQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbGz-00000006eKw-2wvF; Thu, 30 May 2024 08:36:33 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbG6-00000006dr9-1S41 for linux-mediatek@lists.infradead.org; Thu, 30 May 2024 08:35:42 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1f3469382f2so5122305ad.0 for ; Thu, 30 May 2024 01:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1717058138; x=1717662938; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SmWglR2Ij5/TGj5MHHzWjORF1jpZWpClgT/eZSAiwmw=; b=dgdwlRSzc4MJP7IiOfmFXyojkNb1LtjAzuc+Yo13RsIwfCUVhJMdDVZ20N+TkFPd35 NRi/D9BpvQXmQQZirhMfjhz9HqRxQnAhec3p5NE67QihfFXbN7fNltcpqFyIuhwomj3a t7CigDGZVFE+1A1T29VQdY8RXlZF9EktmC12Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717058138; x=1717662938; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SmWglR2Ij5/TGj5MHHzWjORF1jpZWpClgT/eZSAiwmw=; b=SPNfHBddzej06t3WKFugjMpAVHmc744PPIPJshgkdYBloYO7ELMcyhmGZ1OBzhdZjq Q+BsEBlIZ9isPTR8dhtStxJVH1ABxwMbjsD5sx12i/PSyluw2Ga0tfVGW5xqzW53I8/K pnfLBEV9DT/+Qp22LYQKWEJ0o/1G/SZg8lxlXL3GzMphHo4kG2w1UNjWpTSzHtHRDEQ+ q6FlFBRybtO1ROoSJSMsf7mIEO1Fc61arA/M+A+SxwWNVpTpgo6of9QPSiEiTFwXHfm8 SrKAUEu9p+jdfl4NpOMG2yUtlj2KP7uh6UMsa3w+D/9iwVzLW6875QTBRUnBQx0NMxqz 0ciw== X-Forwarded-Encrypted: i=1; AJvYcCVPaE8k29nCdvaVmf9eNolJl8N+weG178lk9yHP7UNkYfTuwIFzSuSo2htX/mV2w4Dca/Zywixaozr70+YEtpYSovNXo4u4VhIQTKYHtIxQ+umy X-Gm-Message-State: AOJu0YxB4SH6rXRKL2Ee7rhDDdiTND1LI4ADfe2LJACNJ8zdkBEvebap Wy9+66rk9i4BXZfnjLCoaUKah1hnRYVRVyj/d8OumO93sXY1E8WMVz++O2XrHA== X-Google-Smtp-Source: AGHT+IFpzoyjS8oEHpsPco6/0czovfTG+BgxZDwOvkJUGlKruUTXsaiUOVp8Alhb12YxLjpScrPXfA== X-Received: by 2002:a17:902:74c8:b0:1f4:7f18:6d7c with SMTP id d9443c01a7336-1f61a4db927mr16665575ad.61.1717058137709; Thu, 30 May 2024 01:35:37 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:65f0:63a9:90bb:50b8]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f617390fe7sm10950635ad.146.2024.05.30.01.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:35:37 -0700 (PDT) From: Chen-Yu Tsai To: Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: Chen-Yu Tsai , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock Date: Thu, 30 May 2024 16:35:04 +0800 Message-ID: <20240530083513.4135052-6-wenst@chromium.org> X-Mailer: git-send-email 2.45.1.288.g0e0cd299f1-goog In-Reply-To: <20240530083513.4135052-1-wenst@chromium.org> References: <20240530083513.4135052-1-wenst@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_013538_677265_4B2E6EDA X-CRM114-Status: GOOD ( 14.90 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org The MFG_ASYNC domain, which is likely associated to the whole MFG block, currently specifies clk26m as its domain clock. This is bogus, since the clock is an external crystal with no controls. Also, the MFG block has a independent CLK_TOP_AXI_MFG_IN_SEL clock, which according to the block diagram, gates access to the hardware registers. Having this one as the domain clock makes much more sense. This also fixes access to the MFGTOP registers. Change the MFG_ASYNC domain clock to CLK_TOP_AXI_MFG_IN_SEL. Fixes: 8b6562644df9 ("arm64: dts: mediatek: Add mt8173 power domain controller") Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno --- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi index 3458be7f7f61..136b28f80cc2 100644 --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi @@ -497,7 +497,7 @@ power-domain@MT8173_POWER_DOMAIN_USB { }; mfg_async: power-domain@MT8173_POWER_DOMAIN_MFG_ASYNC { reg = ; - clocks = <&clk26m>; + clocks = <&topckgen CLK_TOP_AXI_MFG_IN_SEL>; clock-names = "mfg"; #address-cells = <1>; #size-cells = <0>; From patchwork Thu May 30 08:35:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 13679930 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 53A05C25B74 for ; Thu, 30 May 2024 08:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=P3dPYP7w2xcwwD4ezxBwzChfzLxfVatZgNqWhWYFewg=; b=kcdN3vJEmbMRLe50285Nw54FiG rBWmbks/XhYDz9hhC4VAXJbd663TZVQof88tDldsBFFAPiDxpgN1Wkjk/PZEf7RCgJWlW7deyWC+x 1JlaDS/wmjv1VZGCUSD7EeufLUhIBeVq4zi7ahRQY2mZJVfrVRjzCDMeWqfC9OaRQAcFW6B4APSA6 TPcr5Z5JOwvhxz2Vccy9e4SwM2HEfmALrm4mJy5fSMf8f+blDvHs25qGlb9c8gKgK9fMgBZdk4o/z rTwrEGI3ArHBDZLJAJBuQodKDx0Q4pVJrr5E/egKEHHn5+w7Y6ACPisrhVVjzJ9urqizgiYahSUg3 KFONQbLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbH8-00000006eRG-2qXL; Thu, 30 May 2024 08:36:42 +0000 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCbGA-00000006dtm-1JgD for linux-mediatek@lists.infradead.org; Thu, 30 May 2024 08:35:47 +0000 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-6c0fdf42328so158709a12.3 for ; Thu, 30 May 2024 01:35:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1717058141; x=1717662941; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P3dPYP7w2xcwwD4ezxBwzChfzLxfVatZgNqWhWYFewg=; b=ZRCK0BE2SunqARcBhuH7J/MAAP/rIb89KACjjupqYx19gPMfNf+4hjTOGZ5iBGTse7 0UPDF8P+755AQLn8E1wdFz/fZ8U03zOd/aZr4geiq3pj+JR3fMF/f21cEZ1oUpzK8OrT 4DQ2AETtCApEzKqoXL1+UxZcBS2QTkNJg3V2Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717058141; x=1717662941; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P3dPYP7w2xcwwD4ezxBwzChfzLxfVatZgNqWhWYFewg=; b=oZ8aNLmMZjeRNRumdeq/qboBFxqt6U5muTZeyrNhG1t06YHuY/jsIxQB9QPMcfr3ke xPUsqLkeUel6H22gdQqGSXF0A0vAHG5kieHB4hRfk3PL10PpFwD/xi9w9i5OQ7Pnt3NN e+EX4hUuCzFMGiNkdeyrPvoWoOGFFzt9eiXLmbrNaYkxYNyZ6aSYhDGQCKnR2eZJLLQq w75uPvvuWD5jh+Kvd+zJBa1KgNvliYQEtV1Q75fdnR+WMPswKv++gvSVEPiRRs9tnQn5 w0A1uNHD8ZVJddxJ5fB7fZDb6Je+iYsb5Z3WCfZMl5yj7XHIrUXTGy3+B7UXgdYjnt+G RpVQ== X-Forwarded-Encrypted: i=1; AJvYcCVtwR4Zfgx6FfDOPq3dimmQv0GDAzIHCVyNNQCuDUmjmZu3MBV+b3b8nHs1T24WVo2Rs4/HWzycC2MhaWEV9qBLHUcnlZOi9KF28UhJcZJb5HW/ X-Gm-Message-State: AOJu0YxxvBeWaE53yNgCPvU6lHUgWl6+Ik623KHiYlmqExQSLtp7XYBe 85MUHBrH2yO/dr/TNBl8CSWHQNGb25AZmKiI6KfYGrbcvDRed/+J3uPJIVNY8g== X-Google-Smtp-Source: AGHT+IFl9n7DktKEcpEJ4WGQz7AcjFouxFiRzMPk6dDKBcDqPpXqbxbt5Utw0hXKMF4XUXofIeg46w== X-Received: by 2002:a05:6a21:99a3:b0:1b1:ec17:e59c with SMTP id adf61e73a8af0-1b264618a95mr1679425637.61.1717058141165; Thu, 30 May 2024 01:35:41 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:65f0:63a9:90bb:50b8]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f617390fe7sm10950635ad.146.2024.05.30.01.35.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:35:40 -0700 (PDT) From: Chen-Yu Tsai To: Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: Chen-Yu Tsai , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/6] arm64: dts: mediatek: mt8173: Add GPU device nodes Date: Thu, 30 May 2024 16:35:05 +0800 Message-ID: <20240530083513.4135052-7-wenst@chromium.org> X-Mailer: git-send-email 2.45.1.288.g0e0cd299f1-goog In-Reply-To: <20240530083513.4135052-1-wenst@chromium.org> References: <20240530083513.4135052-1-wenst@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_013542_793316_EA2E881E X-CRM114-Status: GOOD ( 10.89 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org The MediaTek MT8173 comes with a PowerVR Rogue GX6250, which is part of the Series6XT, another variation of the Rogue family of GPUs. On top of the GPU is a glue layer that handles some clock and power signals. Add device nodes for both. Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno --- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi index 136b28f80cc2..3d7b9cc20a16 100644 --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi @@ -993,6 +993,30 @@ u2port1: usb-phy@11291000 { }; }; + gpu: gpu@13000000 { + compatible = "mediatek,mt8173-gpu", "img,powervr-6xt"; + reg = <0 0x13000000 0 0x10000>; + interrupts = ; + clocks = <&mfgtop CLK_MFG_G3D>, + <&mfgtop CLK_MFG_MEM>, + <&mfgtop CLK_MFG_AXI>; + clock-names = "core", "mem", "sys"; + power-domains = <&mfgtop>; + }; + + mfgtop: clock-controller@13fff000 { + compatible = "mediatek,mt8173-mfgtop"; + reg = <0 0x13fff000 0 0x1000>; + clocks = <&topckgen CLK_TOP_AXI_MFG_IN_SEL>, + <&topckgen CLK_TOP_MEM_MFG_IN_SEL>, + <&topckgen CLK_TOP_MFG_SEL>, + <&clk26m>; + clock-names = "sys", "mem", "core", "clk26m"; + power-domains = <&spm MT8173_POWER_DOMAIN_MFG>; + #clock-cells = <1>; + #power-domain-cells = <0>; + }; + mmsys: syscon@14000000 { compatible = "mediatek,mt8173-mmsys", "syscon"; reg = <0 0x14000000 0 0x1000>;