linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Vinod Koul <vkoul@kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Alex Dewar <alex.dewar90@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Yu Chen <chenyu56@huawei.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 2/4] staging: hikey9xx: phy-hi3670-usb3.c: adjust retry logic
Date: Fri, 15 Jan 2021 09:10:01 +0100	[thread overview]
Message-ID: <8a5d59d49acba14d0cc9f8e720d9892a21240d22.1610697726.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1610697726.git.mchehab+huawei@kernel.org>

Instead of running a loop up to 100k times, add a small
delay inside it, running it up to 10 times, waiting up
to 100-200 us.

It should be noticed that I don't have the datasheet for
this PHY. So, not sure if this time will cover all
situations.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 drivers/staging/hikey9xx/phy-hi3670-usb3.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/hikey9xx/phy-hi3670-usb3.c b/drivers/staging/hikey9xx/phy-hi3670-usb3.c
index 722cabaa9bd9..cffe6c58dfd7 100644
--- a/drivers/staging/hikey9xx/phy-hi3670-usb3.c
+++ b/drivers/staging/hikey9xx/phy-hi3670-usb3.c
@@ -185,7 +185,7 @@ static int hi3670_phy_cr_start(struct regmap *usb31misc, int direction)
 static int hi3670_phy_cr_wait_ack(struct regmap *usb31misc)
 {
 	u32 reg;
-	int retry = 100000;
+	int retry = 10;
 	int ret;
 
 	while (retry-- > 0) {
@@ -198,6 +198,8 @@ static int hi3670_phy_cr_wait_ack(struct regmap *usb31misc)
 		ret = hi3670_phy_cr_clk(usb31misc);
 		if (ret)
 			return ret;
+
+		usleep_range(10, 20);
 	}
 
 	return -ETIMEDOUT;
-- 
2.29.2


  parent reply	other threads:[~2021-01-15  8:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15  8:09 [PATCH v3 0/4] Promote Hikey 970 USB phy out of staging Mauro Carvalho Chehab
2021-01-15  8:10 ` [PATCH v3 1/4] staging: hikey9xx: phy-hi3670-usb3.c: use bitfield macros Mauro Carvalho Chehab
2021-01-15  8:10 ` Mauro Carvalho Chehab [this message]
2021-01-15  8:10 ` [PATCH v3 3/4] staging: hikey9xx: phy-hi3670-usb3.c: hi3670_is_abbclk_seleted() returns bool Mauro Carvalho Chehab
2021-01-15  8:10 ` [PATCH v3 4/4] phy: phy-hi3670-usb3: move driver from staging into phy Mauro Carvalho Chehab
2021-01-15 11:03   ` Joe Perches
2021-01-15 15:39   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8a5d59d49acba14d0cc9f8e720d9892a21240d22.1610697726.git.mchehab+huawei@kernel.org \
    --to=mchehab+huawei@kernel.org \
    --cc=alex.dewar90@gmail.com \
    --cc=chenyu56@huawei.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).