linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ehci-msm: Remove global struct usb_phy variable
@ 2013-10-11 11:46 Ivan T. Ivanov
  2013-10-11 11:46 ` [PATCH 2/2] USB: ehci-msm: Add device tree support and binding information Ivan T. Ivanov
  2013-10-11 14:06 ` [PATCH 1/2] ehci-msm: Remove global struct usb_phy variable David Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Ivan T. Ivanov @ 2013-10-11 11:46 UTC (permalink / raw)
  To: stern
  Cc: rob.herring, pawel.moll, mark.rutland, swarren, ijc+devicetree,
	rob, grant.likely, gregkh, davidb, linux-usb, linux-arm-msm,
	linux-kernel, Ivan T. Ivanov

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Use struct usb_hcd::phy to hold USB PHY instance.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/usb/host/ehci-msm.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index 0f717dc..1bc9355 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -42,7 +42,6 @@
 
 static const char hcd_name[] = "ehci-msm";
 static struct hc_driver __read_mostly msm_hc_driver;
-static struct usb_phy *phy;
 
 static int ehci_msm_reset(struct usb_hcd *hcd)
 {
@@ -70,6 +69,7 @@ static int ehci_msm_probe(struct platform_device *pdev)
 {
 	struct usb_hcd *hcd;
 	struct resource *res;
+	struct usb_phy *phy;
 	int ret;
 
 	dev_dbg(&pdev->dev, "ehci_msm proble\n");
@@ -121,6 +121,7 @@ static int ehci_msm_probe(struct platform_device *pdev)
 		goto put_hcd;
 	}
 
+	hcd->phy = phy;
 	device_init_wakeup(&pdev->dev, 1);
 	/*
 	 * OTG device parent of HCD takes care of putting
@@ -147,7 +148,7 @@ static int ehci_msm_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 
-	otg_set_host(phy->otg, NULL);
+	otg_set_host(hcd->phy->otg, NULL);
 
 	/* FIXME: need to call usb_remove_hcd() here? */
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] USB: ehci-msm: Add device tree support and binding information
  2013-10-11 11:46 [PATCH 1/2] ehci-msm: Remove global struct usb_phy variable Ivan T. Ivanov
@ 2013-10-11 11:46 ` Ivan T. Ivanov
  2013-10-11 14:06   ` David Brown
  2013-10-11 14:06 ` [PATCH 1/2] ehci-msm: Remove global struct usb_phy variable David Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Ivan T. Ivanov @ 2013-10-11 11:46 UTC (permalink / raw)
  To: stern
  Cc: rob.herring, pawel.moll, mark.rutland, swarren, ijc+devicetree,
	rob, grant.likely, gregkh, davidb, linux-usb, linux-arm-msm,
	linux-kernel, Ivan T. Ivanov

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Allows MSM EHCI controller to be specified via device tree.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 .../devicetree/bindings/usb/msm-hsusb.txt          |   17 +++++++++++++++++
 drivers/usb/host/ehci-msm.c                        |   15 +++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/msm-hsusb.txt

diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
new file mode 100644
index 0000000..5ea26c6
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -0,0 +1,17 @@
+MSM SoC HSUSB controllers
+
+EHCI
+
+Required properties:
+- compatible:	Should contain "qcom,ehci-host"
+- regs:			offset and length of the register set in the memory map
+- usb-phy:		phandle for the PHY device
+
+Example EHCI controller device node:
+
+	ehci: ehci@f9a55000 {
+		compatible = "qcom,ehci-host";
+		reg = <0xf9a55000 0x400>;
+		usb-phy = <&usb_otg>;
+	};
+
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index 1bc9355..f341651 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -108,10 +108,14 @@ static int ehci_msm_probe(struct platform_device *pdev)
 	 * powering up VBUS, mapping of registers address space and power
 	 * management.
 	 */
-	phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
+	if (pdev->dev.of_node)
+		phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
+	else
+		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 = -ENODEV;
+		ret = -EPROBE_DEFER;
 		goto put_hcd;
 	}
 
@@ -187,12 +191,19 @@ static const struct dev_pm_ops ehci_msm_dev_pm_ops = {
 	.resume          = ehci_msm_pm_resume,
 };
 
+static struct of_device_id msm_ehci_dt_match[] = {
+	{ .compatible = "qcom,ehci-host", },
+	{}
+};
+MODULE_DEVICE_TABLE(of, msm_ehci_dt_match);
+
 static struct platform_driver ehci_msm_driver = {
 	.probe	= ehci_msm_probe,
 	.remove	= ehci_msm_remove,
 	.driver = {
 		   .name = "msm_hsusb_host",
 		   .pm = &ehci_msm_dev_pm_ops,
+		   .of_match_table = msm_ehci_dt_match,
 	},
 };
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] ehci-msm: Remove global struct usb_phy variable
  2013-10-11 11:46 [PATCH 1/2] ehci-msm: Remove global struct usb_phy variable Ivan T. Ivanov
  2013-10-11 11:46 ` [PATCH 2/2] USB: ehci-msm: Add device tree support and binding information Ivan T. Ivanov
@ 2013-10-11 14:06 ` David Brown
  1 sibling, 0 replies; 4+ messages in thread
From: David Brown @ 2013-10-11 14:06 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: stern, rob.herring, pawel.moll, mark.rutland, swarren,
	ijc+devicetree, rob, grant.likely, gregkh, linux-usb,
	linux-arm-msm, linux-kernel

On Fri, Oct 11, 2013 at 02:46:09PM +0300, Ivan T. Ivanov wrote:
>From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
>
>Use struct usb_hcd::phy to hold USB PHY instance.
>
>Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
>---
> drivers/usb/host/ehci-msm.c |    5 +++--

Acked-by: David Brown <davidb@codeaurora.org>

-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] USB: ehci-msm: Add device tree support and binding information
  2013-10-11 11:46 ` [PATCH 2/2] USB: ehci-msm: Add device tree support and binding information Ivan T. Ivanov
@ 2013-10-11 14:06   ` David Brown
  0 siblings, 0 replies; 4+ messages in thread
From: David Brown @ 2013-10-11 14:06 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: stern, rob.herring, pawel.moll, mark.rutland, swarren,
	ijc+devicetree, rob, grant.likely, gregkh, linux-usb,
	linux-arm-msm, linux-kernel

On Fri, Oct 11, 2013 at 02:46:10PM +0300, Ivan T. Ivanov wrote:
>From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
>
>Allows MSM EHCI controller to be specified via device tree.
>
>Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
>---
> .../devicetree/bindings/usb/msm-hsusb.txt          |   17 +++++++++++++++++
> drivers/usb/host/ehci-msm.c                        |   15 +++++++++++++--

Acked-by: David Brown <davidb@codeaurora.org>

-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-11 14:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-11 11:46 [PATCH 1/2] ehci-msm: Remove global struct usb_phy variable Ivan T. Ivanov
2013-10-11 11:46 ` [PATCH 2/2] USB: ehci-msm: Add device tree support and binding information Ivan T. Ivanov
2013-10-11 14:06   ` David Brown
2013-10-11 14:06 ` [PATCH 1/2] ehci-msm: Remove global struct usb_phy variable David Brown

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).