Re: [PATCH 3/6] mpc83xx: Power Management support

2008-07-15 Thread Kumar Gala


On Jul 11, 2008, at 6:04 PM, Scott Wood wrote:


Basic PM support for 83xx.  Standby is implemented as sleep.
Suspend-to-RAM is implemented as "deep sleep" (with the processor
turned off) on 831x.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
arch/powerpc/Kconfig  |2 +-
arch/powerpc/platforms/83xx/Makefile  |1 +
arch/powerpc/platforms/83xx/suspend-asm.S |  533  
+

arch/powerpc/platforms/83xx/suspend.c |  388 +
arch/powerpc/sysdev/fsl_soc.h |1 +
arch/powerpc/sysdev/ipic.c|   71 
include/asm-powerpc/reg.h |4 +
include/linux/fsl_devices.h   |6 +
8 files changed, 1005 insertions(+), 1 deletions(-)
create mode 100644 arch/powerpc/platforms/83xx/suspend-asm.S
create mode 100644 arch/powerpc/platforms/83xx/suspend.c


applied.

- k
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 3/6] mpc83xx: Power Management support

2008-07-11 Thread Scott Wood
Basic PM support for 83xx.  Standby is implemented as sleep.
Suspend-to-RAM is implemented as "deep sleep" (with the processor
turned off) on 831x.

Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
---
 arch/powerpc/Kconfig  |2 +-
 arch/powerpc/platforms/83xx/Makefile  |1 +
 arch/powerpc/platforms/83xx/suspend-asm.S |  533 +
 arch/powerpc/platforms/83xx/suspend.c |  388 +
 arch/powerpc/sysdev/fsl_soc.h |1 +
 arch/powerpc/sysdev/ipic.c|   71 
 include/asm-powerpc/reg.h |4 +
 include/linux/fsl_devices.h   |6 +
 8 files changed, 1005 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/platforms/83xx/suspend-asm.S
 create mode 100644 arch/powerpc/platforms/83xx/suspend.c

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index f2a0f50..c22a7bf 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -192,7 +192,7 @@ config ARCH_HIBERNATION_POSSIBLE
 
 config ARCH_SUSPEND_POSSIBLE
def_bool y
-   depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200
+   depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx
 
 config PPC_DCR_NATIVE
bool
diff --git a/arch/powerpc/platforms/83xx/Makefile 
b/arch/powerpc/platforms/83xx/Makefile
index f331fd7..32c7ad1 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -3,6 +3,7 @@
 #
 obj-y  := misc.o usb.o
 obj-$(CONFIG_PCI)  += pci.o
+obj-$(CONFIG_SUSPEND)  += suspend.o suspend-asm.o
 obj-$(CONFIG_MPC831x_RDB)  += mpc831x_rdb.o
 obj-$(CONFIG_MPC832x_RDB)  += mpc832x_rdb.o
 obj-$(CONFIG_MPC834x_MDS)  += mpc834x_mds.o
diff --git a/arch/powerpc/platforms/83xx/suspend-asm.S 
b/arch/powerpc/platforms/83xx/suspend-asm.S
new file mode 100644
index 000..1930543
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/suspend-asm.S
@@ -0,0 +1,533 @@
+/*
+ * Enter and leave deep sleep state on MPC83xx
+ *
+ * Copyright (c) 2006-2008 Freescale Semiconductor, Inc.
+ * Author: Scott Wood <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#define SS_MEMSAVE 0x00 /* First 8 bytes of RAM */
+#define SS_HID 0x08 /* 3 HIDs */
+#define SS_IABR0x14 /* 2 IABRs */
+#define SS_IBCR0x1c
+#define SS_DABR0x20 /* 2 DABRs */
+#define SS_DBCR0x28
+#define SS_SP  0x2c
+#define SS_SR  0x30 /* 16 segment registers */
+#define SS_R2  0x70
+#define SS_MSR 0x74
+#define SS_SDR10x78
+#define SS_LR  0x7c
+#define SS_SPRG0x80 /* 4 SPRGs */
+#define SS_DBAT0x90 /* 8 DBATs */
+#define SS_IBAT0xd0 /* 8 IBATs */
+#define SS_TB  0x110
+#define SS_CR  0x118
+#define SS_GPREG   0x11c /* r12-r31 */
+#define STATE_SAVE_SIZE 0x16c
+
+   .section .data
+   .align  5
+
+mpc83xx_sleep_save_area:
+   .space  STATE_SAVE_SIZE
+immrbase:
+   .long   0
+
+   .section .text
+   .align  5
+
+   /* r3 = physical address of IMMR */
+_GLOBAL(mpc83xx_enter_deep_sleep)
+   lis r4, [EMAIL PROTECTED]
+   stw r3, [EMAIL PROTECTED](r4)
+
+   /* The first 2 words of memory are used to communicate with the
+* bootloader, to tell it how to resume.
+*
+* The first word is the magic number 0xf5153ae5, and the second
+* is the pointer to mpc83xx_deep_resume.
+*
+* The original content of these two words is saved in SS_MEMSAVE.
+*/
+
+   lis r3, [EMAIL PROTECTED]
+   ori r3, r3, [EMAIL PROTECTED]
+
+   lis r4, [EMAIL PROTECTED]
+   lwz r5, 0(r4)
+   lwz r6, 4(r4)
+
+   stw r5, SS_MEMSAVE+0(r3)
+   stw r6, SS_MEMSAVE+4(r3)
+
+   mfspr   r5, SPRN_HID0
+   mfspr   r6, SPRN_HID1
+   mfspr   r7, SPRN_HID2
+
+   stw r5, SS_HID+0(r3)
+   stw r6, SS_HID+4(r3)
+   stw r7, SS_HID+8(r3)
+
+   mfspr   r4, SPRN_IABR
+   mfspr   r5, SPRN_IABR2
+   mfspr   r6, SPRN_IBCR
+   mfspr   r7, SPRN_DABR
+   mfspr   r8, SPRN_DABR2
+   mfspr   r9, SPRN_DBCR
+
+   stw r4, SS_IABR+0(r3)
+   stw r5, SS_IABR+4(r3)
+   stw r6, SS_IBCR(r3)
+   stw r7, SS_DABR+0(r3)
+   stw r8, SS_DABR+4(r3)
+   stw r9, SS_DBCR(r3)
+
+   mfspr   r4, SPRN_SPRG0
+   mfspr   r5, SPRN_SPRG1
+   mfspr   r6, SPRN_SPRG2
+   mfspr   r7, SPRN_SPRG3
+   mfsdr1  r8
+
+   stw r4, SS_SPRG+0(r3)
+   stw r5, SS_SPRG+4(r3)
+   stw r6, SS_SPRG+8(r3)
+   stw r7, SS_SPRG+12(r3)
+   stw r8, SS_SDR1(