Skip to content

Commit 1255dfd

Browse files
xdarklightgregkh
authored andcommitted
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: Martin Blumenstingl <[email protected]> Acked-by: Alan Stern <[email protected]> Tested-by: Neil Armstrong <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 27b3df4 commit 1255dfd

File tree

1 file changed

+5
-51
lines changed

1 file changed

+5
-51
lines changed

drivers/usb/host/ohci-platform.c

Lines changed: 5 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <linux/kernel.h>
2222
#include <linux/module.h>
2323
#include <linux/err.h>
24-
#include <linux/phy/phy.h>
24+
#include <linux/of.h>
2525
#include <linux/platform_device.h>
2626
#include <linux/pm_runtime.h>
2727
#include <linux/reset.h>
@@ -38,8 +38,6 @@
3838
struct ohci_platform_priv {
3939
struct clk *clks[OHCI_MAX_CLKS];
4040
struct reset_control *resets;
41-
struct phy **phys;
42-
int num_phys;
4341
};
4442

4543
static const char hcd_name[] = "ohci-platform";
@@ -48,32 +46,16 @@ static int ohci_platform_power_on(struct platform_device *dev)
4846
{
4947
struct usb_hcd *hcd = platform_get_drvdata(dev);
5048
struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
51-
int clk, ret, phy_num;
49+
int clk, ret;
5250

5351
for (clk = 0; clk < OHCI_MAX_CLKS && priv->clks[clk]; clk++) {
5452
ret = clk_prepare_enable(priv->clks[clk]);
5553
if (ret)
5654
goto err_disable_clks;
5755
}
5856

59-
for (phy_num = 0; phy_num < priv->num_phys; phy_num++) {
60-
ret = phy_init(priv->phys[phy_num]);
61-
if (ret)
62-
goto err_exit_phy;
63-
ret = phy_power_on(priv->phys[phy_num]);
64-
if (ret) {
65-
phy_exit(priv->phys[phy_num]);
66-
goto err_exit_phy;
67-
}
68-
}
69-
7057
return 0;
7158

72-
err_exit_phy:
73-
while (--phy_num >= 0) {
74-
phy_power_off(priv->phys[phy_num]);
75-
phy_exit(priv->phys[phy_num]);
76-
}
7759
err_disable_clks:
7860
while (--clk >= 0)
7961
clk_disable_unprepare(priv->clks[clk]);
@@ -85,12 +67,7 @@ static void ohci_platform_power_off(struct platform_device *dev)
8567
{
8668
struct usb_hcd *hcd = platform_get_drvdata(dev);
8769
struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
88-
int clk, phy_num;
89-
90-
for (phy_num = 0; phy_num < priv->num_phys; phy_num++) {
91-
phy_power_off(priv->phys[phy_num]);
92-
phy_exit(priv->phys[phy_num]);
93-
}
70+
int clk;
9471

9572
for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--)
9673
if (priv->clks[clk])
@@ -117,7 +94,7 @@ static int ohci_platform_probe(struct platform_device *dev)
11794
struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev);
11895
struct ohci_platform_priv *priv;
11996
struct ohci_hcd *ohci;
120-
int err, irq, phy_num, clk = 0;
97+
int err, irq, clk = 0;
12198

12299
if (usb_disabled())
123100
return -ENODEV;
@@ -169,29 +146,6 @@ static int ohci_platform_probe(struct platform_device *dev)
169146
of_property_read_u32(dev->dev.of_node, "num-ports",
170147
&ohci->num_ports);
171148

172-
priv->num_phys = of_count_phandle_with_args(dev->dev.of_node,
173-
"phys", "#phy-cells");
174-
175-
if (priv->num_phys > 0) {
176-
priv->phys = devm_kcalloc(&dev->dev, priv->num_phys,
177-
sizeof(struct phy *), GFP_KERNEL);
178-
if (!priv->phys)
179-
return -ENOMEM;
180-
} else
181-
priv->num_phys = 0;
182-
183-
for (phy_num = 0; phy_num < priv->num_phys; phy_num++) {
184-
priv->phys[phy_num] = devm_of_phy_get_by_index(
185-
&dev->dev, dev->dev.of_node, phy_num);
186-
if (IS_ERR(priv->phys[phy_num])) {
187-
err = PTR_ERR(priv->phys[phy_num]);
188-
goto err_put_hcd;
189-
} else {
190-
/* Avoiding phy_get() in usb_add_hcd() */
191-
hcd->skip_phy_initialization = 1;
192-
}
193-
}
194-
195149
for (clk = 0; clk < OHCI_MAX_CLKS; clk++) {
196150
priv->clks[clk] = of_clk_get(dev->dev.of_node, clk);
197151
if (IS_ERR(priv->clks[clk])) {
@@ -277,7 +231,7 @@ static int ohci_platform_probe(struct platform_device *dev)
277231
err_put_clks:
278232
while (--clk >= 0)
279233
clk_put(priv->clks[clk]);
280-
err_put_hcd:
234+
281235
if (pdata == &ohci_platform_defaults)
282236
dev->dev.platform_data = NULL;
283237

0 commit comments

Comments
 (0)