From patchwork Mon Feb 27 15:13:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Grzeschik X-Patchwork-Id: 13153768 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2FF81C64ED8 for ; Mon, 27 Feb 2023 15:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7XL4l2g2v0BMmljQd4FAEV5VqFbWH0fczZ/lss4ddPo=; b=UKkwn0lv4Ypo8S Z4m7Gm+W+ZajDC1b64OpKhawHyqkekKCKiVb6nv8nGBk8EaVSky8T5G/qKqqC0vy94Da4h3rtKCFR mPt+Jbz7tHINNRm5DcTwOslk3Wl2KGYOStYKHjNjWVxkJJ40kjXTthL8BXtc9gJj5Nir18rZhONZ+ 5pd6vGURPPDdPdyiy1hcf7ZO7uIRNvjf5ve1SwN22R6q2lIUP+7ZRNEXD4nhl5rqSqfsHwwFY9vs1 bI+1Q1S2nw+6YfX0cxcBNEVb4vmSEwyr/5CCTkZU+DizAX7YOdRKMr/k4tk1me1yjsC/oGksCjeKb ms8oor946ys+0P7cfx+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWfCr-00AAUN-24; Mon, 27 Feb 2023 15:14:25 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWfCn-00AATA-Kd for linux-arm-kernel@lists.infradead.org; Mon, 27 Feb 2023 15:14:23 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pWfCh-00082t-00; Mon, 27 Feb 2023 16:14:15 +0100 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pWfCe-000exp-R1; Mon, 27 Feb 2023 16:14:12 +0100 Received: from mgr by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pWfCe-007x7a-0a; Mon, 27 Feb 2023 16:14:12 +0100 From: Michael Grzeschik To: linux-arm-kernel@lists.infradead.org Cc: fabrice.gasnier@foss.st.com, linux-phy@lists.infradead.org, vkoul@kernel.org, kishon@kernel.org, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, error27@gmail.com, kernel@pengutronix.de, linux-stm32@st-md-mailman.stormreply.com, amelie.delaunay@foss.st.com Subject: [PATCH v2] phy: stm32-usphyc: add 200 to 300 us delay to fix timeout on some machines Date: Mon, 27 Feb 2023 16:13:19 +0100 Message-Id: <20230227151318.1894938-1-m.grzeschik@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <1869feff-06b1-17f1-4628-b433c858ad79@foss.st.com> References: <1869feff-06b1-17f1-4628-b433c858ad79@foss.st.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mgr@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230227_071421_680683_AA53BE50 X-CRM114-Status: GOOD ( 12.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org An minimum udelay of 200 us seems to be necessary on some machines. After the setup of the pll, which needs about 100 us to be locked there seem to be additional 100 us to get the phy really functional. Without this delay the usb runs not functional. With this additional short udelay this issue was not reported again. Signed-off-by: Michael Grzeschik Reviewed-by: Fabrice Gasnier --- v1 -> v2: - changed the mdelay to udelay_range(200, 300), like suggested by fabrice - moved the delay to pll enable so it will only be triggered once drivers/phy/st/phy-stm32-usbphyc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-usbphyc.c index 5bb9647b078f12..dd469f57fba7eb 100644 --- a/drivers/phy/st/phy-stm32-usbphyc.c +++ b/drivers/phy/st/phy-stm32-usbphyc.c @@ -317,6 +317,9 @@ static int stm32_usbphyc_pll_enable(struct stm32_usbphyc *usbphyc) stm32_usbphyc_set_bits(pll_reg, PLLEN); + /* Wait for maximum lock time */ + usleep_range(200, 300); + return 0; reg_disable: