Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 227009
b: refs/heads/master
c: 6f783e2
h: refs/heads/master
i:
  227007: 45198f3
v: v3
  • Loading branch information
Felipe Balbi committed Dec 10, 2010
1 parent b03bce2 commit e2615c0
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c20aebb92796cf54ae8171ad7f53a8fa7c61d2d8
refs/heads/master: 6f783e287c074afe1e9cf3f32ded9948e184b45e
62 changes: 45 additions & 17 deletions trunk/drivers/usb/musb/am35x.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ struct am35x_glue {
struct clk *phy_clk;
struct clk *clk;
};
#define glue_to_musb(g) platform_get_drvdata(g->musb)

static inline void phy_on(void)
{
Expand Down Expand Up @@ -462,20 +463,6 @@ static int am35x_musb_exit(struct musb *musb)
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 */
void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
{
Expand Down Expand Up @@ -516,9 +503,6 @@ static const struct musb_platform_ops am35x_ops = {
.set_mode = am35x_musb_set_mode,
.try_idle = am35x_musb_try_idle,

.suspend = am35x_musb_suspend,
.resume = am35x_musb_resume,

.set_vbus = am35x_musb_set_vbus,
};

Expand Down Expand Up @@ -644,10 +628,54 @@ static int __exit am35x_remove(struct platform_device *pdev)
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 = {
.remove = __exit_p(am35x_remove),
.driver = {
.name = "musb-am35x",
.pm = DEV_PM_OPS,
},
};

Expand Down

0 comments on commit e2615c0

Please sign in to comment.