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

ARM: OMAP: USBHOST: Replace usbhs core driver APIs by Runtime pm APIs

The ehci and ohci drivers does not use the APIs of the usbhs
core driver; the runtime pm APIs are used for clock
enable/disable. Since usbhs is parent platform device of the
ehci and ohci devices, the runtime apis indirectly uses the
usb hs core device as input parameter to for clock functions.

Signed-off-by: Keshava Munegowda <keshava_mgowda@ti.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Reviewed-by: Partha Basak <parthab@india.ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Paul Walmsley <paul@pwsan.com>

authored by

Keshava Munegowda and committed by
Paul Walmsley
6c984b06 a6d3a662

+14 -24
-3
arch/arm/plat-omap/include/plat/usb.h
··· 100 100 101 101 extern void usbhs_init(const struct usbhs_omap_board_data *pdata); 102 102 103 - extern int omap_usbhs_enable(struct device *dev); 104 - extern void omap_usbhs_disable(struct device *dev); 105 - 106 103 extern int omap4430_phy_power(struct device *dev, int ID, int on); 107 104 extern int omap4430_phy_set_clk(struct device *dev, int on); 108 105 extern int omap4430_phy_init(struct device *dev);
+7 -10
drivers/usb/host/ehci-omap.c
··· 41 41 #include <linux/usb/ulpi.h> 42 42 #include <plat/usb.h> 43 43 #include <linux/regulator/consumer.h> 44 + #include <linux/pm_runtime.h> 44 45 45 46 /* EHCI Register Set */ 46 47 #define EHCI_INSNREG04 (0xA0) ··· 191 190 } 192 191 } 193 192 194 - ret = omap_usbhs_enable(dev); 195 - if (ret) { 196 - dev_err(dev, "failed to start usbhs with err %d\n", ret); 197 - goto err_enable; 198 - } 193 + pm_runtime_enable(dev); 194 + pm_runtime_get_sync(dev); 199 195 200 196 /* 201 197 * An undocumented "feature" in the OMAP3 EHCI controller, ··· 238 240 return 0; 239 241 240 242 err_add_hcd: 241 - omap_usbhs_disable(dev); 242 - 243 - err_enable: 244 243 disable_put_regulator(pdata); 245 - usb_put_hcd(hcd); 244 + pm_runtime_put_sync(dev); 246 245 247 246 err_io: 248 247 iounmap(regs); ··· 261 266 struct usb_hcd *hcd = dev_get_drvdata(dev); 262 267 263 268 usb_remove_hcd(hcd); 264 - omap_usbhs_disable(dev); 265 269 disable_put_regulator(dev->platform_data); 266 270 iounmap(hcd->regs); 267 271 usb_put_hcd(hcd); 272 + pm_runtime_put_sync(dev); 273 + pm_runtime_disable(dev); 274 + 268 275 return 0; 269 276 } 270 277
+7 -11
drivers/usb/host/ohci-omap3.c
··· 31 31 32 32 #include <linux/platform_device.h> 33 33 #include <plat/usb.h> 34 + #include <linux/pm_runtime.h> 34 35 35 36 /*-------------------------------------------------------------------------*/ 36 37 ··· 135 134 int irq; 136 135 137 136 if (usb_disabled()) 138 - goto err_end; 137 + return -ENODEV; 139 138 140 139 if (!dev->parent) { 141 140 dev_err(dev, "Missing parent device\n"); ··· 173 172 hcd->rsrc_len = resource_size(res); 174 173 hcd->regs = regs; 175 174 176 - ret = omap_usbhs_enable(dev); 177 - if (ret) { 178 - dev_dbg(dev, "failed to start ohci\n"); 179 - goto err_end; 180 - } 175 + pm_runtime_enable(dev); 176 + pm_runtime_get_sync(dev); 181 177 182 178 ohci_hcd_init(hcd_to_ohci(hcd)); 183 179 ··· 187 189 return 0; 188 190 189 191 err_add_hcd: 190 - omap_usbhs_disable(dev); 191 - 192 - err_end: 192 + pm_runtime_put_sync(dev); 193 193 usb_put_hcd(hcd); 194 194 195 195 err_io: ··· 216 220 217 221 iounmap(hcd->regs); 218 222 usb_remove_hcd(hcd); 219 - omap_usbhs_disable(dev); 223 + pm_runtime_put_sync(dev); 224 + pm_runtime_disable(dev); 220 225 usb_put_hcd(hcd); 221 - 222 226 return 0; 223 227 } 224 228