Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1467523ybl; Wed, 18 Dec 2019 19:55:26 -0800 (PST) X-Google-Smtp-Source: APXvYqw8g0KQ9uQjKafxg1p/DIww+FYDrKGSl2U0OdcsaoSpDysIZTXUHe9T8nCzaPtX2V6bsNbB X-Received: by 2002:a9d:630d:: with SMTP id q13mr6132001otk.31.1576727726451; Wed, 18 Dec 2019 19:55:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576727726; cv=none; d=google.com; s=arc-20160816; b=JNKcTwp3mhqavC4srcnevYxxrrfuzch1p3okRrKoBnvn79CjJ72d18qAEzfmjMVT5A 7S6mFYbKAK0EDgJIR8xpy81sHrDqHkv/UuIV/GPtzLQ6JlLFIIwTymL4Q6mogv6F2Hiy GVhtFn0KF/JA+LQcTPIhfMbhIBl1s17O2UqPeZYDyJNA5XO+SkNfp3FIcIhnLTW+n1si mkTAPlaPXCtXditaY1o+WkbAaO+Z5Zd0E7OyFfUlEmX7OnDwY0bipEWJR4P5Ad8JzDVn iTtAhp8nQGRYxjKdiLlRHlVvJBhv0laiU699NVNovpWzV6vDD+ov97J+jxrpEsG7Q1+E fmtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=F3u9kGaQk+7+mvvGSN3GLe2hFj+Kn5FQzP51xZCsUKo=; b=LrXtomQg91QU6OKqad/xqhXihK95m3xEwRTw8/Vojmqp0J/zdL+6vIPIotkgUaTsBZ SkwHMW1sTkt6rXQ0cm8wZwDAErwEq02AZ0PB8gvQ/QF6H1m2Bnw7vStSrOvbLF4tXiwc EQpFzCNcV3EAco9qv9a5yHq3S0GB0nZJGClMCXodnFIlYPawBXO58ZCFWd0KZQZR7ApC W2pIQor0fFfecRQL4gmAqbdjvma6YzONJClqUGeeTGCmBTQ0AZ5LS/DEOQDLxO8whL9w yOVRxFpjtqmRWeQR4xwIrZtx5fQCsnuyBQVhxCbVm2k2r+np4Es3VIaGjmDdM284oMaC FM+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Kdo+GJdX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i17si2599971otl.149.2019.12.18.19.55.13; Wed, 18 Dec 2019 19:55:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Kdo+GJdX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726846AbfLSDyb (ORCPT + 99 others); Wed, 18 Dec 2019 22:54:31 -0500 Received: from mail-qv1-f68.google.com ([209.85.219.68]:39993 "EHLO mail-qv1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726771AbfLSDyb (ORCPT ); Wed, 18 Dec 2019 22:54:31 -0500 Received: by mail-qv1-f68.google.com with SMTP id dp13so1696643qvb.7 for ; Wed, 18 Dec 2019 19:54:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=F3u9kGaQk+7+mvvGSN3GLe2hFj+Kn5FQzP51xZCsUKo=; b=Kdo+GJdX7tYzhXquSDc0xGVNiOOg5TeySqELrQ2yuh9FWPf5ylwA3V6z7XSfLZl2re St7zg+5OfREjsHKCXhtwSSiw5wPLn2LgGO44RUPigiSQTeMaC5jNE5ghGGw5vG87ssPx vV1He9TBFtYLo9BR3a0fBxWAEAus5wwPrQcLw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=F3u9kGaQk+7+mvvGSN3GLe2hFj+Kn5FQzP51xZCsUKo=; b=iBo+pjAWxF/Wqgd8UX05RlntJy//ygOxFo4MfDBIbpJSS+ag3ICRhs6x8QajWWnRYV rL6gAXa3/Ua2bjxmgf/LvvXEM67JyCsQSZm7GTA5c2Aexk6GSj0+cLL5QEh192Xk4Bz+ ynBREyzgFOiMH5HWxKFK1wuD6hmWino9hfvFitBmy1dXZmY2JCYMXiO9gpEuokZ6MJet MEIsbT/fw46qlG0lPbcIlt2m3yjHRLLKLJIdoPci2vGTLcJbMOx7TXLHI7TXk7OW146J pqS4AjzgedVV6cyXbWzkcNPwEWzXcXHJAwQZGzb+IHlXTvQC/6m6Ydu15ypuuQOirXit YtKw== X-Gm-Message-State: APjAAAWdeASSAU1oObsiEl3Dg6fwzmRaXC6H/Wi8naHUylRhPM0uE42q RhPPgYns52R+ri64cUlf5mHM3Hg5CAr7gBS0cUguOQ== X-Received: by 2002:a05:6214:42c:: with SMTP id a12mr5659443qvy.172.1576727669559; Wed, 18 Dec 2019 19:54:29 -0800 (PST) MIME-Version: 1.0 References: <1576657848-14711-1-git-send-email-weiyi.lu@mediatek.com> <1576657848-14711-7-git-send-email-weiyi.lu@mediatek.com> In-Reply-To: <1576657848-14711-7-git-send-email-weiyi.lu@mediatek.com> From: Nicolas Boichat Date: Thu, 19 Dec 2019 11:54:18 +0800 Message-ID: Subject: Re: [PATCH v10 06/12] soc: mediatek: Use bp_table for all compatibles To: Weiyi Lu Cc: Matthias Brugger , Rob Herring , Sascha Hauer , James Liao , Fan Chen , linux-arm Mailing List , lkml , "moderated list:ARM/Mediatek SoC support" , srv_heupstream Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 18, 2019 at 4:31 PM Weiyi Lu wrote: > > Only use bp_table for bus protection of all compatibles, > instead of mixing bus_prot_mask and bus_prot_reg_update. ditto, I'd just squash in the previous patch. > Signed-off-by: Weiyi Lu > --- > drivers/soc/mediatek/mtk-scpsys.c | 94 ++++++++++++++++++++------------------- > 1 file changed, 48 insertions(+), 46 deletions(-) > > diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c > index 5699d9f..c438c53 100644 > --- a/drivers/soc/mediatek/mtk-scpsys.c > +++ b/drivers/soc/mediatek/mtk-scpsys.c > @@ -11,7 +11,6 @@ > #include > #include > #include > -#include > #include > > #include > @@ -88,7 +87,6 @@ > * @ctl_offs: The offset for main power control register. > * @sram_pdn_bits: The mask for sram power control bits. > * @sram_pdn_ack_bits: The mask for sram power control acked bits. > - * @bus_prot_mask: The mask for single step bus protection. > * @basic_clk_name: The basic clocks required by this power domain. > * @caps: The flag for active wake-up action. > * @bp_table: The mask table for multiple step bus protection. > @@ -99,7 +97,6 @@ struct scp_domain_data { > int ctl_offs; > u32 sram_pdn_bits; > u32 sram_pdn_ack_bits; > - u32 bus_prot_mask; > const char *basic_clk_name[MAX_CLKS]; > u8 caps; > struct bus_prot bp_table[MAX_STEPS]; > @@ -128,7 +125,6 @@ struct scp { > struct regmap *infracfg; > struct regmap *smi_common; > struct scp_ctrl_reg ctrl_reg; > - bool bus_prot_reg_update; > }; > > struct scp_subdomain { > @@ -142,7 +138,6 @@ struct scp_soc_data { > const struct scp_subdomain *subdomains; > int num_subdomains; > const struct scp_ctrl_reg regs; > - bool bus_prot_reg_update; > }; > > static int scpsys_domain_is_on(struct scp_domain *scpd) > @@ -256,12 +251,6 @@ static int scpsys_bus_protect_enable(struct scp_domain *scpd) > { > struct scp *scp = scpd->scp; > > - if (scpd->data->bus_prot_mask) { > - return mtk_infracfg_set_bus_protection(scp->infracfg, > - scpd->data->bus_prot_mask, > - scp->bus_prot_reg_update); > - } > - > return mtk_scpsys_ext_set_bus_protection(scpd->data->bp_table, > scp->infracfg, scp->smi_common); > } > @@ -270,12 +259,6 @@ static int scpsys_bus_protect_disable(struct scp_domain *scpd) > { > struct scp *scp = scpd->scp; > > - if (scpd->data->bus_prot_mask) { > - return mtk_infracfg_clear_bus_protection(scp->infracfg, > - scpd->data->bus_prot_mask, > - scp->bus_prot_reg_update); > - } > - > return mtk_scpsys_ext_clear_bus_protection(scpd->data->bp_table, > scp->infracfg, scp->smi_common); > } > @@ -412,8 +395,7 @@ static int init_basic_clks(struct platform_device *pdev, struct clk **clk, > > static struct scp *init_scp(struct platform_device *pdev, > const struct scp_domain_data *scp_domain_data, int num, > - const struct scp_ctrl_reg *scp_ctrl_reg, > - bool bus_prot_reg_update) > + const struct scp_ctrl_reg *scp_ctrl_reg) > { > struct genpd_onecell_data *pd_data; > struct resource *res; > @@ -427,8 +409,6 @@ static struct scp *init_scp(struct platform_device *pdev, > scp->ctrl_reg.pwr_sta_offs = scp_ctrl_reg->pwr_sta_offs; > scp->ctrl_reg.pwr_sta2nd_offs = scp_ctrl_reg->pwr_sta2nd_offs; > > - scp->bus_prot_reg_update = bus_prot_reg_update; > - > scp->dev = &pdev->dev; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > @@ -549,8 +529,10 @@ static void mtk_register_power_domains(struct platform_device *pdev, > .name = "conn", > .sta_mask = PWR_STATUS_CONN, > .ctl_offs = SPM_CONN_PWR_CON, > - .bus_prot_mask = MT2701_TOP_AXI_PROT_EN_CONN_M | > - MT2701_TOP_AXI_PROT_EN_CONN_S, > + .bp_table = { > + BUS_PROT(IFR_TYPE, 0, 0, 0x220, 0x228, > + BIT(2) | BIT(8), BIT(2) | BIT(8)), > + }, I'm a bit sad we lose the information about the BIT meaning. Of course this looks ugly and verbose: BUS_PROT(IFR_TYPE, 0, 0, 0x220, 0x228, MT2701_TOP_AXI_PROT_EN_CONN_M | MT2701_TOP_AXI_PROT_EN_CONN_S, MT2701_TOP_AXI_PROT_EN_CONN_M | MT2701_TOP_AXI_PROT_EN_CONN_S), But if you make "check_clr_mask" a boolean, you wouldn't have to repeat the mask twice and you could keep the nice register bit definitions. [snip, many similar occurences below]