rendered paste bodyIndex: linux-2.6.24/arch/arm/common/sharpsl_pm.c
===================================================================
--- linux-2.6.24.orig/arch/arm/common/sharpsl_pm.c 2008-04-11 01:46:28.882704234 +0200
+++ linux-2.6.24/arch/arm/common/sharpsl_pm.c 2008-04-11 13:35:29.372007220 +0200
@@ -29,11 +28,9 @@
#include <asm/hardware.h>
#include <asm/mach-types.h>
#include <asm/irq.h>
-#include <asm/arch/pm.h>
-#include <asm/arch/pxa-regs.h>
-#include <asm/arch/sharpsl.h>
#include <asm/hardware/sharpsl_pm.h>
+#include "sharpsl_pm.h"
/*
* Constants
*/
@@ -312,6 +309,7 @@
if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_LOCK)) {
dev_err(sharpsl_pm.dev, "Battery now Unlocked! Suspending.\n");
is_fatal = 1;
+ sharpsl_pm.flags |= SHARPSL_DO_RESTART;
}
if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_FATAL)) {
@@ -519,7 +517,7 @@
sharpsl_pm.machinfo->presuspend();
- PEDR = 0xffffffff; /* clear it */
+ clear_pedr_on_pxa();
sharpsl_pm.flags &= ~SHARPSL_ALARM_ACTIVE;
if ((sharpsl_pm.charge_mode == CHRG_ON) && ((alarm_enable && ((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30))) || !alarm_enable)) {
@@ -536,11 +534,14 @@
RTAR = 0;
}
- pxa_pm_enter(state);
+ sharpsl_pm_enter(state);
+
+ if(sharpsl_pm.flags & SHARPSL_DO_RESTART)
+ do_restart();
sharpsl_pm.machinfo->postsuspend();
- dev_dbg(sharpsl_pm.dev, "Corgi woken up from suspend: %08x\n",PEDR);
+ dev_dbg(sharpsl_pm.dev, "Corgi woken up from suspend: %08x\n",pedr_on_pxa());
}
static int corgi_enter_suspend(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state)
Index: linux-2.6.24/arch/arm/common/sharpsl_pm.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.24/arch/arm/common/sharpsl_pm.h 2008-04-11 02:35:43.674704538 +0200
@@ -0,0 +1,47 @@
+#ifdef CONFIG_ARCH_PXA
+# include <asm/arch/pm.h>
+# include <asm/arch/pxa-regs.h>
+# include <asm/arch/sharpsl.h>
+static inline void clear_pedr_on_pxa(void)
+{
+ PEDR = 0xffffffff; /* clear it */
+}
+
+static inline int pedr_on_pxa(void)
+{
+ return PEDR;
+}
+
+static inline int sharpsl_pm_enter(suspend_state_t state)
+{
+ return pxa_pm_enter(state);
+}
+
+static inline void do_restart() {}
+#endif
+
+#ifdef CONFIG_ARCH_SA1100
+# include <asm/arch/SA-1100.h>
+extern int sa11x0_pm_enter(suspend_state_t state);
+
+static inline void clear_pedr_on_pxa(void)
+{
+ GEDR = 0xffffffff;
+}
+static inline int pedr_on_pxa(void)
+{
+ return GEDR;
+}
+
+static inline int sharpsl_pm_enter(suspend_state_t state)
+{
+ return sa11x0_pm_enter(state);
+}
+
+static inline void do_restart()
+{
+ RCSR = 0x0f;
+ RSRR = RSRR_SWR;
+}
+#endif
+
Index: linux-2.6.24/include/asm-arm/hardware/sharpsl_pm.h
===================================================================
--- linux-2.6.24.orig/include/asm-arm/hardware/sharpsl_pm.h 2008-04-11 01:46:28.934704044 +0200
+++ linux-2.6.24/include/asm-arm/hardware/sharpsl_pm.h 2008-04-11 02:35:43.678703879 +0200
@@ -84,6 +84,7 @@
#define SHARPSL_BL_LIMIT (1 << 2) /* Backlight Intensity Limited */
#define SHARPSL_APM_QUEUED (1 << 3) /* APM Event Queued */
#define SHARPSL_DO_OFFLINE_CHRG (1 << 4) /* Trigger the offline charger */
+#define SHARPSL_DO_RESTART (1 << 5) /* Restart machine after next reboot */
int full_count;
unsigned long charge_start_time;