From patchwork Sat Feb 25 10:16:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yassine Oudjana X-Patchwork-Id: 61505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1417709wrd; Sat, 25 Feb 2023 02:22:55 -0800 (PST) X-Google-Smtp-Source: AK7set95lbcdSgMT1A7VBp1Fqv61UyrWdbzXbA9TvMk/LaWc5OX+B5mff0r3l5xyocwBPpwzycfC X-Received: by 2002:a17:907:2c57:b0:8b2:abcc:8d9e with SMTP id hf23-20020a1709072c5700b008b2abcc8d9emr24910449ejc.26.1677320575466; Sat, 25 Feb 2023 02:22:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677320575; cv=none; d=google.com; s=arc-20160816; b=LGe5dvLgE03yJnLh262LEaqVrAGMeErfG6Xe7nA7TV5kOr5kvOYqQ1A4CgP/7JPPE/ b1Y6ZaydtVwusm/GUgFmdjXe0MalfV3nj+hKB3rvl3xc9zBSw36oVnKYOmB5UqMZKvuA p5CIuDMdFPnvJ7nXc8zayxIb//i4Dfom5YFpeFSVrBxtYq2p88dTC0JOXKVRVTSslLlW tbjQQVQnyBTErg6N69C7n4hFIiUfS7veut9i49AUKaSLvZcoqhAAJNksFNOgl3m/Jblj OUacaec6P7KKhM/kPHnRsIzUl1w1xF82m2moMHIMkGXp3Bxg/DOKeW7x7i8yYYhl85AV sfXQ== 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 :dkim-signature; bh=yqdAqtl2HyM6weGdRUYSI5fz6MeLKme641FAPtX5r3Y=; b=bNgO/qrXPjJi6gyrhUtDOVXRbFU6GQw5SlWKOgsFw6kbX4dGwzEgwQlIySJSaI5Vbg RwR9jinMaQkCL7GpLvTIN3jXyMfcB6ctkQi7JK2DUMo9etBrT5HZ6bxkZOf/ZT9wQk3d 3f9uVLFO9mnWcMq6nSczrvjofJvNLhR7d6aF28BxPZ0Pdh91FI3QfZHPk80xAi5jdkip shbqjfGX2DRscgxjAye8ezeOpNyMT/YFl1vtY5jhWUx7dupKu6V1uEG/djl6M0CxvcNB fal9t4Cra9b4La5UxhnDbl5j0rSYDaPNgM/9BQ9tq65GiAUNadz96gx7PxENppibOCdY UjQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SJOypASA; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i6-20020a1709063c4600b008b20e95d474si1891878ejg.51.2023.02.25.02.22.32; Sat, 25 Feb 2023 02:22:55 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SJOypASA; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229635AbjBYKRZ (ORCPT + 99 others); Sat, 25 Feb 2023 05:17:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229617AbjBYKRV (ORCPT ); Sat, 25 Feb 2023 05:17:21 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 757682684B; Sat, 25 Feb 2023 02:17:16 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id h16so6816161edz.10; Sat, 25 Feb 2023 02:17:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=yqdAqtl2HyM6weGdRUYSI5fz6MeLKme641FAPtX5r3Y=; b=SJOypASA17J1FKOo6kyyV500JXZQFVFCO776wNmuV4SCzUTMoivR3arUdg0Hq6bd20 Q57GtAFi/UATECSfJnIWOuOxDuD4nK1qEO/Yn3i3/UMy4M1g/Xkmu4zO2IYpOBQ6GADi dkBppSVdbq3TPlWwsKavCiY8a2PtzoRY9d2mZg+ZVaoKEhz+wWX9nM1U4zByz9bTGP7u 1RmUmwpv0J02HnrnhhC4MD3SXobdjlSRtbyDesa8XywGxzSo0YVEjhImkzSBYtaT1VtP CWQbmvQEzU1FolZSnppWJ5bBrU37lbnoO9i6w+kcprbo3/kgudAKooj2yfgTgRUYhEuy GiIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=yqdAqtl2HyM6weGdRUYSI5fz6MeLKme641FAPtX5r3Y=; b=vi1QkycY6SVriBQerpdl1bUs0r7MxLbaAqJ7BmBnxKFR3nMm8aF+kF5LLQdgaN2YPH QT+cFSODZsi4KOXMeVkQ2jIERmc4WT2xIA/FNdlkv9DWAlzT8UAXquHmHUxkhF1smX7k uQ3Vv2pTl2QISi8QQqQlUjGTPuzLrn12FArLEr8YTWeEGiQa9Q0CzBLGI2+gsb6KvP2t UADpNsLMXNUbe7zUJ2HX+MwnHR2P5gyONur6TG6okzh1RrOz2MM65UYjxTblqm84QJ7i ZJecENkGL/s8JOlc3ghC9khHKeY4EFrDNxkkT4PC2BTkw1PGQPyzm9lwXuIijYJi1upx 94OA== X-Gm-Message-State: AO0yUKV/1ibfJdA9pG8LmartqLDl1cTClw9UsSnTyLGJxGWTRkXlmv0y huRok3k3DMmwfF62uchKr2E= X-Received: by 2002:a17:906:86d4:b0:87b:3d29:2982 with SMTP id j20-20020a17090686d400b0087b3d292982mr26298346ejy.11.1677320235019; Sat, 25 Feb 2023 02:17:15 -0800 (PST) Received: from localhost.localdomain ([95.183.227.97]) by smtp.gmail.com with ESMTPSA id y23-20020a50ce17000000b004af6163f845sm677722edi.28.2023.02.25.02.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 02:17:14 -0800 (PST) From: Yassine Oudjana X-Google-Original-From: Yassine Oudjana To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno Cc: Yassine Oudjana , Yassine Oudjana , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 3/3] soc: mediatek: scpsys: Add support for MT6735 Date: Sat, 25 Feb 2023 13:16:29 +0300 Message-Id: <20230225101629.264206-4-y.oudjana@protonmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230225101629.264206-1-y.oudjana@protonmail.com> References: <20230225101629.264206-1-y.oudjana@protonmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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?1758798099486365918?= X-GMAIL-MSGID: =?utf-8?q?1758798099486365918?= From: Yassine Oudjana Add support for SCPSYS power domains of MT6735. All non-CPU power domains are added except for MD2 (C2K modem), which is left out due to issues with powering it on. Signed-off-by: Yassine Oudjana --- drivers/soc/mediatek/mtk-scpsys.c | 84 +++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c index 7a668888111c..b771bfb93cc9 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -32,6 +33,7 @@ #define SPM_VEN_PWR_CON 0x0230 #define SPM_ISP_PWR_CON 0x0238 #define SPM_DIS_PWR_CON 0x023c +#define SPM_MD1_PWR_CON 0x0284 /* MT6735 */ #define SPM_CONN_PWR_CON 0x0280 #define SPM_VEN2_PWR_CON 0x0298 #define SPM_AUDIO_PWR_CON 0x029c /* MT8173, MT2712 */ @@ -57,11 +59,13 @@ #define PWR_ON_2ND_BIT BIT(3) #define PWR_CLK_DIS_BIT BIT(4) +#define PWR_STATUS_MD1 BIT(0) #define PWR_STATUS_CONN BIT(1) #define PWR_STATUS_DISP BIT(3) #define PWR_STATUS_MFG BIT(4) #define PWR_STATUS_ISP BIT(5) #define PWR_STATUS_VDEC BIT(7) +#define PWR_STATUS_VEN BIT(8) /* MT6735 */ #define PWR_STATUS_BDP BIT(14) #define PWR_STATUS_ETH BIT(15) #define PWR_STATUS_HIF BIT(16) @@ -750,6 +754,73 @@ static const struct scp_subdomain scp_subdomain_mt2712[] = { {MT2712_POWER_DOMAIN_MFG_SC2, MT2712_POWER_DOMAIN_MFG_SC3}, }; +/* + * MT6735 power domain support + */ + +static const struct scp_domain_data scp_domain_data_mt6735[] = { + [MT6735_POWER_DOMAIN_MD1] = { + .name = "md1", + .sta_mask = PWR_STATUS_MD1, + .ctl_offs = SPM_MD1_PWR_CON, + .sram_pdn_bits = GENMASK(8, 8), + .sram_pdn_ack_bits = 0, + .clk_id = {CLK_NONE}, + .bus_prot_mask = (BIT(24) | BIT(25) | BIT(26) | BIT(27) | BIT(28)), + }, + [MT6735_POWER_DOMAIN_CONN] = { + .name = "conn", + .sta_mask = PWR_STATUS_CONN, + .ctl_offs = SPM_CONN_PWR_CON, + .sram_pdn_bits = GENMASK(8, 8), + .sram_pdn_ack_bits = 0, + .clk_id = {CLK_NONE}, + .bus_prot_mask = (BIT(2) | BIT(8)), + }, + [MT6735_POWER_DOMAIN_DIS] = { + .name = "dis", + .sta_mask = PWR_STATUS_DISP, + .ctl_offs = SPM_DIS_PWR_CON, + .sram_pdn_bits = GENMASK(11, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + .clk_id = {CLK_NONE}, + .bus_prot_mask = (BIT(1)), + }, + [MT6735_POWER_DOMAIN_MFG] = { + .name = "mfg", + .sta_mask = PWR_STATUS_MFG, + .ctl_offs = SPM_MFG_PWR_CON, + .sram_pdn_bits = GENMASK(11, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + .clk_id = {CLK_NONE}, + .bus_prot_mask = BIT(14), + }, + [MT6735_POWER_DOMAIN_ISP] = { + .name = "isp", + .sta_mask = PWR_STATUS_ISP, + .ctl_offs = SPM_ISP_PWR_CON, + .sram_pdn_bits = GENMASK(11, 8), + .sram_pdn_ack_bits = GENMASK(13, 12), + .clk_id = {CLK_NONE}, + }, + [MT6735_POWER_DOMAIN_VDE] = { + .name = "vde", + .sta_mask = PWR_STATUS_VDEC, + .ctl_offs = SPM_VDE_PWR_CON, + .sram_pdn_bits = GENMASK(11, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + .clk_id = {CLK_NONE}, + }, + [MT6735_POWER_DOMAIN_VEN] = { + .name = "ven", + .sta_mask = PWR_STATUS_VEN, + .ctl_offs = SPM_VEN_PWR_CON, + .sram_pdn_bits = GENMASK(11, 8), + .sram_pdn_ack_bits = GENMASK(15, 12), + .clk_id = {CLK_NONE}, + }, +}; + /* * MT6797 power domain support */ @@ -1033,6 +1104,16 @@ static const struct scp_soc_data mt2712_data = { .bus_prot_reg_update = false, }; +static const struct scp_soc_data mt6735_data = { + .domains = scp_domain_data_mt6735, + .num_domains = ARRAY_SIZE(scp_domain_data_mt6735), + .regs = { + .pwr_sta_offs = SPM_PWR_STATUS, + .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND + }, + .bus_prot_reg_update = true, +}; + static const struct scp_soc_data mt6797_data = { .domains = scp_domain_data_mt6797, .num_domains = ARRAY_SIZE(scp_domain_data_mt6797), @@ -1088,6 +1169,9 @@ static const struct of_device_id of_scpsys_match_tbl[] = { }, { .compatible = "mediatek,mt2712-scpsys", .data = &mt2712_data, + }, { + .compatible = "mediatek,mt6735-scpsys", + .data = &mt6735_data, }, { .compatible = "mediatek,mt6797-scpsys", .data = &mt6797_data,