USB: ehci-msm: Add device tree support and binding information
authorIvan T. Ivanov <iivanov@mm-sol.com>
Fri, 11 Oct 2013 11:46:10 +0000 (14:46 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Oct 2013 23:31:15 +0000 (16:31 -0700)
Allows MSM EHCI controller to be specified via device tree.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Acked-by: David Brown <davidb@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/devicetree/bindings/usb/msm-hsusb.txt [new file with mode: 0644]
drivers/usb/host/ehci-msm.c

diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
new file mode 100644 (file)
index 0000000..5ea26c6
--- /dev/null
@@ -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>;
+       };
+
index 1bc93552151c9a32e90bbbdc259a4330975087d8..f341651d6f6ce6e4ae67a2d53ab2cab3aefeb81e 100644 (file)
@@ -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,
        },
 };