]> err.no Git - linux-2.6/commitdiff
[ARM] 3628/1: S3C24XX: add get_rate call to struct clk
authorBen Dooks <ben-linux@fluff.org>
Thu, 22 Jun 2006 21:18:21 +0000 (22:18 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 22 Jun 2006 21:18:21 +0000 (22:18 +0100)
Patch from Ben Dooks

Add a get_rate call to allow an given clock
to over-ride the clk_get_rate() call.

This provides support for clocks which rely on
division of their parent to correctly report
their frequency when the parent can also change.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-s3c2410/clock.c
arch/arm/mach-s3c2410/clock.h

index f553e5ee747718c3388b2eb65dbd16b70fc82ff6..c5c93c333ac637e2eabc1af663956810b7f9bcc8 100644 (file)
@@ -148,8 +148,11 @@ unsigned long clk_get_rate(struct clk *clk)
        if (clk->rate != 0)
                return clk->rate;
 
-       while (clk->parent != NULL && clk->rate == 0)
-               clk = clk->parent;
+       if (clk->get_rate != NULL)
+               return (clk->get_rate)(clk);
+
+       if (clk->parent != NULL)
+               return clk_get_rate(clk->parent);
 
        return clk->rate;
 }
index 1bee5708c354c37501181c29c5a8eb5c3246960f..9456c81eb5d3fa67ee64227aba628ab7e640a087 100644 (file)
@@ -22,6 +22,7 @@ struct clk {
 
        int                 (*enable)(struct clk *, int enable);
        int                 (*set_rate)(struct clk *c, unsigned long rate);
+       unsigned long       (*get_rate)(struct clk *c);
        unsigned long       (*round_rate)(struct clk *c, unsigned long rate);
        int                 (*set_parent)(struct clk *c, struct clk *parent);
 };