From: Paul Cercueil <paul@crapouillou.net>
To: Bin Liu <b-liu@ti.com>, Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, od@zcrc.me,
Paul Cercueil <paul@crapouillou.net>
Subject: [PATCH 3/3] usb: musb: jz4740: obtain USB PHY from devicetree
Date: Thu, 21 Mar 2019 16:09:56 +0100 [thread overview]
Message-ID: <20190321150956.6629-3-paul@crapouillou.net> (raw)
In-Reply-To: <20190321150956.6629-1-paul@crapouillou.net>
Fall back to devm_usb_get_phy() if devicetree is not available.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
drivers/usb/musb/jz4740.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index ad35e09f90bd..e4dbf76548c0 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -74,9 +74,14 @@ static struct musb_hdrc_platform_data jz4740_musb_platform_data = {
static int jz4740_musb_init(struct musb *musb)
{
- musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
+ struct device *dev = musb->controller->parent;
+
+ if (dev->of_node)
+ musb->xceiv = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
+ else
+ musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
if (IS_ERR(musb->xceiv)) {
- pr_err("HS UDC: no transceiver configured\n");
+ dev_err(dev, "No transceiver configured\n");
return PTR_ERR(musb->xceiv);
}
@@ -90,13 +95,6 @@ static int jz4740_musb_init(struct musb *musb)
return 0;
}
-static int jz4740_musb_exit(struct musb *musb)
-{
- usb_put_phy(musb->xceiv);
-
- return 0;
-}
-
/*
* DMA has not been confirmed to work with CONFIG_USB_INVENTRA_DMA,
* so let's not set up the dma function pointers yet.
@@ -105,7 +103,6 @@ static const struct musb_platform_ops jz4740_musb_ops = {
.quirks = MUSB_DMA_INVENTRA | MUSB_INDEXED_EP,
.fifo_mode = 2,
.init = jz4740_musb_init,
- .exit = jz4740_musb_exit,
};
static int jz4740_probe(struct platform_device *pdev)
--
2.11.0
next prev parent reply other threads:[~2019-03-21 15:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-21 15:09 [PATCH 1/3] dt-bindings: usb: Add usb-phy property to the jz4740-musb node Paul Cercueil
2019-03-21 15:09 ` [PATCH 2/3] usb: musb: jz4740: Let the platform probe the PHY Paul Cercueil
2019-03-21 15:09 ` Paul Cercueil [this message]
2019-03-31 6:41 ` [PATCH 1/3] dt-bindings: usb: Add usb-phy property to the jz4740-musb node Rob Herring
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=20190321150956.6629-3-paul@crapouillou.net \
--to=paul@crapouillou.net \
--cc=b-liu@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=od@zcrc.me \
--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
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®