Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1251084pxk; Thu, 10 Sep 2020 10:37:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7C0oOUKla6ihui915OV1MbHdMxf7Qwupcp1QXyoMmGpUL9X1+sHzXyS+2WiEA1qYFv5Gx X-Received: by 2002:a05:6402:b0f:: with SMTP id bm15mr10216182edb.388.1599759477205; Thu, 10 Sep 2020 10:37:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599759477; cv=none; d=google.com; s=arc-20160816; b=JfTLGL1TqzpfMRAtak6XWlOc1o5919/Mo9K5WMvHUosWoKsHTlnMIhJ8tYudm7kpMe bUKfXj4m4HWuTzJwfKUA8bLGrVotqLoxgafgw59yGUokhDA4iFnd+1BmL1YSwqAlDAr/ 9sgHxTpsHgWy9+lp2lG7JMyTaF7Yl28Y6kyOkOlxA0t7y29OW2D10K6BguoJlsVMRDbv JbW4SQ2ecJblFfOUiHy8PN1vXN/qMt9BUXFNtauJ+hp6gQoU4/xYg7dnHbB8ZqfjfJcc qLtuKsrwnPgikUjyCwsNuQYza6wbXoRQDNDmu5GAcZNN4I6biMJ2FvGx4xstXp9+aXKW OhqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=mwQtlCcnchMWqwGDPytUtJ6p3XuMqhaGf/O546oCuZE=; b=nESxxWp3CJPx6FuN2bVLnqvVCwnS3gBhTTKkY16qovZEDJeSMWl/mUantsdFdeAG50 V3CT02uuPYsZ3XV55HtC/0Zhndu6/TXvIuITt6FvGk0Xlnd5ePd/B0uIN1BQRsp4lYaL mxuWRd8uy3UprgXSMJ9hDvRWYs4MyN3xXbrKKMfreEYbItSI0LGRDI/nu2tznNI5f0bp dxUmLmYqHK/jExK58eiZB9K/RBmUCcYTg/wntSnzBIbZpD22tJHS0+guQ89wbb4mZWtX jyW16RHvfC5Yyl8X2g1sip4WkNV1m55rspjBfUHpmulhD1JAJ2Tw2oQBs4AliS8yDfd4 sneg== 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 n16si3715540ejj.284.2020.09.10.10.37.33; Thu, 10 Sep 2020 10:37:57 -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 S1726931AbgIJRhA (ORCPT + 99 others); Thu, 10 Sep 2020 13:37:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727800AbgIJR2s (ORCPT ); Thu, 10 Sep 2020 13:28:48 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 324FEC0613ED for ; Thu, 10 Sep 2020 10:28:47 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id EAFBD29BB1A From: Enric Balletbo i Serra To: 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, Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 07/12] soc: mediatek: pm-domains: Add extra sram control Date: Thu, 10 Sep 2020 19:28:21 +0200 Message-Id: <20200910172826.3074357-8-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200910172826.3074357-1-enric.balletbo@collabora.com> References: <20200910172826.3074357-1-enric.balletbo@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; writel(val, ctl_addr); /* Either wait until SRAM_PDN_ACK all 1 or 0 */ -- 2.28.0