Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp578242ybl; Wed, 28 Aug 2019 02:13:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzq8Bqvi83CCspzX6UnEmQFCGfwVP9DHU5flqaxHlrkOydiLG0e1zP/fmzw7m5DZnMOsYtt X-Received: by 2002:a17:90a:e392:: with SMTP id b18mr3099429pjz.140.1566983609679; Wed, 28 Aug 2019 02:13:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566983609; cv=none; d=google.com; s=arc-20160816; b=vtB2jBg7rpMCXN6tmskoeowgzzkTsWsGfV0L7QUPMmaIi1YVvkZeLttbNBOmaFFOuo qMcNsenIXEKqjziVniUgRz1Rgu2H9dYHVqs/i0szbm6VabAxHihTKZYf6DlovBOKnKPk SPUBPZaztCTcpvmri9NSiZ/HjzqqaDCl/nml+ofKiM79OpgrxOcfeAVZC2GeP0AvVoCv 9uzDMquXnw3eiQdudYpCRQdfngwOvKgZXEl90EhAx7oAD3YygYow9XXssl0ZY4UBI34e 4f6GnLM7iGrvaxnbfmPEXSbNzqAe514cTw0tE8pJN89dpvvEfhge8aNF6sOR4Kp2YkcX CJMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=By51BG5+ycp3YhyYjDTwUAu8y+y96Q8U3hbgLVi8BRQ=; b=JWK0UMYbv3sYQgf1gsTclkfZ2OseDQgYUoF18j8pmTQXbFF7wB+pIRibfA3KAtuUNZ wxMOhBG2Kew3Mu/1K54dakiLL4BXut0epW6ZXQ3Pfxi+cz5TNEW2j6lMBBQEsJkczMjW /+3px+t2JObFGR95xU2yHMYmWyjQISCojyN5iQ9PIUPx2GJYvnWDk91KeLd+okVGn0zq lPQI6I7CzLlZ+9bd8AG4Guwjo6oJs/MqyfMQhl6sBNitMg58+naJBhrIg+hZY1I/kYbV eTIx5rcl0aIdpEEnxa5xfssPbcr6tYb+/NbZiPquTJQD12kO6oU2H47GMVVLTX22HRSt 3FkQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a29si2031640pfg.263.2019.08.28.02.13.13; Wed, 28 Aug 2019 02:13:29 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726858AbfH1JMM (ORCPT + 99 others); Wed, 28 Aug 2019 05:12:12 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:15642 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726817AbfH1JMK (ORCPT ); Wed, 28 Aug 2019 05:12:10 -0400 X-UUID: b1b8785ec9fc44a2ac613864fc4719e5-20190828 X-UUID: b1b8785ec9fc44a2ac613864fc4719e5-20190828 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1289487160; Wed, 28 Aug 2019 17:11:59 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 28 Aug 2019 17:12:05 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 28 Aug 2019 17:12:05 +0800 From: Weiyi Lu To: Nicolas Boichat , Matthias Brugger , Rob Herring CC: James Liao , Fan Chen , , , , , Weiyi Lu , Yong Wu Subject: [PATCH v7 11/13] soc: mediatek: Add extra sram control Date: Wed, 28 Aug 2019 17:11:44 +0800 Message-ID: <1566983506-26598-12-git-send-email-weiyi.lu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1566983506-26598-1-git-send-email-weiyi.lu@mediatek.com> References: <1566983506-26598-1-git-send-email-weiyi.lu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/soc/mediatek/mtk-scpsys.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c index 33c4034..85c6bf4 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -57,6 +57,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) @@ -115,6 +117,8 @@ enum clk_id { * @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. * @bus_prot_mask: The mask for single step bus protection. @@ -130,6 +134,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; u32 bus_prot_mask; @@ -268,6 +273,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; } @@ -277,6 +290,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; + if (scpd->data->sram_iso_ctrl) { + val = readl(ctl_addr); + val |= 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); -- 1.8.1.1.dirty