summaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-exynos.c
diff options
context:
space:
mode:
authorVivek Gautam <gautam.vivek@samsung.com>2014-08-05 12:39:08 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-09 00:38:21 +0200
commit2f7f41c7a73c7416e72a07baede021ab62bd5ae7 (patch)
tree7a4807dda8552ccb64c004efa78a2c1493d73e30 /drivers/usb/host/ehci-exynos.c
parentLinux 3.17-rc3 (diff)
downloadlinux-2f7f41c7a73c7416e72a07baede021ab62bd5ae7.tar.xz
linux-2f7f41c7a73c7416e72a07baede021ab62bd5ae7.zip
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/ehci-exynos.c')
-rw-r--r--drivers/usb/host/ehci-exynos.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index cda0a2f5c467..2eed9a4f89a9 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -62,18 +62,6 @@ static int exynos_ehci_get_phy(struct device *dev,
int phy_number;
int ret = 0;
- exynos_ehci->phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
- if (IS_ERR(exynos_ehci->phy)) {
- ret = PTR_ERR(exynos_ehci->phy);
- if (ret != -ENXIO && ret != -ENODEV) {
- dev_err(dev, "no usb2 phy configured\n");
- return ret;
- }
- dev_dbg(dev, "Failed to get usb2 phy\n");
- } else {
- exynos_ehci->otg = exynos_ehci->phy->otg;
- }
-
for_each_available_child_of_node(dev->of_node, child) {
ret = of_property_read_u32(child, "reg", &phy_number);
if (ret) {
@@ -90,15 +78,27 @@ static int exynos_ehci_get_phy(struct device *dev,
phy = devm_of_phy_get(dev, child, NULL);
of_node_put(child);
- if (IS_ERR(phy)) {
- ret = PTR_ERR(phy);
- if (ret != -ENOSYS && ret != -ENODEV) {
- dev_err(dev, "no usb2 phy configured\n");
- return ret;
- }
- dev_dbg(dev, "Failed to get usb2 phy\n");
- }
+ if (IS_ERR(phy))
+ /* Lets fallback to older USB-PHYs */
+ goto usb_phy_old;
exynos_ehci->phy_g[phy_number] = phy;
+ /* Make the older PHYs unavailable */
+ exynos_ehci->phy = ERR_PTR(-ENXIO);
+ }
+
+ return 0;
+
+usb_phy_old:
+ exynos_ehci->phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
+ if (IS_ERR(exynos_ehci->phy)) {
+ ret = PTR_ERR(exynos_ehci->phy);
+ if (ret != -ENXIO && ret != -ENODEV) {
+ dev_err(dev, "no usb2 phy configured\n");
+ return ret;
+ }
+ dev_dbg(dev, "Failed to get usb2 phy\n");
+ } else {
+ exynos_ehci->otg = exynos_ehci->phy->otg;
}
return ret;