* [PATCH 01/03] sh: move the hp6xx pm code
@ 2008-12-04 13:45 Magnus Damm
2008-12-05 18:42 ` Kristoffer Ericson
2008-12-08 16:39 ` Kristoffer Ericson
0 siblings, 2 replies; 3+ messages in thread
From: Magnus Damm @ 2008-12-04 13:45 UTC (permalink / raw)
To: linux-sh
From: Magnus Damm <damm@igel.co.jp>
Move the not-so-generic pm code from arch/sh/kernel/pm.c to the
platform directory together with the rest of the hp6xx pm code.
This is done to let non-hp6xx platforms enable CONFIG_PM.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
---
arch/sh/boards/mach-hp6xx/pm.c | 78 +++++++++++++++++++++++++++++++++++
arch/sh/include/asm/pm.h | 17 -------
arch/sh/kernel/Makefile_32 | 1
arch/sh/kernel/Makefile_64 | 1
arch/sh/kernel/pm.c | 88 ----------------------------------------
5 files changed, 77 insertions(+), 108 deletions(-)
--- 0001/arch/sh/boards/mach-hp6xx/pm.c
+++ work/arch/sh/boards/mach-hp6xx/pm.c 2008-12-04 20:43:36.000000000 +0900
@@ -10,15 +10,91 @@
#include <linux/suspend.h>
#include <linux/errno.h>
#include <linux/time.h>
+#include <linux/delay.h>
+#include <linux/gfp.h>
#include <asm/io.h>
#include <asm/hd64461.h>
#include <mach/hp6xx.h>
#include <cpu/dac.h>
-#include <asm/pm.h>
+#include <asm/freq.h>
+#include <asm/watchdog.h>
+
+#define INTR_OFFSET 0x600
#define STBCR 0xffffff82
#define STBCR2 0xffffff88
+#define STBCR_STBY 0x80
+#define STBCR_MSTP2 0x04
+
+#define MCR 0xffffff68
+#define RTCNT 0xffffff70
+
+#define MCR_RMODE 2
+#define MCR_RFSH 4
+
+extern u8 wakeup_start;
+extern u8 wakeup_end;
+
+static void pm_enter(void)
+{
+ u8 stbcr, csr;
+ u16 frqcr, mcr;
+ u32 vbr_new, vbr_old;
+
+ set_bl_bit();
+
+ /* set wdt */
+ csr = sh_wdt_read_csr();
+ csr &= ~WTCSR_TME;
+ csr |= WTCSR_CKS_4096;
+ sh_wdt_write_csr(csr);
+ csr = sh_wdt_read_csr();
+ sh_wdt_write_cnt(0);
+
+ /* disable PLL1 */
+ frqcr = ctrl_inw(FRQCR);
+ frqcr &= ~(FRQCR_PLLEN | FRQCR_PSTBY);
+ ctrl_outw(frqcr, FRQCR);
+
+ /* enable standby */
+ stbcr = ctrl_inb(STBCR);
+ ctrl_outb(stbcr | STBCR_STBY | STBCR_MSTP2, STBCR);
+
+ /* set self-refresh */
+ mcr = ctrl_inw(MCR);
+ ctrl_outw(mcr & ~MCR_RFSH, MCR);
+
+ /* set interrupt handler */
+ asm volatile("stc vbr, %0" : "=r" (vbr_old));
+ vbr_new = get_zeroed_page(GFP_ATOMIC);
+ udelay(50);
+ memcpy((void*)(vbr_new + INTR_OFFSET),
+ &wakeup_start, &wakeup_end - &wakeup_start);
+ asm volatile("ldc %0, vbr" : : "r" (vbr_new));
+
+ ctrl_outw(0, RTCNT);
+ ctrl_outw(mcr | MCR_RFSH | MCR_RMODE, MCR);
+
+ cpu_sleep();
+
+ asm volatile("ldc %0, vbr" : : "r" (vbr_old));
+
+ free_page(vbr_new);
+
+ /* enable PLL1 */
+ frqcr = ctrl_inw(FRQCR);
+ frqcr |= FRQCR_PSTBY;
+ ctrl_outw(frqcr, FRQCR);
+ udelay(50);
+ frqcr |= FRQCR_PLLEN;
+ ctrl_outw(frqcr, FRQCR);
+
+ ctrl_outb(stbcr, STBCR);
+
+ clear_bl_bit();
+}
+
static int hp6x0_pm_enter(suspend_state_t state)
{
u8 stbcr, stbcr2;
--- 0001/arch/sh/include/asm/pm.h
+++ /dev/null 2008-12-03 11:12:15.442019092 +0900
@@ -1,17 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright 2006 (c) Andriy Skulysh <askulysh@gmail.com>
- *
- */
-#ifndef __ASM_SH_PM_H
-#define __ASM_SH_PM_H
-
-extern u8 wakeup_start;
-extern u8 wakeup_end;
-
-void pm_enter(void);
-
-#endif
--- 0001/arch/sh/kernel/Makefile_32
+++ work/arch/sh/kernel/Makefile_32 2008-12-04 20:41:49.000000000 +0900
@@ -25,7 +25,6 @@ obj-$(CONFIG_MODULES) += sh_ksyms_32.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
-obj-$(CONFIG_PM) += pm.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o
obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
obj-$(CONFIG_KPROBES) += kprobes.o
--- 0001/arch/sh/kernel/Makefile_64
+++ work/arch/sh/kernel/Makefile_64 2008-12-04 20:41:49.000000000 +0900
@@ -15,7 +15,6 @@ obj-$(CONFIG_MODULES) += sh_ksyms_64.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
-obj-$(CONFIG_PM) += pm.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o
obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
obj-$(CONFIG_GENERIC_GPIO) += gpio.o
--- 0001/arch/sh/kernel/pm.c
+++ /dev/null 2008-12-03 11:12:15.442019092 +0900
@@ -1,88 +0,0 @@
-/*
- * Generic Power Management Routine
- *
- * Copyright (c) 2006 Andriy Skulysh <askulsyh@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License.
- */
-#include <linux/suspend.h>
-#include <linux/delay.h>
-#include <linux/gfp.h>
-#include <asm/freq.h>
-#include <asm/io.h>
-#include <asm/watchdog.h>
-#include <asm/pm.h>
-
-#define INTR_OFFSET 0x600
-
-#define STBCR 0xffffff82
-#define STBCR2 0xffffff88
-
-#define STBCR_STBY 0x80
-#define STBCR_MSTP2 0x04
-
-#define MCR 0xffffff68
-#define RTCNT 0xffffff70
-
-#define MCR_RMODE 2
-#define MCR_RFSH 4
-
-void pm_enter(void)
-{
- u8 stbcr, csr;
- u16 frqcr, mcr;
- u32 vbr_new, vbr_old;
-
- set_bl_bit();
-
- /* set wdt */
- csr = sh_wdt_read_csr();
- csr &= ~WTCSR_TME;
- csr |= WTCSR_CKS_4096;
- sh_wdt_write_csr(csr);
- csr = sh_wdt_read_csr();
- sh_wdt_write_cnt(0);
-
- /* disable PLL1 */
- frqcr = ctrl_inw(FRQCR);
- frqcr &= ~(FRQCR_PLLEN | FRQCR_PSTBY);
- ctrl_outw(frqcr, FRQCR);
-
- /* enable standby */
- stbcr = ctrl_inb(STBCR);
- ctrl_outb(stbcr | STBCR_STBY | STBCR_MSTP2, STBCR);
-
- /* set self-refresh */
- mcr = ctrl_inw(MCR);
- ctrl_outw(mcr & ~MCR_RFSH, MCR);
-
- /* set interrupt handler */
- asm volatile("stc vbr, %0" : "=r" (vbr_old));
- vbr_new = get_zeroed_page(GFP_ATOMIC);
- udelay(50);
- memcpy((void*)(vbr_new + INTR_OFFSET),
- &wakeup_start, &wakeup_end - &wakeup_start);
- asm volatile("ldc %0, vbr" : : "r" (vbr_new));
-
- ctrl_outw(0, RTCNT);
- ctrl_outw(mcr | MCR_RFSH | MCR_RMODE, MCR);
-
- cpu_sleep();
-
- asm volatile("ldc %0, vbr" : : "r" (vbr_old));
-
- free_page(vbr_new);
-
- /* enable PLL1 */
- frqcr = ctrl_inw(FRQCR);
- frqcr |= FRQCR_PSTBY;
- ctrl_outw(frqcr, FRQCR);
- udelay(50);
- frqcr |= FRQCR_PLLEN;
- ctrl_outw(frqcr, FRQCR);
-
- ctrl_outb(stbcr, STBCR);
-
- clear_bl_bit();
-}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 01/03] sh: move the hp6xx pm code
2008-12-04 13:45 [PATCH 01/03] sh: move the hp6xx pm code Magnus Damm
@ 2008-12-05 18:42 ` Kristoffer Ericson
2008-12-08 16:39 ` Kristoffer Ericson
1 sibling, 0 replies; 3+ messages in thread
From: Kristoffer Ericson @ 2008-12-05 18:42 UTC (permalink / raw)
To: linux-sh
[-- Attachment #1: Type: text/plain, Size: 7117 bytes --]
On Thu, 04 Dec 2008 22:45:03 +0900
Magnus Damm <magnus.damm@gmail.com> wrote:
> From: Magnus Damm <damm@igel.co.jp>
>
> Move the not-so-generic pm code from arch/sh/kernel/pm.c to the
> platform directory together with the rest of the hp6xx pm code.
>
> This is done to let non-hp6xx platforms enable CONFIG_PM.
Will test it fully tommorow, but the idea seems
sane to me. Been wondering about it before since
the hp6xx pm and the so called generic one is almost
identical (which obviously shouldn't be the case).
>
> Signed-off-by: Magnus Damm <damm@igel.co.jp>
> ---
>
> arch/sh/boards/mach-hp6xx/pm.c | 78 +++++++++++++++++++++++++++++++++++
> arch/sh/include/asm/pm.h | 17 -------
> arch/sh/kernel/Makefile_32 | 1
> arch/sh/kernel/Makefile_64 | 1
> arch/sh/kernel/pm.c | 88 ----------------------------------------
> 5 files changed, 77 insertions(+), 108 deletions(-)
>
> --- 0001/arch/sh/boards/mach-hp6xx/pm.c
> +++ work/arch/sh/boards/mach-hp6xx/pm.c 2008-12-04 20:43:36.000000000 +0900
> @@ -10,15 +10,91 @@
> #include <linux/suspend.h>
> #include <linux/errno.h>
> #include <linux/time.h>
> +#include <linux/delay.h>
> +#include <linux/gfp.h>
> #include <asm/io.h>
> #include <asm/hd64461.h>
> #include <mach/hp6xx.h>
> #include <cpu/dac.h>
> -#include <asm/pm.h>
> +#include <asm/freq.h>
> +#include <asm/watchdog.h>
> +
> +#define INTR_OFFSET 0x600
>
> #define STBCR 0xffffff82
> #define STBCR2 0xffffff88
>
> +#define STBCR_STBY 0x80
> +#define STBCR_MSTP2 0x04
> +
> +#define MCR 0xffffff68
> +#define RTCNT 0xffffff70
> +
> +#define MCR_RMODE 2
> +#define MCR_RFSH 4
> +
> +extern u8 wakeup_start;
> +extern u8 wakeup_end;
> +
> +static void pm_enter(void)
> +{
> + u8 stbcr, csr;
> + u16 frqcr, mcr;
> + u32 vbr_new, vbr_old;
> +
> + set_bl_bit();
> +
> + /* set wdt */
> + csr = sh_wdt_read_csr();
> + csr &= ~WTCSR_TME;
> + csr |= WTCSR_CKS_4096;
> + sh_wdt_write_csr(csr);
> + csr = sh_wdt_read_csr();
> + sh_wdt_write_cnt(0);
> +
> + /* disable PLL1 */
> + frqcr = ctrl_inw(FRQCR);
> + frqcr &= ~(FRQCR_PLLEN | FRQCR_PSTBY);
> + ctrl_outw(frqcr, FRQCR);
> +
> + /* enable standby */
> + stbcr = ctrl_inb(STBCR);
> + ctrl_outb(stbcr | STBCR_STBY | STBCR_MSTP2, STBCR);
> +
> + /* set self-refresh */
> + mcr = ctrl_inw(MCR);
> + ctrl_outw(mcr & ~MCR_RFSH, MCR);
> +
> + /* set interrupt handler */
> + asm volatile("stc vbr, %0" : "=r" (vbr_old));
> + vbr_new = get_zeroed_page(GFP_ATOMIC);
> + udelay(50);
> + memcpy((void*)(vbr_new + INTR_OFFSET),
> + &wakeup_start, &wakeup_end - &wakeup_start);
> + asm volatile("ldc %0, vbr" : : "r" (vbr_new));
> +
> + ctrl_outw(0, RTCNT);
> + ctrl_outw(mcr | MCR_RFSH | MCR_RMODE, MCR);
> +
> + cpu_sleep();
> +
> + asm volatile("ldc %0, vbr" : : "r" (vbr_old));
> +
> + free_page(vbr_new);
> +
> + /* enable PLL1 */
> + frqcr = ctrl_inw(FRQCR);
> + frqcr |= FRQCR_PSTBY;
> + ctrl_outw(frqcr, FRQCR);
> + udelay(50);
> + frqcr |= FRQCR_PLLEN;
> + ctrl_outw(frqcr, FRQCR);
> +
> + ctrl_outb(stbcr, STBCR);
> +
> + clear_bl_bit();
> +}
> +
> static int hp6x0_pm_enter(suspend_state_t state)
> {
> u8 stbcr, stbcr2;
> --- 0001/arch/sh/include/asm/pm.h
> +++ /dev/null 2008-12-03 11:12:15.442019092 +0900
> @@ -1,17 +0,0 @@
> -/*
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - *
> - * Copyright 2006 (c) Andriy Skulysh <askulysh@gmail.com>
> - *
> - */
> -#ifndef __ASM_SH_PM_H
> -#define __ASM_SH_PM_H
> -
> -extern u8 wakeup_start;
> -extern u8 wakeup_end;
> -
> -void pm_enter(void);
> -
> -#endif
> --- 0001/arch/sh/kernel/Makefile_32
> +++ work/arch/sh/kernel/Makefile_32 2008-12-04 20:41:49.000000000 +0900
> @@ -25,7 +25,6 @@ obj-$(CONFIG_MODULES) += sh_ksyms_32.o
> obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
> obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
> obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
> -obj-$(CONFIG_PM) += pm.o
> obj-$(CONFIG_STACKTRACE) += stacktrace.o
> obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
> obj-$(CONFIG_KPROBES) += kprobes.o
> --- 0001/arch/sh/kernel/Makefile_64
> +++ work/arch/sh/kernel/Makefile_64 2008-12-04 20:41:49.000000000 +0900
> @@ -15,7 +15,6 @@ obj-$(CONFIG_MODULES) += sh_ksyms_64.o
> obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
> obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
> obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
> -obj-$(CONFIG_PM) += pm.o
> obj-$(CONFIG_STACKTRACE) += stacktrace.o
> obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
> obj-$(CONFIG_GENERIC_GPIO) += gpio.o
> --- 0001/arch/sh/kernel/pm.c
> +++ /dev/null 2008-12-03 11:12:15.442019092 +0900
> @@ -1,88 +0,0 @@
> -/*
> - * Generic Power Management Routine
> - *
> - * Copyright (c) 2006 Andriy Skulysh <askulsyh@gmail.com>
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License.
> - */
> -#include <linux/suspend.h>
> -#include <linux/delay.h>
> -#include <linux/gfp.h>
> -#include <asm/freq.h>
> -#include <asm/io.h>
> -#include <asm/watchdog.h>
> -#include <asm/pm.h>
> -
> -#define INTR_OFFSET 0x600
> -
> -#define STBCR 0xffffff82
> -#define STBCR2 0xffffff88
> -
> -#define STBCR_STBY 0x80
> -#define STBCR_MSTP2 0x04
> -
> -#define MCR 0xffffff68
> -#define RTCNT 0xffffff70
> -
> -#define MCR_RMODE 2
> -#define MCR_RFSH 4
> -
> -void pm_enter(void)
> -{
> - u8 stbcr, csr;
> - u16 frqcr, mcr;
> - u32 vbr_new, vbr_old;
> -
> - set_bl_bit();
> -
> - /* set wdt */
> - csr = sh_wdt_read_csr();
> - csr &= ~WTCSR_TME;
> - csr |= WTCSR_CKS_4096;
> - sh_wdt_write_csr(csr);
> - csr = sh_wdt_read_csr();
> - sh_wdt_write_cnt(0);
> -
> - /* disable PLL1 */
> - frqcr = ctrl_inw(FRQCR);
> - frqcr &= ~(FRQCR_PLLEN | FRQCR_PSTBY);
> - ctrl_outw(frqcr, FRQCR);
> -
> - /* enable standby */
> - stbcr = ctrl_inb(STBCR);
> - ctrl_outb(stbcr | STBCR_STBY | STBCR_MSTP2, STBCR);
> -
> - /* set self-refresh */
> - mcr = ctrl_inw(MCR);
> - ctrl_outw(mcr & ~MCR_RFSH, MCR);
> -
> - /* set interrupt handler */
> - asm volatile("stc vbr, %0" : "=r" (vbr_old));
> - vbr_new = get_zeroed_page(GFP_ATOMIC);
> - udelay(50);
> - memcpy((void*)(vbr_new + INTR_OFFSET),
> - &wakeup_start, &wakeup_end - &wakeup_start);
> - asm volatile("ldc %0, vbr" : : "r" (vbr_new));
> -
> - ctrl_outw(0, RTCNT);
> - ctrl_outw(mcr | MCR_RFSH | MCR_RMODE, MCR);
> -
> - cpu_sleep();
> -
> - asm volatile("ldc %0, vbr" : : "r" (vbr_old));
> -
> - free_page(vbr_new);
> -
> - /* enable PLL1 */
> - frqcr = ctrl_inw(FRQCR);
> - frqcr |= FRQCR_PSTBY;
> - ctrl_outw(frqcr, FRQCR);
> - udelay(50);
> - frqcr |= FRQCR_PLLEN;
> - ctrl_outw(frqcr, FRQCR);
> -
> - ctrl_outb(stbcr, STBCR);
> -
> - clear_bl_bit();
> -}
--
Kristoffer Ericson <kristoffer.ericson@gmail.com>
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 01/03] sh: move the hp6xx pm code
2008-12-04 13:45 [PATCH 01/03] sh: move the hp6xx pm code Magnus Damm
2008-12-05 18:42 ` Kristoffer Ericson
@ 2008-12-08 16:39 ` Kristoffer Ericson
1 sibling, 0 replies; 3+ messages in thread
From: Kristoffer Ericson @ 2008-12-08 16:39 UTC (permalink / raw)
To: linux-sh
[-- Attachment #1: Type: text/plain, Size: 7272 bytes --]
On Thu, 04 Dec 2008 22:45:03 +0900
Magnus Damm <magnus.damm@gmail.com> wrote:
> From: Magnus Damm <damm@igel.co.jp>
>
> Move the not-so-generic pm code from arch/sh/kernel/pm.c to the
> platform directory together with the rest of the hp6xx pm code.
>
> This is done to let non-hp6xx platforms enable CONFIG_PM.
>
> Signed-off-by: Magnus Damm <damm@igel.co.jp>
> ---
The suspend has been broken on HP Jornada 600
since 2.6.17, so I can only ack on the
idea behind the patch to remove the so called
generic pm.c. I plan on getting round
to it in time.
Also, since they are almost identical
it's unlikely that your patch will break anything.
It essentially just removes an extra copy.
So feel free to add an ack.
>
> arch/sh/boards/mach-hp6xx/pm.c | 78 +++++++++++++++++++++++++++++++++++
> arch/sh/include/asm/pm.h | 17 -------
> arch/sh/kernel/Makefile_32 | 1
> arch/sh/kernel/Makefile_64 | 1
> arch/sh/kernel/pm.c | 88 ----------------------------------------
> 5 files changed, 77 insertions(+), 108 deletions(-)
>
> --- 0001/arch/sh/boards/mach-hp6xx/pm.c
> +++ work/arch/sh/boards/mach-hp6xx/pm.c 2008-12-04 20:43:36.000000000 +0900
> @@ -10,15 +10,91 @@
> #include <linux/suspend.h>
> #include <linux/errno.h>
> #include <linux/time.h>
> +#include <linux/delay.h>
> +#include <linux/gfp.h>
> #include <asm/io.h>
> #include <asm/hd64461.h>
> #include <mach/hp6xx.h>
> #include <cpu/dac.h>
> -#include <asm/pm.h>
> +#include <asm/freq.h>
> +#include <asm/watchdog.h>
> +
> +#define INTR_OFFSET 0x600
>
> #define STBCR 0xffffff82
> #define STBCR2 0xffffff88
>
> +#define STBCR_STBY 0x80
> +#define STBCR_MSTP2 0x04
> +
> +#define MCR 0xffffff68
> +#define RTCNT 0xffffff70
> +
> +#define MCR_RMODE 2
> +#define MCR_RFSH 4
> +
> +extern u8 wakeup_start;
> +extern u8 wakeup_end;
> +
> +static void pm_enter(void)
> +{
> + u8 stbcr, csr;
> + u16 frqcr, mcr;
> + u32 vbr_new, vbr_old;
> +
> + set_bl_bit();
> +
> + /* set wdt */
> + csr = sh_wdt_read_csr();
> + csr &= ~WTCSR_TME;
> + csr |= WTCSR_CKS_4096;
> + sh_wdt_write_csr(csr);
> + csr = sh_wdt_read_csr();
> + sh_wdt_write_cnt(0);
> +
> + /* disable PLL1 */
> + frqcr = ctrl_inw(FRQCR);
> + frqcr &= ~(FRQCR_PLLEN | FRQCR_PSTBY);
> + ctrl_outw(frqcr, FRQCR);
> +
> + /* enable standby */
> + stbcr = ctrl_inb(STBCR);
> + ctrl_outb(stbcr | STBCR_STBY | STBCR_MSTP2, STBCR);
> +
> + /* set self-refresh */
> + mcr = ctrl_inw(MCR);
> + ctrl_outw(mcr & ~MCR_RFSH, MCR);
> +
> + /* set interrupt handler */
> + asm volatile("stc vbr, %0" : "=r" (vbr_old));
> + vbr_new = get_zeroed_page(GFP_ATOMIC);
> + udelay(50);
> + memcpy((void*)(vbr_new + INTR_OFFSET),
> + &wakeup_start, &wakeup_end - &wakeup_start);
> + asm volatile("ldc %0, vbr" : : "r" (vbr_new));
> +
> + ctrl_outw(0, RTCNT);
> + ctrl_outw(mcr | MCR_RFSH | MCR_RMODE, MCR);
> +
> + cpu_sleep();
> +
> + asm volatile("ldc %0, vbr" : : "r" (vbr_old));
> +
> + free_page(vbr_new);
> +
> + /* enable PLL1 */
> + frqcr = ctrl_inw(FRQCR);
> + frqcr |= FRQCR_PSTBY;
> + ctrl_outw(frqcr, FRQCR);
> + udelay(50);
> + frqcr |= FRQCR_PLLEN;
> + ctrl_outw(frqcr, FRQCR);
> +
> + ctrl_outb(stbcr, STBCR);
> +
> + clear_bl_bit();
> +}
> +
> static int hp6x0_pm_enter(suspend_state_t state)
> {
> u8 stbcr, stbcr2;
> --- 0001/arch/sh/include/asm/pm.h
> +++ /dev/null 2008-12-03 11:12:15.442019092 +0900
> @@ -1,17 +0,0 @@
> -/*
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - *
> - * Copyright 2006 (c) Andriy Skulysh <askulysh@gmail.com>
> - *
> - */
> -#ifndef __ASM_SH_PM_H
> -#define __ASM_SH_PM_H
> -
> -extern u8 wakeup_start;
> -extern u8 wakeup_end;
> -
> -void pm_enter(void);
> -
> -#endif
> --- 0001/arch/sh/kernel/Makefile_32
> +++ work/arch/sh/kernel/Makefile_32 2008-12-04 20:41:49.000000000 +0900
> @@ -25,7 +25,6 @@ obj-$(CONFIG_MODULES) += sh_ksyms_32.o
> obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
> obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
> obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
> -obj-$(CONFIG_PM) += pm.o
> obj-$(CONFIG_STACKTRACE) += stacktrace.o
> obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
> obj-$(CONFIG_KPROBES) += kprobes.o
> --- 0001/arch/sh/kernel/Makefile_64
> +++ work/arch/sh/kernel/Makefile_64 2008-12-04 20:41:49.000000000 +0900
> @@ -15,7 +15,6 @@ obj-$(CONFIG_MODULES) += sh_ksyms_64.o
> obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
> obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
> obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
> -obj-$(CONFIG_PM) += pm.o
> obj-$(CONFIG_STACKTRACE) += stacktrace.o
> obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
> obj-$(CONFIG_GENERIC_GPIO) += gpio.o
> --- 0001/arch/sh/kernel/pm.c
> +++ /dev/null 2008-12-03 11:12:15.442019092 +0900
> @@ -1,88 +0,0 @@
> -/*
> - * Generic Power Management Routine
> - *
> - * Copyright (c) 2006 Andriy Skulysh <askulsyh@gmail.com>
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License.
> - */
> -#include <linux/suspend.h>
> -#include <linux/delay.h>
> -#include <linux/gfp.h>
> -#include <asm/freq.h>
> -#include <asm/io.h>
> -#include <asm/watchdog.h>
> -#include <asm/pm.h>
> -
> -#define INTR_OFFSET 0x600
> -
> -#define STBCR 0xffffff82
> -#define STBCR2 0xffffff88
> -
> -#define STBCR_STBY 0x80
> -#define STBCR_MSTP2 0x04
> -
> -#define MCR 0xffffff68
> -#define RTCNT 0xffffff70
> -
> -#define MCR_RMODE 2
> -#define MCR_RFSH 4
> -
> -void pm_enter(void)
> -{
> - u8 stbcr, csr;
> - u16 frqcr, mcr;
> - u32 vbr_new, vbr_old;
> -
> - set_bl_bit();
> -
> - /* set wdt */
> - csr = sh_wdt_read_csr();
> - csr &= ~WTCSR_TME;
> - csr |= WTCSR_CKS_4096;
> - sh_wdt_write_csr(csr);
> - csr = sh_wdt_read_csr();
> - sh_wdt_write_cnt(0);
> -
> - /* disable PLL1 */
> - frqcr = ctrl_inw(FRQCR);
> - frqcr &= ~(FRQCR_PLLEN | FRQCR_PSTBY);
> - ctrl_outw(frqcr, FRQCR);
> -
> - /* enable standby */
> - stbcr = ctrl_inb(STBCR);
> - ctrl_outb(stbcr | STBCR_STBY | STBCR_MSTP2, STBCR);
> -
> - /* set self-refresh */
> - mcr = ctrl_inw(MCR);
> - ctrl_outw(mcr & ~MCR_RFSH, MCR);
> -
> - /* set interrupt handler */
> - asm volatile("stc vbr, %0" : "=r" (vbr_old));
> - vbr_new = get_zeroed_page(GFP_ATOMIC);
> - udelay(50);
> - memcpy((void*)(vbr_new + INTR_OFFSET),
> - &wakeup_start, &wakeup_end - &wakeup_start);
> - asm volatile("ldc %0, vbr" : : "r" (vbr_new));
> -
> - ctrl_outw(0, RTCNT);
> - ctrl_outw(mcr | MCR_RFSH | MCR_RMODE, MCR);
> -
> - cpu_sleep();
> -
> - asm volatile("ldc %0, vbr" : : "r" (vbr_old));
> -
> - free_page(vbr_new);
> -
> - /* enable PLL1 */
> - frqcr = ctrl_inw(FRQCR);
> - frqcr |= FRQCR_PSTBY;
> - ctrl_outw(frqcr, FRQCR);
> - udelay(50);
> - frqcr |= FRQCR_PLLEN;
> - ctrl_outw(frqcr, FRQCR);
> -
> - ctrl_outb(stbcr, STBCR);
> -
> - clear_bl_bit();
> -}
--
Kristoffer Ericson <kristoffer.ericson@gmail.com>
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-12-08 16:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-04 13:45 [PATCH 01/03] sh: move the hp6xx pm code Magnus Damm
2008-12-05 18:42 ` Kristoffer Ericson
2008-12-08 16:39 ` Kristoffer Ericson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox