From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C703AC31E44 for ; Fri, 14 Jun 2019 09:50:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9CB1421773 for ; Fri, 14 Jun 2019 09:50:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="m/leHmXo"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="m/leHmXo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727256AbfFNJuN (ORCPT ); Fri, 14 Jun 2019 05:50:13 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:35496 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726900AbfFNJuM (ORCPT ); Fri, 14 Jun 2019 05:50:12 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B994960795; Fri, 14 Jun 2019 09:50:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1560505811; bh=MyOIZxRkGgLbqjLqfPrshqHSuC7b4kOHm7rZYQQkQKY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=m/leHmXoxScKBERlX6fPGhe2ZFYsH3hQ9qj0K/po0300bKDBye7axc6BzTkakWdSk ZLj6eD0SY4Xohy6ebZ1VFJKJZs48Y7uQ1/TLgXOyQccyoOq7FzjBaEn6U6bDYmQK3t Ko9RY92ncSk8R8v/n1s08fWMqkzmDnRWqNvWgy0g= Received: from [10.79.128.120] (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek.gautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id F09EA60265; Fri, 14 Jun 2019 09:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1560505811; bh=MyOIZxRkGgLbqjLqfPrshqHSuC7b4kOHm7rZYQQkQKY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=m/leHmXoxScKBERlX6fPGhe2ZFYsH3hQ9qj0K/po0300bKDBye7axc6BzTkakWdSk ZLj6eD0SY4Xohy6ebZ1VFJKJZs48Y7uQ1/TLgXOyQccyoOq7FzjBaEn6U6bDYmQK3t Ko9RY92ncSk8R8v/n1s08fWMqkzmDnRWqNvWgy0g= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org F09EA60265 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vivek.gautam@codeaurora.org Subject: Re: [PATCH v1] phy: qcom-qmp: Raise qcom_qmp_phy_enable() polling delay To: Marc Gonzalez , Kishon Vijay Abraham , Bjorn Andersson Cc: MSM , LKML References: <92d97c68-d226-6290-37d6-f46f42ea604b@free.fr> From: Vivek Gautam Message-ID: Date: Fri, 14 Jun 2019 15:20:07 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <92d97c68-d226-6290-37d6-f46f42ea604b@free.fr> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc, On 6/13/2019 5:02 PM, Marc Gonzalez wrote: > readl_poll_timeout() calls usleep_range() to sleep between reads. > usleep_range() doesn't work efficiently for tiny values. > > Raise the polling delay in qcom_qmp_phy_enable() to bring it in line > with the delay in qcom_qmp_phy_com_init(). > > Signed-off-by: Marc Gonzalez > --- > Vivek, do you remember why you didn't use the same delay value in > qcom_qmp_phy_enable) and qcom_qmp_phy_com_init() ? phy_qcom_init() thingy came from the PCIE phy driver from downstream msm-3.18 PCIE did something as below: ----- do {         if (pcie_phy_is_ready(dev))                 break;         retries++;         usleep_range(REFCLK_STABILIZATION_DELAY_US_MIN,                                  REFCLK_STABILIZATION_DELAY_US_MAX); } while (retries < PHY_READY_TIMEOUT_COUNT); REFCLK_STABILIZATION_DELAY_US_MIN/MAX ==> 1000/1005 PHY_READY_TIMEOUT_COUNT ==> 10 ----- phy_enable() from the usb phy driver from downstream.  /* Wait for PHY initialization to be done */  do {          if (readl_relaxed(phy->base +                  phy->phy_reg[USB3_PHY_PCS_STATUS]) & PHYSTATUS)                  usleep_range(1, 2); else break;  } while (--init_timeout_usec); init_timeout_usec ==> 1000 ----- USB never had a COM_PHY status bit. So clearly the resolutions were different. Does this change solves an issue at hand? > --- > drivers/phy/qualcomm/phy-qcom-qmp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c > index bb522b915fa9..34ff6434da8f 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c > @@ -1548,7 +1548,7 @@ static int qcom_qmp_phy_enable(struct phy *phy) > status = pcs + cfg->regs[QPHY_PCS_READY_STATUS]; > mask = cfg->mask_pcs_ready; > > - ret = readl_poll_timeout(status, val, val & mask, 1, > + ret = readl_poll_timeout(status, val, val & mask, 10, > PHY_INIT_COMPLETE_TIMEOUT); > if (ret) { > dev_err(qmp->dev, "phy initialization timed-out\n");