Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp433065ybv; Wed, 19 Feb 2020 02:34:11 -0800 (PST) X-Google-Smtp-Source: APXvYqzN9ZlWvSiOh1akYnZIK9Io2T1AmB6nm//Ze8atSiEk505RM9nuwdCKwQdHiR5sGGv6zDUJ X-Received: by 2002:a9d:7482:: with SMTP id t2mr15844796otk.367.1582108451459; Wed, 19 Feb 2020 02:34:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582108451; cv=none; d=google.com; s=arc-20160816; b=JL3TcLOueJPNp5v/2NMZJXBSQLTsSdLjnUTBi++ACuA1WMAw6ITIpWsJtz2uXikMXW OY1FdDlKYzZv2QFriXgskcBVHoKXVhYXvzuN9/blZiNsOCJ1ECXFYKZbWZT5s+RDnlm/ CZ5ZGVa/iJeOKSlDS+k8cl7Kcip4TNeEx+tRD6u+YxrPDrHUpyGZ3i/sPW2Kb2o0gUSi ZcjocfYbUEiLdOHlItReUdk2NfDZtClumTQO/2LlNBZX0YWwYPa+qVn+A4S4p153sXId 0BupPjvEZce0atzVGWH9gv2pPJ8T5CjqtWEAfZpO613Xono/T55fXgZRPmkMgKg87hk5 Zogw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=rw6UHf0KTPLkHoH94qTywzRb5mw/2w3OWlPPBjvpPNw=; b=NaTFjPdR7kIyXuXBAgiPNuEUvtWmF2l5lqgw5lF9kKORwLxGiMc0e2MMFbJIjxPUQ0 AN5fXBEQjr42KA/CZKQIBlqcjmLENR69Wg75m1Mn64MOZIGzPL4SnxD6JOdk0QyKVMKv Ajrw8nhrgbPYmQQFnuebGSxY+8HbFtBsMfKPI7ujWd5wpmYI2nauntjjKLkG2m8lDBj4 6JCIkcmKUC3z30Le923pIffV29PY7YGHtLD/q8JBbvawPaEyZw1jTshLIIY1L65S+Z6w MAvr7mu4hatbZexjAM0nIPsuEpUblJ/dnRNwD490tU3ocgTFFM00KacnK8NLC10g/wj2 5+qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=Lita4j8V; 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 l20si826119otr.202.2020.02.19.02.33.58; Wed, 19 Feb 2020 02:34:11 -0800 (PST) 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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=Lita4j8V; 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 S1726617AbgBSKdq (ORCPT + 99 others); Wed, 19 Feb 2020 05:33:46 -0500 Received: from mail26.static.mailgun.info ([104.130.122.26]:54681 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726514AbgBSKdq (ORCPT ); Wed, 19 Feb 2020 05:33:46 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1582108425; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=rw6UHf0KTPLkHoH94qTywzRb5mw/2w3OWlPPBjvpPNw=; b=Lita4j8Vo+12yohtKUda38CRGo4YiaVYzSNZoQr1muQKs2rqct7K7PEzHmgEML0VHW1/kePF 1X5eiT+YKfWfwmuXH5KeLvhQe7RH+h9DXRjIkERHYvobZnmU+60JENE8t/eetP7Ud1XWj474 rWkHxQSQ6y2AXIc9djTI1UDdyQk= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e4d0eff.7f3c98b57f80-smtp-out-n01; Wed, 19 Feb 2020 10:33:35 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 40509C4479C; Wed, 19 Feb 2020 10:33:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: cang) by smtp.codeaurora.org (Postfix) with ESMTPSA id 75BA6C43383; Wed, 19 Feb 2020 10:33:34 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 19 Feb 2020 18:33:34 +0800 From: Can Guo To: Stanley Chu Cc: linux-scsi@vger.kernel.org, martin.petersen@oracle.com, Asutosh Das , hongwus@codeaurora.org, avri.altman@wdc.com, alim.akhtar@samsung.com, jejb@linux.ibm.com, beanhuo@micron.com, asutoshd@codeaurora.org, matthias.bgg@gmail.com, bvanassche@acm.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kuohong.wang@mediatek.com, peter.wang@mediatek.com, chun-hung.wu@mediatek.com, andy.teng@mediatek.com Subject: Re: [PATCH v1 1/2] scsi: ufs: add required delay after gating reference clock In-Reply-To: <1582103495.26304.42.camel@mtksdccf07> References: <20200217093559.16830-1-stanley.chu@mediatek.com> <20200217093559.16830-2-stanley.chu@mediatek.com> <1581945168.26304.4.camel@mtksdccf07> <1581946449.26304.15.camel@mtksdccf07> <56c1fc80919491d058d904fcc7301835@codeaurora.org> <1582103495.26304.42.camel@mtksdccf07> Message-ID: X-Sender: cang@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stanley, On 2020-02-19 17:11, Stanley Chu wrote: > Hi Can, > > On Wed, 2020-02-19 at 10:35 +0800, Can Guo wrote: > >> Since we all need this delay here, how about put the delay in the >> entrence of ufshcd_setup_clocks(), before vops_setup_clocks()? >> If so, we can remove all the delays we added in our vops since the >> delay anyways delays everything inside ufshcd_setup_clocks(). >> > > Always putting the delay in the entrance of ufshcd_setup_clocks() may > add unwanted delay for vendors, just like your current implementation, > or some other vendors who do not want to disable the reference clock. > > I think current patch is more reasonable because the delay is applied > to > clock only named as "ref_clk" specifically. > > If you needs to keep "ref_clk" in DT, would you consider to remove the > delay in your ufs_qcom_dev_ref_clk_ctrl() and let the delay happens via > common ufshcd_setup_clocks() only? However you may still need delay if > call path comes from ufs_qcom_pwr_change_notify(). > > What do you think? > I agree current change is more reasonable from what it looks, but the fact is that I canont remove the delay in ufs_qcom_dev_ref_clk_ctrl() even with this change. On our platforms, ref_clk in DT serves multipule purposes, the ref_clk provided to UFS device is actually controlled in ufs_qcom_dev_ref_clk_ctrl(), which comes before where this change kicks start, so if I remove the delay in ufs_qcom_dev_ref_clk_ctrl(), this change cannot provide us the correct delay before gate the ref_clk provided to UFS device. > Always putting the delay in the entrance of ufshcd_setup_clocks() may > add unwanted delay for vendors, just like your current implementation, > or some other vendors who do not want to disable the reference clock. I meant if we put the delay in the entrance, I will be able to remove the delay in ufs_qcom_dev_ref_clk_ctrl(). Meanwhile, we can add proper checks before the delay to make sure it is initiated only if ref_clk needs to be disabled, i.e: if(!on && !skip_ref_clk && hba->dev_info.clk_gating_wait_us) usleep_range(); Does this look better to you? Anyways, we will see regressions with this change on our platforms, can we have more discussions before get it merged? It should be OK if you go with patch #2 alone first, right? Thanks. Best regards, Can Guo. >> Meanwhile, if you want to modify the delay >> (hba->dev_info.clk_gating_wait_us) for some reasons, say for specific >> UFS devices, you still can do it in vops_apply_dev_quirks(). >> >> What do you say? >> >> Thanks, >> Can Guo. > > Thanks, > Stanley Chu