Received: by 10.213.65.68 with SMTP id h4csp3207062imn; Tue, 3 Apr 2018 00:18:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx49AH9Jr8HrKBEPmDWCg/WPBEgKztyXmwfk6C9g6G3BOtP4j7rWUfklcE5is1eab89oRUYHZ X-Received: by 10.101.89.65 with SMTP id g1mr8329053pgu.185.1522739885911; Tue, 03 Apr 2018 00:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522739885; cv=none; d=google.com; s=arc-20160816; b=BwlTvrQtmDEVoiZ0f223urOGznDpUGBBTkbRcKKKbD9uvh7FeBeXWOwAi/7+6fdRqx nx0QwuO7dbFouuH2eyes+3zeRpNTHDDUyTQ2XzgwCqJDDX7TqfLQMnoqPzKX3tFRPj54 vXNiPiqwPrFAR7QxwXf/36NFakal9/21jYkGhwknHZIov79LKKN4HN5g82yWrQy8yoPi AaP7STOvfwoqPpw0YF4V9+0DNg0tNpC4TXQSvKc0D9fZBbXvW11f1id0nuzpVzUItCy/ /b9vkmFaGn7u9CCbyHLh32h8GeLntIRLaI5eGB65VGRdA6HYbj3mT1KjqYlNdpCIuiwg x3VA== 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:arc-authentication-results; bh=d00O3iL4JTWdOVWkWBWhkXn2DeyUaMZx6kQrSlMHDPs=; b=p16ukjKuQCUrY8KoTUd3POwYdArWsu4i80UdKCV/5PQKtRCse+HseCizrSw47RTDqa rSd6wLU7pLtzk0TbWyRngYmogs7HB/1ounJ3iikZds2F55KguatE0Ckw34Z/9EohTlQy CZtZhX+VidFxuha8Y0FdYtOnreM4ANC3Ke9eaFdjBRiPrtoobJPsu4uFcVtoTvXEGw+u aUJUNL4EttBnuT1/Vpp46GhqyhgDoPOUBn/B43o+F9nTw27sk4Ud4ilDrNRrQE+8OzpJ iNQrqQy+pTpF34t//gF9FtiZ6zcrl2jjeTDOrKdwQ+yl4Sq9QDXJrTGI+Vk742kR7919 xE0Q== 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 f27si1546480pgn.484.2018.04.03.00.17.52; Tue, 03 Apr 2018 00:18:05 -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 S1754907AbeDCHQV (ORCPT + 99 others); Tue, 3 Apr 2018 03:16:21 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:54659 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754883AbeDCHQQ (ORCPT ); Tue, 3 Apr 2018 03:16:16 -0400 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: , , , CC: , , , , , Sean Wang , "Matthias Brugger" , Ulf Hansson , Weiyi Lu 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 Content-Type: text/plain 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, }, }; -- 2.7.4