--- zzzz-none-000/linux-3.10.107/drivers/usb/host/ehci-msm.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/usb/host/ehci-msm.c 2021-02-04 17:41:59.000000000 +0000 @@ -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 @@ { struct usb_hcd *hcd; struct resource *res; + struct usb_phy *phy; int ret; dev_dbg(&pdev->dev, "ehci_msm proble\n"); @@ -80,12 +80,12 @@ return -ENOMEM; } - hcd->irq = platform_get_irq(pdev, 0); - if (hcd->irq < 0) { + ret = platform_get_irq(pdev, 0); + if (ret < 0) { dev_err(&pdev->dev, "Unable to get IRQ resource\n"); - ret = hcd->irq; goto put_hcd; } + hcd->irq = ret; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { @@ -108,10 +108,14 @@ * 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; } @@ -121,6 +125,7 @@ goto put_hcd; } + hcd->usb_phy = phy; device_init_wakeup(&pdev->dev, 1); /* * OTG device parent of HCD takes care of putting @@ -147,7 +152,7 @@ pm_runtime_disable(&pdev->dev); pm_runtime_set_suspended(&pdev->dev); - otg_set_host(phy->otg, NULL); + otg_set_host(hcd->usb_phy->otg, NULL); /* FIXME: need to call usb_remove_hcd() here? */ @@ -186,12 +191,19 @@ .resume = ehci_msm_pm_resume, }; +static const 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, }, };