diff options
author | Sonic Zhang <sonic.zhang@analog.com> | 2012-05-17 05:33:00 -0400 |
---|---|---|
committer | Bob Liu <lliubbo@gmail.com> | 2012-05-21 02:54:52 -0400 |
commit | 72b099ed93989575b0c447023748968d30059e8f (patch) | |
tree | 0e5bb7040da26232d66c2fb6c24854566ed9a07a /arch/blackfin/mach-common | |
parent | 0fbd88ca20a68a633b565e1f5ba18ca64afb0c78 (diff) |
blackfin: bf60x: pm: Add a debug option to calculate kernel wakeup time.
Display the total time when kernel resumes normal from standby or suspend to mem
mode.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Diffstat (limited to 'arch/blackfin/mach-common')
-rw-r--r-- | arch/blackfin/mach-common/dpmc_modes.S | 8 | ||||
-rw-r--r-- | arch/blackfin/mach-common/pm.c | 30 |
2 files changed, 38 insertions, 0 deletions
diff --git a/arch/blackfin/mach-common/dpmc_modes.S b/arch/blackfin/mach-common/dpmc_modes.S index cfb7c3c00370..de99f3aac2c5 100644 --- a/arch/blackfin/mach-common/dpmc_modes.S +++ b/arch/blackfin/mach-common/dpmc_modes.S | |||
@@ -42,6 +42,9 @@ ENTRY(_sleep_mode) | |||
42 | BITCLR (R7, 5); | 42 | BITCLR (R7, 5); |
43 | w[p0] = R7.L; | 43 | w[p0] = R7.L; |
44 | IDLE; | 44 | IDLE; |
45 | |||
46 | bfin_init_pm_bench_cycles; | ||
47 | |||
45 | call _test_pll_locked; | 48 | call _test_pll_locked; |
46 | 49 | ||
47 | RETS = [SP++]; | 50 | RETS = [SP++]; |
@@ -74,6 +77,9 @@ ENTRY(_hibernate_mode) | |||
74 | 77 | ||
75 | /* Finally, we climb into our cave to hibernate */ | 78 | /* Finally, we climb into our cave to hibernate */ |
76 | W[P3] = R4.L; | 79 | W[P3] = R4.L; |
80 | |||
81 | bfin_init_pm_bench_cycles; | ||
82 | |||
77 | CLI R2; | 83 | CLI R2; |
78 | IDLE; | 84 | IDLE; |
79 | .Lforever: | 85 | .Lforever: |
@@ -158,6 +164,8 @@ ENTRY(_sleep_deeper) | |||
158 | SSYNC; | 164 | SSYNC; |
159 | IDLE; | 165 | IDLE; |
160 | 166 | ||
167 | bfin_init_pm_bench_cycles; | ||
168 | |||
161 | call _test_pll_locked; | 169 | call _test_pll_locked; |
162 | 170 | ||
163 | P0.H = hi(PLL_DIV); | 171 | P0.H = hi(PLL_DIV); |
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c index 610a3cdf3998..ca6655e0d653 100644 --- a/arch/blackfin/mach-common/pm.c +++ b/arch/blackfin/mach-common/pm.c | |||
@@ -247,9 +247,39 @@ static int bfin_pm_enter(suspend_state_t state) | |||
247 | return 0; | 247 | return 0; |
248 | } | 248 | } |
249 | 249 | ||
250 | #ifdef CONFIG_BFIN_PM_WAKEUP_TIME_BENCH | ||
251 | void bfin_pm_end(void) | ||
252 | { | ||
253 | u32 cycle, cycle2; | ||
254 | u64 usec64; | ||
255 | u32 usec; | ||
256 | |||
257 | __asm__ __volatile__ ( | ||
258 | "1: %0 = CYCLES2\n" | ||
259 | "%1 = CYCLES\n" | ||
260 | "%2 = CYCLES2\n" | ||
261 | "CC = %2 == %0\n" | ||
262 | "if ! CC jump 1b\n" | ||
263 | : "=d,a" (cycle2), "=d,a" (cycle), "=d,a" (usec) : : "CC" | ||
264 | ); | ||
265 | |||
266 | usec64 = ((u64)cycle2 << 32) + cycle; | ||
267 | do_div(usec64, get_cclk() / USEC_PER_SEC); | ||
268 | usec = usec64; | ||
269 | if (usec == 0) | ||
270 | usec = 1; | ||
271 | |||
272 | pr_info("PM: resume of kernel completes after %ld msec %03ld usec\n", | ||
273 | usec / USEC_PER_MSEC, usec % USEC_PER_MSEC); | ||
274 | } | ||
275 | #endif | ||
276 | |||
250 | static const struct platform_suspend_ops bfin_pm_ops = { | 277 | static const struct platform_suspend_ops bfin_pm_ops = { |
251 | .enter = bfin_pm_enter, | 278 | .enter = bfin_pm_enter, |
252 | .valid = bfin_pm_valid, | 279 | .valid = bfin_pm_valid, |
280 | #ifdef CONFIG_BFIN_PM_WAKEUP_TIME_BENCH | ||
281 | .end = bfin_pm_end, | ||
282 | #endif | ||
253 | }; | 283 | }; |
254 | 284 | ||
255 | static int __init bfin_pm_init(void) | 285 | static int __init bfin_pm_init(void) |