ARM: S3C2443: Add get_rate operation for clk_armdiv
authorHeiko Stuebner <heiko@sntech.de>
Fri, 14 Oct 2011 06:08:56 +0000 (15:08 +0900)
committerKukjin Kim <kgene.kim@samsung.com>
Fri, 14 Oct 2011 06:15:51 +0000 (15:15 +0900)
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
arch/arm/plat-s3c24xx/s3c2443-clock.c

index f9c5b0343cf3d5e5c67146c660a6a422ab1a8b3f..fea3d5c0252e2a7546a7f74e60e2b933f5b95d00 100644 (file)
@@ -189,6 +189,19 @@ static unsigned long s3c2443_armclk_roundrate(struct clk *clk,
        return parent / best;
 }
 
+static unsigned long s3c2443_armclk_getrate(struct clk *clk)
+{
+       unsigned long rate = clk_get_rate(clk->parent);
+       unsigned long clkcon0;
+       int val;
+
+       clkcon0 = __raw_readl(S3C2443_CLKDIV0);
+       clkcon0 &= armdivmask;
+       val = clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT;
+
+       return rate / armdiv[val];
+}
+
 static int s3c2443_armclk_setrate(struct clk *clk, unsigned long rate)
 {
        unsigned long parent = clk_get_rate(clk->parent);
@@ -224,6 +237,7 @@ static struct clk clk_armdiv = {
        .parent         = &clk_msysclk.clk,
        .ops            = &(struct clk_ops) {
                .round_rate = s3c2443_armclk_roundrate,
+               .get_rate = s3c2443_armclk_getrate,
                .set_rate = s3c2443_armclk_setrate,
        },
 };