From patchwork Fri Jul 7 00:37:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xianwei Zhao X-Patchwork-Id: 116893 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2935869vqx; Thu, 6 Jul 2023 18:00:54 -0700 (PDT) X-Google-Smtp-Source: APBJJlHNjrQvHIngUSFpZotxxBPzsp/LtM3Z11/rQzAoo/cOeUe216M01LEQYPHEjyfoLAEktX+D X-Received: by 2002:a05:6358:3411:b0:134:e8c6:a888 with SMTP id h17-20020a056358341100b00134e8c6a888mr3705170rwd.8.1688691654066; Thu, 06 Jul 2023 18:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688691654; cv=none; d=google.com; s=arc-20160816; b=qxnmVaJEy1S1cH/krhKXg73MVPp4ompMhe7EBQv+atiX4Vf8jasf3hqf5BZSJn7nNE YFppBXKQzaPzYZo/U17fZnOR1GBtT8npIjOhX5d8FJmGRbrvqP5ELZFHdSKfWWQZoFyl cfsdM6mB1QhLQGzKYHntEionaXp31zcgrHn9jzS3P/TGI7l3yTNV9ALEWU4STIzXTBwp sHU04fU526yOAS9ZeivJeNY78wqka45wfQPFIsdmH6qww4FGWfYIwk25y8Cuual+5EBX IkfXQtX+6v20FH08PVus+aeUt13CqHg3LFxhMwZPO3gylZdToDBLYw6AHGlwp1GqUFso l0MA== 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=gcSyovoxgIyeBH3jDhGDRPsjGL4G8r00fgIvryAEcHA=; fh=WzRG3WH3uvRbKqWQdKb+SWZNQhoyocMFA6Hw0LDjFNQ=; b=mt4ULcmH7SjEc318E2S3UfpPNLiBq4JT7u8OvcTyeBBqQ8OVwoL9CLgoYTbB6TmIlz Y1Ip5gkavImDMNk4fDbd3wLDEyhhATso0W/l7Xp3l0oGTjSLaARvBHgKZyrOS3J7lTsE skKlptRD2c+z06yvFjdAslehG/F5PM/0+ISq0eKqxX4YEb90l0fFZmrSyJIpIUKBVB9D aH80UkQ+xEVM3OTYJokIyprBkHToPz6Dw+04UjkLTTCLCPMLIbBmBj44azDsvgM5Luxp 4ia3dpNMKf5izGX6T6DefWyWKn/cDMSWNSMIbDG8f4a7F9llXAYb+5Zxfcd5vPvF2R+5 04/w== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u31-20020a63471f000000b0055337508370si2458497pga.889.2023.07.06.18.00.34; Thu, 06 Jul 2023 18:00:54 -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 S231228AbjGGAiJ (ORCPT + 99 others); Thu, 6 Jul 2023 20:38:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231465AbjGGAiG (ORCPT ); Thu, 6 Jul 2023 20:38:06 -0400 Received: from mail-sh.amlogic.com (mail-sh.amlogic.com [58.32.228.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5942F19BD; Thu, 6 Jul 2023 17:37:19 -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; Fri, 7 Jul 2023 08:37:09 +0800 From: Xianwei Zhao To: , , , CC: Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Neil Armstrong" , Kevin Hilman , Xianwei Zhao Subject: [PATCH V2 3/4] soc: c3: Add support for power domains controller Date: Fri, 7 Jul 2023 08:37:09 +0800 Message-ID: <20230707003710.2667989-4-xianwei.zhao@amlogic.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230707003710.2667989-1-xianwei.zhao@amlogic.com> References: <20230707003710.2667989-1-xianwei.zhao@amlogic.com> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770721539584265124?= X-GMAIL-MSGID: =?utf-8?q?1770721539584265124?= 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 Reviewed-by: Neil Armstrong --- V1 -> V2: Fixed some formatting. --- drivers/soc/amlogic/meson-secure-pwrc.c | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/soc/amlogic/meson-secure-pwrc.c b/drivers/soc/amlogic/meson-secure-pwrc.c index c11d65a3e3d9..a1ffebf70de3 100644 --- a/drivers/soc/amlogic/meson-secure-pwrc.c +++ b/drivers/soc/amlogic/meson-secure-pwrc.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -120,6 +121,22 @@ static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = { SEC_PD(RSA, 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 struct meson_secure_pwrc_domain_desc s4_pwrc_domains[] = { SEC_PD(S4_DOS_HEVC, 0), SEC_PD(S4_DOS_VDEC, 0), @@ -202,6 +219,11 @@ static struct meson_secure_pwrc_domain_data meson_secure_a1_pwrc_data = { .count = ARRAY_SIZE(a1_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 struct meson_secure_pwrc_domain_data meson_secure_s4_pwrc_data = { .domains = s4_pwrc_domains, .count = ARRAY_SIZE(s4_pwrc_domains), @@ -212,6 +234,10 @@ static const struct of_device_id meson_secure_pwrc_match_table[] = { .compatible = "amlogic,meson-a1-pwrc", .data = &meson_secure_a1_pwrc_data, }, + { + .compatible = "amlogic,c3-pwrc", + .data = &amlogic_secure_c3_pwrc_data, + }, { .compatible = "amlogic,meson-s4-pwrc", .data = &meson_secure_s4_pwrc_data,