Revert "clocksource: Load the ACPI PM clocksource asynchronously"
[linux-2.6.git] / drivers / clocksource / sh_tmu.c
index 3423945..97f54b6 100644 (file)
@@ -30,6 +30,9 @@
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
 #include <linux/sh_timer.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/pm_domain.h>
 
 struct sh_tmu_priv {
        void __iomem *mapbase;
@@ -201,13 +204,9 @@ static int sh_tmu_clocksource_enable(struct clocksource *cs)
        int ret;
 
        ret = sh_tmu_enable(p);
-       if (ret)
-               return ret;
-
-       /* TODO: calculate good shift from rate and counter bit width */
-       cs->shift = 10;
-       cs->mult = clocksource_hz2mult(p->rate, cs->shift);
-       return 0;
+       if (!ret)
+               __clocksource_updatefreq_hz(cs, p->rate);
+       return ret;
 }
 
 static void sh_tmu_clocksource_disable(struct clocksource *cs)
@@ -227,8 +226,11 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p,
        cs->disable = sh_tmu_clocksource_disable;
        cs->mask = CLOCKSOURCE_MASK(32);
        cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
+
        dev_info(&p->pdev->dev, "used as clock source\n");
-       clocksource_register(cs);
+
+       /* Register with dummy 1 Hz value, gets updated in ->enable() */
+       clocksource_register_hz(cs, 1);
        return 0;
 }
 
@@ -384,10 +386,11 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev)
        p->irqaction.handler = sh_tmu_interrupt;
        p->irqaction.dev_id = p;
        p->irqaction.irq = irq;
-       p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL;
+       p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | \
+                            IRQF_IRQPOLL  | IRQF_NOBALANCING;
 
        /* get hold of clock */
-       p->clk = clk_get(&p->pdev->dev, cfg->clk);
+       p->clk = clk_get(&p->pdev->dev, "tmu_fck");
        if (IS_ERR(p->clk)) {
                dev_err(&p->pdev->dev, "cannot get clock\n");
                ret = PTR_ERR(p->clk);
@@ -408,6 +411,9 @@ static int __devinit sh_tmu_probe(struct platform_device *pdev)
        struct sh_tmu_priv *p = platform_get_drvdata(pdev);
        int ret;
 
+       if (!is_early_platform_device(pdev))
+               pm_genpd_dev_always_on(&pdev->dev, true);
+
        if (p) {
                dev_info(&pdev->dev, "kept as earlytimer\n");
                return 0;