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=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 26687C4321A for ; Tue, 19 Jan 2021 10:57:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA2C1208D5 for ; Tue, 19 Jan 2021 10:57:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404720AbhASKy3 (ORCPT ); Tue, 19 Jan 2021 05:54:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:45116 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404492AbhASKp1 (ORCPT ); Tue, 19 Jan 2021 05:45:27 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5FF612312E; Tue, 19 Jan 2021 10:44:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611053086; bh=73sR10wECqQUqw6UkBdoCbc/733OkO6ECg5/oQb+LQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NDIcbPAb9o6Mk2q/aSQ4tBHvN0nXxtIZASJtDRoiQDeKXEuBcNO857UKzqqc1t4vO EEWHS8bk5vr3uzaM9pCCUZNagjSgDsSwatD3ROTUmPQD0LAqqAf+XFOGYuPfx7x9Wz mF0aZLGi/tkPu+7F17oiw65ESM+HbL6MX+BNPRM3CzE1NwUknbGsPKx7Jk/agsnEgw osOM1zd6nJ8sygeyhPB1cGtwRNI4iT0BdgpEqHZdeH9+q+4Pv39bWfzPJplAGRNGkI lhBhbmZJVDuewj5FC18y320PflUXVEHOcAhw4Cl0P+sEhe/8zjsWgAHo+LcjF4MMfQ 7Wqahle3pu6bQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1l1oVA-000u2H-5k; Tue, 19 Jan 2021 11:44:44 +0100 From: Mauro Carvalho Chehab To: Vinod Koul , Rob Herring Cc: Mauro Carvalho Chehab , Alex Dewar , Greg Kroah-Hartman , Yu Chen , 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 Message-Id: X-Mailer: git-send-email 2.29.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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 --- 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 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=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 3F790C433E0 for ; Tue, 19 Jan 2021 10:44:52 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C5C9623139 for ; Tue, 19 Jan 2021 10:44:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5C9623139 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B911E86DF1; Tue, 19 Jan 2021 10:44:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id C2Zo0WQLlnv1; Tue, 19 Jan 2021 10:44:49 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id A926186D73; Tue, 19 Jan 2021 10:44:49 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 9059E1BF27F for ; Tue, 19 Jan 2021 10:44:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8A97F834E6 for ; Tue, 19 Jan 2021 10:44:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FcE+KqTVZT9R for ; Tue, 19 Jan 2021 10:44:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by whitealder.osuosl.org (Postfix) with ESMTPS id 1761186443 for ; Tue, 19 Jan 2021 10:44:47 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 5FF612312E; Tue, 19 Jan 2021 10:44:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611053086; bh=73sR10wECqQUqw6UkBdoCbc/733OkO6ECg5/oQb+LQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NDIcbPAb9o6Mk2q/aSQ4tBHvN0nXxtIZASJtDRoiQDeKXEuBcNO857UKzqqc1t4vO EEWHS8bk5vr3uzaM9pCCUZNagjSgDsSwatD3ROTUmPQD0LAqqAf+XFOGYuPfx7x9Wz mF0aZLGi/tkPu+7F17oiw65ESM+HbL6MX+BNPRM3CzE1NwUknbGsPKx7Jk/agsnEgw osOM1zd6nJ8sygeyhPB1cGtwRNI4iT0BdgpEqHZdeH9+q+4Pv39bWfzPJplAGRNGkI lhBhbmZJVDuewj5FC18y320PflUXVEHOcAhw4Cl0P+sEhe/8zjsWgAHo+LcjF4MMfQ 7Wqahle3pu6bQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1l1oVA-000u2H-5k; Tue, 19 Jan 2021 11:44:44 +0100 From: Mauro Carvalho Chehab To: Vinod Koul , Rob Herring Subject: [PATCH v4 2/5] staging: hikey9xx: phy-hi3670-usb3: adjust retry logic Date: Tue, 19 Jan 2021 11:44:40 +0100 Message-Id: X-Mailer: git-send-email 2.29.2 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, Mauro Carvalho Chehab , Greg Kroah-Hartman , Yu Chen , linux-kernel@vger.kernel.org, Alex Dewar Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" 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 --- 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