Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4765545ybv; Mon, 17 Feb 2020 05:34:24 -0800 (PST) X-Google-Smtp-Source: APXvYqwokRECJtP8KBxJGGoGjolEfNsw3rtKBYWZ7vjlNr9KLDX7TbygQ3UlMEoo3t3iaCLJLOun X-Received: by 2002:aca:f517:: with SMTP id t23mr9582055oih.160.1581946464417; Mon, 17 Feb 2020 05:34:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581946464; cv=none; d=google.com; s=arc-20160816; b=CrjlpvYPdTy9rlEXVD1oMGLeane3e+idIz7zREJsrsCJDePMdTVJ6vYNt5c9XVH5Wl 6WtkI401C4xN2YUQYd3j5q8v7uvulPW6HpCWbmuS+wwgPI0WJerr1XlUzEXQxxBWSeyC JbBRLR2v8NNOo+nPQ4fkEFifMMHdFkOPIZuU6HQO0LuxUKVK6LZjU1TfIbxVfelpa650 sm1G70jRsX6ubeTbtZw5HBQ0glt8L/35c5esO+KLWmMCm7RrhjbLxAyTNK6BvcWGEQX3 VM8SVWxfKwchRY5zBA+4a3I4nW28e+4xo3Rsb/kJLRA3YDOVzfIwPD+8CT0pHCDt7TjO jUeQ== 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=zYaEbtFkXfhmP+oRysQ8QVN5kHY6AaSc1zt8CAGAK7k=; b=0jSz7VWVcjO0XqVwVWOMLru28CDNwaMwGDpIPzG1R8iESwk321t8sjDrcNAJT15hQd GB/GGwQanr7j66ttdwjtvR+FXHspbuCXyhVwIqppeHTg0dxuNjPd1gtRqv8vPi7IKz4t 2GhnF2SooJmW4ZYA9LdMkhPE0/meAHc25wL9nOm64Sq5GpqbbihnjC94BSpaursQYK39 Sq+QYNJAHQkGKawT4cQ/eumaot/MjRj1aGu7ThESvf7VZiWTC1gou2TC40PsY/rMmb4k G+D8qErkYJnpU0p1fqQ8HNpDV+zbPNaxaY0CdIPj+5l0QCICY+RywCrgjfkwaAXfJtyP iPoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="iTInWS/E"; 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 n14si194755otk.179.2020.02.17.05.34.11; Mon, 17 Feb 2020 05:34:24 -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="iTInWS/E"; 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 S1728054AbgBQNWz (ORCPT + 99 others); Mon, 17 Feb 2020 08:22:55 -0500 Received: from mail27.static.mailgun.info ([104.130.122.27]:39904 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727135AbgBQNWz (ORCPT ); Mon, 17 Feb 2020 08:22:55 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1581945774; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=zYaEbtFkXfhmP+oRysQ8QVN5kHY6AaSc1zt8CAGAK7k=; b=iTInWS/EmjGYC3QHz06mZl6YiMRgKZlPeC0RkNuFy10qLfpgi7nP7NqImsK+uI833aPppkl5 geMQVBpS4+lCEDa7TudN/xqQ/yssm/LdLYZy8/lH4SQ/8xGfilARykUfWgnxEu/XyljFA5+s HKLBJI3S6KdyDQQhLrlTp8U/jCU= X-Mailgun-Sending-Ip: 104.130.122.27 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 5e4a93aa.7fafa2a52dc0-smtp-out-n01; Mon, 17 Feb 2020 13:22:50 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 26136C447A3; Mon, 17 Feb 2020 13:22:50 +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 512E8C4479D; Mon, 17 Feb 2020 13:22:49 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 17 Feb 2020 21:22:49 +0800 From: Can Guo To: Stanley Chu Cc: linux-scsi@vger.kernel.org, martin.petersen@oracle.com, 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: <1581945168.26304.4.camel@mtksdccf07> References: <20200217093559.16830-1-stanley.chu@mediatek.com> <20200217093559.16830-2-stanley.chu@mediatek.com> <1581945168.26304.4.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 On 2020-02-17 21:12, Stanley Chu wrote: > Hi Can, > > >> > } else if (!on && clki->enabled) { >> > clk_disable_unprepare(clki->clk); >> > + wait_us = hba->dev_info.clk_gating_wait_us; >> > + if (ref_clk && wait_us) >> > + usleep_range(wait_us, wait_us + 10); >> >> Hi St,anley, >> >> If wait_us is 1us, it would be inappropriate to use usleep_range() >> here. >> You have checks of the delay in patch #2, but why it is not needed >> here? >> >> Thanks, >> Can Guo. > > You are right. I could make that delay checking as common function so > it > can be used here as well to cover all possible values. > > Thanks for suggestion. > Stanley Hi Stanley, One more thing, as in patch #2, you have already added delays in your ufshcd_vops_setup_clocks(OFF, PRE_CHANGE) path, plus this delay here, don't you delay for 2*bRefClkGatingWaitTime in ufshcd_setup_clocks()? As the delay added in your vops also delays the actions of turning off all the other clocks in ufshcd_setup_clocks(), you don't need the delay here again, do you agree? Thanks, Can Guo.