From patchwork Tue Jan 9 19:28:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 10153219 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EE9F960223 for ; Tue, 9 Jan 2018 19:32:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E330C20072 for ; Tue, 9 Jan 2018 19:32:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7D6D200E7; Tue, 9 Jan 2018 19:32:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7595020072 for ; Tue, 9 Jan 2018 19:31:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject: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=iWzp0W8T6J7kHJtT//QF5emoPBHyseA9o1b8WO5xnKY=; b=pp2 LBDwi3xtnVEN/ahadDAuK96yRZDwMCj8Gin8Lmnk+fhjG7vch5qW8zBshgTrGtGZ5K+yh741ENaZ9 i7BJhCg0KXgoe9/tsqklinmzeFYwZXTb8oNw4idTj0y5B2E80iJ6XVhKNDe9n5OrqzLd67svMLX2c 1FzZm4w2J2+XH/unoCVjsV6IvP81kQIzjR4B1o90FX51fNZIWJNiL4LTHEj27r2Lngil9qEv6Aii4 IwR5or72vwLhUKuVHkJEZcYQ3sA1zLrGEoJ3RTV9Pn4upur9G/lTpsIhDvHtfiEn4bCITYntJ8li/ e+SlSDlkmDO67fLullKlC82Yhcpqj/A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eYzck-0003Hj-5u; Tue, 09 Jan 2018 19:31:50 +0000 Received: from mout.kundenserver.de ([212.227.17.13]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eYzce-00032p-AG for linux-arm-kernel@lists.infradead.org; Tue, 09 Jan 2018 19:31:48 +0000 Received: from localhost.localdomain ([95.90.209.92]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MTgfY-1eQIT83mVs-00QVLI; Tue, 09 Jan 2018 20:31:19 +0100 From: Stefan Wahren To: Arnd Bergmann , Eric Anholt , John Youn , Kishon Vijay Abraham I , Greg Kroah-Hartman Subject: [PATCH] usb: dwc2: Fix endless deferral probe Date: Tue, 9 Jan 2018 20:28:54 +0100 Message-Id: <1515526134-2148-1-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 X-Provags-ID: V03:K0:0vpOGiMAzx7dPhETx2GHneEIWfXyjzEu48aXb5We477ny0Smlub dLsSi169duUtiEBf+TV2AaKtNqe7XuOZyB+djURedfI9NjnOg9LSdi30tpT0IwbHbdnxWD5 WCe161/ofxiCTfGGUbB9FnbWjW4wz/6k7C5Nh2fmRt+4x6L0+0YAE4QiVnqAeXhPjhZUP3A c57BUh3B9bceY99mDUh3Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:2ZShqdBfbQg=:Zw7WJRG6WznH8wFXvErKqu 0++NI08CEVfFFZyal1zxIg9CQxBihrhz48mo0QLHGBEa1HunnZK9QvUVwEOKIQq8agbLWykRF hgtNnEfjfYypsN/0YBlUsn9ksPCHctyIVfsqgZ0ScdU2P6SFpW4BBPRuj5bG0wXvsl9tDyC5w 05zS5vK5jY1V5rAux1QBFBR8Mxz3IPs53xx0wCIlNkBfnXBkr9Om2pTr3RLmeuiQnII24NJwu cbAoGuqYZnd8MxXloeiuiciweNh/oBDzazpHjei/0Lef9mC1yW/bb6eN0CXZk6bX+vsdCTAAt g1/UV0AgyN2e5Nd+ln38kx7EhACSJW8S2PAa8cxq11g4tFp178kw1xS9V6FybTtEiFS4aPLpv qBwu+Pf06TnnzJ4Uyzog2ucFlm8+UlmuZQNecm1Y7vd1wpcB5ZAqhx8kUWPOZRZ2j6TqKUF8j goflwA40kEsce+ROW50WCOoX3ct4s9qsB034FdhdxAgH9oxBxUC8cMqxR+P8nfPLSvT6E1oJg VKrJGpFWDjGv9Xz2o8skj8tE/fFLtR/3t/fLWRpH4Pm1DZ55iJte/QA6jwVDR350uHvVHRlU5 X+pbj+AaKxdprkM20A6414GmzdW+m6KvBYdLQethfi9T+jDiCl1p6VaQpsbmh7qV4RZBOSn/L /AtT2EcLDi/CrCjYx19+zu24/cbjHlZFvLzhz5vITyUtpHeFE025VAfntqW/qptY7umWjZxv5 +z8/4yGywjmSvoffYPGYB91Qw6QuZzDPm+8vcA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180109_113144_905916_03F5A77F X-CRM114-Status: GOOD ( 11.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , Felipe Balbi , Florian Fainelli , linux-usb@vger.kernel.org, Minas Harutyunyan , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The dwc2 USB driver tries to find a generic PHY first and then look for an old style USB PHY. In case of a valid generic PHY node without a PHY driver, the PHY layer will return -EPROBE_DEFER forever. So dwc2 will never tries for an USB PHY. Fix this issue by finding a generic PHY and an old style USB PHY at once. Fixes: 6c2dad69163f ("usb: dwc2: Return errors from PHY") Link: https://marc.info/?l=linux-usb&m=151518314314753&w=2 Signed-off-by: Stefan Wahren --- drivers/usb/dwc2/platform.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 3e26550..5279567 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -225,10 +225,11 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) hsotg->phyif = GUSBCFG_PHYIF16; /* - * Attempt to find a generic PHY, then look for an old style - * USB PHY and then fall back to pdata + * Attempt to find a generic PHY or an old style USB PHY at once + * otherwise fall back to pdata */ hsotg->phy = devm_phy_get(hsotg->dev, "usb2-phy"); + hsotg->uphy = devm_usb_get_phy(hsotg->dev, USB_PHY_TYPE_USB2); if (IS_ERR(hsotg->phy)) { ret = PTR_ERR(hsotg->phy); switch (ret) { @@ -237,29 +238,34 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) hsotg->phy = NULL; break; case -EPROBE_DEFER: - return ret; + if (IS_ERR(hsotg->uphy)) + return ret; + + hsotg->phy = NULL; + break; default: dev_err(hsotg->dev, "error getting phy %d\n", ret); return ret; } } - if (!hsotg->phy) { - hsotg->uphy = devm_usb_get_phy(hsotg->dev, USB_PHY_TYPE_USB2); - if (IS_ERR(hsotg->uphy)) { - ret = PTR_ERR(hsotg->uphy); - switch (ret) { - case -ENODEV: - case -ENXIO: - hsotg->uphy = NULL; - break; - case -EPROBE_DEFER: - return ret; - default: - dev_err(hsotg->dev, "error getting usb phy %d\n", - ret); + if (IS_ERR(hsotg->uphy)) { + ret = PTR_ERR(hsotg->uphy); + switch (ret) { + case -ENODEV: + case -ENXIO: + hsotg->uphy = NULL; + break; + case -EPROBE_DEFER: + if (!hsotg->phy) return ret; - } + + hsotg->uphy = NULL; + break; + default: + dev_err(hsotg->dev, "error getting usb phy %d\n", + ret); + return ret; } }