Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp25927308rwd; Mon, 3 Jul 2023 03:03:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlHjmnX+7F8i9/wvseilRiSp3YCKCN2BExi2uVTZTA7Qp2MCP2jnrEnqa3e2nCWszRTKqZIW X-Received: by 2002:a17:902:da92:b0:1b8:5541:9d5b with SMTP id j18-20020a170902da9200b001b855419d5bmr8419686plx.17.1688378606907; Mon, 03 Jul 2023 03:03:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688378606; cv=none; d=google.com; s=arc-20160816; b=MG49gU/08oIbRZZRo4BdkqVPx5gDqtjSwhw1C83DRHlka9y30cNQ38DmfvfKCdc/VY zA6Y2Yrhu/vWF96bkrrPkcPtQPPiU8+2MKlv6yYModgZW5eNru3a58j+Lmu/ot8f2dZm 81G4DzIOek76Lp7XzgMizuAMH9uEcJI41aLXTpn784ufLymK4hIKEMQtdhB37oHUI8Az P8Qvu40ZVnystrvnQHTyLRI344gHOSSfRnYQDjxfg9f985v/8aGBM0pl0ECzU3oW+CEG b3HUHbDM3x+FynxiPxLBe/qqfWseE+xvL3ZToY3FouIRCMAEluWAMCFKOTDXGOQP6WfR KEZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=UU+KjGKUgT1oXBM3e7PRhKhCrDFO/M3uUjVJmooATE4=; fh=OGsX7d96NIKgN7a/X5aL1VFkJp7BmfP/4DIlJu3fPig=; b=HSNef7bVB0FtQ4I195Bq2VM1EwoSP2NQpmGDg04veZ9oEYG88YMc/8AWHEZrRZe0V9 nmJcxIj11q2zCGSDDF0G419wSkcPy7HscAuRgQXIWuQd2pj7FgA4Ug0sS4eBPewADXOD HDtZEXgL9QncCFE4fi7rkbsAcUjInTUF7GVIKwtYhD097aFp2uNc+gOVAeOslqjlqkDX qwyxRw8IwCxW0t7E2Vzz6ZuqME3O6fprkhPapaenhDh+iml/sYG1QkyltEkasSUb9NVM uAYCjYwghgovYCTRlSAN6P9hkwF+hT1pQpR2PW6KbV4g/Dgt91mdd2oBlhVblY+mn4Hb Priw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=amlogic.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji10-20020a170903324a00b001b23e9f586asi17292627plb.121.2023.07.03.03.03.12; Mon, 03 Jul 2023 03:03:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=amlogic.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230460AbjGCJdC (ORCPT + 99 others); Mon, 3 Jul 2023 05:33:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230323AbjGCJcz (ORCPT ); Mon, 3 Jul 2023 05:32:55 -0400 Received: from mail-sh.amlogic.com (mail-sh.amlogic.com [58.32.228.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B69518D; Mon, 3 Jul 2023 02:32:06 -0700 (PDT) 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, 3 Jul 2023 17:32:01 +0800 From: =Xianwei Zhao To: , , , CC: Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Neil Armstrong" , Kevin Hilman , Xianwei Zhao Subject: [PATCH 2/3] soc: c3: Add support for power domains controller Date: Mon, 3 Jul 2023 17:31:41 +0800 Message-ID: <20230703093142.2028500-3-xianwei.zhao@amlogic.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230703093142.2028500-1-xianwei.zhao@amlogic.com> References: <20230703093142.2028500-1-xianwei.zhao@amlogic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.98.11.200] X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xianwei Zhao Add support for C3 Power controller. C3 power control registers are in secure domain, and should be accessed by SMC. Signed-off-by: Xianwei Zhao --- drivers/soc/amlogic/meson-secure-pwrc.c | 28 ++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/soc/amlogic/meson-secure-pwrc.c b/drivers/soc/amlogic/meson-secure-pwrc.c index 25b4b71df9b8..39ccc8f2e630 100644 --- a/drivers/soc/amlogic/meson-secure-pwrc.c +++ b/drivers/soc/amlogic/meson-secure-pwrc.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -132,6 +133,22 @@ static struct meson_secure_pwrc_domain_desc s4_pwrc_domains[] = { SEC_PD(S4_AUDIO, 0), }; +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_VCODEC, 0), +}; + static int meson_secure_pwrc_probe(struct platform_device *pdev) { int i; @@ -179,7 +196,7 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev) for (i = 0 ; i < match->count ; ++i) { struct meson_secure_pwrc_domain *dom = &pwrc->domains[i]; - if (!match->domains[i].index) + if (!match->domains[i].name) continue; dom->pwrc = pwrc; @@ -207,6 +224,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_c3_pwrc_data = { + .domains = c3_pwrc_domains, + .count = ARRAY_SIZE(c3_pwrc_domains), +}; + static const struct of_device_id meson_secure_pwrc_match_table[] = { { .compatible = "amlogic,meson-a1-pwrc", @@ -216,6 +238,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,c3-pwrc", + .data = &amlogic_secure_c3_pwrc_data, + }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, meson_secure_pwrc_match_table); -- 2.37.1