From: Timur Tabi <timur@codeaurora.org>
To: jackp@codeaurora.org, agross@codeaurora.org, iivanov@mm-sol.com,
linux-arm-msm@vger.kernel.org,
Bjorn Andersson <bjorn.andersson@sonymobile.com>,
linux-usb@vger.kernel.org, Greg Kroah-Hartman <greg@kroah.com>,
balbi@ti.com, Mark Langsdorf <mlangsdo@redhat.com>,
Jon Masters <jcm@redhat.com>,
pelcan@codeaurora.org
Subject: [PATCH 2/5] usb: ehci-msm: Remove dependency on OTG PHY
Date: Wed, 9 Dec 2015 17:41:05 -0600 [thread overview]
Message-ID: <1449704468-4480-2-git-send-email-timur@codeaurora.org> (raw)
In-Reply-To: <1449704468-4480-1-git-send-email-timur@codeaurora.org>
From: Jack Pham <jackp@codeaurora.org>
Currently the EHCI MSM driver has a hard dependency to be created
by an OTG layer, namely the phy-msm-usb driver. In some cases or
board configurations we want to allow the EHCI host to be
instantiated without OTG capability. Instead, relax the dependency
on having an OTG PHY being present and call usb_add_hcd() directly.
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
---
drivers/usb/host/ehci-msm.c | 53 ++++++++++++++++++++++++++-------------------
1 file changed, 31 insertions(+), 22 deletions(-)
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index d3ed6c9..0a86b8e 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -106,9 +106,9 @@ static int ehci_msm_probe(struct platform_device *pdev)
}
/*
- * OTG driver takes care of PHY initialization, clock management,
- * powering up VBUS, mapping of registers address space and power
- * management.
+ * If there is an OTG driver, let it take care of PHY initialization,
+ * clock management, powering up VBUS, mapping of registers address
+ * space and power management.
*/
if (pdev->dev.of_node)
phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
@@ -116,27 +116,35 @@ static int ehci_msm_probe(struct platform_device *pdev)
phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
if (IS_ERR(phy)) {
- dev_err(&pdev->dev, "unable to find transceiver\n");
- ret = -EPROBE_DEFER;
- goto put_hcd;
- }
-
- ret = otg_set_host(phy->otg, &hcd->self);
- if (ret < 0) {
- dev_err(&pdev->dev, "unable to register with transceiver\n");
- goto put_hcd;
+ if (PTR_ERR(phy) == -EPROBE_DEFER) {
+ dev_err(&pdev->dev, "unable to find transceiver\n");
+ ret = -EPROBE_DEFER;
+ goto put_hcd;
+ }
+ phy = NULL;
}
hcd->usb_phy = phy;
device_init_wakeup(&pdev->dev, 1);
- /*
- * OTG device parent of HCD takes care of putting
- * hardware into low power mode.
- */
- pm_runtime_no_callbacks(&pdev->dev);
- pm_runtime_enable(&pdev->dev);
- /* FIXME: need to call usb_add_hcd() here? */
+ if (phy && phy->otg) {
+ /*
+ * MSM OTG driver takes care of adding the HCD and
+ * placing hardware into low power mode via runtime PM.
+ */
+ ret = otg_set_host(phy->otg, &hcd->self);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "unable to register with transceiver\n");
+ goto put_hcd;
+ }
+
+ pm_runtime_no_callbacks(&pdev->dev);
+ pm_runtime_enable(&pdev->dev);
+ } else {
+ ret = usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
+ if (ret)
+ goto put_hcd;
+ }
return 0;
@@ -154,9 +162,10 @@ static int ehci_msm_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
- otg_set_host(hcd->usb_phy->otg, NULL);
-
- /* FIXME: need to call usb_remove_hcd() here? */
+ if (hcd->usb_phy && hcd->usb_phy->otg)
+ otg_set_host(hcd->usb_phy->otg, NULL);
+ else
+ usb_remove_hcd(hcd);
usb_put_hcd(hcd);
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
next prev parent reply other threads:[~2015-12-09 23:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-09 23:41 [PATCH 1/5] usb: ehci-msm: Allow LS devices to work Timur Tabi
2015-12-09 23:41 ` Timur Tabi [this message]
[not found] ` <1449704468-4480-1-git-send-email-timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-12-09 23:41 ` [PATCH 3/5] usb: ehci-msm: Add support for ACPI probing Timur Tabi
2015-12-09 23:41 ` [PATCH 4/5] usb: ehci-msm: Fix register initialization Timur Tabi
[not found] ` <1449704468-4480-4-git-send-email-timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-12-10 1:31 ` Jack Pham
2015-12-10 4:05 ` Timur Tabi
2015-12-09 23:41 ` [PATCH 5/5] usb: ehci-msm: Register usb shutdown function Timur Tabi
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=1449704468-4480-2-git-send-email-timur@codeaurora.org \
--to=timur@codeaurora.org \
--cc=agross@codeaurora.org \
--cc=balbi@ti.com \
--cc=bjorn.andersson@sonymobile.com \
--cc=greg@kroah.com \
--cc=iivanov@mm-sol.com \
--cc=jackp@codeaurora.org \
--cc=jcm@redhat.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mlangsdo@redhat.com \
--cc=pelcan@codeaurora.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;
as well as URLs for NNTP newsgroup(s).