From patchwork Mon May 30 20:42:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien Parent X-Patchwork-Id: 12864947 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 2AD33C433EF for ; Mon, 30 May 2022 20:44:08 +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=bN+zUf/+h0YSg+o1lSwzm17bud1iinUbPn2VPn24EkI=; b=AASLbDDKm2Exq6 R5M45SELLArlGY2MCTyJV+BGwSu+oJydEzhBM+gOOUnFi8nmvc1QMTiexigFmdG8HUCndJSRWOAGm PQw+/Hlx8+qCVZR15Oofk8dXHquW+1IvphHJNeH3jCJnDtsC+MOa1B5m2GhhNQysgC8TyNV7Lru7p LiVjfINPyAnqVeihDchLD9a4mz3kJYR4aeiSRYpkVgnwUQR9lje/7VN33/YT9yzzr3mw+NjveqPG/ DsrEyCYR4Y05KWZwFW6PNJyT0wdU5qEVHTgZJ3xixkyMV2nXTQ95Pj9EWqw+RZ176L+y6YIhZrDHf 6zEmIkzQsofzlg8cygDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvmE3-008F9E-J1; Mon, 30 May 2022 20:42:55 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvmDi-008Ewt-0G for linux-arm-kernel@lists.infradead.org; Mon, 30 May 2022 20:42:35 +0000 Received: by mail-wm1-x32f.google.com with SMTP id h62-20020a1c2141000000b0039aa4d054e2so169000wmh.1 for ; Mon, 30 May 2022 13:42:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OfRzRz9zY+mWQeLzIoLCLlJA3rGJuwiAX+1Eau/u4p4=; b=OjKjf6rUbb5SpHdfuQH/imC6NIGGZ3P6M75JaF7jECTByieFVd1TOqOnYXpvC0Xfnl kfuspj+G1QyOLBh5ycOvIDKPEaJpzXwRasjKFwdTVZX+NCHgfJxPMWEQnOa4b7AQ71EH EHzNtZZQhJgqZQxFQ/zf9FKMzmL1isRwROY615/pxsGSyD2GBYUJv9t8Za7onN8ZMiKb 5ziqKRVwUiCvD4Kl0L1TFAlFgHqF9+MiZjI3RA1MsLUFL5UUJFNmYpOCEqe70vM6Ox/e 7hWYxIS0wN5QzYQ3+Wgepr65/WYoGz9FitNkxZIpVpVxrjl6s77g2vP1cmz/I5bO9hVJ TmBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OfRzRz9zY+mWQeLzIoLCLlJA3rGJuwiAX+1Eau/u4p4=; b=ML4zrwVgcvF8yx2u9Lv+a1zwB7hlfZDDzK6idgJmtCmR6KgmyBVUQuQ+K8S0W+emL0 do3on/HvSleHc/EqOs4wrsj1BW5cLWEzujuwrpmP0HR4tNtaB3SZiZR0wgUoOiEO5AQy KjZpy8KJQgziiWCT0wXrPGcqII5z51O3MLPJ3O3bb329cfMLZXWoaWD3HKpVpLFO0nKq iJWt3cs6RbGJc8gSy1z4Hf9x65AMUlgbY+7ehXxxDDQIz4eKQrE9WAydXYn4UMcut5H+ 3/pZpC68PeLRk/RQpYdxV94zufqf6BZJLPWjytI7OsGoawwgggBsDs7gdohMiPml3UsU iYag== X-Gm-Message-State: AOAM530nDH0fmg9EXC2rRu+V+tpcjaczMhLqH4zRH/6g4oNXf36N/Z0Z 5V+FbOfAkVXl7+OHGdtwaCd4MA== X-Google-Smtp-Source: ABdhPJxK0D0IN4lwSq73zpNlpbs45dPOpaoXgVGrmOvGp9YvwJOGUYq8ZhEMazBS/AVR3tG2t4BOCw== X-Received: by 2002:a05:600c:3849:b0:397:89ce:289 with SMTP id s9-20020a05600c384900b0039789ce0289mr16587313wmr.104.1653943351285; Mon, 30 May 2022 13:42:31 -0700 (PDT) Received: from localhost.localdomain ([88.160.162.107]) by smtp.gmail.com with ESMTPSA id w13-20020a7bc74d000000b0039b17714eb2sm262253wmk.34.2022.05.30.13.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 May 2022 13:42:30 -0700 (PDT) From: Fabien Parent To: Matthias Brugger Cc: Alexandre Bailon , Fabien Parent , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] soc: mediatek: add support of MTK_SCPD_STRICT_BUSP cap Date: Mon, 30 May 2022 22:42:13 +0200 Message-Id: <20220530204214.913251-3-fparent@baylibre.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220530204214.913251-1-fparent@baylibre.com> References: <20220530204214.913251-1-fparent@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220530_134234_086520_4A8958EE X-CRM114-Status: GOOD ( 16.06 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Alexandre Bailon This adds support of MTK_SCPD_STRICT_BUSP cap. This is required by the mt8365, for the MM power domain. Signed-off-by: Alexandre Bailon Signed-off-by: Fabien Parent --- drivers/soc/mediatek/mtk-pm-domains.c | 37 ++++++++++++++++++++------- drivers/soc/mediatek/mtk-pm-domains.h | 1 + 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c index 90b91b3b19a8..beaa5785fda2 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.c +++ b/drivers/soc/mediatek/mtk-pm-domains.c @@ -263,17 +263,36 @@ static int scpsys_power_on(struct generic_pm_domain *genpd) regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT); regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); - ret = clk_bulk_prepare_enable(pd->num_subsys_clks, pd->subsys_clks); - if (ret) - goto err_pwr_ack; + if (MTK_SCPD_CAPS(pd, MTK_SCPD_STRICT_BUSP)) { + /* + * In few Mediatek platforms(e.g. MT6779), the bus protect + * policy is stricter, which leads to bus protect release must + * be prior to bus access. + */ + ret = scpsys_sram_enable(pd); + if (ret < 0) + goto err_pwr_ack; - ret = scpsys_sram_enable(pd); - if (ret < 0) - goto err_disable_subsys_clks; + ret = scpsys_bus_protect_disable(pd); + if (ret < 0) + goto err_pwr_ack; - ret = scpsys_bus_protect_disable(pd); - if (ret < 0) - goto err_disable_sram; + ret = clk_bulk_prepare_enable(pd->num_subsys_clks, pd->subsys_clks); + if (ret < 0) + goto err_pwr_ack; + } else { + ret = clk_bulk_prepare_enable(pd->num_subsys_clks, pd->subsys_clks); + if (ret) + goto err_pwr_ack; + + ret = scpsys_sram_enable(pd); + if (ret < 0) + goto err_disable_subsys_clks; + + ret = scpsys_bus_protect_disable(pd); + if (ret < 0) + goto err_disable_sram; + } return 0; diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/mtk-pm-domains.h index a3955d960233..5347471bc3c4 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.h +++ b/drivers/soc/mediatek/mtk-pm-domains.h @@ -8,6 +8,7 @@ #define MTK_SCPD_SRAM_ISO BIT(2) #define MTK_SCPD_KEEP_DEFAULT_OFF BIT(3) #define MTK_SCPD_DOMAIN_SUPPLY BIT(4) +#define MTK_SCPD_STRICT_BUSP BIT(5) #define MTK_SCPD_CAPS(_scpd, _x) ((_scpd)->data->caps & (_x)) #define SPM_VDE_PWR_CON 0x0210