Skip to content

Commit 27b3df4

Browse files
xdarklightgregkh
authored andcommitted
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: 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 6ae9f50 commit 27b3df4

File tree

1 file changed

+4
-51
lines changed

1 file changed

+4
-51
lines changed

drivers/usb/host/ehci-platform.c

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <linux/io.h>
2828
#include <linux/module.h>
2929
#include <linux/of.h>
30-
#include <linux/phy/phy.h>
3130
#include <linux/platform_device.h>
3231
#include <linux/reset.h>
3332
#include <linux/usb.h>
@@ -44,8 +43,6 @@
4443
struct ehci_platform_priv {
4544
struct clk *clks[EHCI_MAX_CLKS];
4645
struct reset_control *rsts;
47-
struct phy **phys;
48-
int num_phys;
4946
bool reset_on_resume;
5047
};
5148

@@ -80,32 +77,16 @@ static int ehci_platform_power_on(struct platform_device *dev)
8077
{
8178
struct usb_hcd *hcd = platform_get_drvdata(dev);
8279
struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd);
83-
int clk, ret, phy_num;
80+
int clk, ret;
8481

8582
for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) {
8683
ret = clk_prepare_enable(priv->clks[clk]);
8784
if (ret)
8885
goto err_disable_clks;
8986
}
9087

91-
for (phy_num = 0; phy_num < priv->num_phys; phy_num++) {
92-
ret = phy_init(priv->phys[phy_num]);
93-
if (ret)
94-
goto err_exit_phy;
95-
ret = phy_power_on(priv->phys[phy_num]);
96-
if (ret) {
97-
phy_exit(priv->phys[phy_num]);
98-
goto err_exit_phy;
99-
}
100-
}
101-
10288
return 0;
10389

104-
err_exit_phy:
105-
while (--phy_num >= 0) {
106-
phy_power_off(priv->phys[phy_num]);
107-
phy_exit(priv->phys[phy_num]);
108-
}
10990
err_disable_clks:
11091
while (--clk >= 0)
11192
clk_disable_unprepare(priv->clks[clk]);
@@ -117,12 +98,7 @@ static void ehci_platform_power_off(struct platform_device *dev)
11798
{
11899
struct usb_hcd *hcd = platform_get_drvdata(dev);
119100
struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd);
120-
int clk, phy_num;
121-
122-
for (phy_num = 0; phy_num < priv->num_phys; phy_num++) {
123-
phy_power_off(priv->phys[phy_num]);
124-
phy_exit(priv->phys[phy_num]);
125-
}
101+
int clk;
126102

127103
for (clk = EHCI_MAX_CLKS - 1; clk >= 0; clk--)
128104
if (priv->clks[clk])
@@ -149,7 +125,7 @@ static int ehci_platform_probe(struct platform_device *dev)
149125
struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev);
150126
struct ehci_platform_priv *priv;
151127
struct ehci_hcd *ehci;
152-
int err, irq, phy_num, clk = 0;
128+
int err, irq, clk = 0;
153129

154130
if (usb_disabled())
155131
return -ENODEV;
@@ -202,29 +178,6 @@ static int ehci_platform_probe(struct platform_device *dev)
202178
"has-transaction-translator"))
203179
hcd->has_tt = 1;
204180

205-
priv->num_phys = of_count_phandle_with_args(dev->dev.of_node,
206-
"phys", "#phy-cells");
207-
208-
if (priv->num_phys > 0) {
209-
priv->phys = devm_kcalloc(&dev->dev, priv->num_phys,
210-
sizeof(struct phy *), GFP_KERNEL);
211-
if (!priv->phys)
212-
return -ENOMEM;
213-
} else
214-
priv->num_phys = 0;
215-
216-
for (phy_num = 0; phy_num < priv->num_phys; phy_num++) {
217-
priv->phys[phy_num] = devm_of_phy_get_by_index(
218-
&dev->dev, dev->dev.of_node, phy_num);
219-
if (IS_ERR(priv->phys[phy_num])) {
220-
err = PTR_ERR(priv->phys[phy_num]);
221-
goto err_put_hcd;
222-
} else {
223-
/* Avoiding phy_get() in usb_add_hcd() */
224-
hcd->skip_phy_initialization = 1;
225-
}
226-
}
227-
228181
for (clk = 0; clk < EHCI_MAX_CLKS; clk++) {
229182
priv->clks[clk] = of_clk_get(dev->dev.of_node, clk);
230183
if (IS_ERR(priv->clks[clk])) {
@@ -306,7 +259,7 @@ static int ehci_platform_probe(struct platform_device *dev)
306259
err_put_clks:
307260
while (--clk >= 0)
308261
clk_put(priv->clks[clk]);
309-
err_put_hcd:
262+
310263
if (pdata == &ehci_platform_defaults)
311264
dev->dev.platform_data = NULL;
312265

0 commit comments

Comments
 (0)