summaryrefslogtreecommitdiff
path: root/packages/linux/linux-ezx-2.6.21/ezx-pm.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/linux/linux-ezx-2.6.21/ezx-pm.patch')
-rw-r--r--packages/linux/linux-ezx-2.6.21/ezx-pm.patch90
1 files changed, 86 insertions, 4 deletions
diff --git a/packages/linux/linux-ezx-2.6.21/ezx-pm.patch b/packages/linux/linux-ezx-2.6.21/ezx-pm.patch
index 4ad66936c9..85b6f5c15d 100644
--- a/packages/linux/linux-ezx-2.6.21/ezx-pm.patch
+++ b/packages/linux/linux-ezx-2.6.21/ezx-pm.patch
@@ -1,7 +1,7 @@
Index: linux-2.6.21/arch/arm/mach-pxa/pxa27x.c
===================================================================
---- linux-2.6.21.orig/arch/arm/mach-pxa/pxa27x.c 2007-05-03 17:41:39.000000000 -0300
-+++ linux-2.6.21/arch/arm/mach-pxa/pxa27x.c 2007-05-03 17:43:42.000000000 -0300
+--- linux-2.6.21.orig/arch/arm/mach-pxa/pxa27x.c 2007-05-08 16:29:23.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/pxa27x.c 2007-05-08 16:29:36.000000000 -0300
@@ -22,6 +22,10 @@
#include <asm/arch/pxa-regs.h>
#include <asm/arch/ohci.h>
@@ -29,8 +29,8 @@ Index: linux-2.6.21/arch/arm/mach-pxa/pxa27x.c
}
Index: linux-2.6.21/arch/arm/mach-pxa/pm.c
===================================================================
---- linux-2.6.21.orig/arch/arm/mach-pxa/pm.c 2007-05-03 17:41:39.000000000 -0300
-+++ linux-2.6.21/arch/arm/mach-pxa/pm.c 2007-05-04 03:51:15.000000000 -0300
+--- linux-2.6.21.orig/arch/arm/mach-pxa/pm.c 2007-05-08 16:29:23.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/pm.c 2007-05-08 16:29:36.000000000 -0300
@@ -24,6 +24,10 @@
#include <asm/arch/lubbock.h>
#include <asm/mach/time.h>
@@ -56,3 +56,85 @@ Index: linux-2.6.21/arch/arm/mach-pxa/pm.c
/* restore registers */
RESTORE_GPLEVEL(0); RESTORE_GPLEVEL(1); RESTORE_GPLEVEL(2);
RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2);
+Index: linux-2.6.21/arch/arm/mach-pxa/ezx.c
+===================================================================
+--- linux-2.6.21.orig/arch/arm/mach-pxa/ezx.c 2007-05-08 16:29:36.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/ezx.c 2007-05-08 16:32:56.000000000 -0300
+@@ -18,6 +18,7 @@
+ #include <asm/arch/pxafb.h>
+ #include <asm/arch/pxa-regs.h>
+ #include <asm/arch/ohci.h>
++#include <asm/arch/system.h>
+
+ #include "generic.h"
+ #include "ezx.h"
+@@ -137,8 +138,69 @@
+ &ezxbp_device,
+ };
+
++/* PM */
++extern int bp_handshake_passed(void);
++
++#define POWER_OFF_TIMEOUT (2*60*HZ)
++
++static void ezx_reboot_poweroff(char mode)
++{
++#ifdef CONFIG_EZX_BP
++ unsigned long start = jiffies;
++
++ printk("Waiting for BP to turn off. This can take some time...\n");
++ *(unsigned long *)(phys_to_virt(BPSIG_ADDR)) = NO_FLAG;
++ cpu_proc_fin();
++
++ do {
++ /*
++ * Turn off gracefully. Wait BP turn off first, and then
++ * properly turn off.
++ */
++ if (pxa_gpio_get_value(GPIO_BB_WDI) == 0) {
++ *(unsigned long *)(phys_to_virt(BPSIG_ADDR)) = WDI_FLAG;
++
++ /* reset BP */
++ pxa_gpio_set_value(GPIO_BB_RESET, 0);
++ mdelay(1);
++ pxa_gpio_set_value(GPIO_BB_RESET, 1);
++
++ if (mode == 'z')
++ arch_reset('h');
++ break;
++ }
++ /* Just turn it off! */
++ if (!bp_handshake_passed() || !pxa_gpio_get_value(GPIO_BB_WDI2)
++ || (jiffies - start) >= POWER_OFF_TIMEOUT) {
++ break;
++ }
++ } while(1);
++#endif
++
++ if (mode == 'z')
++ /* Panic! Ask PCAP to turn both processors off */
++ pxa_gpio_set_value(GPIO_WDI_AP, 0);
++ else
++ arm_machine_restart(mode);
++
++ while(1);
++}
++
++static inline void ezx_poweroff(void)
++{
++ ezx_reboot_poweroff('z');
++}
++
++static inline void ezx_restart(char mode)
++{
++ ezx_reboot_poweroff(mode);
++}
++
+ static int __init ezx_init(void)
+ {
++ pm_power_off = ezx_poweroff;
++ arm_pm_restart = ezx_restart;
++
+ CKEN = CKEN9_OSTIMER | CKEN22_MEMC;
+
+ ezx_ssp_set_machinfo(&ezx_ssp_machinfo);