Merge branch 'nfs-for-2.6.35' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
[pandora-kernel.git] / arch / sh / kernel / cpu / sh4a / clock-sh7780.c
index a249d82..62d7063 100644 (file)
@@ -11,6 +11,8 @@
  */
 #include <linux/init.h>
 #include <linux/kernel.h>
+#include <linux/io.h>
+#include <asm/clkdev.h>
 #include <asm/clock.h>
 #include <asm/freq.h>
 #include <asm/io.h>
@@ -22,7 +24,7 @@ static int cfc_divisors[] = { 1, 1, 4, 1, 6, 1, 1, 1 };
 
 static void master_clk_init(struct clk *clk)
 {
-       clk->rate *= pfc_divisors[ctrl_inl(FRQCR) & 0x0003];
+       clk->rate *= pfc_divisors[__raw_readl(FRQCR) & 0x0003];
 }
 
 static struct clk_ops sh7780_master_clk_ops = {
@@ -31,7 +33,7 @@ static struct clk_ops sh7780_master_clk_ops = {
 
 static unsigned long module_clk_recalc(struct clk *clk)
 {
-       int idx = (ctrl_inl(FRQCR) & 0x0003);
+       int idx = (__raw_readl(FRQCR) & 0x0003);
        return clk->parent->rate / pfc_divisors[idx];
 }
 
@@ -41,7 +43,7 @@ static struct clk_ops sh7780_module_clk_ops = {
 
 static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> 16) & 0x0007);
+       int idx = ((__raw_readl(FRQCR) >> 16) & 0x0007);
        return clk->parent->rate / bfc_divisors[idx];
 }
 
@@ -51,7 +53,7 @@ static struct clk_ops sh7780_bus_clk_ops = {
 
 static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> 24) & 0x0001);
+       int idx = ((__raw_readl(FRQCR) >> 24) & 0x0001);
        return clk->parent->rate / ifc_divisors[idx];
 }
 
@@ -74,7 +76,7 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
 
 static unsigned long shyway_clk_recalc(struct clk *clk)
 {
-       int idx = ((ctrl_inl(FRQCR) >> 20) & 0x0007);
+       int idx = ((__raw_readl(FRQCR) >> 20) & 0x0007);
        return clk->parent->rate / cfc_divisors[idx];
 }
 
@@ -83,7 +85,6 @@ static struct clk_ops sh7780_shyway_clk_ops = {
 };
 
 static struct clk sh7780_shyway_clk = {
-       .name           = "shyway_clk",
        .flags          = CLK_ENABLE_ON_INIT,
        .ops            = &sh7780_shyway_clk_ops,
 };
@@ -96,6 +97,13 @@ static struct clk *sh7780_onchip_clocks[] = {
        &sh7780_shyway_clk,
 };
 
+#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
+
+static struct clk_lookup lookups[] = {
+       /* main clocks */
+       CLKDEV_CON_ID("shyway_clk", &sh7780_shyway_clk),
+};
+
 int __init arch_clk_init(void)
 {
        struct clk *clk;
@@ -113,5 +121,7 @@ int __init arch_clk_init(void)
 
        clk_put(clk);
 
+       clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+
        return ret;
 }