Merge branch 'dt/gic' into next/dt
[pandora-kernel.git] / arch / arm / mach-omap2 / timer.c
index f1e3ec1..e49fc7b 100644 (file)
@@ -44,6 +44,9 @@
 #include <plat/common.h>
 #include <plat/omap_hwmod.h>
 #include <plat/omap_device.h>
+#include <plat/omap-pm.h>
+
+#include "powerdomain.h"
 
 /* Parent clocks, eventually these will come from the clock framework */
 
@@ -431,8 +434,9 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
        int ret = 0;
        char *name = "omap_timer";
        struct dmtimer_platform_data *pdata;
-       struct omap_device *od;
+       struct platform_device *pdev;
        struct omap_timer_capability_dev_attr *timer_dev_attr;
+       struct powerdomain *pwrdm;
 
        pr_debug("%s: %s\n", __func__, oh->name);
 
@@ -467,12 +471,17 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
        if ((sys_timer_reserved >> (id - 1)) & 0x1)
                pdata->reserved = 1;
 
-       od = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
+       pwrdm = omap_hwmod_get_pwrdm(oh);
+       pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
+#ifdef CONFIG_PM
+       pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
+#endif
+       pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
                        omap2_dmtimer_latency,
                        ARRAY_SIZE(omap2_dmtimer_latency),
                        0);
 
-       if (IS_ERR(od)) {
+       if (IS_ERR(pdev)) {
                pr_err("%s: Can't build omap_device for %s: %s.\n",
                        __func__, name, oh->name);
                ret = -EINVAL;