From patchwork Wed Jun 26 09:29:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Cherian X-Patchwork-Id: 2783651 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 84A849F3A0 for ; Wed, 26 Jun 2013 09:29:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7350220355 for ; Wed, 26 Jun 2013 09:29:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 26EA320316 for ; Wed, 26 Jun 2013 09:29:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751640Ab3FZJ3W (ORCPT ); Wed, 26 Jun 2013 05:29:22 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:47230 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751566Ab3FZJ3V (ORCPT ); Wed, 26 Jun 2013 05:29:21 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r5Q9TKXI012113; Wed, 26 Jun 2013 04:29:20 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r5Q9TKsJ018797; Wed, 26 Jun 2013 04:29:20 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Wed, 26 Jun 2013 04:29:20 -0500 Received: from psplinux064.india.ti.com (dbdp20.itg.ti.com [172.24.170.38]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id r5Q9THbZ001363; Wed, 26 Jun 2013 04:29:18 -0500 From: George Cherian To: CC: , , , , George Cherian Subject: [PATCH] usb: dwc3: core: continue probe even if usb3 phy is not available Date: Wed, 26 Jun 2013 14:59:14 +0530 Message-ID: <1372238954-29047-1-git-send-email-george.cherian@ti.com> X-Mailer: git-send-email 1.8.1 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);