From patchwork Tue Jan 24 20:45:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Grzeschik X-Patchwork-Id: 13114796 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 7BDE0C54E94 for ; Tue, 24 Jan 2023 20:46:02 +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: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:In-Reply-To:References: List-Owner; bh=SGjl+bfy/YCmJvtRNV2cV9Lj4pq+sCxN613gx7J9SgQ=; b=qWQxbOoYq2xMoR fD3urvpHJM51wQwg+5Z8r3+BM2LHe5ZlD2OynCfRDAKYGRF12xZ2IVNNEWZaLkMnqYSKOucUAVgI0 LpFr1a96z0X+dfy4D2OrMdBB4WOMQT4qvrBqlJIh6Xktc4nb2mwATIcXveeQBZ9ZiKqWcdau6bM84 Ep7+hJYdCpvKpPXE4xj2fAlL8w1cBKXPXY6F166Lz4hQa8PkKKgfOKtM3O5xTsEx833WeS1NH/kJ+ NTdb3WqGlL9Ph6uQS+eZyPGH6Ho+A/faU/G2K3t4yDT5S8r0sLWB/9zsE7KbpQ///xm3p0HR/0/D4 Mniz2z38e7xH0Mt8zvWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKQAI-005Eyh-Gp; Tue, 24 Jan 2023 20:45:10 +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 1pKQAE-005Ewo-NR for linux-arm-kernel@lists.infradead.org; Tue, 24 Jan 2023 20:45:08 +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 1pKQAD-0003eQ-9t; Tue, 24 Jan 2023 21:45:05 +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 1pKQAB-000BhY-Fl; Tue, 24 Jan 2023 21:45:02 +0100 Received: from mgr by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pKQA9-00EhDd-TW; Tue, 24 Jan 2023 21:45:01 +0100 From: Michael Grzeschik To: linux-arm-kernel@lists.infradead.org Cc: 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 Subject: [PATCH] phy: stm32-usphyc: add mdelay(1) to fix timeout on some machines Date: Tue, 24 Jan 2023 21:45:00 +0100 Message-Id: <20230124204500.3502665-1-m.grzeschik@pengutronix.de> X-Mailer: git-send-email 2.30.2 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-20230124_124506_804586_32DFA102 X-CRM114-Status: GOOD ( 13.10 ) 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 mdelay of 1 seems to be necessary on some machines, since the monsel status does not seem to be accurate. On rare occasions just working with the phy after this pll check lead to no functional usb. With this short mdelay this issue was not reported again. Signed-off-by: Michael Grzeschik --- drivers/phy/st/phy-stm32-usbphyc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-usbphyc.c index 5bb9647b078f12..c452a0caceb9fa 100644 --- a/drivers/phy/st/phy-stm32-usbphyc.c +++ b/drivers/phy/st/phy-stm32-usbphyc.c @@ -353,6 +353,15 @@ static int stm32_usbphyc_phy_init(struct phy *phy) goto pll_disable; } + /* This mdelay seems to be necessary on some machines, since the + * monsel status does not seem to be accurate. On rare occasions + * just working with the phy after this pll check the usb + * peripheral (e.g. on the dwc2) run into timeout issues and + * leading to no functional usb. With this short mdelay this + * issue was not reported again. + */ + mdelay(1); + usbphyc_phy->active = true; return 0;