From: <bob...@us...> - 2006-09-30 08:21:36
|
Revision: 603 http://svn.sourceforge.net/hackndev/?rev=603&view=rev Author: bobofdoom Date: 2006-09-30 01:21:19 -0700 (Sat, 30 Sep 2006) Log Message: ----------- palmld: Moved PM code to seperate file. Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c Added Paths: ----------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pm.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile 2006-09-30 07:13:53 UTC (rev 602) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile 2006-09-30 08:21:19 UTC (rev 603) @@ -6,3 +6,4 @@ obj-$(CONFIG_PALMLD_PCMCIA) += palmld_pcmcia.o obj-$(CONFIG_PALMLD_USB) += palmld_usb.o obj-$(CONFIG_PALMLD_IDE) += palmld_ide.o +obj-$(CONFIG_PM) += palmld_pm.o Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c 2006-09-30 07:13:53 UTC (rev 602) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c 2006-09-30 08:21:19 UTC (rev 603) @@ -25,6 +25,7 @@ #include <asm/arch/palmld-gpio.h> #include <asm/arch/pxa27x-keypad.h> #include <asm/arch/pxapwm-bl.h> +#include <asm/arch/pxa-pm_ll.h> #include <sound/driver.h> #include <sound/core.h> @@ -62,16 +63,6 @@ int err; /** - * Setup GPIOs for MMC/SD card controller. - */ - pxa_gpio_mode(GPIO32_MMCCLK_MD); - pxa_gpio_mode(GPIO92_MMCDAT0_MD); - pxa_gpio_mode(GPIO109_MMCDAT1_MD); - pxa_gpio_mode(GPIO110_MMCDAT2_MD); - pxa_gpio_mode(GPIO111_MMCDAT3_MD); - pxa_gpio_mode(GPIO112_MMCCMD_MD); - - /** * Setup an interrupt for detecting card insert/remove events */ set_irq_type(IRQ_GPIO_PALMLD_SD_DETECT_N, IRQT_BOTHEDGE); @@ -332,100 +323,16 @@ iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc)); - - /* Clear reset status */ //RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; } -#ifdef PM -#error It just doesn't seem to work. :-( -#include <linux/pm.h> -#include <asm/arch/pxa-pm_ll.h> -static u32 *addr_a0200000; -static u32 *addr_a0200004; -static u32 *addr_a0200008; -static u32 save_a0200000; -static u32 save_a0200004; -static u32 save_a0200008; - -static void palmld_pxa_ll_pm_suspend(unsigned long resume_addr) -{ - - SET_PALMLD_GPIO(GREEN_LED, 0); - SET_PALMLD_GPIO(ORANGE_LED, 0); - - save_a0200000 = *addr_a0200000; - save_a0200004 = *addr_a0200004; - save_a0200008 = *addr_a0200008; - - /* - c: e3a00121 mov r0, #1073741832 ; 0x40000008 - 10: e280060f add r0, r0, #15728640 ; 0xf00000 - 14: e590f000 ldr pc, [r0] - */ - - *addr_a0200000 = 0xe3a00121; // mov r0, #0x40000008 - *addr_a0200004 = 0xe280060f; // add r0, r0, #0xf00000 - *addr_a0200008 = 0xe590f000; // ldr pc, [r0] - - return; -} - -static void palmld_pxa_ll_pm_resume(void) -{ - - - SET_PALMLD_GPIO(GREEN_LED, 1); - palm_backlight_power(1); - *addr_a0200000 = save_a0200000; - *addr_a0200004 = save_a0200004; - *addr_a0200008 = save_a0200008; - SET_PALMLD_GPIO(ORANGE_LED, 1); -} - -static struct pxa_ll_pm_ops palmld_ll_pm_ops = { - .suspend = palmld_pxa_ll_pm_suspend, - .resume = palmld_pxa_ll_pm_resume, -}; -#else - -#endif - static void __init palmld_init(void) { - /* wake up on */ - PWER |= PWER_RTC | PWER_GPIO12; - PFER |= PWER_RTC; - PRER |= PWER_GPIO12; - - /* USB, in theory this can even wake us from deep sleep */ - PWER |= PWER_GPIO3; - PFER |= PWER_GPIO3; - PRER |= PWER_GPIO3; - - PCFR = PCFR_GPR_EN | PCFR_OPDE; - - /* as set by POS */ - PGSR0 = 0x00020000; - PGSR1 = 0x00000000; - PGSR2 = 0x01004000; - PGSR3 = 0x00421380; - - PGSR2 |= (1<<30); - PGSR3 |= (1<<7) | (1<<8) | (1<<9); - PSLR = 0xff400000; - - //PKWR |= GPIO_bit(0) | GPIO_bit(12) | GPIO_bit(3) | (1<<17); - PKSR = 0xffffffff; // clear - -#ifdef PM - addr_a0200000 = phys_to_virt(0xa0200000); - addr_a0200004 = phys_to_virt(0xa0200004); - addr_a0200008 = phys_to_virt(0xa0200008); - +#ifdef CONFIG_PM + extern struct pxa_ll_pm_ops palmld_ll_pm_ops; pxa_pm_set_ll_ops(&palmld_ll_pm_ops); #endif Added: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pm.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pm.c (rev 0) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pm.c 2006-09-30 08:21:19 UTC (rev 603) @@ -0,0 +1,76 @@ +#include <linux/kernel.h> +#include <linux/device.h> +#include <linux/pm.h> + +#include <asm/arch/pxa-pm_ll.h> +#include <asm/arch/hardware.h> +#include <asm/arch/pxa-regs.h> + +static u32 *addr_a0200000; +static u32 *addr_a0200004; +static u32 *addr_a0200008; +static u32 save_a0200000; +static u32 save_a0200004; +static u32 save_a0200008; + +static void palmld_pxa_ll_pm_suspend(unsigned long resume_addr) +{ + + /* wake up on */ + PWER |= PWER_RTC | PWER_GPIO12; + PFER |= PWER_RTC; + PRER |= PWER_GPIO12; + + /* USB, in theory this can even wake us from deep sleep */ + PWER |= PWER_GPIO3; + PFER |= PWER_GPIO3; + PRER |= PWER_GPIO3; + + PCFR = PCFR_GPR_EN | PCFR_OPDE; + + /* as set by POS */ + PGSR0 = 0x00020000; + PGSR1 = 0x00000000; + PGSR2 = 0x01004000; + PGSR3 = 0x00421380; + + PGSR2 |= (1<<30); + PGSR3 |= (1<<7) | (1<<8) | (1<<9); + + PSLR = 0xff400000; + + //PKWR |= GPIO_bit(0) | GPIO_bit(12) | GPIO_bit(3) | (1<<17); + PKSR = 0xffffffff; // clear + + addr_a0200000 = phys_to_virt(0xa0200000); + addr_a0200004 = phys_to_virt(0xa0200004); + addr_a0200008 = phys_to_virt(0xa0200008); + + save_a0200000 = *addr_a0200000; + save_a0200004 = *addr_a0200004; + save_a0200008 = *addr_a0200008; + + /* + c: e3a00121 mov r0, #1073741832 ; 0x40000008 + 10: e280060f add r0, r0, #15728640 ; 0xf00000 + 14: e590f000 ldr pc, [r0] + */ + + *addr_a0200000 = 0xe3a00121; // mov r0, #0x40000008 + *addr_a0200004 = 0xe280060f; // add r0, r0, #0xf00000 + *addr_a0200008 = 0xe590f000; // ldr pc, [r0] + + return; +} + +static void palmld_pxa_ll_pm_resume(void) +{ + *addr_a0200000 = save_a0200000; + *addr_a0200004 = save_a0200004; + *addr_a0200008 = save_a0200008; +} + +struct pxa_ll_pm_ops palmld_ll_pm_ops = { + .suspend = palmld_pxa_ll_pm_suspend, + .resume = palmld_pxa_ll_pm_resume, +}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |