Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1469708ybl; Wed, 18 Dec 2019 19:58:54 -0800 (PST) X-Google-Smtp-Source: APXvYqzcpmG78AVxVdP7YbmKaiLg/HpzIRFT9WFJ5Sx8lRdp2oIUGCzUOkHSYkrsiOzpZZ11wOAT X-Received: by 2002:a9d:23b5:: with SMTP id t50mr6254952otb.122.1576727934039; Wed, 18 Dec 2019 19:58:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576727934; cv=none; d=google.com; s=arc-20160816; b=MVPFqCkQwWp0CmirhTs9o3fbsVtwLK9h3fgwJ1KHh8DKS1pLLrrUFNKQhNQSDScd/a G/2nsy69sP0y0Svfy/WqTrnctnAxeZTta0/GcN5krHFOaHEWa0DbT1ExF+nlvjIlg9EF DjV4th6p6PZ0qvUegEdiMyA4/HNyLzqkedftGQ+6nL295Ato7hf3/ZOtknlOGxOEspUh CMhFjL8fM48qSHBKAzoujvwBv4N/incCJsP08LuOLuf0LuIjCFCJijqzF8fEGpPxiUKW VBgFOU3oyNcgq6r8ZT933E0BxU9DKSQA0BlQXSPHhBQTLdk1uUrzsb7DaYywc4AMbhuI pVoQ== 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=gW5SNpt87UiG+lsIdrY5UhkxjdU7rCSW5a9k6JS9SRk=; b=x16wAFaA23vjyvJLtzHsMqn1wwL56E6XJYKp2+n8SpqMeeZw/q7Ub2FPHLQCxzCfAl 6SmA49CCeMWb7xz3M/G+9bf0M2uxABhQN+Fd92r3dRH/8Yn7I3n+Pzp/IG+odTDsJgR8 jz6GxPOV9xtpaNOQearyGjfg1HN8Q8N3P6h16angZEZhH+nGa6YPEs5PgN6Oa82wC+Y8 q0iubVqdk2BoFpNjXHr/CSgu4fUtpqTSbPGoI9oFSk0YNxScrUKhdX0DHrqhm++7SUuy sU4+laYU6sLiTe1l6qL6SmXJY7+gpXsForJ+LT/24UEB1LOuJ9qw8OwGScg2QzW03YJF eCnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hqFkhfDz; 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 v5si2671121otn.155.2019.12.18.19.58.42; Wed, 18 Dec 2019 19:58:54 -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=hqFkhfDz; 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 S1726847AbfLSD6D (ORCPT + 99 others); Wed, 18 Dec 2019 22:58:03 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:44720 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726777AbfLSD6D (ORCPT ); Wed, 18 Dec 2019 22:58:03 -0500 Received: by mail-qk1-f196.google.com with SMTP id w127so3511779qkb.11 for ; Wed, 18 Dec 2019 19:58:01 -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=gW5SNpt87UiG+lsIdrY5UhkxjdU7rCSW5a9k6JS9SRk=; b=hqFkhfDzCCKIUTBL6FeQxUmjvs91e8R1WmNH0Vumuze6UR95Wrm3Tm7TSP/G5+p2yi NcohuQv4yW/e/F73o9/U/0brsCCYjDSsFJ0FzHUZUJ7Y3w8xzUwKwuVzwHyodCdvvRTY xPQFXPHStersJiiwdEMwbEwdFJOsf8FM7ID0g= 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=gW5SNpt87UiG+lsIdrY5UhkxjdU7rCSW5a9k6JS9SRk=; b=L+Qw3PLkmRGCmlCWuxzPbz9/5gqniV8u/bqf3g3yxhZUa5MuXsvmMda+6h/99x00Wb UfLnmAfJiRd4GpqWOExLp12FlXyzZISCIcfwp8FtAaGyHrjeK8tfxJp2OF7QmfvPJXDR AFz9j9CeksOdRzdff7jPGNvnm4O95oPvTpItXogz28m6B9WRwVxU9XrfVFMcHJAdBPPT wP9IhtaaZi3AzkWDPLWiujOd5pJl2Kejgm/Df/XAqLkMQjRLnzA5/pG8cmkL7KzsCITa ODAsTme+DB974A/NkanZi+TxrFu4PpzOkDot08xGuwgq9kGSzX91H9ricyvo5FZpXJly 6qJQ== X-Gm-Message-State: APjAAAWuYWb/wgqNkSWYNbWg1mcySBjqbIjHcoDlTPnbdY+L+rxEJeq1 NG8eQTnMvKx86mvIBJr73ZP8T3cy2RwbdwKKqsUuKA== X-Received: by 2002:ae9:f003:: with SMTP id l3mr6202689qkg.457.1576727881256; Wed, 18 Dec 2019 19:58:01 -0800 (PST) MIME-Version: 1.0 References: <1576657848-14711-1-git-send-email-weiyi.lu@mediatek.com> <1576657848-14711-10-git-send-email-weiyi.lu@mediatek.com> In-Reply-To: <1576657848-14711-10-git-send-email-weiyi.lu@mediatek.com> From: Nicolas Boichat Date: Thu, 19 Dec 2019 11:57:50 +0800 Message-ID: Subject: Re: [PATCH v10 09/12] soc: mediatek: Add extra sram control 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: > > For some power domains like vpu_core on MT8183 whose sram need to > do clock and internal isolation while power on/off sram. > We add a flag "sram_iso_ctrl" in scp_domain_data to judge if we > need to do the extra sram isolation control or not. > > Signed-off-by: Weiyi Lu Reviewed-by: Nicolas Boichat > --- > drivers/soc/mediatek/mtk-scpsys.c | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > > diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c > index 9f06f17..e010fb3 100644 > --- a/drivers/soc/mediatek/mtk-scpsys.c > +++ b/drivers/soc/mediatek/mtk-scpsys.c > @@ -56,6 +56,8 @@ > #define PWR_ON_BIT BIT(2) > #define PWR_ON_2ND_BIT BIT(3) > #define PWR_CLK_DIS_BIT BIT(4) > +#define PWR_SRAM_CLKISO_BIT BIT(5) > +#define PWR_SRAM_ISOINT_B_BIT BIT(6) > > #define PWR_STATUS_CONN BIT(1) > #define PWR_STATUS_DISP BIT(3) > @@ -86,6 +88,8 @@ > * @name: The domain name. > * @sta_mask: The mask for power on/off status bit. > * @ctl_offs: The offset for main power control register. > + * @sram_iso_ctrl: The flag to judge if the power domain need to do > + * the extra sram isolation control. > * @sram_pdn_bits: The mask for sram power control bits. > * @sram_pdn_ack_bits: The mask for sram power control acked bits. > * @basic_clk_name: The basic clocks required by this power domain. > @@ -98,6 +102,7 @@ struct scp_domain_data { > const char *name; > u32 sta_mask; > int ctl_offs; > + bool sram_iso_ctrl; > u32 sram_pdn_bits; > u32 sram_pdn_ack_bits; > const char *basic_clk_name[MAX_CLKS]; > @@ -233,6 +238,14 @@ static int scpsys_sram_enable(struct scp_domain *scpd, void __iomem *ctl_addr) > return ret; > } > > + if (scpd->data->sram_iso_ctrl) { > + val = readl(ctl_addr) | PWR_SRAM_ISOINT_B_BIT; > + writel(val, ctl_addr); > + udelay(1); > + val &= ~PWR_SRAM_CLKISO_BIT; > + writel(val, ctl_addr); > + } > + > return 0; > } > > @@ -242,8 +255,15 @@ static int scpsys_sram_disable(struct scp_domain *scpd, void __iomem *ctl_addr) > u32 pdn_ack = scpd->data->sram_pdn_ack_bits; > int tmp; > > - val = readl(ctl_addr); > - val |= scpd->data->sram_pdn_bits; > + if (scpd->data->sram_iso_ctrl) { > + val = readl(ctl_addr) | PWR_SRAM_CLKISO_BIT; > + writel(val, ctl_addr); > + val &= ~PWR_SRAM_ISOINT_B_BIT; > + writel(val, ctl_addr); > + udelay(1); > + } > + > + val = readl(ctl_addr) | scpd->data->sram_pdn_bits; > writel(val, ctl_addr); > > /* Either wait until SRAM_PDN_ACK all 1 or 0 */ > -- > 1.8.1.1.dirty