Hello. On 02-12-2010 12:25, Felipe Balbi wrote:
musb core doesn't need to know about platform specific details. So start moving clock handling to platform glue layer and make musb core agnostic about that.
Signed-off-by: Felipe Balbi<balbi@xxxxxx>
[...]
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index 9a075bf..052215d 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c
[...]
@@ -551,6 +533,9 @@ static int __init am35x_probe(struct platform_device *pdev) struct platform_device *musb; struct am35x_glue *glue; + struct clk *phy_clk; + struct clk *clk; + int ret = -ENOMEM; glue = kzalloc(sizeof(*glue), GFP_KERNEL); @@ -565,12 +550,40 @@ static int __init am35x_probe(struct platform_device *pdev)
[...]
+ ret = clk_enable(phy_clk); + if (ret) { + dev_err(&pdev->dev, "failed to enable PHY clock\n"); + goto err4; + } + + ret = clk_enable(clk); + if (ret) { + dev_err(&pdev->dev, "failed to enable clock\n"); + goto err5; + }
Is there any point in checking clk_enable() result?
@@ -616,6 +641,10 @@ static int __exit am35x_remove(struct platform_device *pdev) platform_device_put(glue->musb); platform_device_del(glue->musb); + clk_disable(clk); + clk_disable(phy_clk); + clk_put(clk); + clk_put(phy_clok);
Hm, I thought these clock variables were local to am35x_probe() -- I think you need to prepend 'glue->' to them... Have you tried to compile this at all?
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 6c11984..a590bb0 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -510,12 +508,26 @@ static int __init da8xx_probe(struct platform_device *pdev) goto err1; } + clk = clk_get(&pdev->dev, "usb");
This won't work -- the correct clock name is "usb20".
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index bfd3fe9..9ff8a99 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2185,9 +2169,6 @@ fail3: musb_platform_exit(musb); fail2: - if (musb->clock) - clk_put(musb->clock); -
Could have eliminated the label too...
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index f3df3fd..39cb4d8 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -40,6 +40,7 @@ struct omap2430_glue { struct device *dev; struct platform_device *musb; + struct clk *clk; }; static struct timer_list musb_idle_timer; @@ -275,9 +276,6 @@ static int omap2430_suspend(struct musb *musb) { u32 l; - if (!musb->clock) - return 0; - /* in any role */ l = musb_readl(musb->mregs, OTG_FORCESTDBY); l |= ENABLEFORCE; /* enable MSTANDBY */ @@ -289,11 +287,6 @@ static int omap2430_suspend(struct musb *musb) otg_set_suspend(musb->xceiv, 1); - if (musb->set_clock) - musb->set_clock(musb->clock, 0); - else - clk_disable(musb->clock);
Why are you eliminating this altogether?
@@ -301,16 +294,8 @@ static int omap2430_resume(struct musb *musb) { u32 l; - if (!musb->clock) - return 0; - otg_set_suspend(musb->xceiv, 0); - if (musb->set_clock) - musb->set_clock(musb->clock, 1); - else - clk_enable(musb->clock);
Same question here. WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html