sync hh.org
[hh.org.git] / arch / arm / mach-pxa / eseries / eseries_pm.c
blobb2e671f6c9e3c2f243bf1c022134acd7b4920be3
1 /*
2 * e-series wince-bootloader support
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 */
10 #include <linux/init.h>
11 #include <linux/kernel.h>
12 #include <linux/ioport.h>
13 #include <linux/device.h>
14 #include <linux/input.h>
15 #include <linux/delay.h>
16 #include <linux/interrupt.h>
18 #include <asm/mach-types.h>
19 #include <asm/hardware.h>
20 #include <asm/mach/arch.h>
21 #include <asm/arch/pxa-pm_ll.h>
23 extern void pxa_cpu_resume(void);
25 static u32 saved_value[4];
26 static u32 *save_base;
28 static void eseries_pxa_ll_pm_suspend(unsigned long resume_addr) {
30 saved_value[0] = *(save_base+(0x9c>>2));
31 saved_value[1] = *(save_base+(0x98>>2));
32 saved_value[2] = *(save_base+(0x94>>2));
33 saved_value[3] = *(save_base+(0x3c>>2));
35 // asm ("mrc p15, 0, %0, cr3, cr0;\n" :"=r"(rp) );
36 *(save_base+(0x9c>>2)) = 1; // FIXME - flush cache
37 // asm ("mrc p15, 0, %0, cr2, cr0;\n" :"=r"(rp) );
38 *(save_base+(0x98>>2)) = 0xa0000000; // FIXME - flush cache
39 // asm ("mrc p15, 0, %0, cr1, cr0;\n" :"=r"(rp) );
40 *(save_base+(0x94>>2)) = 0x78; // FIXME - flush cache
41 *(save_base+(0x3c>>2)) = resume_addr; // FIXME - flush cache
42 return;
45 static void eseries_pxa_ll_pm_resume(void) {
46 *(save_base+(0x9c>>2)) = saved_value[0]; // FIXME - flush cache
47 *(save_base+(0x98>>2)) = saved_value[1]; // FIXME - flush cache
48 *(save_base+(0x94>>2)) = saved_value[2]; // FIXME - flush cache
49 *(save_base+(0x3c>>2)) = saved_value[3]; // FIXME - flush cache
52 static struct pxa_ll_pm_ops eseries_ll_pm_ops = {
53 .suspend = eseries_pxa_ll_pm_suspend,
54 .resume = eseries_pxa_ll_pm_resume,
57 static int __init eseries_ll_pm_init(void)
59 if(machine_is_e330() || machine_is_e740()) {
60 printk("Initialising wince bootloader suspend workaround\n");
61 save_base = phys_to_virt(0xa0040400);
62 pxa_pm_set_ll_ops(&eseries_ll_pm_ops);
65 return 0;
68 module_init(eseries_ll_pm_init);
70 MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
71 MODULE_DESCRIPTION("implement e-series pm using the wince loader");
72 MODULE_LICENSE("GPLv2");