Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp97738ybh; Tue, 10 Mar 2020 20:15:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuZXIL5x0X0Lth1vz4+BZhObxbBP3cIF8SGyL6kl5SJfEtPupRFDxB/V7Oe0pN4IDx4CTWU X-Received: by 2002:a05:6808:aac:: with SMTP id r12mr538861oij.59.1583896546926; Tue, 10 Mar 2020 20:15:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583896546; cv=none; d=google.com; s=arc-20160816; b=d0kT8FNO+6wtX1mCtKhNkqyo/nCyWruatneho5q3oCax9Qu1xOJxYDVk4eOLEA3XTO JZ3R7O5IjDiQsqdmMYvND3OX+GicumwUqpkeyy3hEmqFJAV5BwOLD8ScQzKfL8ptzEO8 6TkyQ1jYl6V9HlAZkHBIsgdEfYNkHXXz+TnRyXduH8crWquGtFtLB+HHOwU33TzMuie2 X7a8zcU53Fdr0sMkicDndq8QTN5bgjzqVTWpruAJvJEke7oizMUxLNVBfLU5fhm22SJ9 YEYqYnZOvKONQwR2KWM9uZkLQNZdS8VLBK7NrwykHjlD7waNSyjxKyB5PSrdjvLQQCp0 UE5g== 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=xYwUciegLoUmC80zL9vJOXVRDnxOH2mkTDk31tr500o=; b=sa8aLLKVeuMSZ2LNFC4NqsUXzV3VXN8LBhCeY5NRilZCF+sDIjiFkqvpGSicjKMlcf g1nRRuTd8vUrk3Rx72vvag0OrlomcrGLpRZoYpQGHtXCa5xUBKdskQr8lQS02464lhVy S9MjbqC5c/yO2PVtv2ESO9pHo0IMKrRYyzMMKCS9m9C2w10fcXwcalYgcBcwOMkA+cP+ zQ+Ja8uMOyZNM+d5H9qwck3hCZ6SyGwM+8Vj7V+Iy5JdyZp2wtbq4FyVH+qGkvYvyTEx s0LZoiMoUVXvcsePQQykP19OAuUL4czSgeUXf3IHAmXsRSZW1YzTT+kxcBuUSHkFHl5l PCdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kma7Tvna; 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 s199si447023oih.169.2020.03.10.20.15.35; Tue, 10 Mar 2020 20:15:46 -0700 (PDT) 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=kma7Tvna; 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 S1727693AbgCKDOR (ORCPT + 99 others); Tue, 10 Mar 2020 23:14:17 -0400 Received: from mail-vs1-f67.google.com ([209.85.217.67]:43200 "EHLO mail-vs1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727307AbgCKDOR (ORCPT ); Tue, 10 Mar 2020 23:14:17 -0400 Received: by mail-vs1-f67.google.com with SMTP id 7so386405vsr.10 for ; Tue, 10 Mar 2020 20:14:16 -0700 (PDT) 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=xYwUciegLoUmC80zL9vJOXVRDnxOH2mkTDk31tr500o=; b=kma7TvnaUs14CAynENNhB9yMyXCLNtcX+aYaWo+QKVGodAO3cUufnRsCqYxRF+OqQG OJnWRsCWKVXflciiGN1gFbuiCGI2OnYJ/8yprBahXg4gqa3Jr1YNGNE8DETggWwqF/IK OvFgZTSZgTNZXZhXlkbh/RQF5OXbFr0sK67jE= 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=xYwUciegLoUmC80zL9vJOXVRDnxOH2mkTDk31tr500o=; b=jTHFTDuZ7asCEF0JNR6/6WXVPUcSKhaveGg2phn14HVp0UZ/PpTDvXJX4SPnSdzvgH hqVGhpXvP2TD6MTmps2YX+GZSzEaEmbeKHzzEHhv8VdnXCT1uw+hkqrejyvrzdMORiUf o+U/PNS6DaimGMNIMx/3H5Q4Wu9TVvWW0ePVOLF1jy9txWb0jAN3oJxyui18qk83N2xc dCOK+CbR/QvtUUPsaL5pFsnIgcMj3kcl4pfZ1A7C79P3aIBjJi/0BJbeGxbgkj0x4x2m XNM15YwXOsDcScvDI2Knq8eIv8OS0dgFI4ZvBKLZfydG0AnLI0365ngxrPESPo7BGJvv BUPg== X-Gm-Message-State: ANhLgQ2KDhZR+bap8Oksz3oHnKBsTyWjGjuSNtZfHCIwEBETftjorzQQ C846AxZ9hkg/xxIIbLIQA8q0ITmbojeeF8MYcZEVLw== X-Received: by 2002:a67:fe05:: with SMTP id l5mr700513vsr.186.1583896456343; Tue, 10 Mar 2020 20:14:16 -0700 (PDT) MIME-Version: 1.0 References: <1581910527-1636-1-git-send-email-weiyi.lu@mediatek.com> <1581910527-1636-8-git-send-email-weiyi.lu@mediatek.com> In-Reply-To: <1581910527-1636-8-git-send-email-weiyi.lu@mediatek.com> From: Nicolas Boichat Date: Wed, 11 Mar 2020 11:14:05 +0800 Message-ID: Subject: Re: [PATCH v12 07/10] 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 Mon, Feb 17, 2020 at 11:35 AM 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 cap "MTK_SCPD_SRAM_ISO" to judge if we need to do > the extra sram isolation control or not. > > Signed-off-by: Weiyi Lu Still looks good to me, and addresses Matthias' comments AFAICT: Reviewed-by: Nicolas Boichat > --- > drivers/soc/mediatek/mtk-scpsys.c | 22 ++++++++++++++++++++-- > 1 file changed, 20 insertions(+), 2 deletions(-) > > diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c > index 2a9478f..98cc5ed 100644 > --- a/drivers/soc/mediatek/mtk-scpsys.c > +++ b/drivers/soc/mediatek/mtk-scpsys.c > @@ -26,6 +26,7 @@ > > #define MTK_SCPD_ACTIVE_WAKEUP BIT(0) > #define MTK_SCPD_FWAIT_SRAM BIT(1) > +#define MTK_SCPD_SRAM_ISO BIT(2) > #define MTK_SCPD_CAPS(_scpd, _x) ((_scpd)->data->caps & (_x)) > > #define SPM_VDE_PWR_CON 0x0210 > @@ -57,6 +58,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) > @@ -234,6 +237,14 @@ static int scpsys_sram_enable(struct scp_domain *scpd, void __iomem *ctl_addr) > return ret; > } > > + if (MTK_SCPD_CAPS(scpd, MTK_SCPD_SRAM_ISO)) { > + 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; > } > > @@ -243,8 +254,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 (MTK_SCPD_CAPS(scpd, MTK_SCPD_SRAM_ISO)) { > + 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