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>
This commit is contained in:
parent
a6d3a6622e
commit
6c984b066d
3 changed files with 14 additions and 24 deletions
|
@ -100,9 +100,6 @@ extern void usb_musb_init(struct omap_musb_board_data *board_data);
|
||||||
|
|
||||||
extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
|
extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
|
||||||
|
|
||||||
extern int omap_usbhs_enable(struct device *dev);
|
|
||||||
extern void omap_usbhs_disable(struct device *dev);
|
|
||||||
|
|
||||||
extern int omap4430_phy_power(struct device *dev, int ID, int on);
|
extern int omap4430_phy_power(struct device *dev, int ID, int on);
|
||||||
extern int omap4430_phy_set_clk(struct device *dev, int on);
|
extern int omap4430_phy_set_clk(struct device *dev, int on);
|
||||||
extern int omap4430_phy_init(struct device *dev);
|
extern int omap4430_phy_init(struct device *dev);
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include <linux/usb/ulpi.h>
|
#include <linux/usb/ulpi.h>
|
||||||
#include <plat/usb.h>
|
#include <plat/usb.h>
|
||||||
#include <linux/regulator/consumer.h>
|
#include <linux/regulator/consumer.h>
|
||||||
|
#include <linux/pm_runtime.h>
|
||||||
|
|
||||||
/* EHCI Register Set */
|
/* EHCI Register Set */
|
||||||
#define EHCI_INSNREG04 (0xA0)
|
#define EHCI_INSNREG04 (0xA0)
|
||||||
|
@ -190,11 +191,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = omap_usbhs_enable(dev);
|
pm_runtime_enable(dev);
|
||||||
if (ret) {
|
pm_runtime_get_sync(dev);
|
||||||
dev_err(dev, "failed to start usbhs with err %d\n", ret);
|
|
||||||
goto err_enable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An undocumented "feature" in the OMAP3 EHCI controller,
|
* An undocumented "feature" in the OMAP3 EHCI controller,
|
||||||
|
@ -240,11 +238,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_add_hcd:
|
err_add_hcd:
|
||||||
omap_usbhs_disable(dev);
|
|
||||||
|
|
||||||
err_enable:
|
|
||||||
disable_put_regulator(pdata);
|
disable_put_regulator(pdata);
|
||||||
usb_put_hcd(hcd);
|
pm_runtime_put_sync(dev);
|
||||||
|
|
||||||
err_io:
|
err_io:
|
||||||
iounmap(regs);
|
iounmap(regs);
|
||||||
|
@ -266,10 +261,12 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)
|
||||||
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
||||||
|
|
||||||
usb_remove_hcd(hcd);
|
usb_remove_hcd(hcd);
|
||||||
omap_usbhs_disable(dev);
|
|
||||||
disable_put_regulator(dev->platform_data);
|
disable_put_regulator(dev->platform_data);
|
||||||
iounmap(hcd->regs);
|
iounmap(hcd->regs);
|
||||||
usb_put_hcd(hcd);
|
usb_put_hcd(hcd);
|
||||||
|
pm_runtime_put_sync(dev);
|
||||||
|
pm_runtime_disable(dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <plat/usb.h>
|
#include <plat/usb.h>
|
||||||
|
#include <linux/pm_runtime.h>
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -134,7 +135,7 @@ static int __devinit ohci_hcd_omap3_probe(struct platform_device *pdev)
|
||||||
int irq;
|
int irq;
|
||||||
|
|
||||||
if (usb_disabled())
|
if (usb_disabled())
|
||||||
goto err_end;
|
return -ENODEV;
|
||||||
|
|
||||||
if (!dev->parent) {
|
if (!dev->parent) {
|
||||||
dev_err(dev, "Missing parent device\n");
|
dev_err(dev, "Missing parent device\n");
|
||||||
|
@ -172,11 +173,8 @@ static int __devinit ohci_hcd_omap3_probe(struct platform_device *pdev)
|
||||||
hcd->rsrc_len = resource_size(res);
|
hcd->rsrc_len = resource_size(res);
|
||||||
hcd->regs = regs;
|
hcd->regs = regs;
|
||||||
|
|
||||||
ret = omap_usbhs_enable(dev);
|
pm_runtime_enable(dev);
|
||||||
if (ret) {
|
pm_runtime_get_sync(dev);
|
||||||
dev_dbg(dev, "failed to start ohci\n");
|
|
||||||
goto err_end;
|
|
||||||
}
|
|
||||||
|
|
||||||
ohci_hcd_init(hcd_to_ohci(hcd));
|
ohci_hcd_init(hcd_to_ohci(hcd));
|
||||||
|
|
||||||
|
@ -189,9 +187,7 @@ static int __devinit ohci_hcd_omap3_probe(struct platform_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_add_hcd:
|
err_add_hcd:
|
||||||
omap_usbhs_disable(dev);
|
pm_runtime_put_sync(dev);
|
||||||
|
|
||||||
err_end:
|
|
||||||
usb_put_hcd(hcd);
|
usb_put_hcd(hcd);
|
||||||
|
|
||||||
err_io:
|
err_io:
|
||||||
|
@ -220,9 +216,9 @@ static int __devexit ohci_hcd_omap3_remove(struct platform_device *pdev)
|
||||||
|
|
||||||
iounmap(hcd->regs);
|
iounmap(hcd->regs);
|
||||||
usb_remove_hcd(hcd);
|
usb_remove_hcd(hcd);
|
||||||
omap_usbhs_disable(dev);
|
pm_runtime_put_sync(dev);
|
||||||
|
pm_runtime_disable(dev);
|
||||||
usb_put_hcd(hcd);
|
usb_put_hcd(hcd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue