Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
From: Al Cooper <alcooperx@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Al Cooper <alcooperx@gmail.com>,
	devicetree@vger.kernel.org, Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, Luis Chamberlain <mcgrof@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Rob Herring <robh+dt@kernel.org>
Subject: [PATCH 3/6] usb: bdc: driver may fail to get USB PHY
Date: Thu, 20 Jun 2019 17:09:48 -0400
Message-ID: <1561064991-16874-4-git-send-email-alcooperx@gmail.com> (raw)
In-Reply-To: <1561064991-16874-1-git-send-email-alcooperx@gmail.com>

Initialization order is important for the USB PHY and the PHY clients.
The init order is based on the build order of the drivers in the
makefiles and the PHY drivers are built early to help with
dependencies, but the new SCMI based clock subsystem has the side
effect of making some additional drivers DEFER until the clock
is ready. This is causing the USB PHY driver to defer which is causing
some PHY clients to fail when they try to get the PHY. The fix is to have
the client driver return DEFER when it's "get phy" routine returns DEFER.

Signed-off-by: Al Cooper <alcooperx@gmail.com>
---
 drivers/usb/gadget/udc/bdc/bdc_core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c
index 11a43de6c1c6..c794890d785b 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_core.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_core.c
@@ -543,9 +543,13 @@ static int bdc_probe(struct platform_device *pdev)
 			dev, dev->of_node, phy_num);
 		if (IS_ERR(bdc->phys[phy_num])) {
 			ret = PTR_ERR(bdc->phys[phy_num]);
+			if (ret == -EPROBE_DEFER) {
+				dev_dbg(bdc->dev, "DEFER, waiting for PHY\n");
+				return ret;
+			}
 			dev_err(bdc->dev,
 				"BDC phy specified but not found:%d\n", ret);
-			return ret;
+			goto clk_cleanup;
 		}
 	}
 
-- 
1.9.0.138.g2de3478


  parent reply index

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-20 21:09 [PATCH 0/6] usb: bdc: Updates and fixes to USB BDC driver Al Cooper
2019-06-20 21:09 ` [PATCH 1/6] usb: bdc: driver runs out of buffer descriptors on large ADB transfers Al Cooper
2019-06-20 21:09 ` [PATCH 2/6] usb: bdc: Cleanup clock support Al Cooper
2019-06-21  5:26   ` Chunfeng Yun
2019-06-21 13:44     ` Alan Cooper
2019-06-20 21:09 ` Al Cooper [this message]
2019-06-21  5:39   ` [PATCH 3/6] usb: bdc: driver may fail to get USB PHY Chunfeng Yun
2019-06-21 13:39     ` Alan Cooper
2019-06-20 21:09 ` [PATCH 4/6] usb: bdc: Fix bug causing crash after multiple disconnects Al Cooper
2019-06-20 21:09 ` [PATCH 5/6] dt-bindings: usb: bdc: Update compatible strings Al Cooper
2019-07-09 20:14   ` Rob Herring
2019-06-20 21:09 ` [PATCH 6/6] usb: bdc: Update compatible match strings Al Cooper
2019-06-21  8:28   ` Sergei Shtylyov
2019-06-21 13:47     ` Alan Cooper

Reply instructions:

You may reply publically 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=1561064991-16874-4-git-send-email-alcooperx@gmail.com \
    --to=alcooperx@gmail.com \
    --cc=balbi@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mcgrof@kernel.org \
    --cc=robh+dt@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

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org linux-usb@archiver.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/ public-inbox