Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp362571ybv; Tue, 4 Feb 2020 23:22:48 -0800 (PST) X-Google-Smtp-Source: APXvYqzRVdv27QObpWcMR+KqHga/DxvBr88tmsmPRGDOYjiZGo1ui2P9P1s5ZGxN+QjtNDMzKd89 X-Received: by 2002:a9d:64d8:: with SMTP id n24mr23319088otl.71.1580887367803; Tue, 04 Feb 2020 23:22:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580887367; cv=none; d=google.com; s=arc-20160816; b=L0Mc9ef5Apc7G62A8fx7kAQqrcHFNxalIEwuSoKXjGN16HSBjxpf+IYs0/+BOiAGds sfsnRZ8IhrbwGylaXrIYUNLB+ryJzYt4u8usd5+JRa2XxkD1gUTKccm/oO1QQ2trXZ05 w3U24OzKTwUmli2Fz4Q3bwqOGde7OFyUalCgDlJGbJkW7aV979yV9icwu668cgwEmR3/ DA4YKnnCCcil427BKdRC3AB5Xgo6kZtGxkh9Wux81a7orJSJQp2R5KU05dTQIR3yfuAx oL3d2FbFyXTnihZaOWIezfmYbWLqo5RYTX03ICzLI44wtaQcZ8etFlC/wv8SFQb4naVf iAew== 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=7DffYjVGVCcrqC/qHz0LpV46gTFSwzkl9c+dLx2G4uU=; b=csffkZeInVRH0V111PVLnzs0xdvJFWRnzOVXV+/3CCk/6sg5jlt/k93oidraKLUczG DNYacHd0PVW90vx7RGQgsM9Q93Idu56ojVnHEdCaqPJtV/AjUAmtmi7HcUX24/IHbXCH U4UPTYWS03rs/iRYXc2xUzFl4vra9rbGtoda9eK37ZoeVJ7lHhyaj5uS1rZwO8+CdtLG HoK5071hECErRx1AaawPrjIYdFVTfWODa27LGXI/DghVlQa78ceZrXjEUhhNLviK5Mxm 79JwdAkOigNpAriq/KhBQ6Tr6w++CFZdu4OQqKV4M3cvhBiddRECENHKS2axlKktb4AN T+1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=sF43794a; 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 e17si7058893oti.136.2020.02.04.23.22.31; Tue, 04 Feb 2020 23:22:47 -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=sF43794a; 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 S1726810AbgBEHUR (ORCPT + 99 others); Wed, 5 Feb 2020 02:20:17 -0500 Received: from mail25.static.mailgun.info ([104.130.122.25]:41047 "EHLO mail25.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726236AbgBEHUQ (ORCPT ); Wed, 5 Feb 2020 02:20:16 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1580887216; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=7DffYjVGVCcrqC/qHz0LpV46gTFSwzkl9c+dLx2G4uU=; b=sF43794a7Qf81ENo1IR5kiLTpGl6XxG4FCMlkIOyoB4aZpYeDA6W4P6ph6zCn8y/qpeTG9WQ yTMp9FWxx7nHsIdy2FlXveYTFkMS/WmOB2AmblcyLszfuLaharAX5xzTfr3tAgLfcUXyalu/ P5tRQ8zugrnrMc9BA+Id+eFmx30= X-Mailgun-Sending-Ip: 104.130.122.25 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 5e3a6cab.7f4ebfd908f0-smtp-out-n02; Wed, 05 Feb 2020 07:20:11 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 94D74C447A1; Wed, 5 Feb 2020 07:20:11 +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,URIBL_BLOCKED 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: hongwus) by smtp.codeaurora.org (Postfix) with ESMTPSA id C75AFC433CB; Wed, 5 Feb 2020 07:20:10 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 05 Feb 2020 15:20:10 +0800 From: hongwus@codeaurora.org To: Can Guo Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, Andy Gross , Bjorn Andersson , Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 7/8] scsi: ufs-qcom: Delay specific time before gate ref clk In-Reply-To: <1580721472-10784-8-git-send-email-cang@codeaurora.org> References: <1580721472-10784-1-git-send-email-cang@codeaurora.org> <1580721472-10784-8-git-send-email-cang@codeaurora.org> Message-ID: <537a8695bcadd7d5686a6b6e3c04f2af@codeaurora.org> X-Sender: hongwus@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-03 17:17, Can Guo wrote: > After enter hibern8, as UFS JEDEC ver 3.0 requires, a specific gating > wait > time is required before disable the device reference clock. If it is > not > specified, use the old delay. > > Signed-off-by: Can Guo > Reviewed-by: Asutosh Das > --- > drivers/scsi/ufs/ufs-qcom.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c > index 85d7c17..3b5b2d9 100644 > --- a/drivers/scsi/ufs/ufs-qcom.c > +++ b/drivers/scsi/ufs/ufs-qcom.c > @@ -833,6 +833,8 @@ static int ufs_qcom_bus_register(struct > ufs_qcom_host *host) > > static void ufs_qcom_dev_ref_clk_ctrl(struct ufs_qcom_host *host, bool > enable) > { > + unsigned long gating_wait; > + > if (host->dev_ref_clk_ctrl_mmio && > (enable ^ host->is_dev_ref_clk_enabled)) { > u32 temp = readl_relaxed(host->dev_ref_clk_ctrl_mmio); > @@ -845,11 +847,16 @@ static void ufs_qcom_dev_ref_clk_ctrl(struct > ufs_qcom_host *host, bool enable) > /* > * If we are here to disable this clock it might be immediately > * after entering into hibern8 in which case we need to make > - * sure that device ref_clk is active at least 1us after the > + * sure that device ref_clk is active for specific time after > * hibern8 enter. > */ > - if (!enable) > - udelay(1); > + if (!enable) { > + gating_wait = host->hba->dev_info.clk_gating_wait_us; > + if (!gating_wait) > + udelay(1); > + else > + usleep_range(gating_wait, gating_wait + 10); > + } > > writel_relaxed(temp, host->dev_ref_clk_ctrl_mmio); Reviewed-by: Hongwu Su