From patchwork Tue Apr 3 07:15:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 10320725 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1097C60116 for ; Tue, 3 Apr 2018 07:32:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDE3D28980 for ; Tue, 3 Apr 2018 07:32:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E27A5289BA; Tue, 3 Apr 2018 07:32:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1E0A128980 for ; Tue, 3 Apr 2018 07:32:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pWPEz7v1AqGDPbOCldmgCAHCgAFYDMBlhdUOLgg7ZoQ=; b=LWS/HH0t5g+xo1 ErlNdtRN5ewrOnOQgUK8wEyGcvhJ9ba57f3N2N1wZTYj2jSJKRHUrqg1SdxEMC2apQOK/oT7e5HoX CBf9PgBoREK1GqNNeQCsO83mSMedK4QmphUw9PYImIF2EDgN2gN8sMgx9nOySjqWSjRxSv/LB+RAY pLLeQ1qCuXHwdxEz6DjBCm40GdRNd/uzh5V3Vryg/J3pTkhJitszWxTO1gqLMad3izlEqHs5cwzTc HTRqsIfIC9PQ6D+jTCapY/RDdNGS1786mZ4HdgFmFV+m0HscnYyOqutblGuhXsQCZbmH87wJdsaH3 JL9q+cox7SKfd/CBx1fg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f3GQv-0002u4-6l; Tue, 03 Apr 2018 07:32:45 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f3GQt-0002r0-7L; Tue, 03 Apr 2018 07:32:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=d00O3iL4JTWdOVWkWBWhkXn2DeyUaMZx6kQrSlMHDPs=; b=hUjaAV7wVMksZ7r0duszXdpNk WBHqFBIJtp/dZFzuZlmugiSeIuI+zVt2eoD7Mp1r4HdmQGW6UIoe2Drai5+JDvfDfs+WAR0ROcRff aWJqQ9vC8ne7MnOSs160SbUpQrwpnAR1Si/lz7zWxvYYtJviRW6HmhV+xSDvVztKNLRx4JgHNJwNY cUeRsaU7khSGgsfJtBiBSd73MbeAQiyfF4aQKG426YXrNAMlweFiEdfsF9JbAE/UXCa/2/4d04fTD v1jwnRi60PgDQJjpGQdLOiVCR7enge7fKKi42p/yxIHHxqvBDzWclVDmjQ3YNLoer1SLwlPGLXYPJ +Ruq4MTKg==; Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f3GBG-0006Uf-9u; Tue, 03 Apr 2018 07:16:36 +0000 X-UUID: dd47b214ec2c4ee1a3cf74ba3863241b-20180403 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 233998040; Tue, 03 Apr 2018 15:16:11 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Tue, 3 Apr 2018 15:16:10 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Tue, 3 Apr 2018 15:16:10 +0800 From: To: , , , Subject: [PATCH v1 5/7] soc: mediatek: add a fixed wait for SRAM stable Date: Tue, 3 Apr 2018 15:15:55 +0800 Message-ID: <0fc10b2498c6dbe20141831c722c32cc74330d3d.1522736996.git.sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-12.5.0.5042-8.2.9001-23760.005 X-TM-AS-Result: No-6.489900-8.000000-10 X-TMASE-MatchedRID: Ei0WBMmFdJhQlz7zzALRPkKcYi5Qw/RVVo4lwLFUdiuctWHPLT5FfaqP oyh3F974T52TJZnqxBpO62v+OrztwJx6Ilif8OzGA9lly13c/gH0O7M3lSnTW8eQfu6iwSfsYRW GTChXyt1vx7UZ9PwSfR0XwFnoQFewHxPMjOKY7A8LbigRnpKlKWxlRJiH4397tbn3XmfSRVqoOh OBMiYLVDUjphbdGeFINbEv6hywEg3pCdnFKFqrOQ== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--6.489900-8.000000 X-TMASE-Version: SMEX-12.5.0.5042-8.2.9001-23760.005 X-TMASE-POSTMAN: 2-d; X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180403_081634_644042_5A915A60 X-CRM114-Status: GOOD ( 16.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Ulf Hansson , Weiyi Lu , Sean Wang , linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Wang MT7622_POWER_DOMAIN_WB doesn't send an ACK when its managed SRAM becomes stable, which is not like the behavior the other power domains should have. Therefore, it's necessary for such a power domain to have a fixed and well-predefined duration to wait until its managed SRAM can be allowed to access by all functions running on the top. Signed-off-by: Sean Wang Cc: Matthias Brugger Cc: Ulf Hansson Cc: Weiyi Lu --- drivers/soc/mediatek/mtk-scpsys.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c index f9b7248..19aceb8 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -121,6 +121,7 @@ struct scp_domain_data { u32 bus_prot_mask; enum clk_id clk_id[MAX_CLKS]; bool active_wakeup; + u32 us_sram_fwait; }; struct scp; @@ -234,11 +235,16 @@ static int scpsys_power_on(struct generic_pm_domain *genpd) val &= ~scpd->data->sram_pdn_bits; writel(val, ctl_addr); - /* wait until SRAM_PDN_ACK all 0 */ - ret = readl_poll_timeout(ctl_addr, tmp, (tmp & pdn_ack) == 0, - MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT); - if (ret < 0) - goto err_pwr_ack; + /* Either wait until SRAM_PDN_ACK all 0 or have a force wait */ + if (!scpd->data->us_sram_fwait) { + ret = readl_poll_timeout(ctl_addr, tmp, (tmp & pdn_ack) == 0, + MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT); + if (ret < 0) + goto err_pwr_ack; + } else { + usleep_range(scpd->data->us_sram_fwait, + scpd->data->us_sram_fwait + 100); + }; if (scpd->data->bus_prot_mask) { ret = mtk_infracfg_clear_bus_protection(scp->infracfg, @@ -783,6 +789,7 @@ static const struct scp_domain_data scp_domain_data_mt7622[] = { .clk_id = {CLK_NONE}, .bus_prot_mask = MT7622_TOP_AXI_PROT_EN_WB, .active_wakeup = true, + .us_sram_fwait = 12000, }, };