Skip to content

Commit

Permalink
Revert "usb: ehci/ohci-exynos: Fix PHY getting sequence"
Browse files Browse the repository at this point in the history
This reverts commit 0393689.

Vivek writes:
	We not longer need this patch, since we have planned to remove
	the usb-phy drivers for samsung [1], we have completely deleted
	the support for the the same from ohci-exynos and ehci-exynos
	drivers too [2].  Sorry for the confusion, but this patch can be
	dropped and instead we can pick the patches in [2].

	[1] http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg35774.html
	[2] https://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg35695.html
	    https://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg35696.html

Cc: Sachin Kamat <sachin.kamat@samsung.com>
Cc: Vivek Gautam <gautam.vivek@samsung.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Jingoo Han <jg1.han@samsung.com>
Cc: Sachin Kamat <sachin.kamat@samsung.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Greg Kroah-Hartman committed Aug 27, 2014
1 parent e21eba0 commit 7c38405
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 42 deletions.
40 changes: 20 additions & 20 deletions drivers/usb/host/ehci-exynos.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ 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) {
Expand All @@ -78,27 +90,15 @@ 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))
/* 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;
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");
}
dev_dbg(dev, "Failed to get usb2 phy\n");
} else {
exynos_ehci->otg = exynos_ehci->phy->otg;
exynos_ehci->phy_g[phy_number] = phy;
}

return ret;
Expand Down
47 changes: 25 additions & 22 deletions drivers/usb/host/ohci-exynos.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,27 @@ static int exynos_ohci_get_phy(struct device *dev,
int phy_number;
int ret = 0;

exynos_ohci->phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
if (IS_ERR(exynos_ohci->phy)) {
ret = PTR_ERR(exynos_ohci->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_ohci->otg = exynos_ohci->phy->otg;
}

/*
* Getting generic phy:
* We are keeping both types of phys as a part of transiting OHCI
* to generic phy framework, so as to maintain backward compatibilty
* with old DTB too.
* We fallback to older USB-PHYs when we fail to get generic PHYs.
* with old DTB.
* If there are existing devices using DTB files built from them,
* to remove the support for old bindings in this driver,
* we need to make sure that such devices have their DTBs
* updated to ones built from new DTS.
*/
for_each_available_child_of_node(dev->of_node, child) {
ret = of_property_read_u32(child, "reg", &phy_number);
Expand All @@ -74,27 +89,15 @@ static int exynos_ohci_get_phy(struct device *dev,

phy = devm_of_phy_get(dev, child, NULL);
of_node_put(child);
if (IS_ERR(phy))
/* Lets fallback to older USB-PHYs */
goto usb_phy_old;
exynos_ohci->phy_g[phy_number] = phy;
/* Make the older PHYs unavailable */
exynos_ohci->phy = ERR_PTR(-ENXIO);
}

return 0;

usb_phy_old:
exynos_ohci->phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
if (IS_ERR(exynos_ohci->phy)) {
ret = PTR_ERR(exynos_ohci->phy);
if (ret != -ENXIO && ret != -ENODEV) {
dev_err(dev, "no usb2 phy configured\n");
return ret;
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");
}
dev_dbg(dev, "Failed to get usb2 phy\n");
} else {
exynos_ohci->otg = exynos_ohci->phy->otg;
exynos_ohci->phy_g[phy_number] = phy;
}

return ret;
Expand Down

0 comments on commit 7c38405

Please sign in to comment.