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

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 <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
1255dfd1 27b3df41

+5 -51
+5 -51
drivers/usb/host/ohci-platform.c
··· 21 21 #include <linux/kernel.h> 22 22 #include <linux/module.h> 23 23 #include <linux/err.h> 24 - #include <linux/phy/phy.h> 24 + #include <linux/of.h> 25 25 #include <linux/platform_device.h> 26 26 #include <linux/pm_runtime.h> 27 27 #include <linux/reset.h> ··· 38 38 struct ohci_platform_priv { 39 39 struct clk *clks[OHCI_MAX_CLKS]; 40 40 struct reset_control *resets; 41 - struct phy **phys; 42 - int num_phys; 43 41 }; 44 42 45 43 static const char hcd_name[] = "ohci-platform"; ··· 46 48 { 47 49 struct usb_hcd *hcd = platform_get_drvdata(dev); 48 50 struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd); 49 - int clk, ret, phy_num; 51 + int clk, ret; 50 52 51 53 for (clk = 0; clk < OHCI_MAX_CLKS && priv->clks[clk]; clk++) { 52 54 ret = clk_prepare_enable(priv->clks[clk]); ··· 54 56 goto err_disable_clks; 55 57 } 56 58 57 - for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { 58 - ret = phy_init(priv->phys[phy_num]); 59 - if (ret) 60 - goto err_exit_phy; 61 - ret = phy_power_on(priv->phys[phy_num]); 62 - if (ret) { 63 - phy_exit(priv->phys[phy_num]); 64 - goto err_exit_phy; 65 - } 66 - } 67 - 68 59 return 0; 69 60 70 - err_exit_phy: 71 - while (--phy_num >= 0) { 72 - phy_power_off(priv->phys[phy_num]); 73 - phy_exit(priv->phys[phy_num]); 74 - } 75 61 err_disable_clks: 76 62 while (--clk >= 0) 77 63 clk_disable_unprepare(priv->clks[clk]); ··· 67 85 { 68 86 struct usb_hcd *hcd = platform_get_drvdata(dev); 69 87 struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd); 70 - int clk, phy_num; 71 - 72 - for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { 73 - phy_power_off(priv->phys[phy_num]); 74 - phy_exit(priv->phys[phy_num]); 75 - } 88 + int clk; 76 89 77 90 for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--) 78 91 if (priv->clks[clk]) ··· 94 117 struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev); 95 118 struct ohci_platform_priv *priv; 96 119 struct ohci_hcd *ohci; 97 - int err, irq, phy_num, clk = 0; 120 + int err, irq, clk = 0; 98 121 99 122 if (usb_disabled()) 100 123 return -ENODEV; ··· 145 168 146 169 of_property_read_u32(dev->dev.of_node, "num-ports", 147 170 &ohci->num_ports); 148 - 149 - priv->num_phys = of_count_phandle_with_args(dev->dev.of_node, 150 - "phys", "#phy-cells"); 151 - 152 - if (priv->num_phys > 0) { 153 - priv->phys = devm_kcalloc(&dev->dev, priv->num_phys, 154 - sizeof(struct phy *), GFP_KERNEL); 155 - if (!priv->phys) 156 - return -ENOMEM; 157 - } else 158 - priv->num_phys = 0; 159 - 160 - for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { 161 - priv->phys[phy_num] = devm_of_phy_get_by_index( 162 - &dev->dev, dev->dev.of_node, phy_num); 163 - if (IS_ERR(priv->phys[phy_num])) { 164 - err = PTR_ERR(priv->phys[phy_num]); 165 - goto err_put_hcd; 166 - } else { 167 - /* Avoiding phy_get() in usb_add_hcd() */ 168 - hcd->skip_phy_initialization = 1; 169 - } 170 - } 171 171 172 172 for (clk = 0; clk < OHCI_MAX_CLKS; clk++) { 173 173 priv->clks[clk] = of_clk_get(dev->dev.of_node, clk); ··· 231 277 err_put_clks: 232 278 while (--clk >= 0) 233 279 clk_put(priv->clks[clk]); 234 - err_put_hcd: 280 + 235 281 if (pdata == &ohci_platform_defaults) 236 282 dev->dev.platform_data = NULL; 237 283