Re: [at91] Save power by disabling the processor clock when CPU is idle

Previous thread: [PATCH] ZTEAC8710 Support with Device ID 0xffff by Mahesh Kuruganti on Tuesday, April 13, 2010 - 3:33 am. (1 message)

Next thread: Can I limit the number of tcp connections ? by Mark Jackson on Tuesday, April 13, 2010 - 4:16 am. (1 message)
From: Anders Larsen
Date: Tuesday, April 13, 2010 - 4:05 am

Disable the processor clock when the CPU is idle.

This saves much more power than merely entering 'Wait for Interrupt' mode.
Since JTAG-debugging doesn't work when the processor clock is switched off,
make it conditional on CONFIG_DEBUG_KERNEL.

Signed-off-by: Anders Larsen <al@alarsen.net>
Cc: Andrew Victor <avictor.za@gmail.com>
---
KernelVersion: 2.6.33

 arch/arm/mach-at91/include/mach/system.h |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)


Index: b/arch/arm/mach-at91/include/mach/system.h
===================================================================
--- a/arch/arm/mach-at91/include/mach/system.h
+++ b/arch/arm/mach-at91/include/mach/system.h
@@ -24,21 +24,24 @@
 #include <mach/hardware.h>
 #include <mach/at91_st.h>
 #include <mach/at91_dbgu.h>
+#include <mach/at91_pmc.h>
 
 static inline void arch_idle(void)
 {
+#ifndef CONFIG_DEBUG_KERNEL
 	/*
 	 * Disable the processor clock.  The processor will be automatically
 	 * re-enabled by an interrupt or by a reset.
 	 */
-//	at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK);
-
+	at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK);
+#else
 	/*
 	 * Set the processor (CP15) into 'Wait for Interrupt' mode.
 	 * Unlike disabling the processor clock via the PMC (above)
 	 *  this allows the processor to be woken via JTAG.
 	 */
 	cpu_do_idle();
+#endif
 }
 
 void (*at91_arch_reset)(void);

--

From: Uwe Kleine-König
Date: Wednesday, May 5, 2010 - 1:25 pm

Hello,


There is a kernel parameter (IIRC "nohlt") that should take care of
this?!

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--

From: Anders Larsen
Date: Thursday, May 6, 2010 - 1:36 am

Hello,


I hadn't noticed that one (it's operating several layers above the piece
of code I modified).

So it seems we could do way with the #else clause completely (requiring
the user to set 'nohlt' when debugging with JTAG)?

Cheers
Anders
-- 
happy 'ptxdist' user
--

Previous thread: [PATCH] ZTEAC8710 Support with Device ID 0xffff by Mahesh Kuruganti on Tuesday, April 13, 2010 - 3:33 am. (1 message)

Next thread: Can I limit the number of tcp connections ? by Mark Jackson on Tuesday, April 13, 2010 - 4:16 am. (1 message)