Received: by 10.192.165.156 with SMTP id m28csp544574imm; Thu, 19 Apr 2018 03:35:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/q+/0cYg+nzGMxBxd5Ect5F6EVIVLzU4ChqQPNBkSJ034lsrY77MVbKJCoLsoIovycggW+ X-Received: by 10.99.111.200 with SMTP id k191mr4714218pgc.330.1524134109811; Thu, 19 Apr 2018 03:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524134109; cv=none; d=google.com; s=arc-20160816; b=I+2nvHA+yGlcNxm0+MLgHivzOT9086rgvmFSnrVQvnZeR85bnuO4SKJhbBC+JBcME5 NO3i1yGF75UteuWtXjn/ESOIxfZhkRU5o6vVBpDlA+Rz8Hifeh+7I7QwmiXN6+/Sp+JA 29d11g7MsTmetFb3p2zr20XQ+/NaTd9iKyFELKfKRED6zL8ash7hNLBqD97hiODYNxam 6XhnXA78MJlVyNsNQF5W252J2U8zIBYSmKPBSx9tguJYDL4OTuuyBD6ANrb/mSkDQ1pD OfcDL8nQCNTrrn1h8aDJ6NIyt3Xmp1C4rJSiJZCc40RQQbIihACzB+INmZHy8E7kReM9 oqzQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=3LyBJl6C2NC+51FAq4RUTrsP3Ls8myJ5G2bc5YHQQec=; b=aPtg/WPKQcb5iEWGajaO0Vb3MPlje2SfxP7Km3aTY2JQuwDMFTI6H/Gg+zNFvsrYRb +4375X/fANaQUhZAwNca343t+1/VYGEOdN41w0LK+Z4g7CFQKnjoQ09JvDqsPi/QysQ7 rXRSlw+5rjJw8qaSviGjN00QD1PXN4pyBa6FsdqeEfRmyOep80r787IPL5lOwZ6Nz/s9 Aabd2R5dufvipqbwfQkrfaceALEbt+8KPqTi4FBqQQVNUqJQMVr0sPeXTEfHMdhW+TTJ Or88NMIH/OBW5kB/Q/UPSatjgrhrlBwgm+rEW2HSPxQ3vqxMvVKrFV7hmc4z9zUSfVEv gMnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qLfBb/Pk; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l192si2814936pge.365.2018.04.19.03.34.55; Thu, 19 Apr 2018 03:35:09 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qLfBb/Pk; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752489AbeDSKdn (ORCPT + 99 others); Thu, 19 Apr 2018 06:33:43 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:44796 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751042AbeDSKdk (ORCPT ); Thu, 19 Apr 2018 06:33:40 -0400 Received: by mail-wr0-f196.google.com with SMTP id o15-v6so12620008wro.11; Thu, 19 Apr 2018 03:33:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3LyBJl6C2NC+51FAq4RUTrsP3Ls8myJ5G2bc5YHQQec=; b=qLfBb/PkGl0nBUzf2T1uIl0+vpd7zwBt1yIbfm92ZSYmJib26zuGVdEZT3yAA0BQqM 02JrrArauWqJsrI+rppOUKK0a2lzfrQsudAiAdXTjFIOiwmQzV107UehqQiCi4YD0Bb+ hwwH45U7J9YnDH5ts111R4CFyjavp+36rYrJuTK3xf4UImdr71UxWMknCRIaXeIgFL5D te5JBp7f5SMePOuC6KbgA+N3iTDC6sTQlQ2dxRliXX8rbbm4qvLhCvFCAj8xyYUlrVQ6 9M/bbqfL/sN264FlMi9WaVis98kH1UiYR8Vm0TA/jx71CQd5IfYeCSUFrWD8TdbbspHD aUsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=3LyBJl6C2NC+51FAq4RUTrsP3Ls8myJ5G2bc5YHQQec=; b=ex7iP6dcCh1Ut77xiUy1SEEyAnT/wJRm7os9wXLKovd98VIyD3IOhrPOB5S9H8wt0N 3Kr1CkseSomlkGteB8KFs6b+UcdA0tnOPOz3xiI1N45NUBMOqhGj2eIRjUz613YBAQ31 PlabCvOTH8uWc/YBNw/6/aqTrS5URrLM2X5xaCrl+JZTAA/Fc5zDlMSime70fMgqh8f6 SXxHgZiqTgJtmz0yHyv+OwbqmZtXs0xKp+FmG46ZIJ7Wus69MsbHVb7tFBb+WQkyAF5J E+xyeB1MQI5AjzA73Jto+Kh1TNy5MvTOcuxbvYbQVetFFkPxj2LIqo3QGXJk0+6gRcUa Q/ew== X-Gm-Message-State: ALQs6tAr0foHTEK9plZOqe2euAsoSJGDrL7r2YScHlyyIbdcj1UFmLQt RXU/dcnZPGIVG6kUKf8fX8Y= X-Received: by 10.28.236.19 with SMTP id k19mr4285912wmh.11.1524134019232; Thu, 19 Apr 2018 03:33:39 -0700 (PDT) Received: from ziggy.stardust ([37.223.140.222]) by smtp.gmail.com with ESMTPSA id g75sm4727227wmc.47.2018.04.19.03.33.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Apr 2018 03:33:38 -0700 (PDT) Subject: Re: [PATCH v1 5/7] soc: mediatek: add a fixed wait for SRAM stable To: sean.wang@mediatek.com, robh+dt@kernel.org, mark.rutland@arm.com, marcel@holtmann.org, johan.hedberg@gmail.com Cc: devicetree@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Ulf Hansson , Weiyi Lu References: <0fc10b2498c6dbe20141831c722c32cc74330d3d.1522736996.git.sean.wang@mediatek.com> From: Matthias Brugger Openpgp: preference=signencrypt Autocrypt: addr=matthias.bgg@gmail.com; prefer-encrypt=mutual; keydata= xsFNBFP1zgUBEAC21D6hk7//0kOmsUrE3eZ55kjc9DmFPKIz6l4NggqwQjBNRHIMh04BbCMY fL3eT7ZsYV5nur7zctmJ+vbszoOASXUpfq8M+S5hU2w7sBaVk5rpH9yW8CUWz2+ZpQXPJcFa OhLZuSKB1F5JcvLbETRjNzNU7B3TdS2+zkgQQdEyt7Ij2HXGLJ2w+yG2GuR9/iyCJRf10Okq gTh//XESJZ8S6KlOWbLXRE+yfkKDXQx2Jr1XuVvM3zPqH5FMg8reRVFsQ+vI0b+OlyekT/Xe 0Hwvqkev95GG6x7yseJwI+2ydDH6M5O7fPKFW5mzAdDE2g/K9B4e2tYK6/rA7Fq4cqiAw1+u EgO44+eFgv082xtBez5WNkGn18vtw0LW3ESmKh19u6kEGoi0WZwslCNaGFrS4M7OH+aOJeqK fx5dIv2CEbxc6xnHY7dwkcHikTA4QdbdFeUSuj4YhIZ+0QlDVtS1QEXyvZbZky7ur9rHkZvP ZqlUsLJ2nOqsmahMTIQ8Mgx9SLEShWqD4kOF4zNfPJsgEMB49KbS2o9jxbGB+JKupjNddf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N8mPT8rAVclppiHctRA0gssE 3GRKuEIuXx1SDnchsfHg18gCCrEtYZ9czwNjVoV1Tv2lpzTTk+6HEJaQpMnPeAKbOeehq3gY KcvmDL+bRCTjmXg8WrBZdUuj0BCDYqneaUgVnp+wQogA3mHGVs281v1XZmjlsVmM9Y8VPE61 4zSiZQBL5CinBTTI8ssYlV/aIKYi0dxRcj6vYnAfUImOsdZ5AQja5xIqw1rwWWUOYb99 Message-ID: <5f2530a0-aee2-39fe-eb5c-56cd4a68c9db@gmail.com> Date: Thu, 19 Apr 2018 12:33:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <0fc10b2498c6dbe20141831c722c32cc74330d3d.1522736996.git.sean.wang@mediatek.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/03/2018 09:15 AM, sean.wang@mediatek.com wrote: > 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; Before adding more and more fields to scp_domain_data which get checked in if's, I'd prefer to add a caps field used for bus_prot_mask, active_wakeup in a first patch and add the cap FORCE_WAIT in a second patch. Can you help to implement this Sean, or shall I give it a try? Regards, Matthias > }; > > 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, > }, > }; > >