Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp372659imi; Thu, 21 Jul 2022 02:42:01 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sBvgftWXnY2CbRiI1VJfS1ePo/TjaHBmOvwB8lKyzR7g8xa15xen/tWmkbnwFnKMZGNFnU X-Received: by 2002:a05:6402:358b:b0:43a:d645:e1cb with SMTP id y11-20020a056402358b00b0043ad645e1cbmr55777298edc.334.1658396521302; Thu, 21 Jul 2022 02:42:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658396521; cv=none; d=google.com; s=arc-20160816; b=hUZDzh+W5KEr5ZGYAAsA2ZsbpnKBWXwxfaPD2qp17jNJvryY5S/NbZakBC1IdhLoku SzEovsjmrrCyFw85nV3f+5A8bLCqhFgk+p9W0JTUv6d2xr5UKX/2GMJnD+oMmoJwX9dJ H8A5PO5MdUc5TxvUjDc+JTakDCPdyBSxKxWJa50p2SsPEb+JsyI27Cb1HjYvpxAkwYYW bbgm/j/3M15gYIlc0+50ETFEVvl3HrTYbHn8o8Oz5NWGzUCsqGNRBLOUkTMzayimk0FS e5b8u5z/7OaYfObwl/HLqgDmUweWaZjWVJR8DzdU6T4DgxxTnUT8OG9Xa9EBJL4ySh1V vlbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=y52+vmlkRnvgFyCTIdVjgi2XLyCNtChwCyrrSaF4xEs=; b=A8WRULoykMTowfvUDrZdzfsCOrrWDa1AdoaILrq79HU0q6ScFft93akReEcF9GjcB/ 4QwJkXe+NQJQkFfWRsNXYD6q8rROINnB7zW+sHCKbA3nbRnn2qgh6RqzM4JzUIpNQtyC zLk4bZpWMcpzQZjrqJSSOFyK7LsOZ6XGOfkHPTjQG4uu0cayLQrP7djQAInKBREj5g6p uKispaALv6H7dNBJJ+kU2bGaAL4jVHRuonS4U1ph/owMOgG8pQieE4EkI6lSdFjmZpPh RDY0uaxEMOcXeCp2o2hcnO1mBErvi9IqxyrT/8gG7oVpqbBOQKhAkaBMf2j+LDZFRPZX u9bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=JfScOhfO; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a1709064fcd00b0072b7b94c2c5si2015399ejw.866.2022.07.21.02.41.36; Thu, 21 Jul 2022 02:42:01 -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; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=JfScOhfO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232698AbiGUIzy (ORCPT + 99 others); Thu, 21 Jul 2022 04:55:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232692AbiGUIzw (ORCPT ); Thu, 21 Jul 2022 04:55:52 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17CD7357C2 for ; Thu, 21 Jul 2022 01:55:50 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id y4so1305914edc.4 for ; Thu, 21 Jul 2022 01:55:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=y52+vmlkRnvgFyCTIdVjgi2XLyCNtChwCyrrSaF4xEs=; b=JfScOhfOqzqLqsMNguyPz0pmtqPx00EBej7n3tTNiTELdECIuqhQFfdgfxv0NZANL6 fJHBfkEJAKFk4rovHbV7mrijRm9H5aWF9cBLWsIHOitso5dVjWiy2XozKo4+hV0MqAmt mNgaTsrlEcSahSI8zRaZEJpDBfjjMGPO7jIgBdUnSZex7WTQlFX9K3n7+zQmNajKEMRu F9FPjIDBrMF3Crz4neWe7RT80XgUh+SRBz5BD23hs5/YjGMXJLiMh7wXt+F0TY4YlsEp V3Yz7uwhK2GsLAG8wMmN0xZf0N11NN/fTBzc64C6eiDBhDhoV6Zqxkt1JYliOh/vlYiV pV2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=y52+vmlkRnvgFyCTIdVjgi2XLyCNtChwCyrrSaF4xEs=; b=fUsZuDxzGarY0l21okSL4Mt2OKbLYvV5lL426QQHdjwisjdjvOtaMKkuWnJNhhSj+o sQd4m8An3TT7tzXNmOzYgFrMschNGO3Byiq1KS1BAROyVkXzzGgxPmWcZmrIWjCdf33T y+ESPL47Q4eVQYC4AUwU3APpBeALCP5mPNDyO+d9AAaex/3XYC3Bf/RJ97A6ZkfiNVKh g4qJr0xiJAXUzI9uP4zlx6nnvQ7oWwzaSxFRBHx013nrI8+RHPGLN2uzv6C5ZLmEQ5Db LeWGlDdEPUhf/KbSQPqUBIG9HigblKXR4PKL8D877/FFPhBokDf/RYpjoZZf4Dhz0Cin cyKQ== X-Gm-Message-State: AJIora/Jf7vUigXzh52Sjhnoj9RduLFgYbjRegwUekKjumQN729iqozZ t2z8BjRuvX34fKdjM7j17xj39w== X-Received: by 2002:a05:6402:22c9:b0:43b:c529:7ee1 with SMTP id dm9-20020a05640222c900b0043bc5297ee1mr2760657edb.251.1658393748544; Thu, 21 Jul 2022 01:55:48 -0700 (PDT) Received: from blmsp ([2001:4090:a243:806e:25e7:daa:8208:ceb]) by smtp.gmail.com with ESMTPSA id wj22-20020a170907051600b0072af2460cd6sm611924ejb.30.2022.07.21.01.55.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 01:55:48 -0700 (PDT) Date: Thu, 21 Jul 2022 10:55:47 +0200 From: Markus Schneider-Pargmann To: Matthias Brugger Cc: Fabien Parent , Alexandre Bailon , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] soc: mediatek: add support of MTK_SCPD_STRICT_BUSP cap Message-ID: <20220721085547.unr5cu4kywpugxmx@blmsp> References: <20220530204214.913251-1-fparent@baylibre.com> <20220530204214.913251-3-fparent@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 Hi Matthias, sorry, took a long time to respond. On Fri, Jun 17, 2022 at 04:20:10PM +0200, Matthias Brugger wrote: > > > On 30/05/2022 22:42, Fabien Parent wrote: > > From: Alexandre Bailon > > > > This adds support of MTK_SCPD_STRICT_BUSP cap. > > This is required by the mt8365, for the MM power domain. > > > > Please explain better waht this flag is doing. I will update the commit message as well. The flag basically tells the code that there is a strict bus protection policy in place which means that bus protect release must be before bus access. This is not on all platforms the case. > > > 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; > > I think it would help readability if we would enable the clocks only in the > case that MTK_SCPD_CAPS(pd, MTK_SCPD_STRICT_BUSP) is false. Then we would > only need to add the same if to the error path of err_disable_subsys_clks, > correct? I already rearranged the code to have a cleaner flow for v2. Thanks, Markus > > Regards, > Matthias > > > + 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 >