All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Vinod Koul <vkoul@kernel.org>, Rob Herring <robh+dt@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 v4 2/5] staging: hikey9xx: phy-hi3670-usb3: adjust retry logic
Date: Tue, 19 Jan 2021 11:44:40 +0100	[thread overview]
Message-ID: <b653d7d6073de176598a5026c41b1a845f360c9e.1611052729.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1611052729.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


WARNING: multiple messages have this Message-ID (diff)
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Vinod Koul <vkoul@kernel.org>, Rob Herring <robh+dt@kernel.org>
Cc: devel@driverdev.osuosl.org,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Yu Chen <chenyu56@huawei.com>,
	linux-kernel@vger.kernel.org, Alex Dewar <alex.dewar90@gmail.com>
Subject: [PATCH v4 2/5] staging: hikey9xx: phy-hi3670-usb3: adjust retry logic
Date: Tue, 19 Jan 2021 11:44:40 +0100	[thread overview]
Message-ID: <b653d7d6073de176598a5026c41b1a845f360c9e.1611052729.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1611052729.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

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply	other threads:[~2021-01-19 10:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-19 10:44 [PATCH v4 0/5] Promote Hikey 970 USB phy out of staging Mauro Carvalho Chehab
2021-01-19 10:44 ` Mauro Carvalho Chehab
2021-01-19 10:44 ` [PATCH v4 1/5] staging: hikey9xx: phy-hi3670-usb3: use bitfield macros Mauro Carvalho Chehab
2021-01-19 10:44   ` Mauro Carvalho Chehab
2021-01-19 10:44 ` Mauro Carvalho Chehab [this message]
2021-01-19 10:44   ` [PATCH v4 2/5] staging: hikey9xx: phy-hi3670-usb3: adjust retry logic Mauro Carvalho Chehab
2021-01-19 10:44 ` [PATCH v4 3/5] staging: hikey9xx: phy-hi3670-usb3: hi3670_is_abbclk_seleted() returns bool Mauro Carvalho Chehab
2021-01-19 10:44   ` Mauro Carvalho Chehab
2021-01-19 10:44 ` [PATCH v4 4/5] staging: hikey9xx: phy-hi3670-usb3.yaml: add a blank line Mauro Carvalho Chehab
2021-01-19 10:44   ` Mauro Carvalho Chehab
2021-01-19 10:44 ` [PATCH v4 5/5] phy: phy-hi3670-usb3: move driver from staging into phy Mauro Carvalho Chehab
2021-01-19 10:44   ` Mauro Carvalho Chehab
2021-02-04  7:48   ` Vinod Koul
2021-02-04  7:48     ` Vinod Koul
2021-02-05 22:13   ` Rob Herring
2021-02-05 22:13     ` Rob Herring
2021-01-26 17:49 ` [PATCH v4 0/5] Promote Hikey 970 USB phy out of staging Greg Kroah-Hartman
2021-01-26 17:49   ` Greg Kroah-Hartman
2021-02-04  7:49   ` Vinod Koul
2021-02-04  7:49     ` Vinod Koul

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=b653d7d6073de176598a5026c41b1a845f360c9e.1611052729.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=robh+dt@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.