aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantosh Shilimkar <santosh.shilimkar@ti.com>2010-09-14 15:33:59 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2010-09-23 20:14:09 -0400
commit86b0c1e3c07f7fc3a8197a934d9a04476061bed9 (patch)
treeae57143e3acafee1820b466391ae707847407b20
parentb3294e2327718e9487e662d1392b36b39f07d70b (diff)
omap: pm-debug: Move common debug code to pm-debug.c
This patch moves omap2_pm_wakeup_on_timer() and pm debug entries form pm34xx.c to pm-debug.c and export it, so that it is available to other OMAPs Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
-rw-r--r--arch/arm/mach-omap2/pm-debug.c18
-rw-r--r--arch/arm/mach-omap2/pm.h2
-rw-r--r--arch/arm/mach-omap2/pm34xx.c18
3 files changed, 20 insertions, 18 deletions
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 056ff17f7c38..655f9dfd6ef4 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -31,6 +31,7 @@
31#include <plat/board.h> 31#include <plat/board.h>
32#include <plat/powerdomain.h> 32#include <plat/powerdomain.h>
33#include <plat/clockdomain.h> 33#include <plat/clockdomain.h>
34#include <plat/dmtimer.h>
34 35
35#include "prm.h" 36#include "prm.h"
36#include "cm.h" 37#include "cm.h"
@@ -353,6 +354,23 @@ void pm_dbg_update_time(struct powerdomain *pwrdm, int prev)
353 pwrdm->timer = t; 354 pwrdm->timer = t;
354} 355}
355 356
357void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds)
358{
359 u32 tick_rate, cycles;
360
361 if (!seconds && !milliseconds)
362 return;
363
364 tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup));
365 cycles = tick_rate * seconds + tick_rate * milliseconds / 1000;
366 omap_dm_timer_stop(gptimer_wakeup);
367 omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles);
368
369 pr_info("PM: Resume timer in %u.%03u secs"
370 " (%d ticks at %d ticks/sec.)\n",
371 seconds, milliseconds, cycles, tick_rate);
372}
373
356static int clkdm_dbg_show_counter(struct clockdomain *clkdm, void *user) 374static int clkdm_dbg_show_counter(struct clockdomain *clkdm, void *user)
357{ 375{
358 struct seq_file *s = (struct seq_file *)user; 376 struct seq_file *s = (struct seq_file *)user;
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 3de6ece23fc8..4fd021f31e25 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -48,9 +48,11 @@ extern struct omap_dm_timer *gptimer_wakeup;
48 48
49#ifdef CONFIG_PM_DEBUG 49#ifdef CONFIG_PM_DEBUG
50extern void omap2_pm_dump(int mode, int resume, unsigned int us); 50extern void omap2_pm_dump(int mode, int resume, unsigned int us);
51extern void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds);
51extern int omap2_pm_debug; 52extern int omap2_pm_debug;
52#else 53#else
53#define omap2_pm_dump(mode, resume, us) do {} while (0); 54#define omap2_pm_dump(mode, resume, us) do {} while (0);
55#define omap2_pm_wakeup_on_timer(seconds, milliseconds) do {} while (0);
54#define omap2_pm_debug 0 56#define omap2_pm_debug 0
55#endif 57#endif
56 58
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index bb2ba1e03d09..bc24fbd2e983 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -38,7 +38,6 @@
38#include <plat/prcm.h> 38#include <plat/prcm.h>
39#include <plat/gpmc.h> 39#include <plat/gpmc.h>
40#include <plat/dma.h> 40#include <plat/dma.h>
41#include <plat/dmtimer.h>
42 41
43#include <asm/tlbflush.h> 42#include <asm/tlbflush.h>
44 43
@@ -550,23 +549,6 @@ out:
550#ifdef CONFIG_SUSPEND 549#ifdef CONFIG_SUSPEND
551static suspend_state_t suspend_state; 550static suspend_state_t suspend_state;
552 551
553static void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds)
554{
555 u32 tick_rate, cycles;
556
557 if (!seconds && !milliseconds)
558 return;
559
560 tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup));
561 cycles = tick_rate * seconds + tick_rate * milliseconds / 1000;
562 omap_dm_timer_stop(gptimer_wakeup);
563 omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles);
564
565 pr_info("PM: Resume timer in %u.%03u secs"
566 " (%d ticks at %d ticks/sec.)\n",
567 seconds, milliseconds, cycles, tick_rate);
568}
569
570static int omap3_pm_prepare(void) 552static int omap3_pm_prepare(void)
571{ 553{
572 disable_hlt(); 554 disable_hlt();