From patchwork Mon Sep 11 02:52:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xianwei Zhao X-Patchwork-Id: 13378627 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 6B0DFEE49A4 for ; Mon, 11 Sep 2023 02:53:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AkoHn9KUN6BbKeklAIgqD0tgHfHOpnooRwHsAwh6R9I=; b=oKUknwoepV4BSI 2s58YjwmmDV3bn0VpOS8+97Y0m7dh9NNLfhV1vjODyVFcFVXPdZ+SpO1jH7/yViWnG4ZdxgfN2Vjd WNjH7jrqY9XsEKa1NPOvK0NPmzgWWkQgcyjVk/BS5Wb6EBiSpWgosKsTqyBuXV/jLwAClaIBv2CTa 14I9FBXvLOzY3Z4RQL0Aqg13LuYwYmrcK1R6vQD6Wfcs6qEgqk+OOcHBtypGljXmQLVqB4/8vOQx4 Qe+EDd8acmkceJByNNyeZ6mqciLWXL3/hv39cOIpXpC0knNtHvo92l+FvLrPbYl8PemV2amChnkIh k+fEjmRt/o0SjpHNWd7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfX2o-00H7hq-2z; Mon, 11 Sep 2023 02:52:58 +0000 Received: from mail-sh.amlogic.com ([58.32.228.43]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfX2l-00H7fW-1r; Mon, 11 Sep 2023 02:52:56 +0000 Received: from droid01-cd.amlogic.com (10.98.11.200) by mail-sh.amlogic.com (10.18.11.5) with Microsoft SMTP Server id 15.1.2507.13; Mon, 11 Sep 2023 10:52:28 +0800 From: Xianwei Zhao To: , , , , CC: Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Neil Armstrong" , Kevin Hilman , Ulf Hansson , xianwei.zhao Subject: [PATCH V3 RESEND 1/6] genpd: amlogic: modify some power domains property Date: Mon, 11 Sep 2023 10:52:18 +0800 Message-ID: <20230911025223.3433776-2-xianwei.zhao@amlogic.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230911025223.3433776-1-xianwei.zhao@amlogic.com> References: <20230911025223.3433776-1-xianwei.zhao@amlogic.com> MIME-Version: 1.0 X-Originating-IP: [10.98.11.200] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230910_195255_622423_43D37F22 X-CRM114-Status: UNSURE ( 8.56 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org From: "xianwei.zhao" Some power domains for C3 can be using runtime PM, remove ALWAYS_ON property. And add some power domains description when ALWAYS_ON property. Signed-off-by: xianwei.zhao Reviewed-by: Neil Armstrong --- V2 -> V3: modify subject "genpd: amlogic: " V1 -> V2: None --- drivers/genpd/amlogic/meson-secure-pwrc.c | 25 ++++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/genpd/amlogic/meson-secure-pwrc.c b/drivers/genpd/amlogic/meson-secure-pwrc.c index 89c881c56cd7..5ac2437ab8ad 100644 --- a/drivers/genpd/amlogic/meson-secure-pwrc.c +++ b/drivers/genpd/amlogic/meson-secure-pwrc.c @@ -122,18 +122,19 @@ static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = { }; static struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = { - SEC_PD(C3_NNA, 0), - SEC_PD(C3_AUDIO, GENPD_FLAG_ALWAYS_ON), - SEC_PD(C3_SDIOA, GENPD_FLAG_ALWAYS_ON), - SEC_PD(C3_EMMC, GENPD_FLAG_ALWAYS_ON), - SEC_PD(C3_USB_COMB, GENPD_FLAG_ALWAYS_ON), - SEC_PD(C3_SDCARD, GENPD_FLAG_ALWAYS_ON), - SEC_PD(C3_ETH, GENPD_FLAG_ALWAYS_ON), - SEC_PD(C3_GE2D, GENPD_FLAG_ALWAYS_ON), - SEC_PD(C3_CVE, GENPD_FLAG_ALWAYS_ON), - SEC_PD(C3_GDC_WRAP, GENPD_FLAG_ALWAYS_ON), - SEC_PD(C3_ISP_TOP, GENPD_FLAG_ALWAYS_ON), - SEC_PD(C3_MIPI_ISP_WRAP, GENPD_FLAG_ALWAYS_ON), + SEC_PD(C3_NNA, 0), + SEC_PD(C3_AUDIO, 0), + SEC_PD(C3_SDIOA, 0), + SEC_PD(C3_EMMC, 0), + SEC_PD(C3_USB_COMB, 0), + SEC_PD(C3_SDCARD, 0), + /* ETH is for ethernet online wakeup, and should be always on */ + SEC_PD(C3_ETH, GENPD_FLAG_ALWAYS_ON), + SEC_PD(C3_GE2D, 0), + SEC_PD(C3_CVE, 0), + SEC_PD(C3_GDC_WRAP, 0), + SEC_PD(C3_ISP_TOP, 0), + SEC_PD(C3_MIPI_ISP_WRAP, 0), SEC_PD(C3_VCODEC, 0), }; From patchwork Mon Sep 11 02:52:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xianwei Zhao X-Patchwork-Id: 13378629 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 2A6BDC71153 for ; Mon, 11 Sep 2023 02:53: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: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Nsor3EBn3KOXVhUoaHRxBJH85BI16TFGD7DOxJN/b2E=; b=q0FG9/9B4fP0IA 3sose3/SUSWtJ0Fdbsv4h4eP3PSucUymipbwrzbsmLSKhw2OWFUIHk210vMLPsLMj/mxPAsr/XwhL JNCTfM/M9yIGCwJCm3j9S5VucX5CpkFAjsqHPv2CeQKtkygiI6MvDEttFw3JT35x1K+s4gN9poApF zeXzGq62zfBQQt+OuKI+3tic9O/YZnzMM144jeN42fis5OFa7U5owfJAeJPu0pD0FXpGqnDA4pLen 3E1OYA+zPh8pwm9iHYnev/mz0/8JIQTEPB4sCjeF9t0rMFnQyuLaA5OwHq9nPXq7YxZHvFU2Q+L8l CKLASv/wQ3knYYnDce3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfX2s-00H7kC-1W; Mon, 11 Sep 2023 02:53:02 +0000 Received: from mail-sh.amlogic.com ([58.32.228.43]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfX2n-00H7fW-0p; Mon, 11 Sep 2023 02:52:58 +0000 Received: from droid01-cd.amlogic.com (10.98.11.200) by mail-sh.amlogic.com (10.18.11.5) with Microsoft SMTP Server id 15.1.2507.13; Mon, 11 Sep 2023 10:52:30 +0800 From: Xianwei Zhao To: , , , , CC: Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Neil Armstrong" , Kevin Hilman , Ulf Hansson , xianwei.zhao Subject: [PATCH V3 RESEND 2/6] genpd: amlogic: add driver to support power parent node Date: Mon, 11 Sep 2023 10:52:19 +0800 Message-ID: <20230911025223.3433776-3-xianwei.zhao@amlogic.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230911025223.3433776-1-xianwei.zhao@amlogic.com> References: <20230911025223.3433776-1-xianwei.zhao@amlogic.com> MIME-Version: 1.0 X-Originating-IP: [10.98.11.200] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230910_195257_293112_721DCDED X-CRM114-Status: GOOD ( 14.17 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org From: "xianwei.zhao" Some power domains depends on other domains, Such as Amlogic T7 SoC. Add parent node to support this case. Signed-off-by: xianwei.zhao --- V2 -> V3: modify subject "genpd: amlogic: " define PWRC_NO_PARENT UINT_MAX V1 -> V2: None --- drivers/genpd/amlogic/meson-secure-pwrc.c | 26 ++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/genpd/amlogic/meson-secure-pwrc.c b/drivers/genpd/amlogic/meson-secure-pwrc.c index 5ac2437ab8ad..ecada537b19c 100644 --- a/drivers/genpd/amlogic/meson-secure-pwrc.c +++ b/drivers/genpd/amlogic/meson-secure-pwrc.c @@ -19,10 +19,12 @@ #define PWRC_ON 1 #define PWRC_OFF 0 +#define PWRC_NO_PARENT UINT_MAX struct meson_secure_pwrc_domain { struct generic_pm_domain base; unsigned int index; + unsigned int parent; struct meson_secure_pwrc *pwrc; }; @@ -34,6 +36,7 @@ struct meson_secure_pwrc { struct meson_secure_pwrc_domain_desc { unsigned int index; + unsigned int parent; unsigned int flags; char *name; bool (*is_off)(struct meson_secure_pwrc_domain *pwrc_domain); @@ -90,8 +93,19 @@ static int meson_secure_pwrc_on(struct generic_pm_domain *domain) { \ .name = #__name, \ .index = PWRC_##__name##_ID, \ - .is_off = pwrc_secure_is_off, \ + .is_off = pwrc_secure_is_off, \ .flags = __flag, \ + .parent = PWRC_NO_PARENT, \ +} + +#define TOP_PD(__name, __flag, __parent) \ +[PWRC_##__name##_ID] = \ +{ \ + .name = #__name, \ + .index = PWRC_##__name##_ID, \ + .is_off = pwrc_secure_is_off, \ + .flags = __flag, \ + .parent = __parent, \ } static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = { @@ -202,6 +216,7 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev) dom->pwrc = pwrc; dom->index = match->domains[i].index; + dom->parent = match->domains[i].parent; dom->base.name = match->domains[i].name; dom->base.flags = match->domains[i].flags; dom->base.power_on = meson_secure_pwrc_on; @@ -212,6 +227,15 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev) pwrc->xlate.domains[i] = &dom->base; } + for (i = 0; i < match->count; i++) { + struct meson_secure_pwrc_domain *dom = pwrc->domains; + + if (!match->domains[i].name || match->domains[i].parent == PWRC_NO_PARENT) + continue; + + pm_genpd_add_subdomain(&dom[dom[i].parent].base, &dom[i].base); + } + return of_genpd_add_provider_onecell(pdev->dev.of_node, &pwrc->xlate); } From patchwork Mon Sep 11 02:52:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xianwei Zhao X-Patchwork-Id: 13378630 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 C807DEEB57D for ; Mon, 11 Sep 2023 02:53:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Oz8/C7Qu+nwf8WRDjtM7rS4xuUoFZUyVVsF894A/8dU=; b=DoElrJUP0tR8rm g8eP53+bj7H7FsgSSai8yVkRunUUEt5T1DOTYkEgPwsFLZn3SjgerRpJyF+H59T9akkyPVUu7OWdg 2kYNuVDmBBD1DHGpMsA6zskCeal0sEvnFYrfV/DzHRu6/Bwk7Gynwt1xgSvKvZVSU7yhN+Ryv59MV 95lN4l/7gPg/6yuNGmIWE3/BP4AeQG5ezoIfTaTt2VDEMq/LMPx9LFZHUGzAS72/qKUyyFXLli5H5 vKl2/L6dgP2uhudyPy9hwXtsaUsAhXX6hIyQ4c5pwMjVR9G7EiN+VgzLHOREH0SaRiaUjyJx3WDLr 9nBfGJMOUB6kernQ0X2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfX2t-00H7l7-21; Mon, 11 Sep 2023 02:53:03 +0000 Received: from mail-sh.amlogic.com ([58.32.228.43]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfX2o-00H7fW-3C; Mon, 11 Sep 2023 02:53:00 +0000 Received: from droid01-cd.amlogic.com (10.98.11.200) by mail-sh.amlogic.com (10.18.11.5) with Microsoft SMTP Server id 15.1.2507.13; Mon, 11 Sep 2023 10:52:32 +0800 From: Xianwei Zhao To: , , , , CC: Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Neil Armstrong" , Kevin Hilman , Ulf Hansson , xianwei.zhao Subject: [PATCH V3 RESEND 3/6] genpd: amlogic: init power domain state Date: Mon, 11 Sep 2023 10:52:20 +0800 Message-ID: <20230911025223.3433776-4-xianwei.zhao@amlogic.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230911025223.3433776-1-xianwei.zhao@amlogic.com> References: <20230911025223.3433776-1-xianwei.zhao@amlogic.com> MIME-Version: 1.0 X-Originating-IP: [10.98.11.200] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230910_195259_031076_D656360B X-CRM114-Status: UNSURE ( 8.82 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org From: "xianwei.zhao" If initial power domain with 'AWAY_ON' property state is off, turn on the power. Signed-off-by: xianwei.zhao --- V2 -> V3: modify subject "genpd: amlogic: " remove modification that transform is_off into 1 or 0 using !! V1 -> V2: None --- drivers/genpd/amlogic/meson-secure-pwrc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/genpd/amlogic/meson-secure-pwrc.c b/drivers/genpd/amlogic/meson-secure-pwrc.c index ecada537b19c..d751c224048d 100644 --- a/drivers/genpd/amlogic/meson-secure-pwrc.c +++ b/drivers/genpd/amlogic/meson-secure-pwrc.c @@ -222,6 +222,9 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev) dom->base.power_on = meson_secure_pwrc_on; dom->base.power_off = meson_secure_pwrc_off; + if (match->domains[i].is_off(dom) && (dom->base.flags & GENPD_FLAG_ALWAYS_ON)) + meson_secure_pwrc_on(&dom->base); + pm_genpd_init(&dom->base, NULL, match->domains[i].is_off(dom)); pwrc->xlate.domains[i] = &dom->base; From patchwork Mon Sep 11 02:52:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xianwei Zhao X-Patchwork-Id: 13378631 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 DEB42EEB580 for ; Mon, 11 Sep 2023 02:53:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZHaNBfC0yC0bI9qPIYjn9zCkRVbPYBdzdwB6+GaP/xE=; b=5Eh/E0zmHZ7f9s Rjs0FB4U2Z/GE/5h/GvVB9QmX/G5jOrMnFLAH0zonOf7RoT6ddc4P3EpLt/GT0FJABV94Ey7ajrok yO+clNCdCEaLix5Qn/vyPnBLkuJyixy9FeHu/aDG4z1aDCXsJHZN0LvRFnw6lB4E+GqonNAS1KO/u fSvPJVB3Zzr9cNRj3zmDuJSEOOV1M1mfNnRhP2Vvl5h7rsvuJ7Ob120fuA/SG3aTUpq0vN/Hm0hyK ORc7YwpmSZavBfxSeUyV97tCZGLdObPwBsBbxcQVcA+ufPQsHZeDjBLEfxNqU6oI1RX7t4nqTr3uE 2t4l0wHEAnNyZGBsedZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfX2y-00H7p2-2w; Mon, 11 Sep 2023 02:53:08 +0000 Received: from mail-sh.amlogic.com ([58.32.228.43]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfX2q-00H7fW-2H; Mon, 11 Sep 2023 02:53:02 +0000 Received: from droid01-cd.amlogic.com (10.98.11.200) by mail-sh.amlogic.com (10.18.11.5) with Microsoft SMTP Server id 15.1.2507.13; Mon, 11 Sep 2023 10:52:34 +0800 From: Xianwei Zhao To: , , , , CC: Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Neil Armstrong" , Kevin Hilman , Ulf Hansson , xianwei.zhao , Conor Dooley , "Lucas Tanure" Subject: [PATCH V3 RESEND 4/6] dt-bindings: power: add Amlogic T7 power domains Date: Mon, 11 Sep 2023 10:52:21 +0800 Message-ID: <20230911025223.3433776-5-xianwei.zhao@amlogic.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230911025223.3433776-1-xianwei.zhao@amlogic.com> References: <20230911025223.3433776-1-xianwei.zhao@amlogic.com> MIME-Version: 1.0 X-Originating-IP: [10.98.11.200] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230910_195300_742699_C1891B44 X-CRM114-Status: GOOD ( 11.31 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org From: "xianwei.zhao" Add devicetree binding document and related header file for Amlogic T7 secure power domains. Signed-off-by: xianwei.zhao Acked-by: Conor Dooley Tested-by: Lucas Tanure --- V2 -> V3: None V1 -> V2: Fix license from "GPL-2.0-only OR .*" to "GPL-2.0-only OR MIT" --- .../power/amlogic,meson-sec-pwrc.yaml | 3 +- include/dt-bindings/power/amlogic,t7-pwrc.h | 63 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 include/dt-bindings/power/amlogic,t7-pwrc.h diff --git a/Documentation/devicetree/bindings/power/amlogic,meson-sec-pwrc.yaml b/Documentation/devicetree/bindings/power/amlogic,meson-sec-pwrc.yaml index d80bbedfe3aa..dab3d92bc273 100644 --- a/Documentation/devicetree/bindings/power/amlogic,meson-sec-pwrc.yaml +++ b/Documentation/devicetree/bindings/power/amlogic,meson-sec-pwrc.yaml @@ -12,7 +12,7 @@ maintainers: - Jianxin Pan description: |+ - Secure Power Domains used in Meson A1/C1/S4 & C3 SoCs, and should be the child node + Secure Power Domains used in Meson A1/C1/S4 & C3/T7 SoCs, and should be the child node of secure-monitor. properties: @@ -21,6 +21,7 @@ properties: - amlogic,meson-a1-pwrc - amlogic,meson-s4-pwrc - amlogic,c3-pwrc + - amlogic,t7-pwrc "#power-domain-cells": const: 1 diff --git a/include/dt-bindings/power/amlogic,t7-pwrc.h b/include/dt-bindings/power/amlogic,t7-pwrc.h new file mode 100644 index 000000000000..1f1f2739cc26 --- /dev/null +++ b/include/dt-bindings/power/amlogic,t7-pwrc.h @@ -0,0 +1,63 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ +/* + * Copyright (c) 2023 Amlogic, Inc. + * Author: Hongyu Chen + */ +#ifndef _DT_BINDINGS_AMLOGIC_T7_POWER_H +#define _DT_BINDINGS_AMLOGIC_T7_POWER_H + +#define PWRC_T7_DSPA_ID 0 +#define PWRC_T7_DSPB_ID 1 +#define PWRC_T7_DOS_HCODEC_ID 2 +#define PWRC_T7_DOS_HEVC_ID 3 +#define PWRC_T7_DOS_VDEC_ID 4 +#define PWRC_T7_DOS_WAVE_ID 5 +#define PWRC_T7_VPU_HDMI_ID 6 +#define PWRC_T7_USB_COMB_ID 7 +#define PWRC_T7_PCIE_ID 8 +#define PWRC_T7_GE2D_ID 9 +#define PWRC_T7_SRAMA_ID 10 +#define PWRC_T7_SRAMB_ID 11 +#define PWRC_T7_HDMIRX_ID 12 +#define PWRC_T7_VI_CLK1_ID 13 +#define PWRC_T7_VI_CLK2_ID 14 +#define PWRC_T7_ETH_ID 15 +#define PWRC_T7_ISP_ID 16 +#define PWRC_T7_MIPI_ISP_ID 17 +#define PWRC_T7_GDC_ID 18 +#define PWRC_T7_CVE_ID 18 +#define PWRC_T7_DEWARP_ID 19 +#define PWRC_T7_SDIO_A_ID 20 +#define PWRC_T7_SDIO_B_ID 21 +#define PWRC_T7_EMMC_ID 22 +#define PWRC_T7_MALI_SC0_ID 23 +#define PWRC_T7_MALI_SC1_ID 24 +#define PWRC_T7_MALI_SC2_ID 25 +#define PWRC_T7_MALI_SC3_ID 26 +#define PWRC_T7_MALI_TOP_ID 27 +#define PWRC_T7_NNA_CORE0_ID 28 +#define PWRC_T7_NNA_CORE1_ID 29 +#define PWRC_T7_NNA_CORE2_ID 30 +#define PWRC_T7_NNA_CORE3_ID 31 +#define PWRC_T7_NNA_TOP_ID 32 +#define PWRC_T7_DDR0_ID 33 +#define PWRC_T7_DDR1_ID 34 +#define PWRC_T7_DMC0_ID 35 +#define PWRC_T7_DMC1_ID 36 +#define PWRC_T7_NOC_ID 37 +#define PWRC_T7_NIC2_ID 38 +#define PWRC_T7_NIC3_ID 39 +#define PWRC_T7_CCI_ID 40 +#define PWRC_T7_MIPI_DSI0_ID 41 +#define PWRC_T7_SPICC0_ID 42 +#define PWRC_T7_SPICC1_ID 43 +#define PWRC_T7_SPICC2_ID 44 +#define PWRC_T7_SPICC3_ID 45 +#define PWRC_T7_SPICC4_ID 46 +#define PWRC_T7_SPICC5_ID 47 +#define PWRC_T7_EDP0_ID 48 +#define PWRC_T7_EDP1_ID 49 +#define PWRC_T7_MIPI_DSI1_ID 50 +#define PWRC_T7_AUDIO_ID 51 + +#endif From patchwork Mon Sep 11 02:52:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xianwei Zhao X-Patchwork-Id: 13378641 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 429B0EEB57D for ; Mon, 11 Sep 2023 02:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VZeWXMVijZJEQas19BaWG0kFgIgUorKycEQWFCaY2mc=; b=cqJCt4ObFqUqCA 68RPGME/oQgk+JTRxkdWAT8cWsDpYcCAeTbacjdE3dSWIThAlO7qOoKoxV0SFrwKhiVjdSSH46yGC wagw6EsN5sgayNdjWlc4GJDg1KAVonyAQ2gd/vhjIQZ+4aq8Gp91O1gs3cEZD2f7LswR/V66zSJ4m k582GGM5znUOTY2fyRSkiMHd7xF4i/7or0CMs/PAnrPl0Mze741DhEt8w/eCOxT/U8o5tx744/+No hLA1dRvwHS8e83pddy38q6JHo7BPbLbu1pypqWfilJ3jg34n82LXNL7WAVy/dF5t57IdrULiFAbwd szljpCkSNLQkDieWVJIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfX3l-00H86H-0T; Mon, 11 Sep 2023 02:53:57 +0000 Received: from mail-sh.amlogic.com ([58.32.228.43]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfX3h-00H84l-27; Mon, 11 Sep 2023 02:53:55 +0000 Received: from droid01-cd.amlogic.com (10.98.11.200) by mail-sh.amlogic.com (10.18.11.5) with Microsoft SMTP Server id 15.1.2507.13; Mon, 11 Sep 2023 10:53:50 +0800 From: Xianwei Zhao To: , , , , CC: Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Neil Armstrong" , Kevin Hilman , Ulf Hansson , xianwei.zhao Subject: [PATCH V3 RESEND 5/6] genpd: amlogic: Add support for T7 power domains controller Date: Mon, 11 Sep 2023 10:52:22 +0800 Message-ID: <20230911025223.3433776-6-xianwei.zhao@amlogic.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230911025223.3433776-1-xianwei.zhao@amlogic.com> References: <20230911025223.3433776-1-xianwei.zhao@amlogic.com> MIME-Version: 1.0 X-Originating-IP: [10.98.11.200] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230910_195353_697556_916D0F0F X-CRM114-Status: GOOD ( 12.72 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org From: "xianwei.zhao" Add support for T7 power controller. T7 power control registers are in secure domain, and should be accessed by SMC. Signed-off-by: xianwei.zhao Reviewed-by: Neil Armstrong --- V2 -> V3: modify subject "genpd: amlogic: " V1 -> V2: Modify T7_NIC flag "ALWAYS_ON" --- drivers/genpd/amlogic/meson-secure-pwrc.c | 73 +++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/drivers/genpd/amlogic/meson-secure-pwrc.c b/drivers/genpd/amlogic/meson-secure-pwrc.c index d751c224048d..4d5bda0d60fc 100644 --- a/drivers/genpd/amlogic/meson-secure-pwrc.c +++ b/drivers/genpd/amlogic/meson-secure-pwrc.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -164,6 +165,69 @@ static struct meson_secure_pwrc_domain_desc s4_pwrc_domains[] = { SEC_PD(S4_AUDIO, 0), }; +static struct meson_secure_pwrc_domain_desc t7_pwrc_domains[] = { + SEC_PD(T7_DSPA, 0), + SEC_PD(T7_DSPB, 0), + TOP_PD(T7_DOS_HCODEC, 0, PWRC_T7_NIC3_ID), + TOP_PD(T7_DOS_HEVC, 0, PWRC_T7_NIC3_ID), + TOP_PD(T7_DOS_VDEC, 0, PWRC_T7_NIC3_ID), + TOP_PD(T7_DOS_WAVE, 0, PWRC_T7_NIC3_ID), + SEC_PD(T7_VPU_HDMI, 0), + SEC_PD(T7_USB_COMB, 0), + SEC_PD(T7_PCIE, 0), + TOP_PD(T7_GE2D, 0, PWRC_T7_NIC3_ID), + /* SRAMA is used as ATF runtime memory, and should be always on */ + SEC_PD(T7_SRAMA, GENPD_FLAG_ALWAYS_ON), + /* SRAMB is used as ATF runtime memory, and should be always on */ + SEC_PD(T7_SRAMB, GENPD_FLAG_ALWAYS_ON), + SEC_PD(T7_HDMIRX, 0), + SEC_PD(T7_VI_CLK1, 0), + SEC_PD(T7_VI_CLK2, 0), + /* ETH is for ethernet online wakeup, and should be always on */ + SEC_PD(T7_ETH, GENPD_FLAG_ALWAYS_ON), + SEC_PD(T7_ISP, 0), + SEC_PD(T7_MIPI_ISP, 0), + TOP_PD(T7_GDC, 0, PWRC_T7_NIC3_ID), + TOP_PD(T7_DEWARP, 0, PWRC_T7_NIC3_ID), + SEC_PD(T7_SDIO_A, 0), + SEC_PD(T7_SDIO_B, 0), + SEC_PD(T7_EMMC, 0), + TOP_PD(T7_MALI_SC0, 0, PWRC_T7_NNA_TOP_ID), + TOP_PD(T7_MALI_SC1, 0, PWRC_T7_NNA_TOP_ID), + TOP_PD(T7_MALI_SC2, 0, PWRC_T7_NNA_TOP_ID), + TOP_PD(T7_MALI_SC3, 0, PWRC_T7_NNA_TOP_ID), + SEC_PD(T7_MALI_TOP, 0), + TOP_PD(T7_NNA_CORE0, 0, PWRC_T7_NNA_TOP_ID), + TOP_PD(T7_NNA_CORE1, 0, PWRC_T7_NNA_TOP_ID), + TOP_PD(T7_NNA_CORE2, 0, PWRC_T7_NNA_TOP_ID), + TOP_PD(T7_NNA_CORE3, 0, PWRC_T7_NNA_TOP_ID), + SEC_PD(T7_NNA_TOP, 0), + SEC_PD(T7_DDR0, GENPD_FLAG_ALWAYS_ON), + SEC_PD(T7_DDR1, GENPD_FLAG_ALWAYS_ON), + /* DMC0 is for DDR PHY ana/dig and DMC, and should be always on */ + SEC_PD(T7_DMC0, GENPD_FLAG_ALWAYS_ON), + /* DMC1 is for DDR PHY ana/dig and DMC, and should be always on */ + SEC_PD(T7_DMC1, GENPD_FLAG_ALWAYS_ON), + /* NOC is related to clk bus, and should be always on */ + SEC_PD(T7_NOC, GENPD_FLAG_ALWAYS_ON), + /* NIC is for the Arm NIC-400 interconnect, and should be always on */ + SEC_PD(T7_NIC2, GENPD_FLAG_ALWAYS_ON), + SEC_PD(T7_NIC3, 0), + /* CPU accesses the interleave data to the ddr need cci, and should be always on */ + SEC_PD(T7_CCI, GENPD_FLAG_ALWAYS_ON), + SEC_PD(T7_MIPI_DSI0, 0), + SEC_PD(T7_SPICC0, 0), + SEC_PD(T7_SPICC1, 0), + SEC_PD(T7_SPICC2, 0), + SEC_PD(T7_SPICC3, 0), + SEC_PD(T7_SPICC4, 0), + SEC_PD(T7_SPICC5, 0), + SEC_PD(T7_EDP0, 0), + SEC_PD(T7_EDP1, 0), + SEC_PD(T7_MIPI_DSI1, 0), + SEC_PD(T7_AUDIO, 0), +}; + static int meson_secure_pwrc_probe(struct platform_device *pdev) { int i; @@ -257,6 +321,11 @@ static struct meson_secure_pwrc_domain_data meson_secure_s4_pwrc_data = { .count = ARRAY_SIZE(s4_pwrc_domains), }; +static struct meson_secure_pwrc_domain_data amlogic_secure_t7_pwrc_data = { + .domains = t7_pwrc_domains, + .count = ARRAY_SIZE(t7_pwrc_domains), +}; + static const struct of_device_id meson_secure_pwrc_match_table[] = { { .compatible = "amlogic,meson-a1-pwrc", @@ -270,6 +339,10 @@ static const struct of_device_id meson_secure_pwrc_match_table[] = { .compatible = "amlogic,meson-s4-pwrc", .data = &meson_secure_s4_pwrc_data, }, + { + .compatible = "amlogic,t7-pwrc", + .data = &amlogic_secure_t7_pwrc_data, + }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, meson_secure_pwrc_match_table); From patchwork Mon Sep 11 02:52:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xianwei Zhao X-Patchwork-Id: 13378642 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 1ACBAEE49A4 for ; Mon, 11 Sep 2023 02:54:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vxFJ2skceD60ADL9Zu3ypJuUJTbB1Pbr2xZMfd8gI1E=; b=sSGdMF1SPuCp9Y dTwL0Ym6d9GQDfd6RJ034wYmV1lM4DAruAp7Knrf9L0ozu3jYAbnLJ4wbUSgXxKtXN+qM744KBWTY Io6XWbuqxejqwntfQ8LPFXdYvpY4wCCGgiwfx5r+my4dvM2ZLOLNPgqiGZMbBIZtRodnkruaGrpjL 8otMhMFdQ69FAFquMp4otzMzPm7tMxQDh64iXi5dZsF7T5Qpf/BngB+dSA1kOiYljBar44ssPqiiT BHENrYR2PttMjo3WqVE4m0xIYfWfSHeMP8AQzuALVkcSvLAeRdLYFpt++5j2y9aH5LSJyzcoc8CxQ aZG0fpFctEyNQUif5f6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfX3p-00H87U-0U; Mon, 11 Sep 2023 02:54:01 +0000 Received: from mail-sh.amlogic.com ([58.32.228.43]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfX3j-00H84l-1y; Mon, 11 Sep 2023 02:53:56 +0000 Received: from droid01-cd.amlogic.com (10.98.11.200) by mail-sh.amlogic.com (10.18.11.5) with Microsoft SMTP Server id 15.1.2507.13; Mon, 11 Sep 2023 10:53:52 +0800 From: Xianwei Zhao To: , , , , CC: Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Neil Armstrong" , Kevin Hilman , Ulf Hansson , xianwei.zhao , Lucas Tanure Subject: [PATCH V3 RESEND 6/6] arm64: dts: amlogic: t7: add power domain controller node Date: Mon, 11 Sep 2023 10:52:23 +0800 Message-ID: <20230911025223.3433776-7-xianwei.zhao@amlogic.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230911025223.3433776-1-xianwei.zhao@amlogic.com> References: <20230911025223.3433776-1-xianwei.zhao@amlogic.com> MIME-Version: 1.0 X-Originating-IP: [10.98.11.200] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230910_195355_650222_7C90A8EA X-CRM114-Status: UNSURE ( 7.63 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org From: "xianwei.zhao" Add power domain controller node for Amlogic T7 SoC Signed-off-by: xianwei.zhao Reviewed-by: Neil Armstrong Tested-by: Lucas Tanure --- V2 -> V3: modify subject. V1 -> V2: None --- arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi b/arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi index 1423d4a79156..23cdad1b425b 100644 --- a/arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi +++ b/arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi @@ -4,6 +4,7 @@ */ #include +#include / { interrupt-parent = <&gic>; @@ -118,6 +119,11 @@ psci { sm: secure-monitor { compatible = "amlogic,meson-gxbb-sm"; + + pwrc: power-controller { + compatible = "amlogic,t7-pwrc"; + #power-domain-cells = <1>; + }; }; soc {