patch-2.3.99-pre4 linux/include/asm-arm/arch-sa1100/system.h

Next file: linux/include/asm-arm/arch-sa1100/vmalloc.h
Previous file: linux/include/asm-arm/arch-sa1100/keyboard.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre3/linux/include/asm-arm/arch-sa1100/system.h linux/include/asm-arm/arch-sa1100/system.h
@@ -5,43 +5,43 @@
  */
 #include <linux/config.h>
 
-#ifdef CONFIG_SA1100_VICTOR
-
-#define arch_reset( x ) {					\
-	/* switch off power supply */				\
-	mdelay(2000); 						\
-	GPCR = GPIO_GPIO23;					\
-	while(1);						\
+extern __inline__ void arch_idle(void)
+{
+	while (!current->need_resched && !hlt_counter) {
+		cpu_do_idle(IDLE_CLOCK_SLOW);
+		cpu_do_idle(IDLE_WAIT_FAST);
+		cpu_do_idle(IDLE_CLOCK_FAST);
 	}
+}
 
-#else
-
-#define arch_reset(x)	cpu_reset(0)
+#ifdef CONFIG_SA1100_VICTOR
 
-#endif
+extern inline void arch_power_off(void)
+{
+	/* switch off power supply */
+	mdelay(2000);
+	GPCR = GPIO_GPIO23;
+	while(1);
+}
 
+/* power off unconditionally */
+#define arch_reset(x) arch_power_off()
 
-#if 0
-#define arch_do_idle()          cpu_do_idle()
 #else
-/* Enter SA1100 idle mode (see data sheet sec 9.5).
- * It seems that the wait-on-interrupt just hang the CPU forever if it's
- * on the end of a cache line.  Workaround: we force an explicit alignment
- * before it.
- */
-#define arch_do_idle() \
-	do { \
-	__asm__ __volatile__( \
-"	mcr	p15, 0, %0, c15, c2, 2	@ Disable clock switching \n" \
-"	ldr	%0, [%0]		@ Must perform a non-cached access \n" \
-"	b	1f			@ Seems we must align the next \n" \
-"	.align 5			@ instruction on a cache line \n" \
-"1:	mcr	p15, 0, %0, c15, c8, 2	@ Wait for interrupts \n" \
-"	mov	r0, r0			@ insert NOP to ensure SA1100 re-awakes\n" \
-"	mcr	p15, 0, %0, c15, c1, 2	@ Reenable clock switching \n" \
-	: : "r" (&ICIP) : "cc" ); \
-	} while (0)
-#endif
+
+extern inline void arch_reset(char mode)
+{
+	if (mode == 's') {
+		/* Jump into ROM at address 0 */
+		cpu_reset(0);
+	} else {
+		/* Activate SA1100 watchdog and wait for the trigger... */
+		OSMR3 = OSCR + 3686400/2;	/* in 1/2 sec */
+		OWER |= OWER_WME;
+		OIER |= OIER_E3;
+	}
+}
 
 #define arch_power_off()	do { } while (0)
 
+#endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)