Loading drivers/usb/musb/am35x.c +45 −17 Original line number Original line Diff line number Diff line Loading @@ -88,6 +88,7 @@ struct am35x_glue { struct clk *phy_clk; struct clk *phy_clk; struct clk *clk; struct clk *clk; }; }; #define glue_to_musb(g) platform_get_drvdata(g->musb) static inline void phy_on(void) static inline void phy_on(void) { { Loading Loading @@ -462,20 +463,6 @@ static int am35x_musb_exit(struct musb *musb) return 0; return 0; } } static int am35x_musb_suspend(struct musb *musb) { phy_off(); return 0; } static int am35x_musb_resume(struct musb *musb) { phy_on(); return 0; } /* AM35x supports only 32bit read operation */ /* AM35x supports only 32bit read operation */ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) { { Loading Loading @@ -516,9 +503,6 @@ static const struct musb_platform_ops am35x_ops = { .set_mode = am35x_musb_set_mode, .set_mode = am35x_musb_set_mode, .try_idle = am35x_musb_try_idle, .try_idle = am35x_musb_try_idle, .suspend = am35x_musb_suspend, .resume = am35x_musb_resume, .set_vbus = am35x_musb_set_vbus, .set_vbus = am35x_musb_set_vbus, }; }; Loading Loading @@ -644,10 +628,54 @@ static int __exit am35x_remove(struct platform_device *pdev) return 0; return 0; } } #ifdef CONFIG_PM static int am35x_suspend(struct device *dev) { struct am35x_glue *glue = dev_get_drvdata(dev); phy_off(); clk_disable(glue->phy_clk); clk_disable(glue->clk); return 0; } static int am35x_resume(struct device *dev) { struct am35x_glue *glue = dev_get_drvdata(dev); int ret; phy_on(); ret = clk_enable(glue->phy_clk); if (ret) { dev_err(dev, "failed to enable PHY clock\n"); return ret; } ret = clk_enable(glue->clk); if (ret) { dev_err(dev, "failed to enable clock\n"); return ret; } return 0; } static struct dev_pm_ops am35x_pm_ops = { .suspend = am35x_suspend, .resume = am35x_resume, }; #define DEV_PM_OPS &am35x_pm_ops #else #define DEV_PM_OPS NULL #endif static struct platform_driver am35x_driver = { static struct platform_driver am35x_driver = { .remove = __exit_p(am35x_remove), .remove = __exit_p(am35x_remove), .driver = { .driver = { .name = "musb-am35x", .name = "musb-am35x", .pm = DEV_PM_OPS, }, }, }; }; Loading Loading
drivers/usb/musb/am35x.c +45 −17 Original line number Original line Diff line number Diff line Loading @@ -88,6 +88,7 @@ struct am35x_glue { struct clk *phy_clk; struct clk *phy_clk; struct clk *clk; struct clk *clk; }; }; #define glue_to_musb(g) platform_get_drvdata(g->musb) static inline void phy_on(void) static inline void phy_on(void) { { Loading Loading @@ -462,20 +463,6 @@ static int am35x_musb_exit(struct musb *musb) return 0; return 0; } } static int am35x_musb_suspend(struct musb *musb) { phy_off(); return 0; } static int am35x_musb_resume(struct musb *musb) { phy_on(); return 0; } /* AM35x supports only 32bit read operation */ /* AM35x supports only 32bit read operation */ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) { { Loading Loading @@ -516,9 +503,6 @@ static const struct musb_platform_ops am35x_ops = { .set_mode = am35x_musb_set_mode, .set_mode = am35x_musb_set_mode, .try_idle = am35x_musb_try_idle, .try_idle = am35x_musb_try_idle, .suspend = am35x_musb_suspend, .resume = am35x_musb_resume, .set_vbus = am35x_musb_set_vbus, .set_vbus = am35x_musb_set_vbus, }; }; Loading Loading @@ -644,10 +628,54 @@ static int __exit am35x_remove(struct platform_device *pdev) return 0; return 0; } } #ifdef CONFIG_PM static int am35x_suspend(struct device *dev) { struct am35x_glue *glue = dev_get_drvdata(dev); phy_off(); clk_disable(glue->phy_clk); clk_disable(glue->clk); return 0; } static int am35x_resume(struct device *dev) { struct am35x_glue *glue = dev_get_drvdata(dev); int ret; phy_on(); ret = clk_enable(glue->phy_clk); if (ret) { dev_err(dev, "failed to enable PHY clock\n"); return ret; } ret = clk_enable(glue->clk); if (ret) { dev_err(dev, "failed to enable clock\n"); return ret; } return 0; } static struct dev_pm_ops am35x_pm_ops = { .suspend = am35x_suspend, .resume = am35x_resume, }; #define DEV_PM_OPS &am35x_pm_ops #else #define DEV_PM_OPS NULL #endif static struct platform_driver am35x_driver = { static struct platform_driver am35x_driver = { .remove = __exit_p(am35x_remove), .remove = __exit_p(am35x_remove), .driver = { .driver = { .name = "musb-am35x", .name = "musb-am35x", .pm = DEV_PM_OPS, }, }, }; }; Loading