Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1282460lfc; Wed, 1 Jun 2022 14:08:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIRpuYxSjR+5zak4aJjSpxdA+lf16ThdX+4o/l6udk5bAO7wbyMfj72yuNkpz45+w4f3xB X-Received: by 2002:a17:902:cf0c:b0:15b:63a4:9f47 with SMTP id i12-20020a170902cf0c00b0015b63a49f47mr1332444plg.1.1654117700226; Wed, 01 Jun 2022 14:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654117700; cv=none; d=google.com; s=arc-20160816; b=UbPSOPFIEc8NLGuAE7reRG9kt9bnQtxBASm/fjlbISWsZoNKGM3Fy51ye7rnI2ABM3 U3g/KFHvUDA70cbMxSuEcLdYQSnC/bySxy6t5U/wtkHZ0AG/IjMPdmCYX2pmgotPQkVC C6EjNMninAViuGQXcnkqlB61pndRBnfhh1pHvkGX+vq4c7GFcjuPZq1oFaNNlqBYj8fd ajPoBknxPZSe/zUhy1WSF0j4zoM76cPSijJBFtGYs8c6rt2LJNRQG/NNlxDtU7u4w/1A RHgR27aMY2ayUzcRaA1IhAEiqNWlKmGOsUVjhXzpXPYx4EL97Q2CgCwJeBnTje4vPmns kHvQ== 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=OfRzRz9zY+mWQeLzIoLCLlJA3rGJuwiAX+1Eau/u4p4=; b=GBEbcoib/2Ur18fpUV2tI7CefG/kYYloXHHSQEK15BwT9SH4NqT4eQlnaUvAD/Ml50 yNQr2B9DgyP1+DOPWfFnGyLzS3uLMf/veET6hOW0pjbHSeAPomsVHVAV0Im4D+zygL9E RLJTGYiZx5K6SgjfddbxC1+Q6xhcGEzhQ6AcnSlClVG33mTv9vW/FZRNN30u1hvo7qJm h3jWtHAkpYRqypgAjbipQVErmVeqwrDdNENT59OzQBfvpCK0xbBFCumJKxYJjglbEp8E HkEHXXycs6RsKJEIEvZqR9ZgN+eE95opGdn6iaGMeMzCe3gpPtnWkrAr3qrOGbe1ZyT0 v4rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=OjKjf6rU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e15-20020a17090301cf00b00163a2009c2asi4402013plh.5.2022.06.01.14.08.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 14:08:20 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=OjKjf6rU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A7A4E21D3D4; Wed, 1 Jun 2022 13:00:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242788AbiE3Umk (ORCPT + 99 others); Mon, 30 May 2022 16:42:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241787AbiE3Umd (ORCPT ); Mon, 30 May 2022 16:42:33 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD98D25290 for ; Mon, 30 May 2022 13:42:32 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id v4-20020a1cac04000000b00397001398c0so151784wme.5 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=WvpAIxUgaYNMUHt/f2XxBj8SzuQawACkWCSBPTldlnqrifkjbZxGhJRbHzwMw0qEcK pbBRKftyS9mjmZZ+rLOrZ4CtvfWVEsbu0LTd2MJYpG/AXVTJj/KOmaliQb86l5lXIsEv vLrpjMYp9/SwULBmakC0nnR8o+EBS+IlpHFzzVktwuBiJ6MQlJrgVoP4+JxYtreZC/Pq rHtsHDHXCwINnC0th25qWwK8ztaaTASGpREGnhOBMIKZaKEgKOjO+5HHk3+9dSMtSu87 nu+p8/6/V5KgIDA0I+WJ4EOR8I4jyil3C2evTrJzPKQ38kHyw/Or7s4IsrKIMf5YeQRD s84A== X-Gm-Message-State: AOAM532iWYsOZshAR91ECNqQe/0EV7/vOAypzXU8Omh/G3t7/SEik870 81kouvK1aZCK4kRuMY4g3zDKng== 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: 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 -- 2.36.1