Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1378731ybi; Wed, 19 Jun 2019 19:40:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0GDoXBhsZVEdN+orIwFXovyzmvgHSl8RYM9UaNkL9XyRNB2J/Df345QCFfm80HBaY+ndO X-Received: by 2002:a63:4185:: with SMTP id o127mr10336835pga.82.1560998411593; Wed, 19 Jun 2019 19:40:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560998411; cv=none; d=google.com; s=arc-20160816; b=xRJr9FIA0Zaw8pe6kzAFQijtkpoeL+u1+Msc+L/nRn2bUHtH4vHLmMMZwhWPsv+QXb X2R1I6azZscjdyGdxnnUc1/2MdwsDQRsQnYkp+lBMOuXwFtGTeO54+22yCzcDWKh/e8i R/FDrKq9kHxfhIXNJJEkm3MGjGbJ3jRsbMvHhDm0oE7dQMWIRaGTei9N4S5ujH7EAHhh dWUOvT4QpRiKNHQoju/bsVYlxuTgzLenL4zj5LVacmp7fNoeb2I73ATB6n6NQRgn6Xnf PkzM0sNTVv2AD2/lJmPBxVO4aB033QkqhIWUUuHk/r+mM9JSPLuhIz+FpxdtVDPzA2g9 ZLCA== 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=rKT53ntYsfYp3gIS1jk6zOQ3U3L50htS4zU/9P2tu04=; b=z7L3SZEZRwTX9AXv28ms9qkKW3uDkJalwv6iZ/haLnBOvmiW+HlJTLUKDK/AJLHMtV IvcT17qW68rUbHk1UMX4SFbMb/+82eduJmUY8JmcGq5UV0ZeJ+gUYTB/ZIKeACzQaLPV cFX86RlaAXkk535ZJDVQMKgD80EVieYsu0R+Pcahrfu7gjLw927iQhMdfYAAQR1smEdr NS8TOAg3wtwyyqviW5qw04tCLSuqVgFTYQohu3wrHdOnHS9QU0tN62xTWieVGnwTDHOL UROf+OIE6a0ln65ocBJSelGyjAjluMVXTz55WucmduTL0ZVjfgw7LR/pVUONEHMqUZkM eakQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u23si13030691pfh.177.2019.06.19.19.39.55; Wed, 19 Jun 2019 19:40:11 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731321AbfFTCia (ORCPT + 99 others); Wed, 19 Jun 2019 22:38:30 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:28166 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726480AbfFTCi3 (ORCPT ); Wed, 19 Jun 2019 22:38:29 -0400 X-UUID: fe4fe013dad8443ca0d3cfec37ab2324-20190620 X-UUID: fe4fe013dad8443ca0d3cfec37ab2324-20190620 Received: from mtkmrs01.mediatek.inc [(172.21.131.159)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 891489260; Thu, 20 Jun 2019 10:38:21 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 20 Jun 2019 10:38:20 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 20 Jun 2019 10:38:20 +0800 From: Weiyi Lu To: Nicolas Boichat , Matthias Brugger , Rob Herring CC: James Liao , Fan Chen , , , , , Weiyi Lu , Yong Wu Subject: [PATCH v6 12/14] soc: mediatek: Add extra sram control Date: Thu, 20 Jun 2019 10:38:04 +0800 Message-ID: <1560998286-9189-13-git-send-email-weiyi.lu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1560998286-9189-1-git-send-email-weiyi.lu@mediatek.com> References: <1560998286-9189-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 74fd981..d3fdb3f 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