Re: [PATCH D 01/11] OMAP: Add clk_get_parent() for OMAP2/3

From: Paul Walmsley
Date: Fri Jan 30 2009 - 01:29:46 EST


On Thu, 29 Jan 2009, Russell King - ARM Linux wrote:

> On Wed, Jan 28, 2009 at 12:18:16PM -0700, Paul Walmsley wrote:
> > From: Mans Rullgard <mans@xxxxxxxxx>
> >
> > This makes clk_get_parent() work on OMAP2/3.
>
> This is clearly something that the generic code should be doing.
> It's not something specific to OMAP2/3. Please move it to
> arch/arm/plat-omap/clock.c

Done; revised patch below.

- Paul


From: Mans Rullgard <mans@xxxxxxxxx>
Date: Thu Jan 29 23:26:35 2009 -0700

OMAP: Add clk_get_parent() for OMAP1/2/3

This makes clk_get_parent() work on OMAP.

linux-omap source commit is efd65273726b12e42c7225bd1703e5252bdb46c0.

Signed-off-by: Måns Rullgård <mans@xxxxxxxxx>
Signed-off-by: Tony Lindgren <tony@xxxxxxxxxxx>
[paul@xxxxxxxxx: per rmk, made this function available on all OMAPs
and fixated its implementation]
Signed-off-by: Paul Walmsley <paul@xxxxxxxxx>

diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index be6aab9..eb59874 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -210,18 +210,7 @@ EXPORT_SYMBOL(clk_set_parent);

struct clk *clk_get_parent(struct clk *clk)
{
- unsigned long flags;
- struct clk * ret = NULL;
-
- if (clk == NULL || IS_ERR(clk))
- return ret;
-
- spin_lock_irqsave(&clockfw_lock, flags);
- if (arch_clock->clk_get_parent)
- ret = arch_clock->clk_get_parent(clk);
- spin_unlock_irqrestore(&clockfw_lock, flags);
-
- return ret;
+ return clk->parent;
}
EXPORT_SYMBOL(clk_get_parent);

diff --git a/arch/arm/plat-omap/include/mach/clock.h b/arch/arm/plat-omap/include/mach/clock.h
index f6adf39..47c9a11 100644
--- a/arch/arm/plat-omap/include/mach/clock.h
+++ b/arch/arm/plat-omap/include/mach/clock.h
@@ -104,7 +104,6 @@ struct clk_functions {
long (*clk_round_rate)(struct clk *clk, unsigned long rate);
int (*clk_set_rate)(struct clk *clk, unsigned long rate);
int (*clk_set_parent)(struct clk *clk, struct clk *parent);
- struct clk * (*clk_get_parent)(struct clk *clk);
void (*clk_allow_idle)(struct clk *clk);
void (*clk_deny_idle)(struct clk *clk);
void (*clk_disable_unused)(struct clk *clk);