Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp407011pxx; Mon, 26 Oct 2020 11:11:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCBHH9aqVs9nwkLcqS1YDLevTxkcfqoXjdst5r6P5QYs3wG8xqmZ/1cH4ivnRGMZxA3FD/ X-Received: by 2002:a50:e447:: with SMTP id e7mr17086043edm.263.1603735886453; Mon, 26 Oct 2020 11:11:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603735886; cv=none; d=google.com; s=arc-20160816; b=mN2nDiJ+VDFkuadc+fs9u3nL05OkOOq/JvRoFBNLqiijIivAMvgAMr4zh1AlK/BgFh rAPx2Jy7K7/RXlqdTb7mBD2jii+uik8DtH8RWRVF0spxWxeMzYD2fUYF/sWwGq4sr1W7 ZAV77UhR6EncZbvpToz46Oi+BQS2sddq7y923MuRAfL+jZ7C0aaW2gdiYoD2wjxEm6cS +q0Gm/q+GzOOKXtnz+5Lvq7GKQ3txgfQJhnLIxpv08/RWGgr8cyA0+TP2Z8UhEmLReKJ owIOVh0IBWMJ9xZSVAb0u/XjX0DCetgeGMoq1Q0L2K5V4FEmP8FWRJz5texC2Y/eEj5s dhNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:subject:from; bh=/VERWOVDxapYuSak3Qq+GUafjIo/SM1pjFMQFdESXpY=; b=y54/yizj6MAeddOP5LQGjmkfR+kBykAclxSBefN06mcgSxSEXiOePMYjVrusrIMBTk Hq1VfuLj3EkYetKWq3iOa5+CaaZyQjaMBwtIdZeIiU//mTE/8xxvAHOnfHhQD1JS8mvt RXozxX0VkCDKA9wtzJlgTxO8nslAxTkomQHtnZNgzaosflDoyUgv2WwEjEAX/Dzl7GQq s5KbW+pXOsqG/aAm4MIIhCdN/xEHizRyyvcyw/kQEYjR9YJFtR0P7iY0Lc69d/5CKhpp yG04eVZQq8neZHkoiV8wSBc4oFCWLqCe7axi0yJv8P+7xdM4umDJlPD6lQOYQyG/+tN5 fpTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y1si7796069edu.104.2020.10.26.11.11.02; Mon, 26 Oct 2020 11:11:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1783563AbgJZPQm (ORCPT + 99 others); Mon, 26 Oct 2020 11:16:42 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:60404 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1783559AbgJZPQm (ORCPT ); Mon, 26 Oct 2020 11:16:42 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 27E241F44A65 From: Enric Balletbo i Serra Subject: Re: [PATCH 07/12] soc: mediatek: pm-domains: Add extra sram control To: Matthias Brugger , linux-kernel@vger.kernel.org Cc: Collabora Kernel ML , fparent@baylibre.com, matthias.bgg@gmail.com, drinkcat@chromium.org, hsinyi@chromium.org, weiyi.lu@mediatek.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <20200910172826.3074357-1-enric.balletbo@collabora.com> <20200910172826.3074357-8-enric.balletbo@collabora.com> <277b1656-4a64-4fdd-865d-88cf253b7b0e@suse.com> Message-ID: <59d2decc-029a-709b-7796-fc9f370b67c6@collabora.com> Date: Mon, 26 Oct 2020 16:16:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <277b1656-4a64-4fdd-865d-88cf253b7b0e@suse.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Matthias, On 10/9/20 20:27, Matthias Brugger wrote: > > > On 10/09/2020 19:28, Enric Balletbo i Serra wrote: >> From: Matthias Brugger >> >> 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 >> Signed-off-by: Matthias Brugger >> Signed-off-by: Enric Balletbo i Serra >> --- >> >>   drivers/soc/mediatek/mtk-pm-domains.c | 22 ++++++++++++++++++++-- >>   1 file changed, 20 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/soc/mediatek/mtk-pm-domains.c >> b/drivers/soc/mediatek/mtk-pm-domains.c >> index 3aa430a60602..0802eccc3a0b 100644 >> --- a/drivers/soc/mediatek/mtk-pm-domains.c >> +++ b/drivers/soc/mediatek/mtk-pm-domains.c >> @@ -21,6 +21,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 >> @@ -42,6 +43,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_DISP            BIT(3) >>   #define PWR_STATUS_MFG            BIT(4) >> @@ -162,6 +165,14 @@ static int scpsys_sram_enable(struct scpsys_domain *pd, >> void __iomem *ctl_addr) >>       if (ret < 0) >>           return ret; >>   +    if (MTK_SCPD_CAPS(pd, 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; >>   } >>   @@ -171,8 +182,15 @@ static int scpsys_sram_disable(struct scpsys_domain >> *pd, void __iomem *ctl_addr) >>       u32 val; >>       int tmp; >>   -    val = readl(ctl_addr); >> -    val |= pd->data->sram_pdn_bits; >> +    if (MTK_SCPD_CAPS(pd, 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) | pd->data->sram_pdn_bits; > > Nit, I'd prefer: > val = readl(ctl_addr); > val |= pd->data->sram_pdn_bits; > done in next version. > >>       writel(val, ctl_addr); >>         /* Either wait until SRAM_PDN_ACK all 1 or 0 */ >>