From: George Cherian <george.cherian@ti.com>
To: <linux-usb@vger.kernel.org>
Cc: <balbi@ti.com>, <linux-kernel@vger.kernel.org>,
<gregkh@linuxfoundation.org>, <linux-omap@vger.kernel.org>,
George Cherian <george.cherian@ti.com>
Subject: [PATCH] usb: dwc3: core: continue probe even if usb3 phy is not available
Date: Wed, 26 Jun 2013 14:59:14 +0530 [thread overview]
Message-ID: <1372238954-29047-1-git-send-email-george.cherian@ti.com> (raw)
There can be configurations in which DWC3 is hoooked up only to USB2 PHY.
In such cases we should not return -EPROBE_DEFER, rather continue probe
even if there is no USB3 PHY.
Signed-off-by: George Cherian <george.cherian@ti.com>
---
drivers/usb/dwc3/core.c | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index c35d49d..d5e6f3e 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -100,7 +100,9 @@ static void dwc3_core_soft_reset(struct dwc3 *dwc)
dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
usb_phy_init(dwc->usb2_phy);
- usb_phy_init(dwc->usb3_phy);
+
+ if (dwc->usb3_phy)
+ usb_phy_init(dwc->usb3_phy);
mdelay(100);
/* Clear USB3 PHY reset */
@@ -360,7 +362,9 @@ err0:
static void dwc3_core_exit(struct dwc3 *dwc)
{
usb_phy_shutdown(dwc->usb2_phy);
- usb_phy_shutdown(dwc->usb3_phy);
+
+ if (dwc->usb3_phy)
+ usb_phy_shutdown(dwc->usb3_phy);
}
#define DWC3_ALIGN_MASK (16 - 1)
@@ -460,12 +464,19 @@ static int dwc3_probe(struct platform_device *pdev)
if (ret == -ENXIO)
return ret;
+ /*
+ * In some cases we wont have a USB3 PHY, in such cases
+ * if we return EPROBE_DEFER we would never complete the
+ * probe. Just print error and continue.
+ */
dev_err(dev, "no usb3 phy configured\n");
- return -EPROBE_DEFER;
+ dwc->usb3_phy = NULL;
}
usb_phy_set_suspend(dwc->usb2_phy, 0);
- usb_phy_set_suspend(dwc->usb3_phy, 0);
+
+ if (dwc->usb3_phy)
+ usb_phy_set_suspend(dwc->usb3_phy, 0);
spin_lock_init(&dwc->lock);
platform_set_drvdata(pdev, dwc);
@@ -604,7 +615,9 @@ static int dwc3_remove(struct platform_device *pdev)
struct dwc3 *dwc = platform_get_drvdata(pdev);
usb_phy_set_suspend(dwc->usb2_phy, 1);
- usb_phy_set_suspend(dwc->usb3_phy, 1);
+
+ if (dwc->usb3_phy)
+ usb_phy_set_suspend(dwc->usb3_phy, 1);
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
@@ -700,7 +713,9 @@ static int dwc3_suspend(struct device *dev)
dwc->gctl = dwc3_readl(dwc->regs, DWC3_GCTL);
spin_unlock_irqrestore(&dwc->lock, flags);
- usb_phy_shutdown(dwc->usb3_phy);
+ if (dwc->usb3_phy)
+ usb_phy_shutdown(dwc->usb3_phy);
+
usb_phy_shutdown(dwc->usb2_phy);
return 0;
@@ -711,7 +726,9 @@ static int dwc3_resume(struct device *dev)
struct dwc3 *dwc = dev_get_drvdata(dev);
unsigned long flags;
- usb_phy_init(dwc->usb3_phy);
+ if (dwc->usb3_phy)
+ usb_phy_init(dwc->usb3_phy);
+
usb_phy_init(dwc->usb2_phy);
msleep(100);
--
1.8.1.4
next reply other threads:[~2013-06-26 9:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-26 9:29 George Cherian [this message]
2013-06-26 10:16 ` Felipe Balbi
2013-06-26 12:07 ` George Cherian
2013-06-26 12:12 ` Felipe Balbi
2013-06-26 12:46 ` Alexander Shishkin
2013-06-27 6:14 ` Michael Grzeschik
2013-06-27 6:35 ` Felipe Balbi
2013-06-27 7:24 ` Michael Grzeschik
2013-06-27 7:30 ` Felipe Balbi
2013-06-28 18:00 ` Felipe Balbi
2013-06-28 20:06 ` Michael Grzeschik
2013-06-30 8:20 ` Felipe Balbi
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=1372238954-29047-1-git-send-email-george.cherian@ti.com \
--to=george.cherian@ti.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®