Commit 1255dfd1 authored by Martin Blumenstingl's avatar Martin Blumenstingl Committed by Greg Kroah-Hartman

usb: host: ohci-platform: remove custom USB PHY handling

The new PHY wrapper is now wired up in the core HCD code. This means
that PHYs are now controlled (initialized, enabled, disabled, exited)
without requiring any host-driver specific code.
Remove the custom USB PHY handling from the ohci-platform driver as the
core HCD code now handles this.
Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Tested-by: default avatarNeil Armstrong <narmstrong@baylibre.con>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 27b3df41
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/phy/phy.h> #include <linux/of.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/reset.h> #include <linux/reset.h>
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
struct ohci_platform_priv { struct ohci_platform_priv {
struct clk *clks[OHCI_MAX_CLKS]; struct clk *clks[OHCI_MAX_CLKS];
struct reset_control *resets; struct reset_control *resets;
struct phy **phys;
int num_phys;
}; };
static const char hcd_name[] = "ohci-platform"; static const char hcd_name[] = "ohci-platform";
...@@ -48,7 +46,7 @@ static int ohci_platform_power_on(struct platform_device *dev) ...@@ -48,7 +46,7 @@ static int ohci_platform_power_on(struct platform_device *dev)
{ {
struct usb_hcd *hcd = platform_get_drvdata(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd); struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
int clk, ret, phy_num; int clk, ret;
for (clk = 0; clk < OHCI_MAX_CLKS && priv->clks[clk]; clk++) { for (clk = 0; clk < OHCI_MAX_CLKS && priv->clks[clk]; clk++) {
ret = clk_prepare_enable(priv->clks[clk]); ret = clk_prepare_enable(priv->clks[clk]);
...@@ -56,24 +54,8 @@ static int ohci_platform_power_on(struct platform_device *dev) ...@@ -56,24 +54,8 @@ static int ohci_platform_power_on(struct platform_device *dev)
goto err_disable_clks; goto err_disable_clks;
} }
for (phy_num = 0; phy_num < priv->num_phys; phy_num++) {
ret = phy_init(priv->phys[phy_num]);
if (ret)
goto err_exit_phy;
ret = phy_power_on(priv->phys[phy_num]);
if (ret) {
phy_exit(priv->phys[phy_num]);
goto err_exit_phy;
}
}
return 0; return 0;
err_exit_phy:
while (--phy_num >= 0) {
phy_power_off(priv->phys[phy_num]);
phy_exit(priv->phys[phy_num]);
}
err_disable_clks: err_disable_clks:
while (--clk >= 0) while (--clk >= 0)
clk_disable_unprepare(priv->clks[clk]); clk_disable_unprepare(priv->clks[clk]);
...@@ -85,12 +67,7 @@ static void ohci_platform_power_off(struct platform_device *dev) ...@@ -85,12 +67,7 @@ static void ohci_platform_power_off(struct platform_device *dev)
{ {
struct usb_hcd *hcd = platform_get_drvdata(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd); struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
int clk, phy_num; int clk;
for (phy_num = 0; phy_num < priv->num_phys; phy_num++) {
phy_power_off(priv->phys[phy_num]);
phy_exit(priv->phys[phy_num]);
}
for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--) for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--)
if (priv->clks[clk]) if (priv->clks[clk])
...@@ -117,7 +94,7 @@ static int ohci_platform_probe(struct platform_device *dev) ...@@ -117,7 +94,7 @@ static int ohci_platform_probe(struct platform_device *dev)
struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev); struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev);
struct ohci_platform_priv *priv; struct ohci_platform_priv *priv;
struct ohci_hcd *ohci; struct ohci_hcd *ohci;
int err, irq, phy_num, clk = 0; int err, irq, clk = 0;
if (usb_disabled()) if (usb_disabled())
return -ENODEV; return -ENODEV;
...@@ -169,29 +146,6 @@ static int ohci_platform_probe(struct platform_device *dev) ...@@ -169,29 +146,6 @@ static int ohci_platform_probe(struct platform_device *dev)
of_property_read_u32(dev->dev.of_node, "num-ports", of_property_read_u32(dev->dev.of_node, "num-ports",
&ohci->num_ports); &ohci->num_ports);
priv->num_phys = of_count_phandle_with_args(dev->dev.of_node,
"phys", "#phy-cells");
if (priv->num_phys > 0) {
priv->phys = devm_kcalloc(&dev->dev, priv->num_phys,
sizeof(struct phy *), GFP_KERNEL);
if (!priv->phys)
return -ENOMEM;
} else
priv->num_phys = 0;
for (phy_num = 0; phy_num < priv->num_phys; phy_num++) {
priv->phys[phy_num] = devm_of_phy_get_by_index(
&dev->dev, dev->dev.of_node, phy_num);
if (IS_ERR(priv->phys[phy_num])) {
err = PTR_ERR(priv->phys[phy_num]);
goto err_put_hcd;
} else {
/* Avoiding phy_get() in usb_add_hcd() */
hcd->skip_phy_initialization = 1;
}
}
for (clk = 0; clk < OHCI_MAX_CLKS; clk++) { for (clk = 0; clk < OHCI_MAX_CLKS; clk++) {
priv->clks[clk] = of_clk_get(dev->dev.of_node, clk); priv->clks[clk] = of_clk_get(dev->dev.of_node, clk);
if (IS_ERR(priv->clks[clk])) { if (IS_ERR(priv->clks[clk])) {
...@@ -277,7 +231,7 @@ static int ohci_platform_probe(struct platform_device *dev) ...@@ -277,7 +231,7 @@ static int ohci_platform_probe(struct platform_device *dev)
err_put_clks: err_put_clks:
while (--clk >= 0) while (--clk >= 0)
clk_put(priv->clks[clk]); clk_put(priv->clks[clk]);
err_put_hcd:
if (pdata == &ohci_platform_defaults) if (pdata == &ohci_platform_defaults)
dev->dev.platform_data = NULL; dev->dev.platform_data = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment