From: Stefan Wahren <stefan.wahren@i2se.com> To: Arnd Bergmann <arnd@arndb.de>, Eric Anholt <eric@anholt.net>, John Youn <johnyoun@synopsys.com>, Kishon Vijay Abraham I <kishon@ti.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Florian Fainelli <f.fainelli@gmail.com>, Felipe Balbi <balbi@kernel.org>, Minas Harutyunyan <minas.harutyunyan@synopsys.com>, linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, Stefan Wahren <stefan.wahren@i2se.com> Subject: usb: dwc2: Fix endless deferral probe Date: Tue, 9 Jan 2018 20:28:54 +0100 [thread overview] Message-ID: <1515526134-2148-1-git-send-email-stefan.wahren@i2se.com> (raw) 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 <stefan.wahren@i2se.com> --- 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; } }
WARNING: multiple messages have this Message-ID (diff)
From: stefan.wahren@i2se.com (Stefan Wahren) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] usb: dwc2: Fix endless deferral probe Date: Tue, 9 Jan 2018 20:28:54 +0100 [thread overview] Message-ID: <1515526134-2148-1-git-send-email-stefan.wahren@i2se.com> (raw) 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 <stefan.wahren@i2se.com> --- 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; } } -- 2.7.4
next reply other threads:[~2018-01-09 19:28 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-01-09 19:28 Stefan Wahren [this message] 2018-01-09 19:28 ` [PATCH] usb: dwc2: Fix endless deferral probe Stefan Wahren 2018-01-09 21:33 Arnd Bergmann 2018-01-09 21:33 ` [PATCH] " Arnd Bergmann 2018-01-10 12:15 Stefan Wahren 2018-01-10 12:15 ` [PATCH] " Stefan Wahren 2018-01-11 23:32 Arnd Bergmann 2018-01-11 23:32 ` [PATCH] " Arnd Bergmann 2018-01-12 8:06 Stefan Wahren 2018-01-12 8:06 ` [PATCH] " Stefan Wahren 2018-01-12 9:18 Arnd Bergmann 2018-01-12 9:18 ` [PATCH] " Arnd Bergmann 2018-01-12 17:51 Mauro Carvalho Chehab 2018-01-12 17:51 ` [PATCH] " Mauro Carvalho Chehab 2018-01-12 19:45 Arnd Bergmann 2018-01-12 19:45 ` [PATCH] " Arnd Bergmann
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=1515526134-2148-1-git-send-email-stefan.wahren@i2se.com \ --to=stefan.wahren@i2se.com \ --cc=arnd@arndb.de \ --cc=balbi@kernel.org \ --cc=eric@anholt.net \ --cc=f.fainelli@gmail.com \ --cc=gregkh@linuxfoundation.org \ --cc=johnyoun@synopsys.com \ --cc=kishon@ti.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-usb@vger.kernel.org \ --cc=minas.harutyunyan@synopsys.com \ /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: linkBe 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.