diff options
Diffstat (limited to 'drivers/usb/host/ohci-exynos.c')
-rw-r--r-- | drivers/usb/host/ohci-exynos.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 7c48e3f3146b..a72ab8fe8cd3 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c | |||
@@ -51,12 +51,27 @@ static int exynos_ohci_get_phy(struct device *dev, | |||
51 | int phy_number; | 51 | int phy_number; |
52 | int ret = 0; | 52 | int ret = 0; |
53 | 53 | ||
54 | exynos_ohci->phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); | ||
55 | if (IS_ERR(exynos_ohci->phy)) { | ||
56 | ret = PTR_ERR(exynos_ohci->phy); | ||
57 | if (ret != -ENXIO && ret != -ENODEV) { | ||
58 | dev_err(dev, "no usb2 phy configured\n"); | ||
59 | return ret; | ||
60 | } | ||
61 | dev_dbg(dev, "Failed to get usb2 phy\n"); | ||
62 | } else { | ||
63 | exynos_ohci->otg = exynos_ohci->phy->otg; | ||
64 | } | ||
65 | |||
54 | /* | 66 | /* |
55 | * Getting generic phy: | 67 | * Getting generic phy: |
56 | * We are keeping both types of phys as a part of transiting OHCI | 68 | * We are keeping both types of phys as a part of transiting OHCI |
57 | * to generic phy framework, so as to maintain backward compatibilty | 69 | * to generic phy framework, so as to maintain backward compatibilty |
58 | * with old DTB too. | 70 | * with old DTB. |
59 | * We fallback to older USB-PHYs when we fail to get generic PHYs. | 71 | * If there are existing devices using DTB files built from them, |
72 | * to remove the support for old bindings in this driver, | ||
73 | * we need to make sure that such devices have their DTBs | ||
74 | * updated to ones built from new DTS. | ||
60 | */ | 75 | */ |
61 | for_each_available_child_of_node(dev->of_node, child) { | 76 | for_each_available_child_of_node(dev->of_node, child) { |
62 | ret = of_property_read_u32(child, "reg", &phy_number); | 77 | ret = of_property_read_u32(child, "reg", &phy_number); |
@@ -74,27 +89,15 @@ static int exynos_ohci_get_phy(struct device *dev, | |||
74 | 89 | ||
75 | phy = devm_of_phy_get(dev, child, NULL); | 90 | phy = devm_of_phy_get(dev, child, NULL); |
76 | of_node_put(child); | 91 | of_node_put(child); |
77 | if (IS_ERR(phy)) | 92 | if (IS_ERR(phy)) { |
78 | /* Lets fallback to older USB-PHYs */ | 93 | ret = PTR_ERR(phy); |
79 | goto usb_phy_old; | 94 | if (ret != -ENOSYS && ret != -ENODEV) { |
80 | exynos_ohci->phy_g[phy_number] = phy; | 95 | dev_err(dev, "no usb2 phy configured\n"); |
81 | /* Make the older PHYs unavailable */ | 96 | return ret; |
82 | exynos_ohci->phy = ERR_PTR(-ENXIO); | 97 | } |
83 | } | 98 | dev_dbg(dev, "Failed to get usb2 phy\n"); |
84 | |||
85 | return 0; | ||
86 | |||
87 | usb_phy_old: | ||
88 | exynos_ohci->phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); | ||
89 | if (IS_ERR(exynos_ohci->phy)) { | ||
90 | ret = PTR_ERR(exynos_ohci->phy); | ||
91 | if (ret != -ENXIO && ret != -ENODEV) { | ||
92 | dev_err(dev, "no usb2 phy configured\n"); | ||
93 | return ret; | ||
94 | } | 99 | } |
95 | dev_dbg(dev, "Failed to get usb2 phy\n"); | 100 | exynos_ohci->phy_g[phy_number] = phy; |
96 | } else { | ||
97 | exynos_ohci->otg = exynos_ohci->phy->otg; | ||
98 | } | 101 | } |
99 | 102 | ||
100 | return ret; | 103 | return ret; |