Commit 27b3df41 authored by Martin Blumenstingl's avatar Martin Blumenstingl Committed by Greg Kroah-Hartman

usb: host: ehci-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 ehci-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 6ae9f506
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/reset.h> #include <linux/reset.h>
#include <linux/usb.h> #include <linux/usb.h>
...@@ -44,8 +43,6 @@ ...@@ -44,8 +43,6 @@
struct ehci_platform_priv { struct ehci_platform_priv {
struct clk *clks[EHCI_MAX_CLKS]; struct clk *clks[EHCI_MAX_CLKS];
struct reset_control *rsts; struct reset_control *rsts;
struct phy **phys;
int num_phys;
bool reset_on_resume; bool reset_on_resume;
}; };
...@@ -80,7 +77,7 @@ static int ehci_platform_power_on(struct platform_device *dev) ...@@ -80,7 +77,7 @@ static int ehci_platform_power_on(struct platform_device *dev)
{ {
struct usb_hcd *hcd = platform_get_drvdata(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd);
int clk, ret, phy_num; int clk, ret;
for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) { for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) {
ret = clk_prepare_enable(priv->clks[clk]); ret = clk_prepare_enable(priv->clks[clk]);
...@@ -88,24 +85,8 @@ static int ehci_platform_power_on(struct platform_device *dev) ...@@ -88,24 +85,8 @@ static int ehci_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]);
...@@ -117,12 +98,7 @@ static void ehci_platform_power_off(struct platform_device *dev) ...@@ -117,12 +98,7 @@ static void ehci_platform_power_off(struct platform_device *dev)
{ {
struct usb_hcd *hcd = platform_get_drvdata(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); struct ehci_platform_priv *priv = hcd_to_ehci_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 = EHCI_MAX_CLKS - 1; clk >= 0; clk--) for (clk = EHCI_MAX_CLKS - 1; clk >= 0; clk--)
if (priv->clks[clk]) if (priv->clks[clk])
...@@ -149,7 +125,7 @@ static int ehci_platform_probe(struct platform_device *dev) ...@@ -149,7 +125,7 @@ static int ehci_platform_probe(struct platform_device *dev)
struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev); struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev);
struct ehci_platform_priv *priv; struct ehci_platform_priv *priv;
struct ehci_hcd *ehci; struct ehci_hcd *ehci;
int err, irq, phy_num, clk = 0; int err, irq, clk = 0;
if (usb_disabled()) if (usb_disabled())
return -ENODEV; return -ENODEV;
...@@ -202,29 +178,6 @@ static int ehci_platform_probe(struct platform_device *dev) ...@@ -202,29 +178,6 @@ static int ehci_platform_probe(struct platform_device *dev)
"has-transaction-translator")) "has-transaction-translator"))
hcd->has_tt = 1; hcd->has_tt = 1;
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 < EHCI_MAX_CLKS; clk++) { for (clk = 0; clk < EHCI_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])) {
...@@ -306,7 +259,7 @@ static int ehci_platform_probe(struct platform_device *dev) ...@@ -306,7 +259,7 @@ static int ehci_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 == &ehci_platform_defaults) if (pdata == &ehci_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