aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ohci-exynos.c
diff options
context:
space:
mode:
authorVivek Gautam <gautam.vivek@samsung.com>2014-08-05 06:39:08 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-08 18:38:21 -0400
commit2f7f41c7a73c7416e72a07baede021ab62bd5ae7 (patch)
tree7a4807dda8552ccb64c004efa78a2c1493d73e30 /drivers/usb/host/ohci-exynos.c
parent69e273c0b0a3c337a521d083374c918dc52c666f (diff)
usb: ehci/ohci-exynos: Fix PHY getting sequence
Since we want to keep support for both older usb-phys as well as the newer generic phys, lets first get the generic PHYs and fallback to older USB-PHYs only when we fail to get the former. This should fix the issue with ehci-exynos and ohci-exynos, wherein in the absence of SAMSUNG_USB2PHY config symbol, we end up getting the NOP_USB_XCEIV phy when the same is enabled. And thus the PHYs are not configured properly. Reported-by: Sachin Kamat <sachin.kamat@samsung.com> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Jingoo Han <jg1.han@samsung.com> Tested-by: Sachin Kamat <sachin.kamat@samsung.com> Acked-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/ohci-exynos.c')
-rw-r--r--drivers/usb/host/ohci-exynos.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index a72ab8fe8cd3..7c48e3f3146b 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -51,27 +51,12 @@ 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
66 /* 54 /*
67 * Getting generic phy: 55 * Getting generic phy:
68 * We are keeping both types of phys as a part of transiting OHCI 56 * We are keeping both types of phys as a part of transiting OHCI
69 * to generic phy framework, so as to maintain backward compatibilty 57 * to generic phy framework, so as to maintain backward compatibilty
70 * with old DTB. 58 * with old DTB too.
71 * If there are existing devices using DTB files built from them, 59 * We fallback to older USB-PHYs when we fail to get generic PHYs.
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.
75 */ 60 */
76 for_each_available_child_of_node(dev->of_node, child) { 61 for_each_available_child_of_node(dev->of_node, child) {
77 ret = of_property_read_u32(child, "reg", &phy_number); 62 ret = of_property_read_u32(child, "reg", &phy_number);
@@ -89,15 +74,27 @@ static int exynos_ohci_get_phy(struct device *dev,
89 74
90 phy = devm_of_phy_get(dev, child, NULL); 75 phy = devm_of_phy_get(dev, child, NULL);
91 of_node_put(child); 76 of_node_put(child);
92 if (IS_ERR(phy)) { 77 if (IS_ERR(phy))
93 ret = PTR_ERR(phy); 78 /* Lets fallback to older USB-PHYs */
94 if (ret != -ENOSYS && ret != -ENODEV) { 79 goto usb_phy_old;
95 dev_err(dev, "no usb2 phy configured\n");
96 return ret;
97 }
98 dev_dbg(dev, "Failed to get usb2 phy\n");
99 }
100 exynos_ohci->phy_g[phy_number] = phy; 80 exynos_ohci->phy_g[phy_number] = phy;
81 /* Make the older PHYs unavailable */
82 exynos_ohci->phy = ERR_PTR(-ENXIO);
83 }
84
85 return 0;
86
87usb_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 }
95 dev_dbg(dev, "Failed to get usb2 phy\n");
96 } else {
97 exynos_ohci->otg = exynos_ohci->phy->otg;
101 } 98 }
102 99
103 return ret; 100 return ret;