Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <martin.blumenstingl@googlemail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Neil Armstrong <narmstrong@baylibre.con>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Martin Blumenstingl and committed by
Greg Kroah-Hartman
27b3df41 6ae9f506

+4 -51
+4 -51
drivers/usb/host/ehci-platform.c
··· 27 27 #include <linux/io.h> 28 28 #include <linux/module.h> 29 29 #include <linux/of.h> 30 - #include <linux/phy/phy.h> 31 30 #include <linux/platform_device.h> 32 31 #include <linux/reset.h> 33 32 #include <linux/usb.h> ··· 43 44 struct ehci_platform_priv { 44 45 struct clk *clks[EHCI_MAX_CLKS]; 45 46 struct reset_control *rsts; 46 - struct phy **phys; 47 - int num_phys; 48 47 bool reset_on_resume; 49 48 }; 50 49 ··· 77 80 { 78 81 struct usb_hcd *hcd = platform_get_drvdata(dev); 79 82 struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); 80 - int clk, ret, phy_num; 83 + int clk, ret; 81 84 82 85 for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) { 83 86 ret = clk_prepare_enable(priv->clks[clk]); ··· 85 88 goto err_disable_clks; 86 89 } 87 90 88 - for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { 89 - ret = phy_init(priv->phys[phy_num]); 90 - if (ret) 91 - goto err_exit_phy; 92 - ret = phy_power_on(priv->phys[phy_num]); 93 - if (ret) { 94 - phy_exit(priv->phys[phy_num]); 95 - goto err_exit_phy; 96 - } 97 - } 98 - 99 91 return 0; 100 92 101 - err_exit_phy: 102 - while (--phy_num >= 0) { 103 - phy_power_off(priv->phys[phy_num]); 104 - phy_exit(priv->phys[phy_num]); 105 - } 106 93 err_disable_clks: 107 94 while (--clk >= 0) 108 95 clk_disable_unprepare(priv->clks[clk]); ··· 98 117 { 99 118 struct usb_hcd *hcd = platform_get_drvdata(dev); 100 119 struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); 101 - int clk, phy_num; 102 - 103 - for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { 104 - phy_power_off(priv->phys[phy_num]); 105 - phy_exit(priv->phys[phy_num]); 106 - } 120 + int clk; 107 121 108 122 for (clk = EHCI_MAX_CLKS - 1; clk >= 0; clk--) 109 123 if (priv->clks[clk]) ··· 125 149 struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev); 126 150 struct ehci_platform_priv *priv; 127 151 struct ehci_hcd *ehci; 128 - int err, irq, phy_num, clk = 0; 152 + int err, irq, clk = 0; 129 153 130 154 if (usb_disabled()) 131 155 return -ENODEV; ··· 177 201 if (of_property_read_bool(dev->dev.of_node, 178 202 "has-transaction-translator")) 179 203 hcd->has_tt = 1; 180 - 181 - priv->num_phys = of_count_phandle_with_args(dev->dev.of_node, 182 - "phys", "#phy-cells"); 183 - 184 - if (priv->num_phys > 0) { 185 - priv->phys = devm_kcalloc(&dev->dev, priv->num_phys, 186 - sizeof(struct phy *), GFP_KERNEL); 187 - if (!priv->phys) 188 - return -ENOMEM; 189 - } else 190 - priv->num_phys = 0; 191 - 192 - for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { 193 - priv->phys[phy_num] = devm_of_phy_get_by_index( 194 - &dev->dev, dev->dev.of_node, phy_num); 195 - if (IS_ERR(priv->phys[phy_num])) { 196 - err = PTR_ERR(priv->phys[phy_num]); 197 - goto err_put_hcd; 198 - } else { 199 - /* Avoiding phy_get() in usb_add_hcd() */ 200 - hcd->skip_phy_initialization = 1; 201 - } 202 - } 203 204 204 205 for (clk = 0; clk < EHCI_MAX_CLKS; clk++) { 205 206 priv->clks[clk] = of_clk_get(dev->dev.of_node, clk); ··· 259 306 err_put_clks: 260 307 while (--clk >= 0) 261 308 clk_put(priv->clks[clk]); 262 - err_put_hcd: 309 + 263 310 if (pdata == &ehci_platform_defaults) 264 311 dev->dev.platform_data = NULL; 265 312