On Tue, Aug 25, 2009 at 19:19:56, Kevin Hilman wrote:
> Nori, Sekhar <[email protected]> writes:
>
> > Update the clock framework for dynamic CPU frequency change.
> >
> > clk_round_rate, clk_set_rate have been updated to handle dynamic frequency
> > changes.
> >
> > davinci_set_pllrate() changes the PLL rate of a given PLL. This function
> > has been presented as a generic function though it has been tested only
> > on OMAP-L138 EVM. No other currently available DaVinci device will probably
> > use this function, but any future device specific changes will hopefully be
> > small enough to get taken care using a cpu_is_xxx() macro.
> >
> > The clk_set_parent() API is implemented to reparent clocks to
> > asynchronous domains where possible and insulate them from frequency
> > changes.
> >
> > An inline function is introduced to get to the parent PLL of a given
> > clock. This is useful in finding out all the clocks which gets
> > affected by a PLL rate change.
> >
> > Finally, another function is implemented to recalculate the PLL derived
> > rates after the PLL rate has been changed.
> >
> > Tested on OMAP-L138 EVM.
> >
> > Signed-off-by: Sekhar Nori <[email protected]>
>
> Looks pretty good, minor comment below. And would also be nice to at
> least boot test on one of the DM* boards.
Right, honestly haven't done that so far :)
>
> > ---
> > arch/arm/mach-davinci/clock.c | 140
> > ++++++++++++++++++++++++++++++++++++++++-
> > arch/arm/mach-davinci/clock.h | 18 +++++
> > 2 files changed, 155 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
> > index 83d54d5..5cbb95e 100644
> > --- a/arch/arm/mach-davinci/clock.c
> > +++ b/arch/arm/mach-davinci/clock.c
> > @@ -19,6 +19,7 @@
> > #include <linux/mutex.h>
> > #include <linux/platform_device.h>
> > #include <linux/io.h>
> > +#include <linux/delay.h>
> >
> > #include <mach/hardware.h>
> >
> > @@ -99,20 +100,50 @@ long clk_round_rate(struct clk *clk, unsigned long
> > rate)
> > if (clk == NULL || IS_ERR(clk))
> > return -EINVAL;
> >
> > + if (clk->round_rate)
> > + return clk->round_rate(clk, rate);
> > +
> > return clk->rate;
> > }
> > EXPORT_SYMBOL(clk_round_rate);
> >
> > int clk_set_rate(struct clk *clk, unsigned long rate)
> > {
> > + unsigned long flags;
> > + int ret = -EINVAL;
> > +
> > if (clk == NULL || IS_ERR(clk))
> > - return -EINVAL;
> > + return ret;
>
> should probably also check for a non-NULL clk->set_rate here since
> it's only defined for da850 currently.
There is a check further down in this function, you ask
to pull it further up?
- /* changing the clk rate is not supported */
- return -EINVAL;
+ spin_lock_irqsave(&clockfw_lock, flags);
+ if (clk->set_rate)
+ ret = clk->set_rate(clk, rate);
+ spin_unlock_irqrestore(&clockfw_lock, flags);
Thanks,
Sekhar
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source